orwell Posted June 22, 2012 Share Posted June 22, 2012 Hi everyone, I'm quite a noob with prestashop and I'd like to do something that seemed quite simple but isn't. I want to be able to display various info about the manufacturer on a product page. I get the manufacturers name and id from $product in my product.tpl. How could I get the manufacturer info to display it on my product.tpl ? I'm not sur on how to tackle that... extend the product class, write a module... ? Any help would be great as it would help me to understand prestashop a little bit more ! Thanks Link to comment Share on other sites More sharing options...
orwell Posted June 22, 2012 Author Share Posted June 22, 2012 Ok so I managed to get a $manufacturer object via a custom module I've built. Still wondering, isn't there a easier way to add data passed to a smarty template ? Extending the product class ? Thanks for helping me getting better with PrestaShop ! Link to comment Share on other sites More sharing options...
genix Posted June 22, 2012 Share Posted June 22, 2012 Hi, you can access the manufacturer in the product.tpl template with {$product_manufacturer}. Here a list of important manufacturer attributes: ID: {$product_manufacturer->id} Name: {$product_manufacturer->name} Description: {$product_manufacturer->description} Short Description: {$product_manufacturer->short_description} Regards, genix. 1 Link to comment Share on other sites More sharing options...
orwell Posted June 22, 2012 Author Share Posted June 22, 2012 ID: {$product_manufacturer->id} Name: {$product_manufacturer->name} Description: {$product_manufacturer->description} Short Description: {$product_manufacturer->short_description} Seems that none of those work in my product.tpl ... Anyway now i need to fetch the manufacturer's product, so I'll keep on with the solution I've got which is building a custom module to display what I need. Link to comment Share on other sites More sharing options...
genix Posted June 22, 2012 Share Posted June 22, 2012 (edited) Did you recompile your smarty templates? Admin > Settings > Performance > enable "force recompilation". Edited June 22, 2012 by genix (see edit history) Link to comment Share on other sites More sharing options...
orwell Posted June 22, 2012 Author Share Posted June 22, 2012 Did you recompile your smarty templates? Admin > Settings > Performance > enable "force recompilation". Yes, that is how it is set up as I'm in developpment... Link to comment Share on other sites More sharing options...
genix Posted June 22, 2012 Share Posted June 22, 2012 Strange, which prestashop version do you use? Could you send me your "controllers/ProductController.php" file? Link to comment Share on other sites More sharing options...
orwell Posted June 22, 2012 Author Share Posted June 22, 2012 Ver 1.4.8.2 Haven't modified the ProductController.php file... Thanks for your help, but don't worry too much as I've looked into another way of achieving my goal by writing a custom module... yeeeaaaaahhh I had to dive into that anyway... ProductController.php Link to comment Share on other sites More sharing options...
genix Posted June 22, 2012 Share Posted June 22, 2012 (edited) Hmm... the controller seems fine. And even if you are in development mode (I just tried), you'll have to enforce recompilation... I think the problem is, that your product.tpl template is cached. Try to also deactivate all cache systems. Edited June 22, 2012 by genix (see edit history) Link to comment Share on other sites More sharing options...
orwell Posted June 22, 2012 Author Share Posted June 22, 2012 Well all cache systems are inactive... I can see other changes made to my tpl without problems Link to comment Share on other sites More sharing options...
genix Posted June 22, 2012 Share Posted June 22, 2012 Does {$product->id_manufacturer} print the right manufacturer ID? If yes, then sorry, I have no idea why it is not working, seems to be a bit more subtle bug Link to comment Share on other sites More sharing options...
orwell Posted June 22, 2012 Author Share Posted June 22, 2012 Yes, $product-id_manufacturer and $product->manufacturer_name dispay the right info... Thank you anyway, I'll mak this as (subtle) solved for now ! Link to comment Share on other sites More sharing options...
ijaure Posted September 13, 2012 Share Posted September 13, 2012 super easy just substistute de XXX <!-- product page manufacturer --> <p id="product_manufacturer" {if !$product->manufacturer_name}style="display: none;"{/if}> <label for="manufacturer">{l s='XXXXX'} </label> <a href="{$link->getmanufacturerLink($product->id_manufacturer, $product->link_rewrite)}" title="{l s=''}"> {$product->manufacturer_name|escape:'htmlall':'UTF-8'} </a> </p> <!-- product page manufacturer end --> 1 Link to comment Share on other sites More sharing options...
coronatonewmedia Posted November 18, 2012 Share Posted November 18, 2012 Hi, you can access the manufacturer in the product.tpl template with {$product_manufacturer}. Here a list of important manufacturer attributes: ID: {$product_manufacturer->id} Name: {$product_manufacturer->name} Description: {$product_manufacturer->description} Short Description: {$product_manufacturer->short_description} Regards, genix. is this applicable for ver 1.4?? doesn't seem to work @ all, even with all cahce functions turned off and forced recompile set.... Link to comment Share on other sites More sharing options...
jincmd Posted December 4, 2012 Share Posted December 4, 2012 I would like to super easy just substistute de XXX <!-- product page manufacturer --> <p id="product_manufacturer" {if !$product->manufacturer_name}style="display: none;"{/if}> <label for="manufacturer">{l s='XXXXX'} </label> <a href="{$link->getmanufacturerLink($product->id_manufacturer, $product->link_rewrite)}" title="{l s=''}"> {$product->manufacturer_name|escape:'htmlall':'UTF-8'} </a> </p> <!-- product page manufacturer end --> I would like to display the manufacturers logo next to each product in a list, as well as on the products page Would you please inform me how this can be done? 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