News:

Support the VirtueMart project and become a member

Main Menu

Base Price Including Taxes, but Without Discounts.

Started by MyDesigner, October 01, 2016, 17:43:08 PM

Previous topic - Next topic

MyDesigner

Hello, it's possible to view Base Price Including Taxes, but Without Discounts only when in the product there is a discount and only for detail product page ?
Thanks.

I have VirtueMart 3.0.18 and Joomla 3.6.2 .


jenkinhill

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

MyDesigner


StefanSTS

An override of the sublayout prices.php should do.

Just put an if clause if the two wanted prices are not equal and echo the discount.

Alle the code for the different prices is in that file.

If you want it only in productdetails you could use some CSS to hide it in category view or make a second prices_something.php sublayout and reference it from category view.

So short (it's weekend)
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

MyDesigner

#5
Quote from: StefanSTS on October 02, 2016, 15:12:40 PM
An override of the sublayout prices.php should do.

Just put an if clause if the two wanted prices are not equal and echo the discount.

Alle the code for the different prices is in that file.

If you want it only in productdetails you could use some CSS to hide it in category view or make a second prices_something.php sublayout and reference it from category view.

So short (it's weekend)
Stefan

I can't edit file does not work ...

What should I change ?
      
            //In case you are not happy using everywhere the same price display fromat, just create your own layout
            //in override /html/fields and use as first parameter the name of your file
            ?>
            <div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
               <?php            
               if ($this->product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and isset($this->product->images[0]) and !$this->product->images[0]->file_is_downloadable) {
                  $askquestion_url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->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 {
                  echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices);
                  if ($this->product->prices['discountedPriceWithoutTax'] != $this->product->prices['priceWithoutTax']) {
                     echo $this->currency->createPriceDiv ('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
                  } else {
                     echo $this->currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
                  }
                  
                  echo $this->currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);
                  echo $this->currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
                  echo $this->currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $this->product->prices);
                  
                  if (round($this->product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $this->product->prices['salesPrice']) {
                     echo '<span class="price-crossed" style="text-decoration: line-through;">' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";
                  }
                  if (round($this->product->prices['salesPriceWithDiscount'],$this->currency->_priceConfig['salesPrice'][1]) != $this->product->prices['salesPrice']) {
                     echo $this->currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $this->product->prices);
                  }
                  echo $this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $this->product->prices);
                  echo $this->currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
                  $unitPriceDescription = vmText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', vmText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.$this->product->product_unit));
                  echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $this->product->prices);
               }
               ?>
            </div>
               
            <?php