VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Geppux on April 21, 2017, 18:00:25 PM

Title: [SOLVED] Word "ARRAY" displayed in the product detail page
Post by: Geppux on April 21, 2017, 18:00:25 PM
VM 3.2.1 - J 3.6.5

In the override file in /templates/mytemplate/html/com_virtuemart/productdetails/default.php I have this code if (is_array($this->productDisplayShipments)) {
foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment . '<br />';
}
}
that cause the  word "ARRAY" to be displayed on the detailproduct page,  as you can see for example, here https://www.mulligan.it/it/attrezzatura-da-golf/legni/cobra-king-f7-driver-detail.html

This happens after the upgrade to the version 3.2 of virtuemart.
To solve I could comment those lines but there is another way more correct to solve the problem ?

Thank you, bye.
Giuseppe
Title: Re: Word "ARRAY" displayed in the product detail page
Post by: jenkinhill on April 21, 2017, 18:38:35 PM
http://forum.virtuemart.net/index.php?topic=137229.msg480422#msg480422
Title: Re: Word "ARRAY" displayed in the product detail page
Post by: Geppux on April 21, 2017, 19:12:58 PM
Thank you jenkinhill,
obviously I made the wrong search.
This solved the problem.
Title: Re: [SOLVED] Word "ARRAY" displayed in the product detail page
Post by: WillP on February 22, 2019, 15:35:36 PM
Quote from: Geppux on April 21, 2017, 19:12:58 PM
Thank you jenkinhill,
obviously I made the wrong search.
This solved the problem.


Hi Geppux, may I know how you fix the problem. My template has the shipment code as yours, but i find no following code as stated in the solution
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
}
}
}


I have tried
1. replace the shipment code with suggested code
2. add suggested code instead replace

But problem not resolves. The word array gone only if there is no shipping method published.

Thanks!
Title: Re: [SOLVED] Word "ARRAY" displayed in the product detail page
Post by: jenkinhill on February 22, 2019, 18:34:27 PM
On the shipment method turn the "Show on the product details page" to "No".

or

https://forum.virtuemart.net/index.php?topic=140113.0
Title: Re: [SOLVED] Word "ARRAY" displayed in the product detail page
Post by: WillP on February 23, 2019, 03:27:57 AM
Hi jenkinhill,

Thank you for your reply. Yes, i did read and try the method in suggested thread before to this thread.

1. Turn to NO for show on the product details page
2. Add the code as suggested (not resolved)
3. Replace the code (not resolved)

Below is partial of the code
<div class="vm-product-details-container">
<?php
echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$this->showRating,'product'=>$this->product));
echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$this->product,'currency'=>$this->currency));
echo shopFunctionsF::renderVmSubLayout('stockhandle',array('product'=>$this->product));
?>

   
<?php // Product Sku
if (!empty($this->product->product_sku)) { ?>

<p class="product_sku"><span class="text"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_SKU'); ?></span>: <?php echo $this->product->product_sku?></p>
<?php ?>
<?php
// Manufacturer of the Product
if (VmConfig::get('show_manufacturers'1) && !empty($this->product->virtuemart_manufacturer_id)) { ?>

<div class="form-group">
<?php echo $this->loadTemplate('manufacturer');?>
</div>
<?php ?>
<?php
// Product Short Description
if (!empty($this->product->product_s_desc)) {
?>

<div class="product-short-description">

<?php
/** @todo Test if content plugins modify the product description */
echo nl2br($this->product->product_s_desc);
?>

</div>
<?php
// Product Short Description END
?>

<div class="spacer-buy-area">

<?php
// TODO in Multi-Vendor not needed at the moment and just would lead to confusion
/* $link = JRoute::_('index2.php?option=com_virtuemart&view=virtuemart&task=vendorinfo&virtuemart_vendor_id='.$this->product->virtuemart_vendor_id);
  $text = vmText::_('COM_VIRTUEMART_VENDOR_FORM_INFO_LBL');
  echo '<span class="bold">'. vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS_VENDOR_LBL'). '</span>'; ?>
<a class="modal" href="<?php echo $link ?>"><?php echo $text ?></a><br />
*/
?>
<?php if (is_array($this->productDisplayShipments)) {
foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment '';
}
}
if (is_array($this->productDisplayPayments)) {
foreach ($this->productDisplayPayments as $productDisplayPayment) {
echo $productDisplayPayment '';
}
}



where the string "Array" caused by this code
<?php if (is_array($this->productDisplayShipments)) {
foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment '';
}
}


Thank you so much for your kind assist.
Title: Re: [SOLVED] Word "ARRAY" displayed in the product detail page
Post by: GJC Web Design on February 23, 2019, 11:31:17 AM
if u don't use/want a shipping display on the detail pages just comment it out


<?php /*  if (is_array($this->productDisplayShipments)) {
foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment . '';
}
} */