Jump to content

Adding product to cart doesn't work on product-list


Recommended Posts

I've got some issue with Prestashop product-list.

Here is a link to my site: http://vigdm.no-restrictions.com/index.php?id_category=29&controller=category

You can see small link 'Add to cart' under each product. Unfortunately, the product is not added to cart. When I'm on product page, everytyhing works fine.

The code is copied from the default prestatshop theme, it's goes like this:

<div class = "cart-logo-on-product">
    {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
        {if ($product.allow_oosp || $product.quantity > 0)}
            {if isset($static_token)}
                <a id="add_to_cart" class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
            {else}
                <a id ="add_to_cart" class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
            {/if}
        {else}
            <span class="exclusive"><span></span>{l s='Add to cart'}</span><br />
        {/if}
    {/if}

</div> 

I need to add product to cart from the product list, do you know what can be wrong?

 

 

Link to comment
Share on other sites

Yep, that's right, I've made it that way, but I need to aim another goal, after clicking on cart icon, the product should be added to cart and should not redirect me to the cart page. On the product page it works, but on the category page doesn't. I suspect that may be js issue, but now I stucked.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...