VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: lostmail on January 18, 2021, 14:14:39 PM

Title: SOLVED Low stock notification email - stock quantity wrong
Post by: lostmail on January 18, 2021, 14:14:39 PM
Sample:
I have 10 in stock
Low stock is set at 3

Order is 8 pcs.

Admin gets an email notification that there are 10 in stock...

Something`s wrong here...should be 2 pcs. remaining - not 10.
10-8 = 2
Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 18, 2021, 14:18:57 PM
Check without overrides, could be an template issue. Not calculating with reserved. I guess the stock of 8 is still reserved, yes ?

Jörgen @ Kreativ Fotografi
Title: Re: Low stock notification email - stock quantity wrong
Post by: jenkinhill on January 18, 2021, 16:00:28 PM
Surely stock total is not reduced until the products are shipped.
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 18, 2021, 17:07:30 PM
Hm would it not make sense to have the left over products calculated after the order is placed ? So it`s irritating if there is the stock amoung without the open orders...
Title: Re: Low stock notification email - stock quantity wrong
Post by: pinochico on January 18, 2021, 20:14:56 PM
QuoteSo it`s irritating if there is the stock amoung without the open orders...

is not, it is exactly what we require from the e-shop.
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 19, 2021, 08:08:42 AM
HM I think it is....normally the availibility for disposition is calculated with open orders to decide if it is urgent or not to re-order....only for inventory you need the current stock status but for on going disposition you need to know what the availibilty.
thats the different between stock status and availibility.....every ERP availibilty is working with open/pending oders included (Disposition).
And at last it`s the first information you get from the system where you can see what the availibility is - not the stock status before the (last) orders..

Or do you see open orders not relevant for stock status and cancel them ?
Title: Re: Low stock notification email - stock quantity wrong
Post by: pinochico on January 19, 2021, 09:48:24 AM
We are tailoring the bridge between VM and ERP.

If there are 10 items in stock and 8 items in reservations, you actually have
- 10 boxes in stock
- in stock 8 pcs out of 10 pcs are packed and reserved for customers = no one can order them until the ordering process is completed
- in stock you have 2 pcs of 10 pcs free to order

This is the correct functionality of the eshop and the VM surprisingly adheres to it.

Even for ERP (warehouse) it is right, because if the control comes from the tax office, you still have the right number of pieces in stock - 10 pieces == you have 10 pieces in stock and therefore in the cost of the company.

I don't really understand what you're trying to achieve - it seems to me that you want only 2 pieces in stock?

But that contradicts the laws of nature - I still have 10 pieces of goods on the shelf in the warehouse - they are not lost anywhere, no one took them.

Sorry - Google Translate :)
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 19, 2021, 10:49:09 AM
It`s all OK but not the "low stock email notification" when the low stock minimum is reached.

I have 10 in stock.
Low stock is set to 3

Now comes an order with 8 pcs.

In that moment I receive the los stock email notification that 10 pcs. are in stock.....this is true; temporarily but the AVAILABILITY is relevant here....it`s now 10-8 = 2

So the Email is irritating because it tells the stock status (10 pcs.) before the order (8 pcs.) comes in which activates the low stock email notification.

Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 19, 2021, 10:52:10 AM
Quote from: pinochico on January 19, 2021, 09:48:24 AM
We are tailoring the bridge between VM and ERP.

If there are 10 items in stock and 8 items in reservations, you actually have
- 10 boxes in stock
- in stock 8 pcs out of 10 pcs are packed and reserved for customers = no one can order them until the ordering process is completed
- in stock you have 2 pcs of 10 pcs free to order


That is correct.
But what should it be good for taht the low stock email notification tell that there are 10 pcs. in STOCK....?
It would make sense that there ae currently 2 pcs. AVAILABLE....
Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 19, 2021, 13:41:34 PM
Is this one order of 8 that is shipped or is another order involved ? The email informes that the order quantity in stock is under 3 but You have an extra order that reserves another 8  that have not been removed from stock yet ?

If You had only one order you would have gotten the message that there are 2 in stock after shipment.


Jörgen
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 19, 2021, 14:59:17 PM
Yes - I placed one order about 8 pcs. in test system to check what happens with the low stock email notification.

As you mentioned the message should be:

"there are 2 in stock after shipment."  :D

But in the sent email message you see, that not the available pcs. AFTER shipment but the stock pcs. BEFORE the order  is shipped.
Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 19, 2021, 15:05:52 PM
This is not happening in my store I get the stock e-mail after shipment and with two in stock not ten as You mention. Are all Your order statuses correct ? I guess you have "is removed" chosen to early in You work flow. It should only be chosen for "shipped", "delivered" or similar statuses.

Jörgen @ Kreativ Fotografi
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 19, 2021, 18:37:10 PM
Hm - is there a point in configuration to set the status when low stock mail should be sent ?
Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 19, 2021, 19:13:02 PM
As i said in My earlier post "is removed' should only be assigned to order status, shipped, delivered or similar. Depends om your workflow. I.e when products have been taken out from stock.
Jörgen @ Kreativ Fotografi
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 08:07:31 AM
Where is the order status set to initiate sending "the low stock notification" ?
I think it has to be "order completed"....but it seems my system is sending out it one step before...
Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 20, 2021, 08:35:43 AM
Have You even TRIED to look at the settings in the VM cofiguration for ORDER STATUSES ????

Jörgen
Title: Re: Low stock notification email - stock quantity wrong
Post by: pinochico on January 20, 2021, 09:54:53 AM
To Jörgen:

Is not better don't looking in admin, but first write post on forum. It is funny and better, definitelly :)
Oh my goodness, I like your patience.
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 10:06:26 AM
YES - i found it but i never changed something here.

For me the VM Order statuses are OK (default).

The order status "is removed" is only active in status "shipped".

But the Low stock notificaton is sent out BEFORE the products are removed from stock and so the amount of available products in the notificaton is wrong (as it shows the sock amount without pending orders - respective the order which is responsible reaching defined low stock limit).

I think the message in the email is wrong....status setting are correct for me....



Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 20, 2021, 12:42:25 PM
When is shipped applied ?

Have You checked the recorded status history for this EXACT order ? Does it say Pending, Confirmed, Payed, Shipped or something else ?

I would guess that this has something with an customization to do, maybe a badly written payment option ?

For me it has been working for about 13 years, but this may not count for anything.

Not much to go on here, without screenshots or settings.

Payment options, Shipping options ? Settings for these?  OPC checkout ? Template issue ?

Jörgen
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 13:18:53 PM
"Shipped" = "is removed".

1st Record Status for new orders is "confirmed by shopper" - I think this is default as I it`s a default installation (only with HORME3 Template).
Nothing else customized.

The low stock information came directly after the order which initialised the low stock notification.

Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 20, 2021, 14:12:41 PM
Quote from: Jörgen on January 20, 2021, 12:42:25 PM

Have You checked the recorded status history for this EXACT order ? Does it say Pending, Confirmed, Payed, Shipped or something else ?

Not much to go on here, without screenshots or settings.

Payment options, Shipping options ? Settings for these?  OPC checkout ? Template issue ?

Jörgen

With STATUS history I mean: what has been done with the order so far ? Which (multiple) statuses have been assigned so far ? You will find this in the view where you edit the order lines in BE.

Jörgen
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 14:24:39 PM
HI, nothing.

The order was created by (Test-)customer and that was it...nothing else happend with the order or status.

Admin got the low stock information with stock amount  (10 pcs.)
The order which initialised the low stock notification was 8 pcs. - so min stock level (10-8=2, min stock is 3) was reached and admin becomes an information.

But it says 10 in stock....yes but available are 2 and the initial low stock mail was sent out (correct)....



Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 14:27:58 PM
Quote\components\com_virtuemart\language\en-GB\en-GB.com_virtuemart.ini(318): COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="The product %s has stock of %d."


Quote%d
How is this calculated ? Is it the current stock level ? (Without reserved/pending orders) ?

Title: Re: Low stock notification email - stock quantity wrong
Post by: Jörgen on January 20, 2021, 14:59:01 PM
Really ? So You do not have pending status in order status history ? I have a very hard time believing this. What kind of payment method do you use and how is it setup ?

Jörgen
Title: Re: Low stock notification email - stock quantity wrong
Post by: pinochico on January 20, 2021, 15:05:00 PM
QuoteHow is this calculated ? Is it the current stock level ? (Without reserved/pending orders) ?

Find this constant:
COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY

on your server and check.

I don't know inmedietally, but I use this funkction in terrminal - grep
With this i find all presence in FTP:


./administrator/language/de-DE/de-DE.com_virtuemart.ini:874:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="Das Produkt %s hat einen Lagerbestand von %d."
./administrator/language/pl-PL/pl-PL.com_virtuemart.ini:874:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="Stan magazynu dla %s wynosi %d."
./administrator/language/cs-CZ/cs-CZ.com_virtuemart.ini:876:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="Produkt %s  je na skladě v počtu %d."
./administrator/components/com_virtuemart/language/en-GB/en-GB.com_virtuemart.ini:995:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="The product %s has a stock of %d."
./administrator/components/com_virtuemart/models/product.php:3257:         $vars['mailbody'] =vmText::sprintf('COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY',$link, $vars['product_in_stock']);
./components/com_virtuemart/language/en-GB/en-GB.com_virtuemart.ini:318:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="The product %s has stock of %d."
./language/de-DE/de-DE.com_virtuemart.ini:311:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="Der Lagerbestand von Produkt %s beträgt %d."
./language/pl-PL/pl-PL.com_virtuemart.ini:311:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="Stan produktu %s wynosi %d."
./language/cs-CZ/cs-CZ.com_virtuemart.ini:312:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="Výrobek %s je na skladě v množství %d."

and then find on ftp every presence on FTP for this:

product_in_stock
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 15:22:05 PM
Quote from: Jörgen on January 20, 2021, 14:59:01 PM
Really ? So You do not have pending status in order status history ? I have a very hard time believing this. What kind of payment method do you use and how is it setup ?

Jörgen

For testing i have configured only 1 payment method:
Cash on delivery. (standard)
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 15:26:24 PM
Quote from: pinochico on January 20, 2021, 15:05:00 PM
QuoteHow is this calculated ? Is it the current stock level ? (Without reserved/pending orders) ?

Find this constant:
COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY

on your server and check.

I don't know inmedietally, but I use this funkction in terrminal - grep
With this i find all presence in FTP:


./administrator/components/com_virtuemart/models/product.php:3257:         $vars['mailbody'] =vmText::sprintf('COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY',$link, $vars['product_in_stock']);
./components/com_virtuemart/language/en-GB/en-GB.com_virtuemart.ini:318:COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY="The product %s has stock of %d."

and then find on ftp every presence on FTP for this:

product_in_stock


I know but I do not need the product_in_stock level in the low stock email report - i need the product_in_stock minus reserved orders in the message.
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 15:44:09 PM
Quote$vars['mailbody'] =vmText::sprintf('COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY',$link, $vars['product_in_stock']);

I think i have to change this line in:

Quote$vars['mailbody'] =vmText::sprintf('COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY',$link, $vars[`product_in_stock` - `product_ordered`]);


UPDATE:
Hm - does not work...now it tells me that "0" pcs.

Seems to be wrong syntax but I think the caculation is what i`m searching for...
Title: Re: Low stock notification email - stock quantity wrong
Post by: pinochico on January 20, 2021, 17:29:41 PM
You are quickly as women without thinking :(

NO!!!

The var product_in_stock is finally count for this == product_in_stock - product_ordered, but you must find in FTP in definition this variable where is.
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 20, 2021, 18:00:02 PM
?
I think that product_in_stock is not the same like product_in_stock - product_ordered

I put product_ordered in this line for testing low stock notification email:
$vars['mailbody'] =vmText::sprintf('COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY',$link, $vars['product_ordered']);

and it shows 8 pcs. in low stock mail.

So in low stock email i need:
  product_in_stock = 10 pcs.
- product_ordered = 8 pcs.
= product available  = 2 pcs.

Any idea how the above line has to be modified (correct syntax) ?

Title: Re: Low stock notification email - stock quantity wrong
Post by: GJC Web Design on January 20, 2021, 19:44:21 PM
$vars['mailbody'] =vmText::sprintf('COM_VIRTUEMART_PRODUCT_LOW_STOCK_EMAIL_BODY',$link, $vars['product_in_stock'] - $vars['product_ordered']);

assuming there is a   $vars['product_ordered']

check first

print 'Debug Line '.__LINE__.' pos <pre>'; print_r ($vars['product_ordered']); print "</pre><br />\n"; die();
Title: Re: Low stock notification email - stock quantity wrong
Post by: lostmail on January 21, 2021, 06:43:14 AM
YEAH !
That`s right now !

Will replace "Lagerbestand" with "Verfügbarkeit"...as language override; than message is PERFECT.

But how can i ensure that with next update the changement is not be overwritten ?
Saving as override does not work in this case I think.
Title: Re: SOLVED Low stock notification email - stock quantity wrong
Post by: jenkinhill on January 21, 2021, 10:56:17 AM
Language overrides are retained after VM and Joomla updates.
Title: Re: SOLVED Low stock notification email - stock quantity wrong
Post by: lostmail on January 21, 2021, 11:09:14 AM
Quote from: jenkinhill on January 21, 2021, 10:56:17 AM
Language overrides are retained after VM and Joomla updates.

Yes i know, but i ment the modification in \administrator\components\com_virtuemart\models\product.php