pixAN Posted April 29, 2018 Share Posted April 29, 2018 Bonjour, Je suis souhaite cacher le bouton d'ajout au panier si une caractéristique à une certaine valeur. j'ai réussi à le faire dans la page produit en modifiant en faisant un override dans le fichier ProductController (fonction init content) : /* Feature array by id */ $features = $this->product->getFrontFeatures($this->context->language->id); foreach ($features as $key=>$value) { $features_by_key[$value['id_feature']]['name'] = $value['name']; $features_by_key[$value['id_feature']]['value'] = $value['value']; } $this->context->smarty->assign(array( 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => $product_manufacturer, 'token' => Tools::getToken(false), 'features' => $features, 'features_by_key' => $features_by_key, 'attachments' => (($this->product->cache_has_attachments) ? $this->product->getAttachments($this->context->language->id) : array()), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int)$this->product->out_of_stock), 'last_qties' => (int)Configuration::get('PS_LAST_QTIES'), 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)), 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)), 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)), 'display_qties' => (int)Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank, 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'), 'ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK') )); } puis dnas le fichier product.tpl : {if isset($features_by_key.16.value) && $features_by_key.16.value == O} <div>contenu à mettre à la place du bouton</div> {else} <div{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || (isset($restricted_country_mode) && $restricted_country_mode) || $PS_CATALOG_MODE} class="unvisible"{/if}> <p id="add_to_cart" class="buttons_bottom_block no-print rx-cart"> <button type="submit" name="Submit" class="exclusive"> <span><i class="icon-shopping-cart"></i>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span> </button> {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} </p> </div> {/if} Mais je n'aarive pas à faire la même chose pour la page productlist.tpl, j'ai ajouté de faire un override de Categoycontroller.php mais sans succès. Savez vous comment procéder ? Merci 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