News:

Support the VirtueMart project and become a member

Main Menu

product in cart, become out of stock

Started by guardiano78, July 09, 2019, 16:05:00 PM

Previous topic - Next topic

guardiano78

Hello,
I hope to write the post in the right section.
I explain my problem with an example.

This is my warehouse:

products - stock
Apple - 5
Pears - 4
Pineapple - 8


The "buyer 1" puts 3 apples and 2 pineapples in his cart.
Then continue to browse the site.
Meanwhile, the "buyer 2" bought all the apples.

At this point the "buyer 1" returns to the cart and it happens that the 3 apples disappear from his cart.
Instead I would like the cart to remain as it was created by the "buyer 1".

Is there an option in virtuemart that allows you to do this?

If it is more useful, I use the "RuposTel One Page Checkout" component for the shopping cart and the "Cart AutoSave for VirtueMart 3 aWeb_RecallCart" plugin to not lose the cart at logout.


Joomla 3.8.13 - Virtuemart 3.2.14

Thank you.

Studio 42

It's not so simple to mange.
Imagine that you have a buyer add 10 in cart another 50, 5 ... and none come back ?
The only solution i integrated, similar to this, is for an auction site but this had only 1 quantity per product and i needed to manage a secondary table and removed the records older then 1 hours (and it need a customfield).

To do this in core, it need to have a table recording all cards items (quantity+id + date) to verify if a user can add or not to cart

guardiano78

#2
Hello Studio 42,
thank you for answer me.

For what my needs are, virtuemart is fine as it is.I just wanted that check to come into effect only upon confirmation of the purchase.
Alternatively, would it be possible to display a message indicating the product_sku of products that have been deleted from the cart because out of stock?


What is the function that verifies if there is one of the products in the cart out of stock and eliminates it from the cart?

I'm looking in "components/com_virtuemart/helpers/cart.php" but it doesn't seem to be in this file.
I would like to add a message like this:

vmInfo('COM_VIRTUEMART_CART_SOME_PRODUCTS_OUT_OF_STOCK');


Thanks

guardiano78

Hello,
in helper/cart.php i founded the function that recalculate quantities:

private function checkForQuantities($product, &$quantity=0) { ... }

in my case this function should display the alert message in the cart as specified by the following code:

$ product-> errorMsg = vmText :: sprintf ('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_QUANTITY', $ product-> product_name, $ quantity);


perhaps on my cart page, the code for displaying virtuemart system messages is missing.Can you tell me the code to add to make it work?

Thanks.

Studio 42

The template should have a zone to display Joomla message.
It's not a Virtuemart problem.
Do a test using protostar template , to be sure your template hide or not render the system messages.