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
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->prices, FALSE, FALSE, 1.0, TRUE);
if ($product->prices['salesPriceWithDiscount'] > 0) {
echo $currency->createPriceDiv ('salesPriceWithDiscount', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
}
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
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
Thank you Pro, tomorrow I'll try.
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
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
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
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
Thank you Jorgen, let me know if you have news, bye.
so weird, i looked into it.
i can get the prices, but print_r but it will not echo it
So no chance to obtain what I want? :(
i dont know
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
Great Jorgen!! You did it.
Thank you very much for your help!
Giuseppe
You´re welcome :)
Jörgen @ Kreativ Fotografi
Hi,
i am also trying to do this, but seems nothing is showing. Maybe i have put this in the wrong place? Hope you can advice where to put this code, cause i obviously did not get it :)
I am editing the \mod_virtuemart_product\default.php to this:
<?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->prices, FALSE, FALSE, 1.0, TRUE);
if ($product->prices['salesPriceWithDiscount'] > 0) {
echo $currency->createPriceDiv ('salesPriceWithDiscount', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
}
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>";
}
echo '</div>';
}?>
Actually i figured it out. I had to edit the single.php instead of the default.php
Thanks for your tip above :) :)