unsuported operand type

If you are runnig Joomla 3.x and Virtuemart 3.x please post to this forum your questions or support tickets about One Page Checkout

unsuported operand type

Postby padalec » Wed Feb 11, 2015 11:11 pm

i am reciving the errors below in my inbox.

what does this error mean? am i losing sales?

index.php?&option=com_virtuemart&view=productdetails&task=recalculate&format=json&nosef=1&lang=sl
Error message data:
1 Unsupported operand types in file: /public_html/administrator/components/com_virtuemart/helpers/calculationh.php line: 473 timestamp: 2015-02-11T19:47:47+00:00
padalec
 
Posts: 13
Joined: Tue Jan 20, 2015 12:50 pm

Re: unsuported operand type

Postby admin » Thu Feb 12, 2015 1:13 pm

hello, pls update your Virtuemart or just the file
\administrator\components\com_virtuemart\helpers\calculationh.php

to the latest version of your VM branch (2.6.x or 3.0.x )

if you write here, what your line says there, i can advise a modification there, but i do not see this line being broken on my VM installation.

the problem is most probably caused by:

// to replicate:
$x = 0;
$x = (string)$x;

//gives fatal error:
$y = 10 % $x;

so to fix this, just make sure that $x is a number and not an empty string...

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: unsuported operand type

Postby admin » Thu Feb 12, 2015 2:45 pm

hello, after checking your site, this is how to replicate and fix the problem - note that this is just a quick fix and VM should make sure about other product properties which are used in calculation that they are indeed numbers...

1. choose a product with custom attributes
2. set quantity to zero (in some countries, it's required that the default quantity is ZERO) !
3. change the custom attribute while the forms' quanty is ZERO

you'll see error 500 (vm3.0.4) within the google chrome console from within the ajax context

to "quick fix" this issue without breaking anything else, you can do this:

locate line 291 (on 3.0.4) in your calculationh.php:

Code: Select all
public function getProductPrices(&$product, $variant=0.0, $amount=0) {

      $costPrice = 0;
                // stAn - this is the new line which fixes the problem:
      $product->quantity = (double)$product->quantity;



best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: unsuported operand type

Postby admin » Thu Feb 12, 2015 2:46 pm

also, please note that this problem is not related to our OPC anyhow.

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: unsuported operand type

Postby padalec » Mon Feb 16, 2015 10:55 am

Does it make sense to report this issue/bug ti VM forum?

For me it seems a standalone VM hidden bug!
padalec
 
Posts: 13
Joined: Tue Jan 20, 2015 12:50 pm

Re: unsuported operand type

Postby admin » Mon Feb 23, 2015 6:46 pm

hello, this should have been already fixed by an update of VM, so maybe you do not need to report this.
best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 3 on Joomla 3.x