Jump to content

Fournisseur et détail fournisseur dans le product-list.tpl


uthn

Recommended Posts

Bonjour,

 

J'ai un petit soucis avec une variable que j'ai ajouté au productcontroller.php et que j'affiche sans soucis sur ma fiche produit :

'product_supplier' => new Supplier((int)$this->product->id_supplier, $this->context->language->id),

Dans la page produit (via le product.tpl) j'appelle ensuite mes deux variables, jusque là aucun soucis

{$product->supplier_name|escape:'htmlall':'UTF-8'}
{$product_supplier->description}

Par contre, si j'essaye d'afficher la même chose dans le product-list.tpl ça ne passe pas, le controleur utilisé par le fichier est-il différent de celui du product.tpl ?

 

merci d'avance,

Link to comment
Share on other sites

Bonjour, dans CategoryController.php, dans la function assignProductList, il faut changer:

 

foreach ($this->cat_products as &$product)
if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity']))
$product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];

par 

foreach ($this->cat_products as &$product)
{
    if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity']))
    $product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];

   $product_supplier = new Supplier((int)$product['id_supplier'], $this->context->language->id);
   $product['supplier_name'] = $product_supplier->name;
   $product['supplier_description'] = $product_supplier->description;
}

ensuite vous pourrez retrouver les infos dans product-list par {$product.supplier_name},  {$product.supplier_description} ...

Edited by fred-vinapresta (see edit history)
  • Like 1
Link to comment
Share on other sites

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...