Buy X Number Items Get 1 Free
Copyright © 1999, William Weiland
Overview
The Buy X Items - Get 1 Free module gives the shopper a discount based on a predetermined qualifying number of items. In the admin module, the store owner sets the number of items it requires in order for the lowest priced item to be free.
Initial Setup
You will install two modules (get1free.mvc and cim_log.mvc).

Install get1free.mvc
1) In admin, click Add Modules link (fig 2)
2) Click the file upload button
3) Browse to find the get1free.mvc file on your hard drive and upload (fig 3)
4) Click Add to add it to the domain
5) Then in admin click on the plus to the left of Stores
6) Click the plus to the left of your store name
7) Click on the word Utilities under your store (fig 9)
8) Check the box next to the Buy X Number of Items Get 1 Free
9) Click Update
10) Click on System Extension Configuration link
11) Check the box next to the Buy X Number of Items Get 1 Free
12) Click Update
13) Click Pages link to get to the User Interface (fig 4)
14) Click Items link at the top of the User Interface page (fig 5)
15) Click the Add Item button (fig 6)
16) Enter get1free for the code
17) Look up and scroll to the last page of items and Buy X Number of Items Get 1 Free should be at the end of the list of items
18) Select Buy X Number of Items Get 1 Free
19) Click the Add button to assign the module
20) The CIM Activity Log (cim_log.mvc) may already be in your store as it is used by many of our modules. Check under the Modules link to see if it is already there. If it is there, skip to 29. If not, then go to 21.

Install cim_log.mvc
21) Again, click Add Modules link
22) Click the file upload button
23) Browse to find the cim_log.mvc file on your hard drive and upload
24) Click Add to add it to the domain
25) Click on the Logging Configuration Link
26) Check the box next to the CIM Activity Log
27) Click Update
28) Skip to 31

Update cim_log.mvc
29) Click Modules link
30) Scroll down to CIM Activity Log and click the link
31) Click the file upload button
32) Browse to find the cim_log.mvc file on your hard drive and upload
33) Click Update to update the module

Configure the module
34) Return to the Utilities Configuration screen (fig 9) and click the link for Buy X Number of Items Get 1 Free to enter the configuration settings

Configuration Setting
Enter data into the applicable input field.

Quantity
For every increment of the number entered, an item's value reduces the total sale. For example, if the number is 5 and the customer buys 5, the lowest priced item is free. If the customer buys 10, the lowest priced two items are free.

If you run a special and then end the special for awhile, do not unassign the module. Rather up the quantity to a number that would not likely be ordered. That way the validation check will still occur and any residual baskets will not qualify with the new setting.

You can change the percent off the lowest priced item from 100% to a lower percentage if you don't want the item to be totally free.


Editing Requirements
The module is called within specific template screens with render tokens. They are in the format of
<mvt:item name="itemcode" param="xxxx" />
The templates are listed at the Pages link. You will edit the template by inserting the token and clicking the Update (fig 7). Important: After adding the render token to a template page, you must click the Items link for that page, scroll down to the item name and assign it to the page (fig 8). These two steps are repeated for every page that a module's render token is used on.
This module has one token available
<mvt:item name="get1free" param="basket_message" />
It is placed on the 'bask' page template. Click on that page edit. Then at the top of the page you will see a link for Basket Contents. Click that link and scroll down the template to a point just before the basket:charge display. This will put it in a location that is clearly visible to the customer when they view the basket. It displays a message that one more and they will get the free item (or whatever verbage you use for your message). Below is the code to enter. I have included the existing first line of the basket:charge loop so that you can easily find the recommended insertion point for this token.
<tr>
<td colspan="6" align="center">
<font color="#ff0000">
<mvt:item name="get1free" param="basket_message" />
</font>
</td>
</tr>

<mvt:foreach iterator="charge" array="basket:charges">


Fig 1: Main admin screen

Fig 2: Add a new module

Fig 3: Upload the module to the server

Fig 4: Template page selection

Fig 5: Items list

Fig 6: Add a new item

Fig 7: Editing a template page

Fig 8: Assign a page item to the template

Fig 9: Assigning a module to the store