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

Array text showing again on product detail page

Started by Tentaurus, April 12, 2018, 13:01:31 PM

Previous topic - Next topic

Tentaurus

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.

Milbo

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));
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

web-itc

Hi Milbo

I have the same issue.  How exactly must I solve this issue?
www.web-ict.be

Nilsy


Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Nilsy

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).

Milbo

"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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

web-itc

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

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/

RobertG

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

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

RobertG

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

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum