Disable addtocart button for certain stock only for selected products

Started by stawebnice, September 16, 2017, 19:04:37 PM

Previous topic - Next topic

stawebnice

Hi,

please is there a way to hide addtocart button for certain products (not all) that have stock lower than 50?

I think they could be added to a hidden/unpublished virtuemart category, so this condition could be selected with product in certain category that have stock 50 or less

Could you post the code for productdetails/default.php and category/default.php  - or addtocart.php sublayout or where else it belongs, please?

Studio 42

You can use different layout(for categories, products ...), but this is not a right solution, because on doing a search in the shop., the cart is show for all.
A solution is to do a plugin "check for stock" so you can set stock level and disable add to cart for product having minimum stock set in this plugin.
Of course another solution is to pay the team so they add the feature in the core paying here http://extensions.virtuemart.net/support/virtuemart-supporter-membership-gold-detail if you need it qucik.
You can contact me or another dev in the forum to make this plugin. It's not a big Job to do it.

Jörgen

If i don't error there is a sublayout for addtocart. Simply override that and you could exclude products on stock value. This should be fairly simple to do. Today stock under 1 is filtered out.

Regards
Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

stawebnice

@Jorgen: yes, that is what I think. Right now there must be  such options for the default stock handling options that are related to number of products in stock, but I need to modify this code for availability text...

I know the principle but I am not a programmer...

and I already have my silver membership for this year and did not wish anything yet, saving it for Christmas, huh, Max :]



Jörgen

This should be easy. If someone does not beat me to i will be back.

Regards
Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

Hi, the problem is that you have to hard code in the addtocard sublayout a list of categories and check for this and update manually, if you need it later.
It's why i have give you 2 possibilities that are more simple to maintain.