Notice: Array to string conversion - Only when logged in on product details page

Started by SoTrue, August 07, 2017, 16:48:04 PM

Previous topic - Next topic

SoTrue

Hi Guys,

This is a bit of a strange one, I'm running J3.6.5 and VM3.2.1 the following error only occurs when I view a product as a logged in customer it does not show when viewing as a guest:

Notice: Array to string conversion in /home4/philly01/public_html/mydomain/templates/ot_tshirt/html/com_virtuemart/productdetails/default.php on line 142
Array


The code causing the error is:

<?php
echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$this->showRating,'product'=>$this->product));

if (is_array($this->productDisplayShipments)) {
    foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment '<br />';
    }
}
if (is_array($this->productDisplayPayments)) {
    foreach ($this->productDisplayPayments as $productDisplayPayment) {
echo $productDisplayPayment '<br />';
    }
}

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'ontop'));
?>


Line 142 contains echo $productDisplayShipment . '<br />';, Commenting out this echo obviously removes the error however, i'd like to try and fix the problem rather than just hide it.

It seems that there is a different default product details template being used for logged in users compared to non logged in users but I cannot for the life of my figure out where/why? This is apparent due to a slight variable name change which displays the price font differently (different css selector) for Guest users compared to logged in users.

I personally, did not set this site up so i'm slightly baffled by this to be honest. Any suggestions would be most appreciated.

Best Regards
Donna

SoTrue

Just an update in case any one else has this problem.

This seemed to be an issue with the Super User account. I have deleted the account and re-added it and the error no longer displays. Very odd indeed.

I now have another strange issue, when trying to edit any user, as soon as I open the user to edit it the email address changes to another customers email address. This happens with every user and always changes to the same email address? I've never seen this behaviour before.

Any Ideas?

Regards
D

Milbo

The first error seems to be an old override, looks now like this:

<?php  $productDisplayTypes = array('productDisplayShipments''productDisplayPayments');
foreach ($productDisplayTypes as $productDisplayType) {

if(empty($this->$productDisplayType)){
continue;
} else if (!is_array($this->$productDisplayType)) {
$this->$productDisplayType = array($this->$productDisplayType);
}

foreach ($this->$productDisplayType as $productDisplay) {

if(empty($productDisplay)){
continue;
} else if (!is_array($productDisplay)){
$productDisplay = array($productDisplay);
}

foreach ($productDisplay as $virtuemart_method_id =>$productDisplayHtml) {
?>

<div class="<?php echo substr($productDisplayType0, -1?> <?php echo substr($productDisplayType0, -1).'-'.$virtuemart_method_id ?>">
<?php
echo $productDisplayHtml;
?>

</div>
<?php
}
}
?>
[/quote]


But maybe also some wrong written plugin using this trigger.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

The second error, I have "no clue". Seems there got something broken in your db. maybe when you created the new superuser.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/