Some days ago i ask in forum how to hide variations from list if stock is 0.
Well i found the solution working hard finding the code, and a litle piece of code do that automatic.
Ex.: If you sell t-shirts and the XS size is unavailable, the size appear in list and when client click on it the message out of stock appear. The correct, in my opinion is hide the unavailable size from list (without making any changes in admin), by this way, if the product goes to stock again it simple show the sizes available or hide it. I found the code that do that!
To make this change, go to includes/classes/class.product.php around line 297 and find the code:
Code: Select all
$query = "
SELECT
vcoptionids
FROM
[|PREFIX|]product_variation_combinations
WHERE
vcenabled = 1 AND
vcvariationid = " . $this->_prodvariationid . " AND
vcproductid = " . $this->_prodid;
Code: Select all
$query = "
SELECT
vcoptionids
FROM
[|PREFIX|]product_variation_combinations
WHERE
vcenabled = 1 AND
vcvariationid = " . $this->_prodvariationid . " AND
vcstock > 0 AND
vcproductid = " . $this->_prodid;
I've working on this but now, i saw one problem that i want your help to resolve.
Ex. You're using the code but all variations of product become unavailable, so in product page you will not see any variation.
The question is: How to hide the add to cart button and after the title of variation put the text Unavailable?
If someone know how to do that, please post here.
Best Regards
Mozack