Blacklists and Order Limits

Blacklist

Overview

Blacklist is used to deny orders on an eCommerce site by date set in the DXP. Blacklist will only filter orders made for retailers, via the merchant id. This is useful for sites where they are closed on certain days or cannot process stock during a certain period. During checkout the user will be shown a calendar to select shipping date in customer details, this date is then compared to the blacklist and order limit (below). If the check fails, an error is shown to the user and they are asked to select another date.

Blacklist requires minimal templates changes, as it already functions on the customer details page.

Setup

In order to setup the blacklist, go to:

Transactions → Commerce → Configure → Manage Blacklist

you will be shown this screen:
 

At this point we do not have dates setup. The 'All' retailer are the default dates which are applied to every retailer with no settings configured. All allows you to configure every retailer easily and quickly.

To set some dates for a retailer, click the drop down and select a retailer.

Once you select a retailer, the calendar will populate with the blacklisted dates. An enable switch will appear, so you can easily switch off the Blacklist without effecting the dates if you need.

To Blacklist a new date, click the date and you will see that it turns black. The black dates indicate blacklisted, green are blacklist free.

It is not saved at this point, click update to save. As soon as you save it, it will take effect.

Clear Selected will remove all dates, which still requires a save to take effect.

The box with the arrow beside the retailer drop down will refresh the current screen. This is used as 'Order Limit' days which have met their criteria (or are set to zero) will also be displayed here as blacked out dates.

This may result in some days repopulating as blacklisted after you remove them from the blacklist. 

Template Changes

on

sitedir/modules/prodcatalogueorder/templates/customer_details.html

the only required field to pass is the merchant id. Without the merchant id the blacklist check will be skipped and not counted.

<input type="hidden" name="merchant_id" value="*yourMerchantId*" />


Any Blacklist errors will be returned as part of the normal customer details error log. 

Order limit

Overview

Order Limits work much like the Blacklist, except that we count the orders made for that retailers on a given date and compare against the limit specified. Once the limit is met, or exceed, the date is blacklisted. These Limits can be changed per date and can be updated at any time.

Setup

In order to setup Order Limits, go to:

Transactions → Commerce → Configure → Manage Order Limit

you will be shown this screen:

Like Blacklists, Order Limits are per retailer with an 'All' setting. The 'All' setting defines the defaults used by all Retailers if they have no dates configured. 

To add a Limit, click the Add icon and you will see two text field's appear. 

In the above example, we have the date set to the 9th of May, with a limit of 29 orders. After this limit users will get a warning on checkout asking to select a different date, when they select this date.

You can add multiple dates using the Add button. To remove a date click the minus icon. 

You must save any updates for changes to take effect.

Template Changes

The template changes required as the same as blacklist.

Getting the Dates For Blacklist and Order Limit

On customer details, on page load you must pass the merchant id. Once you do this the 'blacklistDates' variable will be set, which looks like this:

array (size=5)
 'blacklist' =>
 array (size=4)
 0 => string '2017-06-21' (length=10)
 1 => string '2017-06-22' (length=10)
 2 => string '2017-06-23' (length=10)
 'orderLimit' =>
 array (size=1)
 0 => string '2017-06-01' (length=10)
 'allDates' =>
 array (size=1)
 0 => string '2017-06-01' (length=10)
 'blacklist_enabled' => boolean false
 'orderlist_enabled' => boolean true

This is what you get assigned into customer details for blacklist and order limit. 

'allDates' is what you care about, as it contains the dates which will effect you. The blacklist_enable and orderlist_enable tells you the state of each blacklist and order limit per retailer.

This function will get the dates even if they are not enabled, but it will only filter allDates.

In the above example, blacklist is disabled, order limit is enabled but only the orderlimit date is in allDates.

Ship to School (staples)

In order to setup ship to school, you must create a custom field for the retailers first. This will allow them to change the option of shipping to school.

Go to admin_customfield, click configure → add new category. → add new cateogry

name the category school_shipping (this is vert important, it is how we find the value)

Now add a custom field, call it 'Allow Ship to School', set the category to ship to school, set the module to Retail. Type of checkbox. Set Options and Default Value to 1:

 

After this each Retailer should have ship to school configured. 

You must enable Ship to School to allow customers to select the school address on checkout.

On customer details, these variables are assigned:

even if ship to school is not enabled, the school data will be assinged into the template. Use the $showSchoolAddress var to determine the status.

staples branch: TECH-3076-dev-for-staples-2