Jump to content

BUG! Can't add products to basket only when user is logged in


neller

Recommended Posts

Hi all,

 

When adding this code to product_list.tpl in themes folder;

{if $category->id == 7}<a class="btn_collection" href="cart?add=1&id_product=12">Buy Collection</a>{/if}
{if $category->id == 8}<a class="btn_collection" href="cart?add=1&id_product=13">Buy Collection</a>{/if}
{if $category->id == 9}<a class="btn_collection" href="cart?add=1&id_product=14">Buy Collection</a>{/if}

From that, I want users to be able to buy a certain product when they are on the category pages.

This works fine when users aren't logged in. Clicking on the buy button puts the product in the basket and users can register/ log in and checkout as normal.

But if a user is already logged in, then they are returned to the home page and the product isn't added to the basket. No error is displayed either.

 

I have tried this on a clean demo install of version 1.5.3.1 and a modded version of 1.5.4.0, the same scenario happens.

 

Anyone else had problems similar to this? Or have a better code suggestion than above I would love to hear.

 

Neller

  • Like 1
Link to comment
Share on other sites

I have tried in it different places.

The code currently is in the products_list.tlp twice, the first at the very top of the file;

{if isset($products)}
<!-- Products list -->
   {if $category->id == 7}<a class="btn_collection" href="cart?add=1&id_product=12">Buy Collection</a>{/if}
{if $category->id == 8}<a class="btn_collection" href="cart?add=1&id_product=13">Buy Collection</a>{/if}
{if $category->id == 9}<a class="btn_collection" href="cart?add=1&id_product=14">Buy Collection</a>{/if}
<a class="btn_collection" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product=12", false)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
<ul id="product_list" class="clear">
...

 

And again at the very end

...
</ul>
{if $category->id == 7}<a class="btn_collection" href="cart?add=1&id_product=12">Buy Collection</a>{/if}
{if $category->id == 8}<a class="btn_collection" href="cart?add=1&id_product=13">Buy Collection</a>{/if}
{if $category->id == 9}<a class="btn_collection" href="cart?add=1&id_product=14">Buy Collection</a>{/if}

{/if}

 

I have tried it in categories.tpl too and also header.tpl (without the {if}) so it appears on every page and the same happens, user is returned to home page.

 

In first block of code above, I have tried a different add to cart link to see if this would work, but this does the exact same thing in returning users to home page and no product in basket.

 

I'm stumped!

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...