Author Topic: How to display the price on related products  (Read 487 times)

Josemi

  • Beginner
  • *
  • Posts: 3
  • A beginner
How to display the price on related products
« 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

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28120
  • Always on vacation
    • Jenkin Hill Internet
Re: How to display the price on related products
« Reply #1 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.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.24 PHP 7.4.14

Josemi

  • Beginner
  • *
  • Posts: 3
  • A beginner
Re: How to display the price on related products
« Reply #2 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>

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3456
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: How to display the price on related products
« Reply #3 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Josemi

  • Beginner
  • *
  • Posts: 3
  • A beginner
Re: How to display the price on related products
« Reply #4 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.

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3456
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: How to display the price on related products
« Reply #5 on: February 19, 2021, 12:48:37 pm »
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28120
  • Always on vacation
    • Jenkin Hill Internet
Re: How to display the price on related products
« Reply #6 on: February 19, 2021, 13:52:33 pm »
This is the option (usually set by default) - using the new beta admin template.

Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.24 PHP 7.4.14