News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Show BasePriceWithTax and Unit Price with related products

Started by kratzi, February 10, 2016, 11:55:01 AM

Previous topic - Next topic

kratzi

Hi,

I am on J 3.4.8 and VM 3.0.12.

I see the code for related products has changed quite a bit.

I would like to show in related products the BasePriceWithTax and the Unit Price.

I have adjusted the following code

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

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


//juri::root() For whatever reason, we used this here, maybe it was for the mails
echo JHtml::link (JRoute::('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $related->virtuemart_product_id '&virtuemart_category_id=' $related->virtuemart_category_id), $thumb   $related->product_name, array('title' => $related->product_name,'target'=>'_blank'));
if(
$customfield->wPrice){
$currency calculationHelper::getInstance()->_currencyDisplay;
echo $currency->createPriceDiv ('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$related->prices);
echo 
$currency->createPriceDiv ('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$related->prices);
$unitPriceDescription vmText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE'vmText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.$product->product_unit));
echo 
$currency->createPriceDiv ('unitPrice''COM_VIRTUEMART_PRODUCT_UNITPRICE'$related->prices);

}
if(
$customfield->wDescr){
echo '<p class="product_s_desc">'.$related->product_s_desc.'</p>';
}


The problem is that the BasPrice is always displayed. So in case there is no BasePrice defined in the backend it will show the SalesPrice as BasePrice. So you have twice the same price.

I tried with the following code which I have from the earlier version but without luck:

if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
echo '<div class="price-crossed" style="margin:0px;" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</div>";
}


Regarding the Unit Price the code from above works but the correct symbol is not showing. It always shows "%s"

Hope you can help here. Mostly the unit price is in some countries mandatory as soon you show a price for a product.

Regards

kratzi