Wrong reduction price

Issue #11 resolved
huseyin_kaya created an issue

I get the wrong Price in the following code. I have a product for 2,30 and i put it on sale by 10% what should make it 2,07, what show good in the admin panel. But the following code {{price}} shows 2,15 :S I put that code on the homepage.

{{ store:extras limit="4" type="sale"  }}
{{ name }}  {{ price }} 
{{ /store:extras }}

when i go to /store/extras/sales it shows the right price with the reduction for 2,07. No i click on the product but it shows the old price 2,30. i used the following code:

<span><?php if (isset($product->sale_type)): ?>
    <span class="<?php echo $product->sale_type; ?>">
        <?php echo $product->sale_type == 'reduce' ? '-' . $product->reduction . '%' : lang('store:option_' . $product->sale_type); ?>
    </span>
    <?php if ($product->price > $product->new_price): ?>
        <span style="text-decoration: line-through"><?php echo $product->price_tax; ?></span> <?php echo $product->new_price_tax; ?> 
    <?php else: ?>
        <span class="price"><?php echo $product->price_tax; ?></span>
    <?php endif; ?>
<?php else: ?>
    <span class="price"><?php echo $product->price_tax; ?></span>
<?php endif; ?>
{{ settings:currency }}</span>

Comments (2)

  1. Błażej Adamczyk repo owner

    The "price" value is not overwritten when you add reduction. If you did "print_r" of any product item you would notice that there are in fact 4 price values:

    echo $product->price; // before reduction price without tax
    echo $product->price_tax; // before reduction price with tax
    echo $product->new_price; // price without tax after reduction
    echo $product->new_price_tax; // price with tax after reduction
    

    The same applies for lex tags:

    {{ price }}
    {{ price_tax }}
    {{ new_price }}
    {{ new_price_tax }}
    
  2. Log in to comment