Skip to end of metadata
Go to start of metadata
Icon

Having hard time finding an answer to your question?

Check out our Knowledge Base.

On Sale

Version 2.5


Extension page: http://ecommerce.aheadworks.com/magento-extensions/on-sale.html


This extension allows you to add graphical labels to your special or new products images. Moreover you can specify a graphical label for the image of any product. Attract your visitors to special and new items - the labels can be displayed in catalog view as well as in product. The label image and text are easily customized: you can use a label that comes into the package and upload your own; you can not only write your text on the label but also use the following variables: Discount Amount (calculated automatically), Regular Price, Special Price, Save Amount (calculated automatically), Lifetime in days, Lifetime in hours, Product SKU, In stock amount, Any product attribute. So it's possible to label your products with texts like "Save $10 on this item today", "Buy for $29 save $10!", "Only 3 phones left!", "Only 2 days on sale!" - all values are calculated for each product individually. Label appears when there is a special price for the product and when a new product is added.

This way you save a lot of time when running e.g. seasonal discounts campaign, with a simple 3-minutes setup you can put labels on a category or the whole store.

Installation

1. Backup your web directory and store database.

 Click to view details

You can make backup copies with any tool you find appropriate

If you are going to use the native Magento backup function, navigate to System -> Tools -> Backups and perform System and Database backups

 2. Log in to the Magento backend

 3. Disable compilation

 Click to view details

Navigate to System -> Tools -> Compilation.

If Compiler status is Disabled, you can skip to the next step

If Compiler is enabled, disable it.

IMPORTANT: after the extension is installed, you can enable the compilation again; IT IS CRUCIAL that you use "Run Compilation Process" function, not just "Enable button"

Icon

Installing an extension with the Compilation enabled will result in store downtime.

 4. Flush store cache

 Click to view details

You can flush the store cache in 2 ways:

  • via the backend:

Navigate to System -> Cache Management menu, and click Flush Magento Cache button

  • via filesystem:

On your server, navigate to Magento root folder, then proceed to /var/cache/; delete all the content there.

 5. Download the extension package from your account and extract the downloaded archive

 6. Copy the content of /Step_1/ folder to your store's root directory

If you are using a custom theme,

Icon
 read the instructions here.

In case you are using a custom theme, it is recommended to copy the design files to your current theme's folders. In case there are several themes in use at the same store, the design files must be copied to each of them.

  • Find this folder in the package: /step_1/app/design/frontend/base/default/ ; copy its content to /app/design/frontend/[your_package]/[your_theme]/
  • Find this folder in the package: /step_1/skin/frontend/base/default/ ; copy its content to /skin/frontend/[your_package]/[your_theme]/

 7. Copy the content of /Step_2/ folder to your store's root directory

 8. Edit the page template files as described below. After the template files are adjusted and the changes are saved, flush store cache again; log out from the backend and log in again.

Edit Templates

Installing the On Sale extension requires inserting some code into the page template files. This code is responsible for displaying the label images.

NOTE: it is recommended that you make backup copies of the original template files prior to editing the latter.

For Magento Community and Professional

The "On Sale" label can be displayed on both View Product and View Category pages.

media.phtml

To display the label on View Product page, open the /app/design/frontend/<your_package>/<your_theme>/template/catalog/product/view/media.phtml file, where your_theme and your_package are your current Theme and Design Package respectively. If you haven't ever changed your theme or package, use default as the value.

Find the following lines:

 

<p class="product-image product-image-zoom">
   ...
</p>

 

For RWD theme, the target code is different:

<div class="product-image product-image-zoom">
...
</div>

 

 

Enclose these lines with a code like in the example below:

 

<div class="onsale-product-container">
   <?php echo Mage::helper('onsale')->getProductLabelHtml($_product); ?>
   <p class="product-image product-image-zoom">
      ...
   </p>
</div>

 

list.phtml

To display the OnSale label on the View Category page, open the /app/design/frontend/<your_package>/<your_theme>/template/catalog/product/list.phtml file

Icon

Note, that list.phtml file contains 2 instances of identical code (see below). Normally, 1st instance is relevant to List representation, while the 2nd one is for the Grid view.

If both List and Grid representations are in use at your store, make sure to amend both code instances according to these instructions

Find the following lines:

 

<a href="<?php echo $_product->getProductUrl() ?>"
        title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"
        class="product-image">
    ...
</a>

 

 

for List Mode, enclose these lines with a code like in the example below

 

<div class="onsale-category-container-list">
   <?php echo Mage::helper('onsale')->getCategoryLabelHtml($_product); ?>
   <a href="<?php echo $_product->getProductUrl() ?>"
           title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"
           class="product-image">
       ...
   </a>
</div>

 


 

for Grid Mode, enclose these lines with a code like in the example below

 

<div class="onsale-category-container-grid">
   <?php echo Mage::helper('onsale')->getCategoryLabelHtml($_product); ?>
   <a href="<?php echo $_product->getProductUrl() ?>"
           title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"
           class="product-image">
       ...
   </a>
</div>


 

 

For Magento Enterprise

The "On Sale" label can be displayed on both View Product and View Category pages.

media.phtml

To display the label on View Product page, open the /app/design/frontend/<your_package>/<your_theme>/template/catalog/product/view/media.phtml file, where your_theme and your_package are your current Theme and Design Package respectively. If you haven't ever changed your theme or package, use default as the value.

Find the following lines:

 

<a class="product-image image-zoom" id="main-image" title="<?php echo $this->htmlEscape($_product->getImageLabel()); ?>" href="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>">
    <?php
       ...
    ?>
</a>

 

 

Enclose these lines with a code like in the example below:

 

<div class="onsale-product-container">
   <?php echo Mage::helper('onsale')->getProductLabelHtml($_product); ?>
   <a class="product-image image-zoom" id="main-image" title="<?php echo $this->htmlEscape($_product->getImageLabel()); ?>" href="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>">
    <?php
       ...
    ?>
   </a>
</div>

Find the following lines:

 

<p class="product-image product-image-zoom">
   ...
</p>

 

 

Enclose these lines with a code like in the example below:

 

<div class="onsale-product-container">
   <?php echo Mage::helper('onsale')->getProductLabelHtml($_product); ?>
   <p class="product-image product-image-zoom">
      ...
   </p>
</div>

 

list.phtml

To display the onsale label on the View Category page, open the /app/design/frontend/<your_package>/<your_theme>/template/catalog/product/list.phtml file

Icon

Note, that list.phtml file contains 2 instances of identical code (see below). Normally, 1st instance is relevant to List representation, while the 2nd one is for the Grid view.

If both List and Grid representations are in use at your store, make sure to amend both code instances according to these instructions

Find the following lines:

 

<a href="<?php echo $_product->getProductUrl() ?>"
   title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"
   class="product-image">
   ...
</a

 

 

for List Mode enclose these lines with a code like in the example below

 

<div class="onsale-category-container-list">
<?php echo Mage::helper('onsale')->getCategoryLabelHtml($_product); ?>    
  <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">          
      <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(166); ?>" width="166" height="166" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  </a>
</div>

 


 

for Grid Mode enclose these lines with a code like in the example below

 

<div class="onsale-category-container-grid">
<?php echo Mage::helper('onsale')->getCategoryLabelHtml($_product); ?>
  <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">         
  <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(166); ?>" width="166" height="166" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  </a>
</div>


 

Configuration

Automatic Label Assignment

Product / Category On Sale label

The On Sale label appears on the products that have a current price reduction (compared to their basic price specified in the product settings). The label will only appear for the products that have the price below the specified Threshold

These labels can be configured in System -> Configuration -> aheadWorks Extensions -> On Sale (or Promotions -> On Sale -> Configuration), via Product On Sale Label and Category On Sale Label tabs. The available options are identical, the difference is the label target: Product View and Category View respectively. 

  • Display (= Yes / No) - enables / disables the label
  • Position - defines the label position within the product image
  • Image - here, you should select the actual label image. You can either upload an image from the local machine, or, use a URL to an already available one (in the Image Path field).
  • Text - here, you can specify the label text. It will be displayed over the label image. Note, you can use pre-defined values in this filed, check here for details
  • Threshold (%) - this value defines the discount amount necessary to trigger the label.

 

Product / Category New label

The New label appears on the products that have been added to the catalog less than X days ago (the exact period is defined via settings).

These labels can be configured in System -> Configuration -> aheadWorks Extensions -> On Sale (or Promotions -> On Sale -> Configuration), via Product New Label and Category New Label tabs. The available options are identical, the difference is the label target: Product View and Category View respectively. 

  • Display (= Yes / No) - enables / disables the label
  • Position - defines the label position within the product image
  • Image - here, you should select the actual label image. You can either upload an image from the local machine, or, use a URL to an already available one (in the Image Path field).
  • Text - here, you can specify the label text. It will be displayed over the label image. Note, you can use pre-defined values in this filed, check  here for details
  • Days - this option defines for how long the extension considers a product to be "New". The period is counted since the item is added to the catalog (i.e., a new product is created).
  • Overrides On Sale Label - this option defines which of the 2 global labels (On Sale / New) has a priority over the other one. If this option is set to "Yes", the extension will consider "New" label to be more important.
  • Overrides Native Product "New" Period - this option defines what value will be used for marking a product as "New". If set to "Yes", all the products will be labelled as "New" per the Days option above. If this option is set to "No", the products will be labelled "New" according to the New From-To period specified. If a given product does not have the New From-To period defined, "New" label will not be assigned.


 

Rule-based labels

Rule labels have priority over the Sale and New labels.

The On Sale And Product Labels extension allows assigning labels via attribute-based  rules. The rules can be created in Promotions -> On Sale -> Manage Rules backend page.

Rule Info tab

In this tab, you can define the general rule parameters: Rule Name and Description, Status (Active / Inactive), target Storeview and Customer Group(s), From-To Dates and the rule Priority*.

*Rule Priority is counted low to high. I.e., the rule with Priority=1 will be processed before a rule with Priority=2.

Conditions tab

In this tab, you can select the criteria for an item to get the label. The available conditions are based on the Product Attributes.

Actions tab

In this tab, you are to specify the actual labels to be used in Product View and in Category View.

For both Product and Category labels, you can enable / disable the label (Display label on product / category page = "Yes / No"), select the Label Position, choose Label image (via upload or web URL), and specify the Label text

 


 

Manual Label Assignment

The manually assigned labels have highest priority. I.e., none of the auto-assigned labels can override a manually placed one.

Both Product view and Category view labels can be manually assigned from the Edit Product backend page (Catalog -> Manage Products -> Edit Product), via Product Label and Category Label tabs respectively.

The list of the available options is identical to setting up any other labels.

You can enable / disable the label (Display label on product / category page = "Yes / No"), select the Label Position, choose Label image (via upload or web URL), and specify the Label text

 


 

Label Text

The text specified in the correspondent field of any label instance will be displayed over the label image.

In addition to plain text, the extension supports a number of pre-defined shortcuts, that display dynamic details. See the list below.

Code
Description
#DA#discount amount, e.g. 10%
#RP#regular price, e.g. $100
#SP#special price, e.g. $90
#SA#save amount, e.g. $10
#NL#inserts line break
#ND#life time in days
#NH#life time in hours
#SK#product SKU
#ST#in stock amount
#CA:attribute_code#custom attribute

 

 

Label Image

The On Sale extension comes with a default labels pack. There are 20 ready-made images for your use. You can use any of them, you should just specify a file path (in Image Path field) like
http://domain.com/skin/frontend/default/default/onsale/labels/[file_name]

 

Icon
 Click to see the list of default image files

Here's the list of available images:

  • buy-it-now-yellow-top-right.png 
  • eco-green-top-left.png 
  • low-price-otange-top-right.png 
  • sold-black-top-left.png
  • discount-orange-top-left.png 
  • eco-green-top-right.png 
  • new-blue-top-left.png 
  • sold-black-top-right.png
  • best-price-orange-top-left.png 
  • discount-orange-top-right.png 
  • for-sale-orange-top-left.png 
  • new-blue-top-right.png
  • best-price-orange-top-right.png 
  • download-blue-top-left.png 
  • for-sale-orange-top-right.png 
  • sale-pink-top-left.png
  • buy-it-now-yellow-top-left.png 
  • download-blue-top-right.png 
  • low-price-otange-top-left.png 
  • sale-pink-top-right.png

 


 

Labels Priority

The On Sale and Product Labels extension only allows to show 1 label for a given product at a time.

If a product qualifies for several labels, the priority is arranged as follows:

  1. Manually assigned labels - always have top priority. If a product has a manually selected label, it will always be shown
  2. Rule-assigned labels - the rule labels always override the global labels. If a product meets the conditions for several rules, the one with lower Priority value will be active (i.e., the label will be shown.)
  3. Global labels - have lowest priority. The "Overrides On Sale Label" option in the New Label settings controls which of the 2 is considered to be more important.

 

Uninstallation

1. Disable compilation, in case it is enabled.

2. Login to your FTP, navigate to app/etc/modules/

3. Open the file AW_Onsale.xml and change the following line:  

 

<active>true</active>

 

 to

 

 

<active>false</active>

 

 

Now your Magento is unaware of the existence of the module.

4. Clear the cache under var/cache

5. Make sure that the site is working properly, otherwise roll back the changes, restore the database and apply to our technical support.

6. make a backup and then run the following query in MySQL (Note, if you are using the tables with prefixes, you must specify them in all table names): 

 

DELETE FROM eav_attribute WHERE attribute_code LIKE 'aw_os_%';
DROP TABLE `aw_onsale_product`;
DROP TABLE `aw_onsale_rule`;

 

This will delete the extension's attributes and tables from the database. 
If you are not sure how to do that or expect any troubles with it, please contact your server administrator regarding the matter.
After that, you can safely remove the extension's files from your store.

 7. If everything works fine, it is safe to delete the files of the extension.

 

Troubleshooting

After the extension installation the store gives an error, or blank page, or suggests to start Magento installation procedure.

Change the owner of the extracted extension files to the web server user and set 775 permissions on them. Clear the store cache and try again.

There is no aheadWorks extensions under my configuration section, or having the extension tab clicked I get a blank page, or Access Denied error.

Clear the store cache, browser cookies, logout and login again.

I've set up everything correctly, inserted the HTML code but there is nothing on that page.

Clear the store cache, clear your browser cache and domain cookies and refresh the page.

My configuration changes do not appear on the store.

 Clear the store cache, clear your browser cache and domain cookies and refresh the page.

“Use Default Value” box is ticked off after saving changes in the Product/Category Label tab for a specific store.

Set “Choose Store View:” to “Default Values” and click the Save and Continue Edit button.



You can always find the latest version of the software, full documentation, demos, screenshots and reviews at http://ecommerce.aheadworks.com
License agreement: http://ecommerce.aheadworks.com/LICENSE-M1.txt
Contact us: http://ecommerce.aheadworks.com/contacts/
Copyright © 2015 aheadWorks Co. http://www.aheadworks.com

  • No labels