VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: yosandra on July 17, 2013, 13:28:13 PM

Title: Display normal price, discount and new price
Post by: yosandra on July 17, 2013, 13:28:13 PM
Hi,
I'm using a gavick template (commercial) but the guys can't solve me the issue I'm having. Can I ask here?
If so here is my issue:
I need to display in product details the base price, the discounted price and the descount amount.
Now when apply a 50% discount to a product, it only displays the discounted price, not the base price and discount amount, see http://www.negre.es/tienda/entrega-rapida/mesa-extensible-s1047-lacada-blanco-.html
I think I have my product page template with mistakes. I would be grateful if someone can examine the code and see why these prices are not displayed.
I have all price options selected in vm configuration so I don't understand the reason why they aren't displayed on my product page.
I have to get this working as this is a must for the online shop.

Here is (part) of the code of my product details template:


<div class="product-pricetitle" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
<?php echo $this->currency->createPriceDiv 'salesPrice'''$this->product->prices );?>
<?php echo '<div class="PricetaxAmount">'.$this->product->prices['VatTax'][1][0].'</div>'?>
</div>
<?php // Product custom_fields normal
if (!empty($this->product->customfieldsSorted['normal'])) {  ?>

<div class="product-fields pblock1">

                                           
                                           
<?php foreach ($this->product->customfieldsSorted['normal'] as $field2) { ?>
<div class="product-field-type-<?php echo $field2->field_type ?>">
<label class="product-fields-title" ><?php echo  JText::_($field2->custom_title?></label>
<span class="product-fields-value"><?php echo $field2->display ?></span>
</div>
<?php ?>
</div>
<?php ?>
<?php
$iManufacturer $this->product;
JRequest::setVar('virtuemart_manufacturer_id',$iManufacturer->virtuemart_manufacturer_id,'GET');
$model VmModel::getModel('manufacturer');
$manufacturerURL JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' $iManufacturer->virtuemart_manufacturer_id);
if ($iManufacturer->virtuemart_manufacturer_id !=) {
$manufacturer $model->getManufacturer();
$model->addImages($manufacturer,1);
$manufacturerImage $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image-product-page"',false);
?>

</div>
<div class="product-manufacturer-information">
<div class="pleft">
<div class="product-field-type-S">
<label class="product-fields-title" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL'?></label>

</div>
</div>
<div class="manufacturer-image pright">
<a title="<?php echo JText::_('TPL_GK_LANG_VIRTUEMART_PRODUCTS_DISPLAY_MANUFACTURER_PRODUCTS'?><?php echo $iManufacturer->mf_name?>" href="<?php echo $manufacturerURL?>"><?php echo $manufacturerImage?></a>
</div>
</div>
                                <div class="clear"></div>



<div class="spacer-buy-area">
<?php
if (is_array($this->productDisplayShipments)) {
foreach ($this->productDisplayShipments as $productDisplayShipment) {
echo $productDisplayShipment '<br />';
}
}
if (is_array($this->productDisplayPayments)) {
foreach ($this->productDisplayPayments as $productDisplayPayment) {
echo $productDisplayPayment '<br />';
}
}

// Product Price
if ($this->show_prices) { ?>

<div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">

<?php
if (!empty($this->product->prices['salesPrice'])) {

}
echo $this->currency->createPriceDiv 'salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices ); 
//vmdebug('view productdetails layout default show prices, prices',$this->product);
if ($this->product->prices['salesPrice']<=and VmConfig::get ('askprice'1) and isset($this->product->images[0]) and !$this->product->images[0]->file_is_downloadable) { ?>

<a class="ask-a-question bold" href="<?php echo $this->askquestion_url ?>"><?php echo JText::('COM_VIRTUEMART_PRODUCT_ASKPRICE'?></a>
<?php
} else {
if ($this->showBasePrice) {
echo $this->currency->createPriceDiv ('basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$this->product->prices);
if (round($this->product->prices['basePrice'],$this->currency->_priceConfig['basePriceVariant'][1]) != $this->product->prices['basePriceVariant']) {
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" >' $this->currency->createPriceDiv ('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$this->product->prices) . "</span>";
}
echo $this->currency->createPriceDiv 'discountedPriceWithoutTax''COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE'$this->product->prices );
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 'priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$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 JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE'JText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.$this->product->product_unit));
echo $this->currency->createPriceDiv ('unitPrice'$unitPriceDescription$this->product->prices);

if (!empty($this->product->customfieldsSorted['ontop'])) {
$this->position='ontop';
echo $this->loadTemplate('customfields');
// Product Custom ontop end


}
?>

</div>
<?php ?>



Thanks in advance,
Kind Regards,
Title: Re: Display normal price, discount and new price
Post by: Maxim Pishnyak on July 17, 2013, 14:00:53 PM
As far as I know base price could be shown on frontend only if superadmin is logged.

What's your VM version?

Post here screen shot of your VM price settings.

Could I look on the thread from http://www.gavick.com/forums.html where gavick support failed?
Title: Re: Display normal price, discount and new price
Post by: yosandra on July 17, 2013, 17:37:24 PM
Hi Maxim, thanks for your interest.
Base price: I mean regular price, without discount. The vm version I'm using is the 2.0.20b.
Attached is a screen of my prices configuration: I have all of them checked.

The link to the topic opened regarding this issue in gavick forums is here: https://www.gavick.com/forums/storebox-joomla25/trouble-with-tax-discount-price-26879.html (https://www.gavick.com/forums/storebox-joomla25/trouble-with-tax-discount-price-26879.html)

Thanks in advance,
Kind Regards,

[attachment cleanup by admin]
Title: Re: Display normal price, discount and new price
Post by: jenkinhill on July 17, 2013, 18:15:02 PM
Please see http://forum.virtuemart.net/index.php?topic=108212.0

You will need to work on their override file for productdetails/default_showprices.php
Title: Re: Display normal price, discount and new price
Post by: yosandra on July 18, 2013, 10:37:08 AM
Hi jenkinhill, thanks for the link, if the template support cannot do anything can I ask how to override and fix the file you mention in order to get this working?
The prices (normal, discount and amount saved) are very important for us to display in the site when a product has a discount.

Please let me know how can we get this working.
Thanks in advance,

Kind Regards,
Title: Re: Display normal price, discount and new price
Post by: Maxim Pishnyak on July 18, 2013, 12:18:43 PM
Did you try searching in current forum section?

Something like "show original price, discounted price and discount"?
Title: Re: Display normal price, discount and new price
Post by: yosandra on September 25, 2013, 12:38:21 PM
Hi,
I don't like how prices with discount are displayed. I post an image attached to the topic. The price now is displayed as:
-discount amount (category page).

And I need:
-was $
-now $
-save $ (discount amount)

Into the VM Prices config, I have the following options checked (see attached image "prices").
I need to know the code to display the base price without tax ("was $"), the discounted price ("now $") and the amount saved ("save $").
We don't apply taxes to these prices.

Please let me know,

Kind Regards,



[attachment cleanup by admin]
Title: Re: Display normal price, discount and new price
Post by: Maxim Pishnyak on September 26, 2013, 15:08:03 PM
There are plenty threads about customizing discount look. Why you don't bother forum search button?