VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Tentaurus on April 12, 2018, 13:01:31 PM

Title: Array text showing again on product detail page
Post by: Tentaurus on April 12, 2018, 13:01:31 PM
like in this thread http://forum.virtuemart.net/index.php?topic=137229.msg480376#msg480376
the text 'array' is showing again on the product detail page.

I set all shippment methods "Show on the product details page" to "No".
Happens since the update from 3.2.12 to 3.2.14.
Title: Re: Array text showing again on product detail page
Post by: Milbo on April 12, 2018, 20:01:07 PM
It is very likely and old layout override. Your default.php in productdetails view should have something like


foreach ($this->productDisplayTypes as $type=>$productDisplayType) {

foreach ($productDisplayType as $productDisplay) {

foreach ($productDisplay as $virtuemart_method_id =>$productDisplayHtml) {
?>
<div class="<?php echo substr($type0, -1?> <?php echo substr($type0, -1).'-'.$virtuemart_method_id ?>">
<?php
echo $productDisplayHtml;
?>

</div>
<?php
}
}
}


this code block is usually below

echo shopFunctionsF::renderVmSubLayout('rating', array('showRating' => $this->showRating, 'product' => $this->product));
Title: Re: Array text showing again on product detail page
Post by: web-itc on April 16, 2018, 13:29:03 PM
Hi Milbo

I have the same issue.  How exactly must I solve this issue?
www.web-ict.be
Title: Re: Array text showing again on product detail page
Post by: Nilsy on April 19, 2018, 14:16:10 PM
Same problem here...  :-\
Title: Re: Array text showing again on product detail page
Post by: Milbo on April 19, 2018, 23:44:13 PM
Open your override

/templates/yourtemplate/html/com_virtuemart/productdetails.

there is a file called default.php. Open it. Search for


$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_shipmentmethod_id =>$productDisplayHtml) {
?>
<div class="<?php echo substr($productDisplayType0, -1?> <?php echo substr($productDisplayType0, -1).'-'.$virtuemart_shipmentmethod_id ?>">
<?php
echo $productDisplayHtml;
?>

</div>
<?php
}
}
}


or

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 />';
    }
}

replace it with the code, which I posted above.
Title: Re: Array text showing again on product detail page
Post by: Nilsy on April 20, 2018, 21:53:08 PM
Thank you Milbo!
For me, it was the second alternative alteration that was visible in the code... (which is why I didn't see it the first time around).
Title: Re: Array text showing again on product detail page
Post by: Milbo on April 21, 2018, 11:32:09 AM
"Re: Array text showing again on product detail page"

I did not mention the second code, because the topic contained the word "again". I wonder if there is a Faq about.
Title: Re: Array text showing again on product detail page
Post by: web-itc on April 24, 2018, 23:34:11 PM
Hi Milbo

I am sure that it is me but I don't know with which code I need to replace this.  I found the code where it is, but I just need to know the code.  You said that you posted the codes above, but I don't know exactly what code

Thank you
Title: Re: Array text showing again on product detail page
Post by: Milbo on May 02, 2018, 14:10:15 PM
I hope this FAQ clears it http://forum.virtuemart.net/index.php?topic=140113.0
Title: Re: Array text showing again on product detail page
Post by: RobertG on January 21, 2019, 11:04:43 AM
Hi Milbo,

I have the same problem on the website of a friend. Joomla! 3.9.2 and Virtuemart 3.4.2 : on some pages, we see "Array" above the price of products, ont other it doesn't appear.
The template has no override for Virtuemart.
It seems only new categories and products are affected, not ancient.

How can I set something to mask this word?
Thanks!
Robert
Title: Re: Array text showing again on product detail page
Post by: jenkinhill on January 21, 2019, 11:24:28 AM
URL of an affected product?
Title: Re: Array text showing again on product detail page
Post by: RobertG on January 21, 2019, 11:34:56 AM
Sorry jenkinhill and thanks for your reply!
I explored the code and found a "productdetails/tmpl/perso.php" dated of 2015, default.php modified to not show the "back to category" button on the product detail page.
I changed the choice to "default" in the "product layout" parameter in "Templates and Layouts" configuration, then I used the new code of default.php and changed it to mask this button.
Robert
Title: Re: Array text showing again on product detail page
Post by: jenkinhill on January 21, 2019, 12:16:40 PM
OK