cookerseb Posted January 20, 2018 Share Posted January 20, 2018 Hi, Prestashop 1.7 latest On my shop, I need to display a button or link to add to the product attributes basket like the example below: So I removed the default button "Add to cart", I hid (type hidden) the quantity field with a fixed value of 1. In my themes based on the classic themes, I edited templates / catalog / _partials / product-variants.tpl and deleted all the default codes. I have written a simple code to get all the information I need to display (I will customize the display as the image above with CSS when add to cart will work). The "Add to Cart" link does not work. Nothing is happening : {assign var=prate value=($product.rate/100)+1} {foreach from=$groups key=id_attribute_group item=group} <!--{$group.name|escape:'htmlall':'UTF-8'} :--> {foreach from=$group.attributes key=id_attribute item=group_attribute} {assign var="myAttrName" value=" - "|explode:$group_attribute.name} {assign var=txattr value=$group_attribute.attribute_impacts+$product.price_tax_exc} {assign var=txattr_wt value=$txattr*$prate} <div>PRODUCT ID {$product.id} -> {$myAttrName[0]|escape:'htmlall':'UTF-8'} - > {$myAttrName[1]|escape:'htmlall':'UTF-8'} -> group[{$id_attribute_group}] -> ID ATTR {$id_attribute} -> HT PRICE IMPACT {Tools::displayPrice($group_attribute.attribute_impacts)} -> HT PRODUCT {Tools::displayPrice($product.price_tax_exc)} -> HT RESULT PRICE {Tools::displayPrice($txattr)} -> TTC {Tools::displayPrice($txattr_wt|string_format:"%d")} <br><a class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$product.id|intval}&id_product_attribute={$id_attribute}&token={$static_token}&add")}" rel="ajax_id_product_{$product.id|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a> </div> {/foreach} {/foreach} Display : PRODUCT ID 4 -> Non commercial licence - > 8k image -> group[1] -> ID ATTR 25 -> HT PRICE IMPACT €0.00 -> HT PRODUCT €49.00 -> HT RESULT PRICE €49.00 -> TTC €58.00 -> Add to cart PRODUCT ID 4 -> Commercial licence - > 8k image -> group[1] -> ID ATTR 26 -> HT PRICE IMPACT €350.00 -> HT PRODUCT €49.00 -> HT RESULT PRICE €399.00 -> TTC €478.00 -> Add to cart PRODUCT ID 4 -> Commercial licence - > 16k image -> group[1] -> ID ATTR 27 -> HT PRICE IMPACT €550.00 -> HT PRODUCT €49.00 -> HT RESULT PRICE €599.00 -> TTC €718.00 -> Add to cart How to format the link or button to add a product attribute to the cart from the product card, keeping the effect of the confirmation that opens to go to cart or continue shopping? Thanks 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