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

How to modify price in virtuemart module product

Started by Geppux, February 13, 2016, 10:46:26 AM

Previous topic - Next topic

Geppux

VM 3.0.12 J 3.4.8

Hi, in my home page I have the virtuemart module that shows the latest products, but the product is shown only with the final price... I would like to show also the base price with tax but without discount and the discount amount. I know which file has to be edited and I made some try but without success, can somebody helps me?
Thank you.
Giuseppe

Geppux

In the template/mytemplate/html/mod_virtuemart_product/default.php the price is set with this code:
<span class="product-price">
<?php 
// $product->prices is not set when show_prices in config is unchecked
if ($show_price and  isset($product->prices)) {
echo '<div class="product-price">'.$currency->createPriceDiv ('salesPrice'''$product->pricesFALSEFALSE1.0TRUE);
if ($product->prices['salesPriceWithDiscount'] > 0) {
echo $currency->createPriceDiv ('salesPriceWithDiscount'''$product->pricesFALSEFALSE1.0TRUE);
}
echo '</div>';
}?>

</span>

any suggestion on how to modify it to obtain what I need?
In the category page prices are displayed as I need but the code of the template/mytemplate/html/com_virtuemart/category/default.php is completely different and I don't understand how to do.
Thank you.

Giuseppehe code of the template/mytemplate/html/com_virtuemart/category/default.php

PRO

if u notice the word    salesPrice in
echo '<div class="product-price">'.$currency->createPriceDiv ('salesPrice', '', $product->prices, FALSE, FALSE, 1.0, TRUE);

salesPrice is the sales price.
You can add any one you want.

in the category, you can look at the code with firebug etc. and see the correct name for the price you want.
for example, mine says
<span class="PricepriceWithoutTax">$99.99</span>

This text PricepriceWithoutTax      is the name of the price


Geppux


Geppux

I can't wait tomorrow...  ;D even if it's late!
I checked with firebug in the category page and the name of the price is PricebasePriceWithTax so I added this to the file but the price completely disappeared... so I thought I inserted in the wrong place so I just replaced salesPrice with PricebasePriceWithTax and I expected to have the full price displayed as in the category page, but again no price displayed... what I'm missing?
Thank you.
Giuseppe

www.mulligan.it
VM 3.0.12
J 3.4.8

Jörgen

Hello Geppux

You don´t say what You changed. Changing the CSS is not enough. You have to change the PHP echo statement. I this does not help. Have You published the price You want to see in the backend ?

regards

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

Geppux

Hi Jorgen,
I didn't changed the CSS, I modified the template/mytemplate/html/mod_virtuemart_product/default.php
The price I want to see is published in the back end, in fact I can see it regularly in the category page.
You can check here: http://mulligan.it/it/gps-e-telemetri-da-golf.html

Jörgen

Hi Geppux

He, he, I looked at my site and the same happens (doesn´t show) to crossed over price.  :-[
Have to take a check and see what happens. Maybe I get time to investigate this weekend.

regards

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

Geppux

Thank you Jorgen, let me know if you have news, bye.

PRO

so weird, i looked into it.

i can get the prices, but print_r  but it will not echo it

Geppux


PRO


Jörgen

Hello Geppux

I just made a quick test. If You include this, You will get the crossed out price without discount. Look into the sublayout prices.php and You will find the other prices You are looking for.
// Only displays if we have discount
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>";
}


best regards

Jörgen @ Kreativ Fotografi


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

Geppux

Great Jorgen!! You did it.
Thank you very much for your help!

Giuseppe

Jörgen

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