Jump to content

Problème d'ajout d'un nouveau champ produit


Recommended Posts

Bonjour,

 

J'ai besoin d'ajouter un champ garantie sur ma page produit. j'ai suivi les étapes de ce tutoriel http://www.paulineghiazza.fr/ajouter-un-champ-dans-le-backoffice-prestashop-1-5/

Bon! j'ai ajouté le champ garantie de type varchar dans la table ps_product_lang

ensuite j'ai ajouté dans override/classes/Product.php le code suivant dans :

<?php
 
class Product extends ProductCore
{
    public $garantie;
 
    public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
    {
      self::$definition['fields']['garantie'] = array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255);
      parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
    }
 
}
?>

Puis sur la page produit du BO override/controllers/admin/templates/products/informations.tpl

<tr>
			<td class="col-left"><label>{$bullet_common_field} Garantie</label></td>
			<td style="padding-bottom:5px;">
				<input size="55" type="text" name="garantie" value="{$product->garantie}" style="width: 130px; margin-right: 44px;" /> <span class="small">{$product->garantie}</span>
			</td>
</tr>

Quand j’enregistre le champs s'ajoute bien dans la BD et je peux le récupérer sur le FO juste en mettent ça {$product->garantie}, le problème c'est que dans le BO je peux pas récupérer la valeur dans la base, il me met "Array"!!

 

ps : Je suis sur la vs 1.5.6.0

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