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)
-   -   Don't show "Out of stock" after add to cart (https://forum.x-cart.com/showthread.php?t=59330)

Stizerg 05-24-2011 10:33 PM

Re: Don't show "Out of stock" after add to cart
 
OK, I found it. In \modules\Product_Options\func.php
PHP Code:

if ($kv == func_get_variantid($v['options'], $productid)) 
    
$variants[$kv]['avail'] -= $v['amount']; 


replaced with
PHP Code:

if ($kv == func_get_variantid($v['options'], $productid)) {
    
$variants[$kv]['avail'] -= $v['amount'];
    if (
$variants[$kv]['avail'] <= 0)
      
$variants[$kv]['avail'] = 1;



It works well for products that current customer put into cart.

godboma 05-25-2011 10:14 AM

Re: Don't show "Out of stock" after add to cart
 
If I read this mod correctly, your buyer will be able to add indefinitely the same item to his/her cart even if you only have 1 left in your stock. I think you need something more complex than that. Probably controlling the the amount of item showed and not changing the available quantity. I am sorry that I can not give you more precise code. Programming logic is one thing and doing the programming is another...

Stizerg 05-25-2011 03:43 PM

Re: Don't show "Out of stock" after add to cart
 
cart.php checks for the real amount in stock, you can't add more than you have.

Thomasw 07-13-2011 08:08 AM

Re: Don't show "Out of stock" after add to cart
 
Stizerg,

I tried this mod and it doesn't seem to have made any difference.
Am I right in saying that the idea here is that if you for example have a product with 1 left in stock and then a customer adds it to their cart it still shows as available instead of sold out to them?
I realise it still shows as in stock to others, which to me seems a bit odd but I can understand the logic to some extend.

I would really like this as I don't want customers to think they've just missed out or something, not realising that with it being in their cart means it is somewhat 'reserved' for them.

I've got 4.3.2 and I simply copied and pasted the code and uploaded.
I'm pretty new to editing x-cart and although I'm a IT tech I'm not really a web developer so I may have missed something.


Thanks


All times are GMT -8. The time now is 08:55 PM.

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