Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Showing Slashed prices to show discount

ktwbc edited this page Oct 1, 2012 · 12 revisions

###Note: This information only applies to 2.1 and below. Web Store 2.5 has slashed price display built-in.

You can display "slashed prices" in your product detail page and the product grid with a few template changes. This feature requires you to use the Web Price field in your product card with your discounted or sale price, and will show the regular Sell Price as the "normal" price with a slash.

To make any of these changes, you will need to edit your template files. Under the /templates folder, you will have a subfolder corresponding with the template set you're currently using (specified at Tools->eCommerce->Admin Panel->Configuration->Appearance->Store Template). Under your chosen folder, you will find the files you need to modify.

Please note the line numbers provided below may vary slightly in different templates, or may be inaccurate if your templates have been extensively modified. In this case, look at the code itself to match up with our directions.

Showing slashes in pricing details

figure 1

To use slashes in pricing detials, edit the file product_detail.tpl.php which is the template for the individual "cell" in the grid.

Note around lines 79-83 you have the following code:

<!--  
<div class="price_reg"><?php _p("Regular Price"); ?> : <strike><?= _xls_currency($this->prod->Sell) ; ?></strike></div>
-->

If you remove the comment lines, it will display the regular price with a slash above your web sell price. You can change the labeling for your needs as well.

Showing slashes in product grid cells

figure 2

If you wanted to change the grid when you're browsing, that file is product_list_item.tpl.php which is the template for the individual "cell" in the grid.

The code:

<div class="product_cell_price rounded"><a href="<?php _xt($_ITEM->Link); ?>"><?= _xls_currency($_ITEM->Price); ?></a></div>

on line 36 can be replaced with:

<div class="product_cell_price rounded"><a href="<?php _xt($_ITEM->Link); ?>"><?php if ($_ITEM->SellWeb<$_ITEM->Sell) echo '<strike>'._xls_currency($_ITEM->Sell).'</strike> '._xls_currency($_ITEM->SellWeb); else echo _xls_currency($_ITEM->Price); ?></a></div>

You can also use coloring with in the HTML/CSS similar to this: http://store.dunbarcycles.com or http://www.defconproshop.com/index.php?search=onsale

Showing a percentage off in the product grid

figure 3

To calculate a percentage off, you can do this:

this is an example of the entire line 36 in product_list_item.tpl.php

<div class="product_cell_price rounded"><a href="<?php _xt($_ITEM->Link); ?>"><?= _xls_currency($_ITEM->SellWeb); ?><?php if ($_ITEM->SellWeb<$_ITEM->Sell) echo " (".round((-100*(1-($_ITEM->Sell/$_ITEM->SellWeb))),0)."% off)"; ?></a></div>

Which would display a percentage discount calculated next to the price.

Clone this wiki locally