If you want to get price with discount on the cart page, use special construction in the template cart.html
/** Get data about the product * * @param array $item - Product data * @param string $field - Field, you want to get * Available values: * - 'price' - price with discount, * - 'compare_price' - compare price, * - 'discount' - discount value * * array['class'] string Additional CSS to the block * array['html_before'] string HTML code before the block * array['html_after'] string HTML code after the block * array['multiply'] int Multiply value or not. Available values: 0 or 1 * array['ruble_sign'] string Ruble setting. Available values: 'symbol' - ruble sign, 'string' - rub sign. * array['return_clear_value'] int Get only the value without html-wrap. Available values: 0 or 1. * If you set 1, than block will be static. HTML before/after will be ignored * array['ignore_hide'] int Ignore default hiding behaviour. Available values: 0 or 1 * By default, if compare price or discount are empty, than block should be hidden. * array['tag'] string Tag of the block * array['remove_loader'] int Remove block loader. Available values: 0 or 1 * @param array $params - Array of params (see above) * $params = [ * 'class' => '', * 'html_before' => '', * 'html_after' => '', * 'multiply' => 1, * 'ruble_sign' => 'string', * 'return_clear_value' => 0, * 'ignore_hide' => 0, * 'tag' => 'span', * 'remove_loader' => 0 * ] * @return string */ {$wa->shop->flexdiscountPlugin->cartItem($item, $field, $params)}
Example
In the template do:
1) Find code in the template cart.html:
{foreach $cart.items as $item}
2) After it you can add any construction.
Construction examples
− Output of the price with discount
{$wa->shop->flexdiscountPlugin->cartItem($item, 'price')}
− Output of the compare price
{$wa->shop->flexdiscountPlugin->cartItem($item, 'compare_price')}
− Output of the discount
{$wa->shop->flexdiscountPlugin->cartItem($item, 'discount')}
− Output of the compare price with additional HTML
Block will hide, if price will be zero. Add CSS-class, remove the loader.
{$wa->shop->flexdiscountPlugin->cartItem($item, 'compare_price', [ 'class' => 'compare-at-price', 'html_before' => '<b>Старая цена: </b>', 'remove_loader' => 1 ])}
− Output of the discount value for one product item (do not multiply quantity)
Block will not hide, if discount will be zero. Change the tag of the block. Change ruble sign.
{$wa->shop->flexdiscountPlugin->cartItem($item, 'discount', [ 'multiply' => 0, 'html_before' => 'Discount ', 'ruble_sign' => 'symbol', 'ignore_hide' => 1, 'tag' => 'div' ])}
By default Shop-Script change prices on the cart page. To prevent your discounted price from being replaced, do not insert the above constructions in the class blocks: item-total or s-product-total.
Also you can delete this classes.