Jump to content

[Resolut] appeler une nouvelle variable


Recommended Posts

Bonjour à tous.

 

J'ai besoin d'une nouvelle caractérisitque sur les produits.

J'ai donc ajouté un champs dans la table ps_product_lang.

Puis j'ai rajouté un override/classe/product.

 

En ajoutant

	public $img_rewrite;


	public static $definition = array(
	'table' => 'product',
	'primary' => 'id_product',
	'multilang' => true,
	'multilang_shop' => true,
	'fields' => array(
		// Classic fields
		'id_shop_default' =>			 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
[...]
		'img_rewrite' =>				 array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'),

 

Ce qui me permet de l'appeler sur la ficht produit par:

<hr>{$product->img_rewrite}<hr>

 

 

mais je n'arrive pas à l appeler depuis product-list.tpl par exemple

j ;ai essayer:

 <hr>{$product.img_rewrite}<hr>
 <hr>{$product->img_rewrite}<hr>

 

ce qui me donne:

Notice: Undefined index: img_rewrite in /var/www/html/prestashop/cache/smarty/compile/[...].file.product-list.tpl.php on line 63

Notice: Trying to get property of non-object in /var/www/html/prestashop/cache/smarty/compile/[....file.product-list.tpl.php on line 65

 

 

 

Quelqu'un pourrais t il m'aider?

 

SOLUTION:

ovverride de la classe category.

Edited by jd440 (see edit history)
Link to comment
Share on other sites

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