tlandru Posted August 10, 2009 Share Posted August 10, 2009 Salut à tous,Je dois mettre en place un système permettant de mettre un poids type par catégorie. Voici les modifications apportées :- ajout d'un champs dans la bdd sur la table ps_category- modification du category.php pour prendre en compte ce nouveau champs (isFloat)- modification du fichier admincategories.php pour faire apparaitre le champs dans l'edit des catégories (ramène bien la valeur contenu dans la bdd)Mais je rencontre un problème lors de la mise à jour du poids de la catégorie, cela ne fait strictement rien...Le nom du champs dans la bdd est "weight" et les modifications apportées dans le category.php sont les suivantes : public $weight = 0; .... protected $fieldsValidateLang = array('name' => 'isCatalogName', 'link_rewrite' => 'isLinkRewrite', 'description' => 'isCleanHtml', 'meta_title' => 'isGenericName', 'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName', 'weight' => 'isFloat'); protected $fieldsValidate = array('active' => 'isBool', 'weight' => 'isFloat'); .... $fields['weight'] = floatval($this->weight); Ci joint le code du admincategories : '.$this->l('Poids des articles:').' '; foreach ($languages as $language) echo ' <input size="6" maxlength="6" name="weight" type="text" value="'.htmlentities($this->getFieldValue($obj, 'weight'), ENT_COMPAT, 'UTF-8').'" onKeyUp="[removed]this.value = this.value.replace(/,/g, \'.\');" /> '.Configuration::get('PS_WEIGHT_UNIT').' '; echo ' Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now