prestashop: add supplier name to product page

 

source:

https://www.prestashop.com/forums/topic/870116-how-to-display-supplier-products-on-producttpl/

 

 

on /override/ProductController.php add:

 

<?php

class ProductController extends ProductControllerCore
{
    public function initContent()
    {
        parent::initContent();
        
        if ((int)$this->product->id_supplier) {
            $this->context->smarty->assign(
                'product_supplier',
                new Supplier((int)$this->product->id_supplier, (int)$this->context->language->id)
            );
        }
    }
}


on product.tpl add: 

            {if isset($product_supplier)}
            <p id="product_supplier">
                <label>{l s='Supplier:'} </label>
                {$product_supplier->name}
            </p>
            {/if}
 

Leave a Reply

Your email address will not be published.