Belinda999 Posted October 28, 2011 Share Posted October 28, 2011 Hi, If you need display all categories associate with product in product detail, i can help you. Im inspired here http://www.prestashop.com/forums/topic/122213-solved-display-categories-to-which-product-belongs-in-product-listing-page/ reply number #8 and attach the result below classes/Product.php 1. step (for me it's row 234) public function __construct($id_product = NULL, $full = false, $id_lang = NULL) // MOI naplneni $product pro product.tpl { global $cart; parent::__construct($id_product, $id_lang); if ($full AND $this->id) { $this->tax_name = 'deprecated'; // The applicable tax may be BOTH the product one AND the state one (moreover this variable is some deadcode) $this->manufacturer_name = Manufacturer::getNameById((int)$this->id_manufacturer); //volani funkce pro ziskani jmena $this->supplier_name = Supplier::getNameById((int)$this->id_supplier); $this->moi_2 = Supplier::getNameById((int)$this->id_supplier); // MOI testovaci promena $this->moi_categories_names = Product::Moicat($id_product); // HERE IS VARIABLE FOR TPL self::$_tax_rules_group[$this->id] = $this->id_tax_rules_group; if (is_object($cart) AND $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != NULL) $this->tax_rate = Tax::getProductTaxRate($this->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); else $this->tax_rate = Tax::getProductTaxRate($this->id, NULL); $this->new = $this->isNew(); $this->price = Product::getPriceStatic((int)($this->id), false, NULL, 6, NULL, false, true, 1, false, NULL, NULL, NULL, $this->specificPrice); $this->unit_price = ($this->unit_price_ratio != 0 ? $this->price / $this->unit_price_ratio : 0); if ($this->id) $this->tags = Tag::getProductTags((int)$this->id); } if ($this->id_category_default) $this->category = Category::getLinkRewrite((int)$this->id_category_default, (int)$id_lang); } classes/Product.php 2. adding function (for me it's end of file, before last } ) public function Moicat($id_product) { // MOI funkce pro zobrazení jména kategorii $categories_ids = Product::getProductCategories($id_product); /*nejdriv se zjistují ID (jedno nebo vice) category pres funkci getProductCategorie pro produkt indetifikovany pres id_product */ $categories_names = array(); //vytvori se pole nazvy kateg. foreach ($categories_ids AS $id) // kazde policko z $categories_ids se ulozi do $ID {$category = new Category($id); // docasna promena se $category(objekt) se naplni třídou proměných Category(ID) $categories_names[] = $category->getName();// pro policko pole $categories_names se ziska jmeno (funkci tridy getName()) kategorie pres jeji ID z $category }// A znova ;konec foreach return $categories_names; //definice promene pro smartyho } Display in product.tpl <!-- Display categories --> {foreach from=$product->moi_categories_names item=moi_category_name} {$moi_category_name|escape:'htmlall':'UTF-8'} {/foreach} Please,comments, try it and reply. 2 Link to comment Share on other sites More sharing options...
franco.pentangeli Posted December 29, 2011 Share Posted December 29, 2011 It works! Thank you! Link to comment Share on other sites More sharing options...
LeGhe Posted January 25, 2012 Share Posted January 25, 2012 Great !! Is it linkable ? Link to comment Share on other sites More sharing options...
Velocity Posted February 28, 2012 Share Posted February 28, 2012 This works like a charm ! Very clear. Thank You. Link to comment Share on other sites More sharing options...
dramdram Posted May 2, 2012 Share Posted May 2, 2012 Great !! Is it linkable ? Have you find a way to make it "linkable" ? Thank you in adavnce ? Link to comment Share on other sites More sharing options...
TWDesign Posted May 3, 2012 Share Posted May 3, 2012 Great. This is close to what I need. And yes..... how to make it linkable would be nice. And how should we future proof this by using Overrides? Link to comment Share on other sites More sharing options...
orwell Posted July 12, 2012 Share Posted July 12, 2012 I've written a simple module for myself to include the categories (with link) that hooks in the product footer. Let me know if anybody needs this, I could release it. Link to comment Share on other sites More sharing options...
picarry Posted August 16, 2012 Share Posted August 16, 2012 I've written a simple module for myself to include the categories (with link) that hooks in the product footer. Let me know if anybody needs this, I could release it. the categories (with link). i need this . could u emal it to me ? thinks! email: [email protected] Link to comment Share on other sites More sharing options...
Velocity Posted August 16, 2012 Share Posted August 16, 2012 Please share for the community and give download link in this own threat or in a new one, showing the module to the world ! hehe Thanks! Link to comment Share on other sites More sharing options...
orwell Posted August 16, 2012 Share Posted August 16, 2012 Here it is: http://www.prestashop.com/forums/topic/182657-module%C2%A0display-the-categories-to-which-a-product-belongs/ Link to comment Share on other sites More sharing options...
Zmey05 Posted October 19, 2012 Share Posted October 19, 2012 Here it is: http://www.prestasho...roduct-belongs/ I can't make it work - I'm uploading the module, but it's nowhere to be found under Modules I'm using PS 1.4.4.1 - is this the problem? Thanks for your help! Link to comment Share on other sites More sharing options...
orwell Posted October 19, 2012 Share Posted October 19, 2012 I can't make it work - I'm uploading the module, but it's nowhere to be found under Modules I'm using PS 1.4.4.1 - is this the problem? Thanks for your help! It's called Product categories, you should find it under Modules > Front Office functionnalities Haven't tested on PS 1.4.4.1, but it should work Link to comment Share on other sites More sharing options...
Zmey05 Posted October 19, 2012 Share Posted October 19, 2012 (edited) It's called Product categories, you should find it under Modules > Front Office functionnalities Haven't tested on PS 1.4.4.1, but it should work Unfortunately it's not there The folder is on my server, but the module does not appear on my PS dashboard so I could activate it... Editing the product.php gives me just a fatal error here: $this->moi_2 =Supplier::getNameById((int)$this->id_supplier); Is there anything I could do, any advice will be much appreciated Edited October 19, 2012 by Zmey05 (see edit history) Link to comment Share on other sites More sharing options...
LeGhe Posted November 16, 2012 Share Posted November 16, 2012 Works on PS 1.5.2... How can we have links too ? Link to comment Share on other sites More sharing options...
orwell Posted November 17, 2012 Share Posted November 17, 2012 The categories are displayed as links. Check the .tpl file if you need to customize it. Link to comment Share on other sites More sharing options...
luckin315 Posted December 4, 2012 Share Posted December 4, 2012 Hi, how do this for product_list.tpl? With product.tpl works, but i don´t know how to change for list. Link to comment Share on other sites More sharing options...
orwell Posted December 5, 2012 Share Posted December 5, 2012 Currently the module is plugged in the Product Footer hook, so no, it won't show on product-list.tpl. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now