Jump to content

[SOLVED] How to show supplier description on product page?


Juhy

Recommended Posts

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

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!

  • Like 1
Link to comment
Share on other sites

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

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

  • 10 months later...

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

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

  • 5 months later...

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

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

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

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

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

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

  • 1 year later...
  • 7 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...