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

Base price and discount price layout - J3.6.4 / VM3.0.18

Started by thefbi, December 03, 2016, 15:49:32 PM

Previous topic - Next topic

thefbi

Hello,

i have read many post on this subject, but no one can resolve this basic problem for a e-shop. I dont understand we have this problem on a great component like Virtuemart...

I want to show the final price for all the products.
If i have a discount, i want to show the base price without discount, the final price with discount and the amount of discount.
If i activate the base price in my VM config, i have what i want, but for the non discount product, i have too the base price, and the final price, wich are the same = I dont want this.

So, actually, in my price configuration i have activate :
- Base price with tax, without discount => but it show NOTHING
- Final price
- Amount of discount

If you go in the url page : https://www.energie-sante.ch/accueil-boutique/consommables-argent-colloidal.html
you can see (at the end of the page) my "Argent colloidal TEST" with the Final price and discount amount but NOT the base price without discount.

I am not programmer and that make many month i try to resolve this issue, so if somebody can tell me what code i have to put in what folder, i was very happy :)

Thanks for help,
Frédéric

thefbi

Here is th code i have in my html override, in sublayout => price.php

<?php
/**
 *
 * Show the product prices
 *
 * @package    VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2014 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default_showprices.php 8024 2014-06-12 15:08:59Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');
$product $viewData['product'];
$currency $viewData['currency'];
?>

<div class="product-price" 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]) != $product->prices['salesPrice']) {
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]) != $product->prices['salesPrice']) {
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 class="clear"></div>
</div>

maxispin

Hmm.. what is the problem? all other products are not having discount price showing
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

thefbi

QuoteSo, actually, in my price configuration i have activate :
- Base price with tax, without discount => but it show NOTHING
- Final price
- Amount of discount

The problem is for the product with discount price...
Do you see the Base price with tax, without discount ??? Me not

maxispin

It is much easier to understand if you give calculation example.

Am I right,

Baseprice 150
Discount price 120.

So please open the calculation of yours here.
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

thefbi

Hello yes,

i have chang my template now, but the problem still here.

Actually i have (for example) :

Final price : 150.-
Base price : 120.-

This is a discount price, it is OK like this, but i have on all my other non discount price :

Final price : 150.-
Base price : 150.-

It is a non-sense to have the same price twice.
I want the base price ONLY when i have a discount

maxispin

VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

thefbi

Hum... if i make this one, i have ONLY the final price. I want the Base price AND final price for discount products.
I want the clients see the base price and final price for the discount products.

If you see only the final price in a discount product, how do you do to know the price without discount ???

GJC Web Design

If you don't specifically charge tax or use b4 tax discounts  then the logic of the strikethru / discount display is wrong in the sublayout/prices.php

you need to add something like

//GJC added to show strikethru price on b4 tax discounts
    if (abs($product->prices['discountAmount']) > 0 && ($product->prices['salesPrice'] < $product->prices['product_price'] ) ){
        echo '<span class="price-crossed" >' .$this->currency->createPriceDiv ('product_price', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices). "</span>";
    }
//GJC added to show strikethru price on b4 tax discounts


but echo out your $product->prices to see which ones to us in the logic

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

maxispin

#9
It was not meant to be perfect solution for your case.

As you wrote. It works. Play with settings and code 
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

thefbi

Thank you, but my knowledge is limited on coding...
I gone try to edit it, but i have already tested and i never succeeded to make append the "Base price without discount" in my site.
Because i thing it is this parameter. But if you select it in the VM config, it never appear... In all template.

thefbi

Hello,

OK, that is OK now. I have add this code, but not work :

<?php if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
} ?>


I have replace basePriceWithTax BY basePrice and is OK.