X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Add to Cart button on Featured Products & Category Pages (https://forum.x-cart.com/showthread.php?t=1445)

disneyana 02-09-2003 10:01 PM

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?

funkydunk 02-23-2003 11:10 AM

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.

disneyana 03-03-2003 05:16 AM

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.


All times are GMT -8. The time now is 03:54 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.