VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: joozen on July 07, 2022, 15:14:40 PM

Title: Product not adding to cart after latest update
Post by: joozen on July 07, 2022, 15:14:40 PM
Joomla! 3.10.10
VirtueMart 4.0.6 Eagle owl 10690
PHP 7.4.3

After latest update when you click Add to Cart Virtuemart returns to main page. All was working before update. Please advise.

ps. Just noticed, PayPal express checkout from oniline store stopped work as well. I don't know what been done with product details or ever file but shop actually stopped working.
Title: Re: Product not adding to cart after latest update
Post by: joozen on July 07, 2022, 22:46:21 PM
Rolled back from backup, its working now. Thanks for help. 
Title: Re: Product not adding to cart after latest update
Post by: sjstv on July 08, 2022, 11:41:57 AM
Anybody know a fix for this? I'm unsure how you go back to the previous version.
Title: Re: Product not adding to cart after latest update
Post by: GJC Web Design on July 08, 2022, 12:01:34 PM
you need to report what exactly is wrong or at least provide all info -- versions, live site and example page
Title: Re: Product not adding to cart after latest update
Post by: sjstv on July 08, 2022, 12:26:44 PM
Sorry, thought it would be a common problem as it occurred on the last update.

Joomla 3.10.8
Virtuemart 4.0.6

Try the Buy Now button. https://www.sjstv.co.uk/parts-shop/all-categories/remote-controls/4776/lg-genuine-oem-remote-control-2021-models-mr21ga-akb76036201-detail
Title: Re: Product not adding to cart after latest update
Post by: jenkinhill on July 08, 2022, 12:36:02 PM
On console I see this error:
VP One Page Checkout plugin is not ready.        plugin.min.js:10:70955
Title: Re: Product not adding to cart after latest update
Post by: joozen on July 08, 2022, 14:28:19 PM
Quote from: jenkinhill on July 08, 2022, 12:36:02 PM
On console I see this error:
VP One Page Checkout plugin is not ready.        plugin.min.js:10:70955
I don't have one page checkout on my site. I'm using native checkout. When you try to add product to card it redirect to link yousite/# and redirect to main page. Exactly the same with Paypal Express button on product details page. After I restored site from backup to previous version it work as it should.
Title: Re: Product not adding to cart after latest update
Post by: jenkinhill on July 08, 2022, 15:41:54 PM
Checkout on your restored site uses VP:
<link href="/plugins/system/vponepagecheckout/assets/css/light-checkout.css?ver=7.9" rel="stylesheet" type="text/css" />
   <link href="/plugins/system/vponepagecheckout/assets/css/responsive-procheckout.css?ver=7.9" rel="stylesheet" type="text/css" />
Title: Re: Product not adding to cart after latest update
Post by: sjstv on July 08, 2022, 15:52:10 PM
Only way I could get out of it was to do a full restore. Now running VM 4.0.2
Title: Re: Product not adding to cart after latest update
Post by: ssc3 on July 08, 2022, 19:50:53 PM
You can duplicate this behaviour in product details page with

VirtueMart 4.0.6 10690
Native Checkout
No third party plugins installed

by setting "Display modal popup upon 'Add to cart'" to No

this should take you directly to checkout without the "Add to Cart" modal popup,

but you just remain on the same page.
Title: Re: Product not adding to cart after latest update
Post by: GJC Web Design on July 08, 2022, 20:18:23 PM
you can also see this with the standard VM checkout and the "OPC" not selected so you have separate views for shipping and payment selection.
The Save form does nothing..  i.e. u stay on the same view ..

{
   "updatecart": "",
   "virtuemart_shipmentmethod_id": "4",
   "option": "com_virtuemart",
   "view": "cart",
   "task": "updatecart",
   "controller": "cart"
}

doesn't even reach the cart controller afaik .. certainly doesn't reach the function updatecart() ..
assume a router problem but weirdly the almost same post form the ajax (i.e. enable the core OPC setting) works fine!

Title: Re: Product not adding to cart after latest update
Post by: joozen on July 08, 2022, 21:52:14 PM
Quote from: jenkinhill on July 08, 2022, 15:41:54 PM
Checkout on your restored site uses VP:
<link href="/plugins/system/vponepagecheckout/assets/css/light-checkout.css?ver=7.9" rel="stylesheet" type="text/css" />
   <link href="/plugins/system/vponepagecheckout/assets/css/responsive-procheckout.css?ver=7.9" rel="stylesheet" type="text/css" />
If it about my site VP turned off because Online Store PayPal Express not working with it. Therefore I'm using native checkout.
Title: Re: Product not adding to cart after latest update
Post by: Jörgen on July 09, 2022, 10:44:50 AM
Apparently does the inactivation not enough. VP OPC code is involved in your error.

Jörgen
Title: Re: Product not adding to cart after latest update
Post by: joozen on July 09, 2022, 15:40:48 PM
Quote from: Jörgen on July 09, 2022, 10:44:50 AM
Apparently does the inactivation not enough. VP OPC code is involved in your error.

Jörgen

Thank you. OK Uninstalled. But still a bit scared to update so far all working. Probably I'll try to do fresh backup just before and update it later today. Will see what's happen.
Title: Re: Product not adding to cart after latest update
Post by: Jörgen on July 09, 2022, 18:19:17 PM
Yes backup before update is always a very good idea  8)

Jörgen
Title: Re: Product not adding to cart after latest update
Post by: Mike J on July 11, 2022, 02:03:23 AM
Sharing my experiences with Joomla 4.1.5 & VirtueMart 4.0.6 10690

Good news: State drop down error is resolved!

Started with VirtueMart4.0.2_Joomla_3.10.9-Stable-Full_Package.zip (Just this source file. Clean install / no other templates or plugins).

* Installed with preconfigured VirtueMart (also for multilanguage sites) + Installed VirtueMart with sample data enabled.

Joomla ‎3.10.9 > 3.10.10 VM test order using COD (Cash On Delivery) = Success... Reached thank you page and order was recorded as confirmed in BE.

Updated J to 4.1.5 = Call to undefined method Joomla\CMS\Application\SiteApplication::isAdmin() in FE (Front End).
Back End (BE): Swapped template from Horme 3 - Default to vmbeez3 - Default = #500 behavior::framework not found.
BE: Swapped template from vmbeez3 - Default to Cassiopeia - Default = User is redirected to home page (not thank you page) after selecting COD > Check Out – No trace of order in BE.

* As I ran many attempts, I did select different options when installing and at one stage installed my Pay Pay Credit Card payment plugin (for VM 3 and VM 4 ) which worked great in Joomla ‎3.10.10 / VirtueMart 4.0.6 10690 but locked everything up after clicking Confirm Order in Joomla 4.1.5 / VirtueMart 4.0.6 10690.

So, my experience revealed that test orders in 3.10.10 + VirtueMart 4.0.6 10690 = Success
Test orders in Joomla 4.1.5 + VirtueMart 4.0.6 10690 = No go.

Would love to hear reports from others as your experience may help me in moving forward.
Title: Re: Product not adding to cart after latest update
Post by: ssc3 on July 11, 2022, 10:49:32 AM
The product not adding to cart issue looks to be caused by an update to vrequest.php

Revision 10690 The fix for J4 in vRequest

http://dev.virtuemart.net/projects/virtuemart/repository/revisions/10690/diff/trunk/virtuemart/administrator/components/com_virtuemart/helpers/vrequest.php?utf8=%E2%9C%93&type=inline

The problem is also present in J4 as well as J3

Test by setting

"Display modal popup upon 'Add to cart'" to No

The add to cart button will no longer work in 4.0.6

Reverting to the version of  vrequest.php used in 4.0.4 fixes this.
Title: Re: Product not adding to cart after latest update
Post by: ssc3 on July 12, 2022, 12:10:43 PM
$vars = $router->getVars();
if($source===0){
$source = $_REQUEST;
if(!empty($vars)){
$source = array_merge($_REQUEST,$vars);
}



seems to be causing the problem in vrequest.php
if $_REQUEST['view'] is already set
it is overwritten by the value from $router->getVars()
so
view = cart
becomes
view = productdetails

in this case staying on the product details page instead of going to the cart page.
Title: Re: Product not adding to cart after latest update
Post by: Mike J on July 13, 2022, 06:34:46 AM
Many thanks ssc3,

I tried an install of VirtueMart 4.0.4 10688 which worked perfectly in J 3.10.10 but broke when updating to J 4.1.5 as per my previous findings.

Was just checking to see if the problem was introduced between VM 4.0.4.10688 & VM 4.0.6.10690 but not the case.
Title: Re: Product not adding to cart after latest update
Post by: ssc3 on August 10, 2022, 10:32:34 AM
if you get fed up of waiting for 4.0.8

you could try hacking the code in vrequest.php

change

$source = array_merge($_REQUEST,$vars);
               
to
                  
$source = $_REQUEST + $vars

using the array union operator. This prevents the view from being overwritten if it already exists in $_REQUEST

Fixes the "Not Adding to Cart" problem but may or may not cause others, so use entirely at own risk!
Title: Re: Product not adding to cart after latest update
Post by: Mike J on August 11, 2022, 02:46:41 AM
Hey thanks ssc3,

This may just save my bacon. I'm about to jump ship as other stuff I'm running must be on J! 4.

... Been pulling my hair out over this dilemma being a happy VM user for decade... Reluctant to move to something else.

This may be my only hope as time has run out. :(
Title: Re: Product not adding to cart after latest update
Post by: ssc3 on August 12, 2022, 11:00:30 AM
Still using Joomla 3. I have no plugins that require Joomla 4, so no plans to upgrade yet.

Joomla 3 still has security updates until August 2023

The "Adding to Cart" problem affects both Joomla 3 and 4. The hack "fixes" that one,

but there are still a whole set of other problems that are exclusively Joomla 4's.
Title: Re: Product not adding to cart after latest update
Post by: sgagner on August 15, 2022, 22:55:54 PM
I tried to add the mentioned code in VM 4.0.6 but the problem with items removed from cart remains
Title: Re: Product not adding to cart after latest update
Post by: pinochico on August 16, 2022, 00:52:44 AM
Quote from: ssc3 on August 12, 2022, 11:00:30 AM
Still using Joomla 3. I have no plugins that require Joomla 4, so no plans to upgrade yet.

Joomla 3 still has security updates until August 2023

The "Adding to Cart" problem affects both Joomla 3 and 4. The hack "fixes" that one,

but there are still a whole set of other problems that are exclusively Joomla 4's.

Thank you,
we're still on J3 and VM3 as well.

But next month we will start to update most of our about 80 active extensions for VM to J4 and prepare two new eshops for VM4 and J4.
Completion date - 04/2023

Plenty of time before the end of J3 security upgrades are complete and plenty of time before the functional versions of VM4 and J4 are complete.

The "scaremongers" who have to keep upgrading to VM4 and Joomla4 are smiling and probably forgot about the same issues when moving from J1.5, J2.5, J3...
But I keep my fingers crossed for them, I just feel sorry for their customers.

Translated with www.DeepL.com/Translator (free version)
Title: Re: Product not adding to cart after latest update
Post by: ssc3 on August 16, 2022, 08:06:44 AM
Quote from: sgagner on August 15, 2022, 22:55:54 PM
I tried to add the mentioned code in VM 4.0.6 but the problem with items removed from cart remains

The code fixes a VM 4.0.6 problem but looking back at your posts you also had this problem with VM 4.0.4

I can find no problem with with items removed from cart using VM 4.0.4 or VM 4.0.6 using the default setup with no third party plugins installed.

I would try with a different template or checkout. Then uninstall any third party plugin one by one to see that makes a difference.

If that does not work then roll back to whatever were the last versions of Joomla or Virtuemart that worked for you.

Title: Re: Product not adding to cart after latest update
Post by: GJC Web Design on August 16, 2022, 10:04:24 AM
The routing problem becomes apparent with an "POST" .. e.g. using the "add to cart" without ajax or trying to update a stored address.

Anything using a "GET" works correctly ... as mentioned .. with the last development version before the holidays - com_virtuemart.4.0.7.10693 - afaik all routing problems were solved

if anyone wants to experiment here is the router & vrequest from that version. THESE ARE DEV VERSIONS AND NOT INTENDED FOR PRODUCTION!