VirtueMart Forum

VirtueMart 2 + 3 => General Questions => Topic started by: Josemi on February 18, 2021, 12:34:06 pm

Title: How to display the price on related products
Post by: Josemi on February 18, 2021, 12:34:06 pm
Hi, I have Joomla 3.9.19 and virtuemart 3.8.4 10335. I want the price of the related products to appear but I don't know how to do it. I have seen in the forum that it refers to the modification of the default_relatedproducts.php file but that file is not in my virtuemart. You can help me.
Thanks a lot
Title: Re: How to display the price on related products
Post by: jenkinhill on February 18, 2021, 13:28:39 pm
In current versions the relevant template is components/com_virtuemart/sublayouts/related.php but if using overrides this may be found in templates/[YourJoomlaTemplate]/html/com_virtuemart/sublayouts/

The default template action is to show prices for related products. You may have overrides that need editing to show the prices sublayout. Check using VMBeez (if you have it) or Protostar Joomla templates. These will use the default VM templates.
Title: Re: How to display the price on related products
Post by: Josemi on February 19, 2021, 09:34:47 am
Thank you very much for the answer, I have tried another template and it does not show the prices of related products. This is my related.php file in the two templates, the general one from virtuemart and the one from the site.

<?php defined('_JEXEC') or die('Restricted access');

$related = $viewData['related'];
$customfield = $viewData['customfield'];
$thumb = $viewData['thumb'];

?>
<div class="product-container">
<div class="vm-product-media-container"><?php
echo JHtml::link (JRoute::_ ($related->link), $thumb   . $related->product_name, array('title' => $related->product_name,'target'=>'_blank'));
?></div><?php
if($customfield->wPrice){
   ?> <div class="product-price" id="productPrice<?php echo $related->virtuemart_product_id ?>"> <?php
   $currency = calculationHelper::getInstance()->_currencyDisplay;
   echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$related,'currency'=>$currency));
   echo $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $related->prices);
   ?></div><div class="clear"></div><?php
}

if($customfield->waddtocart){
   ?><div class="vm3pr-related" ><?php
   echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$related, 'position' => array('ontop', 'addtocart')));
   ?></div><?php
}

if($customfield->wDescr){
   echo '<p class="product_s_desc">'.$related->product_s_desc.'</p>';
}
   ?></div>
Title: Re: How to display the price on related products
Post by: Jörgen on February 19, 2021, 10:17:55 am
Have You marked the check box "Show prices" in the custom field reelated products ?

Jörgen @ Kreativ Fotografi
Title: Re: How to display the price on related products
Post by: Josemi on February 19, 2021, 12:32:52 pm
Thanks for the reply. I don't know where that Check is. Could you tell me where it is to check if it is pressed.
Title: Re: How to display the price on related products
Post by: Jörgen on February 19, 2021, 12:48:37 pm
Look for Your "CUSTOM FIELDS"  search for "custom field related products".

Jörgen
Title: Re: How to display the price on related products
Post by: jenkinhill on February 19, 2021, 13:52:33 pm
This is the option (usually set by default) - using the new beta admin template.

(https://i.ibb.co/Df3ybwk/Ashampoo-Snap-19-February-2021-12h47m55s-002.png) (https://ibb.co/3mtqsSW)