Juhy Posted October 6, 2013 Share Posted October 6, 2013 Hi, im trying to solve this "problem" for 3 days.... but no luck. I searched the forum... stil no solutions. I whant to show supplier description on pruduct page under the tab. I successfully add supplier name, supplier reference. I have used this for description in .tpl {$product->supplier_description|escape:'htmlall':'UTF-8'} - but no luck im using prestashop 1.4.4.1 thnx for any ideas or help Regards, Juhy Link to comment Share on other sites More sharing options...
NemoPS Posted October 7, 2013 Share Posted October 7, 2013 I think that parameter is not grabbed in the product controller. You probably need to get the full information stack about the current supplier, using its ID. SO, from productcontroller.php (use an override, and extend the initContent() method. You can use something like $supplier = new Supplier($this->product->id_supplier, $this->context->language->id); and then $supplier->description to get what you need. Of course, assign it to a smarty variable! 1 Link to comment Share on other sites More sharing options...
Juhy Posted October 7, 2013 Author Share Posted October 7, 2013 Hi, thnx for replay. I tryed to call $supplier2 = new Supplier($this->product->id_supplier, (int)(self::$cookie->id_lang)); direct from my module, where i assign variable to a smarty. $smarty->assign(array( 'product' => $product, 'product2' => $product2, 'supplier2' => $supplier2 With product2 i get image for product supplier and supplier name. With supplier2 still no luck.... Regards Link to comment Share on other sites More sharing options...
Juhy Posted October 7, 2013 Author Share Posted October 7, 2013 Hi, i have solved the problem, with your help Nemo1. I added this code to ProductControler. $supplier= new Supplier($this->product->id_supplier, (int)(self::$cookie->id_lang)); and the code to my .tpl module {$supplier->description|escape:'htmlall':'UTF-8'} Thnx. Regards, Juhy Link to comment Share on other sites More sharing options...
NemoPS Posted October 7, 2013 Share Posted October 7, 2013 Glad you solved it! Can I then mark the topic as solved? Link to comment Share on other sites More sharing options...
Juhy Posted October 7, 2013 Author Share Posted October 7, 2013 With your help. Yes, the topic is solved Link to comment Share on other sites More sharing options...
EVDPOL Posted August 14, 2014 Share Posted August 14, 2014 can you show me what you have done to get it work, i dont get it work... Link to comment Share on other sites More sharing options...
NemoPS Posted August 15, 2014 Share Posted August 15, 2014 can you show me what you have done to get it work, i dont get it work... Hi, i have solved the problem, with your help Nemo1. I added this code to ProductControler. $supplier= new Supplier($this->product->id_supplier, (int)(self::$cookie->id_lang)); and the code to my .tpl module {$supplier->description|escape:'htmlall':'UTF-8'} Thnx. Regards, Juhy Link to comment Share on other sites More sharing options...
EVDPOL Posted August 15, 2014 Share Posted August 15, 2014 it doesn't work in 1.6.0.9 Link to comment Share on other sites More sharing options...
NemoPS Posted August 16, 2014 Share Posted August 16, 2014 Do you get any error? Link to comment Share on other sites More sharing options...
EVDPOL Posted August 16, 2014 Share Posted August 16, 2014 (edited) the site goes on a blank page or the description is not showing at all Notice: Undefined index: supplier in /public_html/prestashop16/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 417 Edited August 17, 2014 by EVDPOL (see edit history) Link to comment Share on other sites More sharing options...
houin Posted August 17, 2014 Share Posted August 17, 2014 Glad you solved it! Can I then mark the topic as solved? Hi, i have solved the problem, with your help Nemo1. I added this code to ProductControler. $supplier= new Supplier($this->product->id_supplier, (int)(self::$cookie->id_lang)); and the code to my .tpl module {$supplier->description|escape:'htmlall':'UTF-8'} Thnx. Regards, Juhy Good evening.Can you explain to me and the code to my .tpl module???? What file?Thank you Link to comment Share on other sites More sharing options...
NemoPS Posted August 18, 2014 Share Posted August 18, 2014 Did you write this $this->product->id_supplier, or this? $this->product->supplier, ? Link to comment Share on other sites More sharing options...
EVDPOL Posted August 18, 2014 Share Posted August 18, 2014 $this->product->id_supplier, i have copied your code into the files. Link to comment Share on other sites More sharing options...
uthn Posted February 4, 2015 Share Posted February 4, 2015 Good morning, Sorry to act like the good ol' gravedigger on this post but it doesn't seem to work on the last release (1.6.0.11), adding this: $supplier= new Supplier($this->product->id_supplier, (int)(self::$cookie->id_lang)); in the ProductController.php only results in a blank page. Any hint would gladly welcome, Thanks Link to comment Share on other sites More sharing options...
NemoPS Posted February 4, 2015 Share Posted February 4, 2015 See my signature on error reporting. Then try this instead of the cookie part $this->language->id Link to comment Share on other sites More sharing options...
uthn Posted February 4, 2015 Share Posted February 4, 2015 Thanks for the reply Nemo, Here's the error Parse error: syntax error, unexpected '$supplier' (T_VARIABLE), expecting function (T_FUNCTION) in /home/clients/808f85cf92b63b57bc0238e1c62e37af/web/psds/prestashop/override/controllers/front/ProductController.php on line 23 That's using the code directly in the overide file "ProductController.php" same thing happens after changing the cookie part. Parse error: syntax error, unexpected '$supplier' (T_VARIABLE), expecting function (T_FUNCTION) in /home/clients/808f85cf92b63b57bc0238e1c62e37af/web/psds/prestashop/override/controllers/front/ProductController.php on line 23 Thanks for your help, Link to comment Share on other sites More sharing options...
uthn Posted February 4, 2015 Share Posted February 4, 2015 Got a bit further or so it seems, changing the categorycontroller.php code to : $supplier = new Supplier($this->product->id_supplier, $this->language->id); Error doesn't show up anymore ('=' symbol was lacking a space i guess), got an error on the product page trying to show the description though (using {$supplier->description|escape:'htmlall':'UTF-8'} somewhere in the product.tpl) Notice: Undefined index: supplier in /home/clients/808f85cf92b63b57bc0238e1c62e37af/web/psds/prestashop/cache/smarty/compile/96/cd/7e/96cd7e91b232a03b8b19b8241c10319891cbe490.file.product.tpl.php on line 543 Notice: Trying to get property of non-object in /home/clients/808f85cf92b63b57bc0238e1c62e37af/web/psds/prestashop/cache/smarty/compile/96/cd/7e/96cd7e91b232a03b8b19b8241c10319891cbe490.file.product.tpl.php on line 543 Notice: Trying to get property of non-object in /home/clients/808f85cf92b63b57bc0238e1c62e37af/web/psds/prestashop/cache/smarty/compile/96/cd/7e/96cd7e91b232a03b8b19b8241c10319891cbe490.file.product.tpl.php on line 543 Link to comment Share on other sites More sharing options...
uthn Posted February 4, 2015 Share Posted February 4, 2015 Found it (at last...) So, to make all things clear : 1 - Edit your ProductController.php, look for $this->context->smarty->assign(array( and paste this code below, anyplace you want (added mine just after the manufacturer) 'product_supplier' => new Supplier((int)$this->product->id_supplier, $this->context->language->id), 2 - Next step, just add {$product_supplier->description} (or whatever you want with the supplier) to the product.tpl and you're done, works with 1.6.0.11 Thanks again for your help Nemo 2 Link to comment Share on other sites More sharing options...
Goliath777 Posted February 18, 2015 Share Posted February 18, 2015 Hello, and if i need to show detailed information about supplier on product page? e.g. phones, addresses tried many ways but still no luck Link to comment Share on other sites More sharing options...
uthn Posted February 18, 2015 Share Posted February 18, 2015 Hi there, Guess you'll just have to (if you already add product supplier in the smarty array) add whatever information you want in your product template : {$product_supplier->description} {$product_supplier->phone} -> values are just for exemple, you'll have to check the entry name in your database {$product_supplier->postcode} -> values are just for exemple, you'll have to check the entry name in your database good luck Link to comment Share on other sites More sharing options...
NemoPS Posted February 20, 2015 Share Posted February 20, 2015 It should be an address, use this to get the address id getAddressIdBySupplierId($id_supplier) then new Address($id_address) Using what you just got Link to comment Share on other sites More sharing options...
uthn Posted February 20, 2015 Share Posted February 20, 2015 Hello, As i see you roaming around Nemo, just a quick one, original changes to the ProductController.php won't seem to affect the product-list.tpl view, does it use another controller ? thanks, Link to comment Share on other sites More sharing options...
NemoPS Posted February 21, 2015 Share Posted February 21, 2015 Ah, because the source is CategoryController.php Link to comment Share on other sites More sharing options...
uthn Posted February 21, 2015 Share Posted February 21, 2015 Thanks Nemo, had trouble getting the variables in the CategoryController but i managed to get some help on this one. All done for me thanks Link to comment Share on other sites More sharing options...
[email protected] Posted April 28, 2016 Share Posted April 28, 2016 Hello, Sir, Can I get a step-by-step description on this... how to It will be a great help. Thanks Link to comment Share on other sites More sharing options...
sshare Posted December 16, 2016 Share Posted December 16, 2016 (edited) Could anyone please tell me what needs to be added to CategoryController to make it work on product list please? Am on 1.6.x Edited December 16, 2016 by sshare (see edit history) 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