Author Topic: Leave Product Price But diable add to cart for an out of stock items  (Read 294 times)

hotrod

  • Jr. Member
  • **
  • Posts: 126
  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?
VirtueMart 3.6.10
Joomla! 3.9.18
PHP Version    PHP 7.3.13  
Dedicated Server.
http://forum.virtuemart.net/index.php?topic=124355.0

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
if you remove price, the rich snippets with price is existing still?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2750
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Turn on stock handling and set stock to ZERO.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)

hotrod

  • Jr. Member
  • **
  • Posts: 126
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..
VirtueMart 3.6.10
Joomla! 3.9.18
PHP Version    PHP 7.3.13  
Dedicated Server.
http://forum.virtuemart.net/index.php?topic=124355.0

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 379
    • MiniJoomla
  • VirtueMart Version: 3
In DB I will finish in 5 minutes for every products -> set negative stock to zero, what is the problem?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2750
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3165
  • VirtueMart Version: 3.6.11
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:

Code: [Select]
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


regards
A

Joomla 3.9.18
php 7.3

hotrod

  • Jr. Member
  • **
  • Posts: 126
This is a simple Data base task?   I get scared going in there.. : )
VirtueMart 3.6.10
Joomla! 3.9.18
PHP Version    PHP 7.3.13  
Dedicated Server.
http://forum.virtuemart.net/index.php?topic=124355.0

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27730
  • Always on vacation
    • Jenkin Hill Internet
Just remember to back up (dump) the database using phpMyAdmin before running the SQL.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.8.0 10314 on Joomla 3.9.16 PHP 7.0.33

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2750
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3165
  • VirtueMart Version: 3.6.11
Re: Leave Product Price But diable add to cart for an out of stock items
« Reply #10 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 :-)
regards
A

Joomla 3.9.18
php 7.3