install

BCSE Reward Points Mod Instructions
Installation Instructions
Note: If you have a custom skin then you will need to apply template changes to the proper skin directory chosen in X-cart Admin. Replace /common_files/ with /<your_skin_directory_name>/ to edit the proper files. If that file doesn't exist in your skin directory then edit the common_files directory file.
Note: You should always make a back-up copy of your files and/or database before installing any modification.
1. Upload the files into their appropriate directories.
2. Apply patch.sql in the Patch/Upgrade page.
3. In include/check_useraccount.php, find this code:
?>
Before, add this code block:
/* BCSE Module Begin - Reward Points */
if(!empty($active_modules['BCSE_Reward_Points'])){
    @include $xcart_dir . '/modules/BCSE_Reward_Points/bcse_get_points.php';
}
/* BCSE Module End - Reward Points  */
4a. In include/func/func.cart.php, in func_calculate_single(), find this code:
    return $return;
Before, add this code block:
	/* BCSE Module Begin - Reward Points */
	if(!empty($active_modules["BCSE_Reward_Points"])){
		@include $xcart_dir."/modules/BCSE_Reward_Points/calculate_single.php";
	}
	/* BCSE Module End - Reward Points  */
4b. In include/func/func.cart.php, in check_payment_methods(), find this code:
    $condition = (
            !empty($giftcerts)
            && 'Y' !== $config['Gift_Certificates']['allow_use_gc_for_buying_gc']
        )
        ? ' AND pm.payment_script != \'payment_giftcert.php\''
        : '';
				
After, add this code block:
	/* BCSE Module Begin - Reward Points */
	if(!empty($active_modules['BCSE_Reward_Points']) && function_exists('bcse_add_points_payment_condition')){
		bcse_add_points_payment_condition($condition);
	}
	/* BCSE Module End - Reward Points  */
		
NOTE: You only need to do step 4c if you're using Xcart PRO
4c. In include/func/func.cart.php, in func_calculate(), find this code:
        if (!empty($cart["giftcerts"])) {
Before, add this code block:
        /* BCSE Module Begin - Reward Points */
        if(!empty($active_modules['BCSE_Reward_Points'])){
            @include $xcart_dir."/modules/BCSE_Reward_Points/bcse_points_pro_calculation.php";
        }
				/* BCSE Module End - Reward Points  */
5a. In include/func/func.order.php, in func_select_order(), find this code:
    $order['discounted_subtotal'] = $order['subtotal'] - $order['discount'] - $order['coupon_discount'];
After, add this code block:
	/* BCSE Module Begin - Reward Points */
	if(!empty($active_modules['BCSE_Reward_Points'])){
		$order["discounted_subtotal"] = price_format($order["discounted_subtotal"] - bcse_get_order_points_discount($order));
	}
	/* BCSE Module End - Reward Points  */
5b. In include/func/func.order.php, in func_select_order(), find this code:
    return $order;
Before, add this code block:
    /* BCSE Module Begin - Reward Points */
    if(!empty($active_modules['BCSE_Reward_Points']) && function_exists('bcse_set_points_order_info')){
        bcse_set_points_order_info($order);
    }
	/* BCSE Module End - Reward Points  */
5c. In include/func/func.order.php, in func_place_order(), find this code:
        // Mail template processing

        $admin_notify = (
            (
                $order_status == 'Q'
                && $config['Email_Note']['enable_order_notif'] == 'Y'
								
Before, add this code block:
        /* BCSE Module Begin - Reward Points */
        if(!empty($active_modules['BCSE_Reward_Points'])){
            @include $xcart_dir . '/modules/BCSE_Reward_Points/bcse_points_system_order.php';
        }
	/* BCSE Module End - Reward Points  */
5d. In include/func/func.order.php, in func_change_order_status(), find this code:
        db_query("update $sql_tbl[orders] set status='$status' where orderid='$orderid'");
After, add this code block:
        /* BCSE Module Begin - Reward Points */
        if(!empty($active_modules['BCSE_Reward_Points'])){
            @include $GLOBALS['xcart_dir'] . '/modules/BCSE_Reward_Points/bcse_points_system_order.php';
        }
        /* BCSE Module End - Reward Points  */
Do this step only if the line <li>Custom Modules doesn't exist
6a. In skin/common_files/single/menu_box.tpl (Xcart Gold) or skin/common_files/admin/menu_box.tpl (Xcart Pro), find this code:
{include file="admin/help.tpl"}
After, add this code block:

<li>Custom Modules
<div>

</div>
</li>
6b. In skin/common_files/single/menu_box.tpl (Xcart Gold) or skin/common_files/admin/menu_box.tpl (Xcart Pro), find this code:
<li>Custom Modules
<div>
After, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/menu_admin.tpl"}
{/if}
{*BCSE Module End - Reward Points mod*}
7a. In skin/common_files/main/order_info.tpl, find this code:
<tr> 
  <td valign="top">{$lng.lbl_payment_method}</td>
  <td valign="top">
  {strip}
    {$order.payment_method}
    {if $active_modules.Klarna_Payments}
      ({include file="modules/Klarna_Payments/klarna_invoice_info.tpl"})
    {/if}
  {/strip}  
  </td>
</tr>
Before, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/order_info_points_used.tpl" order=$order}
{/if}
{*BCSE Module End - Reward Points mod*}
7b. In skin/common_files/main/order_info.tpl, find this code:
<tr>
    <td valign="top">{$lng.lbl_discount}</td>
    <td valign="top">{include file="currency.tpl" value=$order.discount}</td>
</tr>
Before, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/order_info_points_discount.tpl" order=$order}
{/if}
{*BCSE Module End - Reward Points mod*}
8. In skin/common_files/customer/menu_cart.tpl, find this code:
{/capture}
Before, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/minicart_points_details.tpl"}
{/if}
{*BCSE Module End - Reward Points mod*}
9. In skin/common_files/customer/main/cart.tpl, find this code:
{if $cart.coupon_discount eq 0 and $products and $active_modules.Discount_Coupons}
  {include file="modules/Discount_Coupons/add_coupon.tpl"}
{/if}
Before, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/cart_add_points.tpl"}
{/if}
{*BCSE Module End - Reward Points mod*}
10a. In skin/common_files/customer/main/cart_totals.tpl, find this code:
      {if $cart.coupon_discount ne 0 and $cart.coupon_type ne "free_ship"}
Before, add this code block:
      {*BCSE Module Begin - Reward Points mod*}
      {if $active_modules.BCSE_Reward_Points}
        {include file="modules/BCSE_Reward_Points/cart_totals.tpl"}
      {/if}
      {*BCSE Module End - Reward Points mod*}
10b. In skin/common_files/customer/main/cart_totals.tpl, find this code:
    </table>
  </div>

  {if $cart.applied_giftcerts}
Before, add this code block:
      {*BCSE Module Begin - Reward Points mod*}
      {if $active_modules.BCSE_Reward_Points}
        {include file="modules/BCSE_Reward_Points/cart_points.tpl"}
      {/if}
      {*BCSE Module End - Reward Points mod*}
11a. In skin/common_files/customer/main/cart_subtotal.tpl, find this code:
{if $cart.coupon_discount ne 0 and $cart.coupon_type ne "free_ship"}
Before, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/cart_totals.tpl"}
{/if}
{*BCSE Module End - Reward Points mod*}
11b. In skin/common_files/customer/main/cart_subtotal.tpl, find this code:
{if $cart.applied_giftcerts}
    <tr>
      <td class="total-name">{$lng.lbl_giftcert_discount}:</td>
      <td class="total-value">{currency value=$cart.giftcert_discount}</td>
      <td class="total-alt-value">{alter_currency value=$cart.giftcert_discount}</td>
    </tr>
{/if}
After, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/cart_points.tpl"}
{/if}
{*BCSE Module End - Reward Points mod*}
12. In skin/common_files/customer/main/product_details.tpl, find this code:
    {if $product.forsale ne "B"}
      <tr>
        <td colspan="3">{include file="customer/main/product_prices.tpl"}</td>
      </tr>
    {/if}
Before, add this code block:
    {*BCSE Module Begin - Reward Points mod*}
    {if $active_modules.BCSE_Reward_Points}
      {include file="modules/BCSE_Reward_Points/product_points.tpl"}
    {/if}
    {*BCSE Module End - Reward Points mod*}
13. In skin/common_files/customer/main/register.tpl, find this code:
        <table cellspacing="1" class="data-table register-table" summary="{$lng.lbl_register|escape}">
Before, add this code block:
        {*BCSE Module Begin - Reward Points mod*}
        {if $active_modules.BCSE_Reward_Points}
          {include file="modules/BCSE_Reward_Points/user_points_available.tpl"}
        {/if}
        {*BCSE Module End - Reward Points mod*}
14. In skin/common_files/mail/html/order_data.tpl, find this code:
  {if $order.discount gt 0}
Before, add this code block:
  {*BCSE Module Begin - Reward Points mod*}
  {if $active_modules.BCSE_Reward_Points}
    {include file="modules/BCSE_Reward_Points/order_data_points.tpl"}
  {/if}
  {*BCSE Module End - Reward Points mod*}
15. In skin/common_files/mail/html/order_invoice.tpl, find this code:
        {if $order.netbanx_reference}
Before, add this code block:
{*BCSE Module Begin - Reward Points mod*}
{if $active_modules.BCSE_Reward_Points}
{include file="modules/BCSE_Reward_Points/order_invoice_points.tpl"}
{/if}
{*BCSE Module End - Reward Points mod*}
Step 16 is only required if you have CDSEO Pro installed and you want Points to show up on the Product pages
16. In cdseopro.php, find this code:
/********************************************************************************
| Load the requested page
********************************************************************************/
Before, add this code block:
/* BCSE Begin - Reward Points mod */
if(!empty($active_modules['BCSE_Reward_Points'])){
    @include $xcart_dir."/modules/BCSE_Reward_Points/bcse_get_points.php";
}
/* BCSE End */
NOTE: If you're upgrading from a previous version of the mod that doesn't use the 'bcse_points' table, you'll need to apply the following patch to transer the customer points and your settings to this new version:

INSERT INTO `bcse_points` (id, `type`, `userid`, `orderid`, `points`, `notes`, `payment_rate`) SELECT p.`id`, p.`type`, c.`id`, p.`orderid`, p.`points`, p.`notes`, p.`payment_rate` FROM `points` p INNER JOIN `xcart_customers` c ON c.`login` = p.`login`;

INSERT INTO `bcse_points_rate` SELECT * FROM `points_rate`;
INSERT INTO `bcse_points_config` SELECT * FROM `points_config`;
Installation Complete!

Documenation

Find documenation for this module here. Track updates for this module here.