Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
SOLUTION: viewtopic.php?f=4&t=13065

@KK Sir,

I was going through the forum, searching for a way to display the product cost and its discounted cost. I came across a post,
viewtopic.php?f=4&t=12065.

Can this be implemented? If so how?

Regards,
GenXCoders
Image
where innovation meets technology
When I do a <cms:dump /> on the cart template, I get the following:
pp_cart_items-dump.png
pp_cart_items-dump.png (17.26 KiB) Viewed 1616 times

Here, if a discount is applied, there are two values available:
1. orig_price
2. price

The "orig_price" shows the pp_price value, while the "price" shows the discounted value. Can the "price" be displayed directly in any other template, i.e. other than the cart template?

Regards,
GenXCoders
Image
where innovation meets technology
Hi,

..the "price" shows the discounted value. Can the "price" be displayed directly in any other template, i.e. other than the cart template?

Assuming 'cart_ex.php' is in use (how else would the discounts be calculated :) ), please try placing the following wherever your product is displayed (other than the cart itself) and its 'pp_price' and 'pp_discount_scale' can be accessed -
Code: Select all
<cms:php>
    global $CART, $CTX;
   
    $item_price = $CTX->get( 'pp_price' );
    $discount_scale = $CTX->get( 'pp_discount_scale' );
    $item_count = 1;

    if( strlen(trim($discount_scale)) ){
        $rates = $CART->_calc_line_discount( $item_price, $item_count, $discount_scale );
        $discounted_price = $rates['item_discounted_price'];
    }
    else{
        $discounted_price = $item_price;
    }
   
    echo $discounted_price;
</cms:php>

Hope this helps.
@KK Sir,
This works perfectly now!
Thanks a lot!
Regards,
GenXCoders
Image
where innovation meets technology
4 posts Page 1 of 1