LemonStand Documentation

Catalog level price rules

You can manage the catalog price rules on the Catalog Price Rules page of the Shop module. This page contains a list of rules. The order of rules is important, because LemonStand applies them one by one, and result of a one rule can be used by another rule. For example, if you have a rule which discounts some product by 10%, and another rule which discounts this product by 20 USD, the second rule will use the price discounted by 10% as input. You can reorder price rules by dragging them up and down in the list.

Creating a catalog price rule

To create a new catalog price rule, click the Add Rule button. There is a number of required fields in the New Rule form:

  • Rule name. This name appears in the rule list, in the header of the rule.
  • Rule description. The description appears in the rule list, in the area below the rule title.

You can also specify a time interval when you rule should be active. The time interval can be open, i.e. you can leave the From Date or the To Date field empty. For example, if you specify some date in the From Date field and leave the To Date field empty, the rule will be active forever starting from the date specified in the From Date field.

By default rules are inactive. You should click the Active checkbox in order to activate the rule.

In the Customer Groups checkbox list you can choose which customer groups the rule is active for. If you do not check any checkbox, the rule will be active for all customer groups.

After entering the general rule parameters, you can go to the Conditions tab and begin building conditions for activating the rule. Please note that if you need to apply the rule to all products, you need not to create any conditions. By default new rules are active for all products in the catalog. There is only one type of conditions available in catalog rules – a product attribute condition. For example “product weight is greater than 100”. Also you can use compound conditions for checking products against a combination of conditions. The following screenshot contains a condition which checks whether a product name contains hat and the product does not belong the Art or Photography categories.

Among other product attribute conditions there is the Product condition, which allows you to find specific products and thus apply (or do not apply) rules only to specific products.

After defining the rule conditions go to the Action tab. This tab contains the Terminating Rule checkbox and the Action drop-down menu. The Terminating Rule checkbox instructs LemonStand to stop further rules processing for products which satisfy the conditions specified on the Conditions tab. It means, that if you have a rule which discounts all hats in the catalog by 10% and a rule which discounts all products by 5 USD, and if you check the Terminating Rule checkbox in the first rule, then hats will be discounted only once, by 10%. If the checkbox is unchecked, the hats will be discounted two times – by 10% and then by 5 USD.

The Action drop down menu contains a list of available actions. There are 4 actions available for the catalog rules:

  • discount by percentage of the original price
  • discount by fixed amount
  • discount to fixed price (this action sets a fixed price to products)
  • discount to percentage of the original price

After selecting an action in the drop-down menu you need to enter a corresponding discount amount to the text field below the drop-down menu. Please note that discounts take into account price tiers.

After defining the action parameters click the Save button in order to save the rule and return to the rule list.

Note about category-related conditions

If your conditions include category checks please note the following:

  • The IS and IS NOT conditions are more strict than the IS ONE OF and IS NOT ONE OF conditions. This means that if you have a product which belongs to the Computers and Hardware categories (two categories at the same time), the "Category IS Computers" condition will return FALSE, because the product also belongs to the Hardware category. In most cases you can use the IS ONE OF and IS NOT ONE OF conditions for categories.
  • Category conditions do not check in subcategories automatically. This means that if you have a product which belongs to the Hardware => Computers category (Computers is a subcategory of the Hardware category), the "Category IS Hardware" condition will not work, because subcategories are not checked automatically. You should create the "Category IS Computers" condition instead.

How to apply price rules manually

Catalog price rules are applied when you click the Apply Rules button above the rule list. This forces LemonStand to process all products in the catalog and save discounts to the database. You need to apply rules each time after you add or edit a rule. LemonStand automatically applies catalog rules to new or updated products.

Some price rules can have a time interval assigned, and if there are such rules defined in your store, you need to apply the catalog rules daily.

How to apply price rules automatically, using a cronjob

You can configure a cronjob for applying the price rules automatically, for example on daily basis. LemonStand has a special URL, which, once accessed, forces price rules to apply. This URL is
/ls_shop_apply_catalog_rules

The full URL depends on your server name and can look like this:
http://yourserver.com/ls_shop_apply_catalog_rules

To invoke this URL by a cronjob you can use the CURL command:
curl http://yourserver.com/ls_shop_apply_catalog_rules

If you use CPanel it is very simple to add a cronjob using the graphic interface. The following image displays a cronjob configuration in the CPanel Standard Cron Manager:

If you configure cronjobs manually, a cronjob entry in the crontab file can look as follows:
0 * * * * curl http://yourserver.com/ls_shop_apply_catalog_rules

This cronjob will apply the price rules each midnight.

Granting IP access for invoking the cron commands

By default the access to the script for applying the price rules is denied for any IP. You can allow access to the script from specific IP addresses.

First, you need to detect which IP address has the server you invoke the URL from. To do it, you need to access the URL from the server where you are configuring the cron job, using a browser or a command line. Open the http://yourserver.com/ls_shop_apply_catalog_rules (use a correct server URL) script in a browser, or from a command line using the CURL application, and look to the error message:
Error. Cron access from the IP address 127.0.0.1 is denied.

To grant access to the script from specific IP address (in this case 127.0.0.1), please open the /config/config.php file in a text editor and find the following configuration parameter:

$CONFIG['CRON_ALLOWED_IPS'] = array();

Add the IP address to the list of allowed addresses:

$CONFIG['CRON_ALLOWED_IPS'] = array('127.0.0.1');

Save the document and try to invoke the script again, using a browser or a command line. If you configured the permissions correctly, you will see a confirmation message:
Price rules have been successfully applied to 139 product(s).

Catalog price rules and product on-sale price

You can assign product on-sale price for individual products on the Create/Edit Product page. Please note that an on-sale price specified for some product overrides any catalog price rules applied to the product.

Next: Shopping cart price rules (discounts)
Previous: Managing discounts
Return to Managing discounts

Comments

No comments posted so far.

Add your comment

Loading form...