Using the SalesBlock extension in Magento

With our SalesBlock extension, you can create rules and use those rules to block sales for specific groups of customers. For instance, if you are being spammed a lot by fake orders from Antartica, or if you simply want your former employee from making orders, you can use SalesBlock to make that happen. This guido helps you with the usage of our module.


Check our Downloads section for instructions on how to install SalesBlock in your Magento environment.


Within the System Configuration, you can navigate to the Advanced section where you will find tabs for the SalesBlock extension. The first setting Enabled allows you to simply disable all rule checking temporarily. This is useful when debugging your order process and when you want to make sure SalesBlock is not in the way.

The other two settings - Redirect to CMS Page and Redirect to Custom Page - deal with more or less the same thing: Whenever a rule is matched, SalesBlock will try to block that transaction by either redirecting the customer to a new page (which these two settings deal with). This new page can be a simple CMS page (which is more or less the default): You can simply create your own CMS page from within the backend menu CMS > Pages and once that page is created, you can pick it from the list in the configuration here.

However, some things can not be modified using CMS pages: It is hard to customize PHTML code and XML layout for one specific CMS Page. If you are a professional Magento developer, it is better to focus on the Custom Page instead: This page is served via the URL salesblock/index/index and involves the usage of the PHTML template salesblock/content.phtml plus a custom XML handle salesblock_index_index. This is what you will want to use when you are customizing the Magento theme professionally.

Creating rules

From within the backend page System > Sales Block Rules, you can create new rules. Each rule has a Label and Status. The Label is only there for your own personal reference. A Status field set to No effectively disabled the rule.

The most important part of a rule are the fields Email Value and IP Value:

  • Email Value: This is a newline separated listing of email values. When a customer tries to checkout a product, the customers (or guests) emailaddress will be matched with this listing. This can be a direct match ( or a partial match (johndoe@ or
  • IP Value: This is again a newline separated listing of IP values. When a customer tries to checkout a product, his IP address (including support for proxies) is matched with this listing. Values can include direct IPs (, subnet ranges ( or whole ranges (

When both fields are used, a match is found to be valid once it is matched with either one of the fields, not both.

Displaying the denied page

Once the transaction is denied based upon a specific rule, the SalesBlock extension will redirect the customer to a new page, which is either a CMS page or a custom page (see above). On this page, you can explain the customer why the transaction is denied. Each rule also has two fields specifically for this: A Frontend Label and a Frontend Text which can be shown to the customer to explain specific details for that rule. The way that these values are shown in your frontend depend on what kind of page is used.

Within a CMS page, you can add the variables {{var salesblock_rule_frontend_label}} and {{var salesblock_rule_frontend_text]] to your own text in the WYSIWYG editor. SalesBlock will translate these values to the currently active rule dynamically.

Within a custom page, the block class salesblock/content contains the methods getContentTitle() and getContentText() which will display the same values.

This guide applies to SalesBlock version 0.1.0 and later.