News:

Looking for documentation? Take a look on our wiki

Main Menu

How to display the price on related products

Started by Josemi, February 18, 2021, 12:34:06 PM

Previous topic - Next topic

Josemi

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

jenkinhill

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

Josemi

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>

Jörgen

Have You marked the check box "Show prices" in the custom field reelated products ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Josemi

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.

Jörgen

Look for Your "CUSTOM FIELDS"  search for "custom field related products".

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jenkinhill

This is the option (usually set by default) - using the new beta admin template.

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