categories variable in best seller module

ThemeBurn SupportForumsOpenCart ThemesPavilion OpenCart Themecategories variable in best seller module

This topic has been marked as resolved.

hello,
my question was how to get the categories variable (and attributes) in the best seller , latest modules etc..
i found the tpl file catalog/view/theme/pavilion/template/tb/widget/_list_products.tpl

but i have tp change the corresponding controller file, but where is it for this oneā€¦ ?

thx

January 23, 2015 at 12:05 pm #37061

Ok i finally find the file, and manage to add the categories.. here it is if it can help someone

file:

tb_themes/pavilion/catalog/plugin/ProductPlugin.php 

find:

foreach ($products as &$product) {

add right afterwards:

// add categories and attribute variables 
$querycats = $this->getOcModel('catalog/product')->getCategories( $product['product_id']);
$categories = array();
foreach( $querycats as $item ) {
  $categ = $this->getOcModel('catalog/category')->getCategory($item['category_id']);
  $catinfo['id'] = $item['category_id'];
  $catinfo['name'] = $categ['name'];
  $catinfo['href'] = $this->manager->getOcUrl()->link('product/category', 'path=' . $item['category_id']);
  $categories[] = $catinfo;
}
$product['attribute_groups']   = $this->getOcModel('catalog/product')->getProductAttributes( $product['product_id']);
$product['categories'] = $categories;

You can then use those variables in the tpl file catalog/view/theme/pavilion/template/tb/widget/_list_products.tpl

have fun

January 26, 2015 at 2:52 pm #37175

Thanks for the share. We can use it in future versions :)

BR,
ThemeBurn team

January 29, 2015 at 3:33 pm #37400
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.