News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Notice: Array to string conversion in ../com_virtuemart/helpers/cart.php

Started by Thomas Kuschel, May 31, 2012, 17:05:30 PM

Previous topic - Next topic

Thomas Kuschel

Hi,

There is another code sequence inside the cart.php, which causes notice messages within error.log (php 5.4.0):
Notice: Array to string conversion in /home/tkuschel/workspaces/cms/joomla/components/com_virtuemart/helpers/cart.php on line 241

if(!empty($sessionCart->pricesUnformatted)){
foreach($sessionCart->pricesUnformatted as &$prices){
if(is_array($prices)){
foreach($prices as &$price){
$price = (string)$price;
}
} else {
$prices = (string)$prices;
}
}
}


I didn't spend time to dig-in to this code sequence, so I don't know what's going on inside this code; I added the following lines to get rid of these messages:

if(!empty($sessionCart->pricesUnformatted)){
foreach($sessionCart->pricesUnformatted as &$prices){
if(is_array($prices)){
foreach($prices as &$price){
if (is_array($price)){
//do nothing - is there something to do?
}else{
$price = (string)$price;
}
}
} else {
$prices = (string)$prices;
}
}
}


Perhaps, there is a better solution...
I've seen, the array $prices consists of costPrice, basePrice, etc. but also has members DBTax, Tax, and DATax which are defined as Arrays in my environment, but set as Array[0].
Any better solution and can you explain the upper code?

Best regards
Thomas Kuschel
http://www.loytec.com
VM 2.0.6; and source from lastest cvs (compared)
PHP 5.4.0

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/