Author Topic: "Cannot use object of type stdClass as array" when choosing a payment method  (Read 1017 times)

lumares

  • Beginner
  • *
  • Posts: 4
  • A beginner
Since the last updates we get a "Cannot use object of type stdClass as array" error when I go to checkout and choose a payment method.

We are running:
Joomla 3.9.16
Virtuemart 3.6.10 10211
Payments via: VM modules and RO payments (v 5.2.0)

Problem:
In checkout when we choose a payment method, error "Cannot use object of type stdClass as array" appears.
Before the updates everything was working fine.

Troubleshooting:
We already contacted the ro payments and they did some checking.

Quote
"The error basically says it fails in the function checkForCartQuantities on line 2030 in the file components/com_virtuemart/helpers/cart.php."

Also see attachement.

Any help would greatly be appreciated.
S.


pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 400
    • MiniJoomla
  • VirtueMart Version: 3
I think problem is mybe in paymet plugin RO == contact payment plugin developer
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

lumares

  • Beginner
  • *
  • Posts: 4
  • A beginner
Yes, that is exaclty what I did. They said it has to be Virtuemart.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9667
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Quote
Yes, that is exaclty what I did. They said it has to be Virtuemart.

well .. if they can't be bothered to update their plugin for new versions then it tells u a lot about their commitment to their clients and VM

switch on Joomla debug and u should get a stack trace to show u exactly where the error is being thrown
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lumares

  • Beginner
  • *
  • Posts: 4
  • A beginner
They did help, this is the exact statement I got from Ro payments, after his research (screenshot is the one above):

Quote
Hello Steven,

I have taken a look and it is not an RO Payments problem as the error is generated in the VirtueMart code. Attached is the screenshot from the site. This doesn't happen when I click checkout but it happens for me when I click a payment method.

In that case it may be related to the OPC but that is for VirtueMart to tell you as I have no idea about that. The error basically says it fails in the function checkForCartQuantities on line 2030 in the file components/com_virtuemart/helpers/cart.php.

I just don't know what to do with this info; To be honest I don't know what OPC is?

I do have backups etc... but after updating the same happens. We are always strickt in updating our all Joomla sites and plugins.
I also disabled the whole RO payments plugin and only enabled VM COD and VM bank transfer. Same thing happens.

when selecting a payment method the error appears.

When I enable debug, I can't get any further then the homepage?

I can post the link to the site if you want or pm.

Any help is greatly appreciated.
Steven


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9667
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
OPC = One Page Checkout

r u using a 3rd party checkout?

so it happens on any payment method?

that line is

if($quantity!=$this->cartProductsData[$key]['quantity']){

so check what are the values of the vars  ... esp  $this->cartProductsData

should be an array

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 400
    • MiniJoomla
  • VirtueMart Version: 3
Quote
I also disabled the whole RO payments plugin

I think Virtuemart load any payments plugins even if disabled in the cart (initializes them). If this true, then RO plugin error in cart persists :(
We delete all payments plugin if we don't need.
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

lumares

  • Beginner
  • *
  • Posts: 4
  • A beginner
OPC = One Page Checkout

r u using a 3rd party checkout?

so it happens on any payment method?

that line is

if($quantity!=$this->cartProductsData[$key]['quantity']){

so check what are the values of the vars  ... esp  $this->cartProductsData

should be an array

Thank you for the tips, I have disabled OPC. -> Now the error happens when I click on "submit order".

So now I did a complete back-up restore and I am updating plugin per plugin to find the culprit.

1) Working & already updated site/shop with only VM and RO updates left open to be updated. > at this moment the shop is working as it should.
2) I Install the VM update and get an error: "Class 'vmPSPlugin' not found" -> now I get error "Cannot use object of type stdClass as array"

So the causing problem seems to do with Class 'vmPSPlugin' not found during the vm update.

PHP max execution is 60 and max men 128M , max file 512M

So at this point RO payments isn't even installed yet.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27744
  • Always on vacation
    • Jenkin Hill Internet
Did you update both the VM component and the associated aio package?

Do you have any other third party VM plugins installed (apart from OPC)?
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.2 10325 on Joomla 3.9.18 PHP 7.3.18

pinochico

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 400
    • MiniJoomla
  • VirtueMart Version: 3
Quote
2) I Install the VM update and get an error: "Class 'vmPSPlugin' not found" -> now I get error "Cannot use object of type stdClass as array"

Virtuemart hase bug and not initialized vm model in payment or shipment plugins.
For this we must upgraded our gopay payment plugin and vm standard shipping plugin and add some code for loading some class.
I don't know what is with new version 3.6.10 and higher, but I think change wotking with loading models and class (we must upgraded VirtueMart Mailing Manager too).

So for this moment you must upgrade RO payment plugin.
Definitelly.

Yre you another question? :D
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