Price not sticking when adding/updating products [SOLVED]

Started by Andrew Smith, June 29, 2021, 07:03:45 AM

Previous topic - Next topic

Andrew Smith

Hi there,

The VM install has suddenly started refusing to save the price entered into it when adding a product, and in one instance the product image is also refusing to display.

(I googled this one per the posting instructions and only found issues from circa 2010)

Background:
This development site is running VirtueMart 3.8.8.10472 in Joomla 3.9.27 (upon PHP 7.4) as part of an auto install with the Joomlart template "Atom" where sample data (including VM) was included and uploaded as part of the install. 

At the time of install, VM was subsequently upgraded to the above stated version and the new admin template was enabled.

In the Joomla install stage, the site was deliberately set to EN-AU language so that the shop defaults would be localised for Australia.  Upon later inspection in VM, it was discovered that the shop language was EN UK (United Kingdom English) and this was changed back to Australian English.  EN UK language was deleted to be absolutely sure of it with EN AU the only one available.  Demo data products and categories were stripped out as they were tied to the initial demo data's install language.

A similar thing was done with currencies, all except for AUD were deleted so that the Australian currency was the only one available.

There was a front end (I think) error message "The parameter Merchant e-mail is required for the payment" which was found to be related to the PayPal module.  An email address was entered and this resolved it.

After adding some categories, I then added a test product to verify that the pricing and tax component were working correctly on the VM install.  This was for the full (GST inclusive) price to display against the product and on the invoice it displays what the GST component of the total purchase was.  This was working correctly, but as it turned out the non-profit was set up to operate without GST in sales.  To this extent, the tax rule was removed and the sole existing product behaved correctly when it came to the shopping cart. 
Awesome.  Now to add more products.

I added in two more and checked how they displayed in the front end, and the pricing had not appeared – only a "call for price".  Checked again and the price that I had entered in and saved was not listed in the product details.  Applied the price again, noted the message "Product successfully saved" and checked again.  Still no price showing on the front end and no price retained against the product in VM.

This was a complete and unexpected surprise.  The only thing I could possibly ascribe it to is the removal of the tax rule which had previously worked flawlessly.

Switching on the full debugging mode in VM, the save message is:

1 vmdebug vmTime: time to load config: 0.00782990455627441
2 vmdebug vmTime: time to import plugins vmuserfield: 7.29560852050781E-5
3 vmdebug Start used Ram 10M
4 vmdebug My Memory Limit in Bytes 134217728
5 vmdebug isSuperVendor Active vendor 0 1
6 vmdebug vmTime: time to import plugins vmcustom: 0.0653831958770752
7 vmdebug Delete $old_customfield_ids Var1:
Array
(
)

8 vmdebug vmTime: "VirtueMartControllerProduct" Finished task apply: 0.934273958206177
9 vmdebug End used Ram 14M
10 vmdebug Peak memory peak 14M
Product successfully saved
1 vmdebug vmTime: time to load config: 0.0092921257019043
2 vmdebug vmTime: time to import plugins vmuserfield: 4.98294830322266E-5
6 vmdebug getVendorId manager
7 vmdebug createUrlWithPrefix Var1:
https://new.gregbiddellministries.com.au/administrator/index.php?option=com_virtuemart&view=ajax&task=getMedias&format=json&mediatype=product
Var2:
index.php?option=com_virtuemart&view=ajax&task=getMedias&format=json&mediatype=product
8 vmdebug vmTime: "VirtueMartControllerProduct" Finished task edit: 0.154106140136719
9 vmdebug End used Ram 18M
10 vmdebug Peak memory peak 18M


No idea what it means. 

Andrew Smith

(this bit got truncated from the original post by the edit/save function)

(and the added price still doesn't stick)

On the front end of this development site, you can see a display of all products (I think) at http://new.gregbiddellministries.com.au/index.php/shop, including debug messages.

Someone internal to the project is welcome to an Akeeba backup of the site as it stands (or admin login access), should this make it easier to diagnose and debug.

Best wishes and thanks in advance.

Andrew

GJC Web Design

are there entries in the the #__virtuemart_product_prices  table for the 2 new products?

but it is mentioned over and over here ... don't use bundled installs...  so often leads to config problems especially with vendors etc
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Andrew Smith

Hi Peter,

(hope I have the correct name)

I've checked the #__virtuemart_product_prices table and the only price listed is for the first product, and a total of one entry in that table.  The additional prices do not have an entry there, despite the VM admin message saying that the product was successfully saved. 

Given the "success" message I do feel that there will be a bug here, also as this only happened after I had removed the tax rule that was previously applied to the shop.  (I document everything as I go, which in turn enabled me to give a step by step account of what had been done from install through to the problem being discovered).

I've since started another development site where all components are being installed manually and not via a kickstart / bundled install.

I did read through the VM documentation before proceeding as well as a bit of the forums.  I think the documentation would benefit from the warning against bundled installs being added (I would certainly have taken heed) and I've previously already sent an email (via contact form) to Max offering my help with this.  (You're more than welcome to also alert him to this in case he hasn't seen the message.)

Andrew

GJC Web Design

it is very odd ... only one price per currency/quantity is ever stored per product in VM in the #__virtuemart_product_prices  table

the tax etc is held in a different table and applied after the single price has been read so I can't see that deleting a tax can have any bearing

try editting/ adding the price again and check what is posted to the server in the console
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Andrew Smith

By "the console" do you mean a console view to phpMyAdmin using some sort of SSH tunnel thing?  Sorry, but I really have no idea (and lack the software or bravery) to be able to do that sort of thing.  I'm not a database geek.

If it helps, I'd be happy to give you some credentials so you can access that part.  Just send me an email from your work email address and I can reply to that with the information.  No problems with trusting you as you are very well involved with the VM project.

Andrew

Andrew Smith

I did discover the "Joomla! Debug Console" which has database queries displayed, but it doesn't catch anything from a "add price" function in VM. 

Just through I'd let you know that I'm trying everything within my technical limits.

Andrew

Andrew Smith

Okay, I have a development.   :D

In my very manually installed Joomla + VM site I had the exact same issue.  What I have since found out is that I'd been adding pricing incorrectly (all of a sudden), thanks to trying to add it in a 'no tax rate will apply' kind of a manner. See the attached image.

I'd been merely specifying the final price by entering it into the "final price" box which I guess kinda makes sense.  This is what the UI was accepting, and then after "saving" the price wouldn't show because it actually hadn't saved.

So I guess the bug might now be that the form needs to give an error when someone tries to do this? 

As a matter of explanation, from reading the documentation it seems like the pricing system is build around having a cost price that is increased per a calculation rule (and also one for tax), and this is then the final price presented to the customer.  Certainly in my instance the ratio of input cost vs retail price will be different for every product and you wouldn't establish a calculation rule for every single product.  So I thought I would forgo the ability to have the VM software report profit and just settle for turnover, only having the finished price entered.

Andrew

Jörgen

This is not a bug, it is intended behaviour. This has not happened lately, it has been this way for many years.

Tick the box "Calculate cost price" You will see what happens :)

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

Andrew Smith

Hi Jörgen,

Thank you so much for replying in such a timely manner.

Yes, I checked the "calculate price" box and it inserted the finished price into the cost price.  Yup.  That fixes it.  LOL.

I'd read in the documentation that "Override" is meant for temporary price reductions such as a limited time special price.  For my desired outcome of having per item cost and retail price, would it be appropriate for me to put the cost price (to the shop) as the "Cost price" (in the UI) and use the "override" to manually set the permanent retail price?  I'm still figuring out the correct way to do things.

Truly appreciate your help.  Thanks in advance.

Andrew

Jörgen

Do NOT use the override, this is a legacy from VM 1.0 and does not play well with other parts of VM. It confuses people and template makers, it is NOT advised to use this. Presenting discounts do not work as expected. It is an override and a very blunt tool.
I use a couple of calculation rules, Markup 100%, Markup 125% and so on.  I also use a number of other rules Discount 10%, Discount 20 % and so on. These give me enogh flexibility.

My 2 cents

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

Andrew Smith

Hi Jörgen,

Really appreciate the straight forward advice about the override function.

I don't get to set the pricing (client does) so I will just forgo the input cost consideration and the only part of the orders summary taken seriously will be the total turnover.  It's not super critical and I can always change this around later.

Thanks again.  I'll now try and mark this thread as solved.

Andrew