News:

Looking for documentation? Take a look on our wiki

Main Menu

[SOLVED] Word "ARRAY" displayed in the product detail page

Started by Geppux, April 21, 2017, 18:00:25 PM

Previous topic - Next topic

Geppux

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

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

Geppux

Thank you jenkinhill,
obviously I made the wrong search.
This solved the problem.

WillP

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!

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

WillP

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.

GJC Web Design

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 . '';
}
} */
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation