Jump to content

Edit History

jmauclair

jmauclair


title

Hi guys,

I'm developping a cross sell module that will display produtcs in cart that you can add to cart by clicking the button add to cart.

I need to take consideration of product variants (attributes).

I've already find out how to add the add to cart button to the cart page thanks to this code :

<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
            <input type="hidden" name="token" value="{$static_token}">
            <input type="hidden" name="id_product" value="{$product->id}" id="product_page_product_id">
            <span class="remove-from-cart">
                <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit"
                    {if (!$product->checkQty(1))} disabled {/if}>
                    <i class="material-icons float-xs-left">shopping_cart</i>
                    {l s="Add to cart" d='Shop.Theme.Actions'}
                </button>
            </span>
        </form>

But what I need now is to update the display price depending about the value choosen with the select option value dropdown set as on my product page and use the attribute id selected in order than when the user click on the add to cart button, it add to cart the product with the good attribute and not the default one

I'm sure that is from js script that the price is updated but I don't really find ou which function is in charge of this

Waiting for your help guys ! 😉

jmauclair

jmauclair

Hi guys,

I'm developping a cross sell module that will display produtcs in cart that you can add to cart by clicking the button add to cart.

I need to take consideration of product variants (attributes).

I've already find out how to add the add to cart button to the cart page thanks to this code :

<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
            <input type="hidden" name="token" value="{$static_token}">
            <input type="hidden" name="id_product" value="{$product->id}" id="product_page_product_id">
            <span class="remove-from-cart">
                <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit"
                    {if (!$product->checkQty(1))} disabled {/if}>
                    <i class="material-icons float-xs-left">shopping_cart</i>
                    {l s="Add to cart" d='Shop.Theme.Actions'}
                </button>
            </span>
        </form>

But what I need now is to update the display price depending about the value choosen with the select option value dropdown set as on my product page and use the attribute id selected in order than when the user click on the add to cart button, it add to cart the product with the good attribute and not the default one

I'm sure that is from js script that the price is updated but I don't really find ou which function is in charge of this

Waiting for your help guys ! 😉

×
×
  • Create New...