Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

View Poll Results: Does your X-Cart have [Add to Cart] buttons on Category Pages?
Yes 11 57.89%
No 1 5.26%
No, but I'm thinking of adding it 7 36.84%
Voters: 19. You may not vote on this poll

Add to Cart button on Featured Products & Category Pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-09-2003, 10:01 PM
  disneyana's Avatar 
disneyana disneyana is offline
 

Senior Member
  
Join Date: Sep 2002
Location: Columbus, OH
Posts: 116
 

Default Add to Cart button on Featured Products & Category Pages

Hey All,

There has been some discussion and a few threads on how to do this:
http://forum.x-cart.com/viewtopic.php?t=1052
http://forum.x-cart.com/viewtopic.php?t=536

I'm curious to see how many X-Cart developers have incorporated this feature into their stores. Here is a *LIVE* example:
http://treasurekingdom.disneyana.com/

Although this is a great mod, it does has it's problems. Here are a few that I've discovered:
1) The Add to Cart button still appears even if the item is Out of Stock. This happens when products are added to the cart, but the checkout has not been completed. For instance, if you have a product with 1 item available and 1 customer adds it to their cart, another customer can also add the item to their cart by clicking on the Add to Cart button. If they click on the product title or See Details link, the detailed product page will display Out of Stock. Has anyone figured out a way to only display the Add to Cart button ONLY when product is available to Add to Cart?
2) Another problem exists when the customer wants more than 1 of an item and does the following:
- clicks Add to Cart and is forwarded to the Your Shopping Cart page
- click the back button in their browser and click the Add to Cart button for the same product (the Add to Cart button is displayed even though the quantity is set to 1)

When they click the Add to Cart button, the cart gets totally screwed up!
- The Items display as 1 (even though the customer thinks they added 2 products)
- The Total is now listed at $ 0.00
- There are NO products displayed in the Items section of Your Shopping Cart
There are only 2 ways that I know of to get the cart back to a working state after this happens:
1) Admin increases the product quantity to more or equal to what was initially added to the cart
2) Customer adds another product to the cart which now shows:
- The Items display as 2 (even though the customer thinks they added 3 products)
- The Total is now listed at the price of the last item added to the cart
- The only product displayed in the Items section of Your Shopping Cart is the last item added
If the customer clicks on the Delete item, the cart really deletes the existing two (or 1??) items and then displays the last item that was added again. At this point the cart is returned back to it's normal state.

I'm not a programmer, but I think the fix could be pretty easy. Something like "IF quantity =0, display (link to Out of Stock button) or nothing; ELSE display (link to Add to Cart button). Comments?
__________________
- disneyana
4.0.17
Reply With Quote
  #2  
Old 02-23-2003, 11:10 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

For the last bit try:

{if $products[product].avail > 0}
show add to cart button
{else}
show out of stock
{if}



For the quantity side of things, you could alway put in a drop down field with the quantity to add to the cart. The field must be named amount though.
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 03-03-2003, 05:16 AM
  disneyana's Avatar 
disneyana disneyana is offline
 

Senior Member
  
Join Date: Sep 2002
Location: Columbus, OH
Posts: 116
 

Default

Thanks for the suggestion Funk, however I still can't seem to get it to work. I'm using the standard Add to Cart code that has been floating around the forum
Code:
<form name=orderform_{%product.index%} method=post action="cart.php?mode=add"> <a href="javascript: document.orderform_{%product.index%}.submit()"> {include file="buttons/add_to_cart.tpl"}</a> <input type=hidden name=amount value=1> <input type=hidden name=mode value=add> <input type=hidden name=productid value="{$products[product].productid}"> <input type=hidden name=cat value="{$smarty.get.cat}"> <input type=hidden name=page value="{$smarty.get.page}"> </form>
The code in product.tpl works fine with automatically changing things to "0" and Out of Stock. I just need the same functionality in the products.tpl page as well.
__________________
- disneyana
4.0.17
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:13 AM.

   

 
X-Cart forums © 2001-2020