VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: hotrod on May 07, 2020, 12:28:59 PM

Title: Leave Product Price But diable add to cart for an out of stock items
Post by: hotrod on May 07, 2020, 12:28:59 PM
  We do not track stock,  when I have a part that is Out Of Stock,  I remove the price.. and use an Out Of stock image for availability....  is there a way to leave the price in the field so it shows but not let the shopper add to cart?
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: pinochico on May 07, 2020, 12:36:29 PM
if you remove price, the rich snippets with price is existing still?
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: Jörgen on May 07, 2020, 12:53:19 PM
Turn on stock handling and set stock to ZERO.

Jörgen @ Kreativ Fotografi
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: hotrod on May 07, 2020, 13:00:13 PM
If I turn on stock handling..  that would be a nightmare.. we have 5,000 parts..  and most are showing a negative.. I would have to edit every part to like 100..  should have done that years ago..
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: pinochico on May 07, 2020, 13:18:09 PM
In DB I will finish in 5 minutes for every products -> set negative stock to zero, what is the problem?
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: Jörgen on May 07, 2020, 13:29:17 PM
As pinochico sais, make adjustments in database for your stock. Quickly done and then make a strategy. Either handle stock or set stock to 100 000 pcs and then set to ZERO for those you do not want to add to cart.

Jörgen @ Kreativ Fotografi
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: AH on May 07, 2020, 14:36:05 PM
Yes if you remove price the product can look very odd and snippets has no price.

Turning stock handling on is an issue as you have no stock registered - so all items would be immediately pulled from sale -  so you need to update stock levels to a large values before turning this switch on!

One way of achieving this is to turn on stock handling and do not let ordering happen if 0 stock

Bearing in mind that you may have items already out of stock - you need to list these, as you will manually have to adjust at some point - I guess at the moment they have 0 price so should be easy when you set the price back to also handle the stock values!

You need to set your (non tracked) stock levels high to prevent accidental removal of items from sale

Do a simple SQL query via phpmyadmin and an SQL query on the VirtueMart  "products" table that sets items to a huge stock value in 2 seconds:


UPDATE YOURPREFIX_virtuemart_products AS p SET p.product_in_stock = 999999999;
UPDATE YOURPREFIX_virtuemart_products AS p SET p.product_ordered = 0;



To stop items being available to add to cart - manually set the stock to 0  and ordered to 0
When you do this the item will be out of stock and cannot be added to cart but the sales price will still be displayed along with a message regarding stock (this can be adjusted using a language override)

To bring items back for sale just set the stock to 999999999


Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: hotrod on May 07, 2020, 21:30:31 PM
This is a simple Data base task?   I get scared going in there.. : )
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: jenkinhill on May 07, 2020, 23:19:51 PM
Just remember to back up (dump) the database using phpMyAdmin before running the SQL.
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: Jörgen on May 08, 2020, 06:32:52 AM
Then i have something to help you. Regular labs has a dbreplacer that does this kind of things with a nice Interface. You can watch your replacements in real time before you decide to go through with them. I use the pro version because it has less limitations.
https://www.regularlabs.com/extensions
Title: Re: Leave Product Price But diable add to cart for an out of stock items
Post by: AH on May 08, 2020, 10:08:04 AM
Or use phpmyadmin and my code with the table prefix adjusted :-)

YOURPREFIX

becomes the actual prefix for your tables :-)