jebali Posted January 31, 2016 Share Posted January 31, 2016 bonjour je suis entrain dajouter dans la page product.tpl un champ text saisi par le client <inputname="nickname" class="form-control customization_block_input" /> le champ saisie sauvegarder dans le panier. jai rajouter un code dans la page cartcontroller.php $authorized_text_fields = array('nickname'); foreach ($_POST as $field_name => $value) if (in_array($field_name, $authorized_text_fields) && $value != '') { if (!Validate::isMessage($value)) $this->errors[] = Tools::displayError('Invalid message'); else{ //var_dump($field_name);exit(); $this->context->cart->deleteCustomizationToProduct((int)$this->id_product, 'nickname'); $this->context->cart->addTextFieldToProduct($this->id_product, 'nickname', Product::CUSTOMIZE_TEXTFIELD,Tools::getValue('nickname')); } } else if (in_array($field_name, $authorized_text_fields) && $value == '') $this->context->cart->deleteCustomizationToProduct((int)$this->id_product, 'nickname'); ----dans la page ajax-cart.js var nickname = $('input[name=nickname]').val(); $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity :'1')+'&id_product=' + idProduct +'&nickname='+nickname+ '&token=' + static_token + ((parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): '')}); je veux savoir comment afficher les notes produit dans blockart.tpl 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