Author Topic: Some questions about configuring VM  (Read 730 times)

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3881
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Some questions about configuring VM
« Reply #15 on: July 20, 2022, 14:57:14 pm »
Check your code in the template for updating prices in the view.

There is a check if discount price is equal to base price. You have to check with diff. Not ==, rounding errors makes this impossible with float.

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

micropalla

  • Jr. Member
  • **
  • Posts: 102
Re: Some questions about configuring VM
« Reply #16 on: July 22, 2022, 10:26:27 am »
Is it in /public_html/templates/ja_elicyon/html/com_virtuemart/productdetails/default.php?

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1522
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Some questions about configuring VM
« Reply #17 on: July 22, 2022, 10:34:53 am »
no

sublayout price
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

micropalla

  • Jr. Member
  • **
  • Posts: 102
Re: Some questions about configuring VM
« Reply #18 on: July 22, 2022, 10:53:00 am »
This is the code I have:

Code: [Select]
defined ('_JEXEC') or die('Restricted access');
$product = $viewData['product'];
$currency = $viewData['currency'];
?>
<div class="product-price <?php echo (empty($product->prices['salesPrice']) ? '':'salesprice'?>" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php
if (!empty(
$product->prices['salesPrice'])) {
//echo '<div class="vm-cart-price">' . vmText::_ ('COM_VIRTUEMART_CART_PRICE') . '</div>';
}

if ($product->prices['salesPrice']<=and VmConfig::get ('askprice'1) and isset($product->images[0]) and !$product->images[0]->file_is_downloadable) {
$askquestion_url JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id '&tmpl=component'FALSE);
?>

<a class="ask-a-question bold" href="<?php echo $askquestion_url ?>" rel="nofollow" ><?php echo vmText::('COM_VIRTUEMART_PRODUCT_ASKPRICE'?></a>
<?php
} else {
//if ($showBasePrice) {
echo $currency->createPriceDiv ('basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$product->prices);
//if (round($product->prices['basePrice'],$currency->_priceConfig['basePriceVariant'][1]) != $product->prices['basePriceVariant']) {
echo $currency->createPriceDiv ('basePriceVariant''COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT'$product->prices);
//}

//}
echo $currency->createPriceDiv ('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$product->prices);
if (round($product->prices['basePriceWithTax'],$currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$currency->_priceConfig['salesPrice'][1])) {
echo '<span class="price-crossed" >' $currency->createPriceDiv ('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$product->prices) . "</span>";
}
if (round($product->prices['salesPriceWithDiscount'],$currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$currency->_priceConfig['salesPrice'][1])) {
echo $currency->createPriceDiv ('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$product->prices);
}
echo $currency->createPriceDiv ('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$product->prices);
if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $currency->createPriceDiv ('discountedPriceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$product->prices);
} else {
echo $currency->createPriceDiv ('priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$product->prices);
}
echo $currency->createPriceDiv ('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$product->prices);
echo $currency->createPriceDiv ('taxAmount''COM_VIRTUEMART_PRODUCT_TAX_AMOUNT'$product->prices);
$unitPriceDescription vmText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE'vmText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.$product->product_unit));
echo $currency->createPriceDiv ('unitPrice'$unitPriceDescription$product->prices);
}
?>

</div>

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3881
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Some questions about configuring VM
« Reply #19 on: July 22, 2022, 12:28:02 pm »
Prices.php cotains the logic that shows the correct price in the orrect moment and in the correct place. Customize as you like, but make a template override first for this file or else your changes will soon be lost.

Check these lines:

Code: [Select]
if (round($product->prices['basePriceWithTax'],$currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$currency->_priceConfig['salesPrice'][1])) {
Code: [Select]
if (round($product->prices['salesPriceWithDiscount'],$currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$currency->_priceConfig['salesPrice'][1])) {
Code: [Select]
if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
I guess the last line is the one that makes trouble.

Jörgen

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

micropalla

  • Jr. Member
  • **
  • Posts: 102
Re: Some questions about configuring VM
« Reply #20 on: July 22, 2022, 14:59:27 pm »
I was trying to modify as followign but with bad results:

if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $currency->createPriceDiv ('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
}
if ($product->prices['discountedPriceWithoutTax'] == $product->prices['priceWithoutTax']) {
echo $this->currency->createPriceDiv ( 'basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices );
}

Where do I wrong?