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

Don't show "Out of stock" after add to cart

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 05-24-2011, 10:33 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default 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.
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #12  
Old 05-25-2011, 10:14 AM
 
godboma godboma is offline
 

Advanced Member
  
Join Date: Dec 2009
Posts: 43
 

Default 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...
__________________
X-Cart 4.2.2 (linux)
Vivid Dreams
XAOM
Reply With Quote
  #13  
Old 05-25-2011, 03:43 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default 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.
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #14  
Old 07-13-2011, 08:08 AM
 
Thomasw Thomasw is offline
 

Newbie
  
Join Date: Nov 2009
Posts: 3
 

Default 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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 03:47 PM.

   

 
X-Cart forums © 2001-2020