News:

Support the VirtueMart project and become a member

Main Menu

VM3 display original price and sale price

Started by mbrando, November 23, 2016, 18:44:54 PM

Previous topic - Next topic

mbrando

Hello,

I was having trouble getting my VM3.0.18 install on J3.6.4 to display the original price with a strike and the sale price.

In viewing the sublayouts/prices.php file I noticed that the $product->prices array is used to find the price you want to display e.g.

echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);

will show the [basePrice] => 110.5 from the array.

Odd though the 110.5 in the array is actually the sale price or discount price.

I had to create an HTML override in the theme for this so that the page would display the cost before discount like this:

echo $currency->createPriceDiv ('costPrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);

Note I only changed the reference from basePrice to costPrice in the first section.

Here is a copy of the $product->prices array I was working with as reference. It seems odd that the 'discountAmount' is -0 value. You'd think it would be costPrice less salesPrice. However, it looks like it is basePrice less salesPrice which is zero.

Array
(
    [virtuemart_product_price_id] => 290
    [virtuemart_product_id] => 290
    [virtuemart_shoppergroup_id] => 0
    [product_price] => 130
    [override] => 0
    [product_override_price] => 0
    [product_tax_id] => 0
    [product_discount_id] => 0
    [product_currency] => 144
    [product_price_publish_up] => 0000-00-00 00:00:00
    [product_price_publish_down] => 0000-00-00 00:00:00
    [price_quantity_start] => 0
    [price_quantity_end] => 0
    [created_on] => 2015-04-26 14:04:48
    [created_by] => 63
    [modified_on] => 2015-04-26 14:13:28
    [modified_by] => 63
    [locked_on] => 0000-00-00 00:00:00
    [locked_by] => 0
    [costPrice] => 130
    [basePrice] => 110.5
    [basePriceVariant] => 110.5
    [basePriceWithTax] => 0
    [discountedPriceWithoutTax] => 110.5
    [priceBeforeTax] => 110.5
    [salesPrice] => 110.5
    [taxAmount] => 0
    [salesPriceWithDiscount] => 0
    [salesPriceTemp] => 110.5
    [unitPrice] => 0
    [discountAmount] => -0
    [priceWithoutTax] => 110.5
    [variantModification] => 0
    [DBTax] => Array
        (
        )

    [Tax] => Array
        (
        )

    [VatTax] => Array
        (
        )

    [DATax] => Array
        (
        )

    [Marge] => Array
        (
            [3] => Array
                (
                    [0] => Budget Sale
                    [1] => 15.0000
                    [2] => -%
                    [3] => 0
                    [4] => 144
                    [5] =>
                    [6] => 1
                    [7] => 3
                )

        )

)


I'm looking closer at this to see why the price is not calculating correctly for discount.

- Mike
Reliable Web Hosting www.JIKOmetrix.net

Jörgen

Hello

Have You checked Your settings in configuration->prices ?

regards

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

mbrando

Yes, I turned them on and off and it would not display with these edits.

I also tried to install an over lay of the current version thinking my developer had modified core files since I saw no HTML overrides in the template folder.

so far so good.

Are you saying that generally in a clean install these changes would not be necessary?

- Mike
Reliable Web Hosting www.JIKOmetrix.net

Jörgen

Hum..

Sorry, I read Your question a bit carelessly, I think the baseprise is not accessible. The idea is to use it as cost price and nothing to show Your customer.

If it is only the base price You are after You have to make changes in the code,

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