Code:
CREATE TABLE `reward_master` (
`rewards_products_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`scope` INT( 1 ) NOT NULL DEFAULT '0',
`scope_id` INT( 11 ) NOT NULL DEFAULT '0',
`point_ratio` DOUBLE( 15, 4 ) NOT NULL DEFAULT '1',
`bonus_points` DOUBLE( 15, 4 ) NULL,
`redeem_ratio` DOUBLE( 15, 4 ) NULL,
`redeem_points` DOUBLE( 15, 4 ) NULL,
UNIQUE `unique_id` ( `scope` , `scope_id` ));
INSERT INTO `reward_master` (`rewards_products_id` ,`scope` ,`scope_id` ,`point_ratio` ,`bonus_points`, `redeem_ratio`, `redeem_points`) VALUES (NULL , '0', '0', '1.0000', NULL, 0.01, NULL);
CREATE TABLE `reward_customer_points` (
`customers_id` INT( 11 ) NOT NULL PRIMARY KEY,
`reward_points` DOUBLE( 15, 4 ) NOT NULL DEFAULT '0',
`pending_points` DOUBLE( 15, 4 ) NOT NULL DEFAULT '0');
CREATE TABLE `reward_status_track` (
`rewards_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`customers_id` INT( 11 ) NOT NULL ,
`orders_id` INT( 11 ) NOT NULL ,
`date` DATETIME NOT NULL ,
`reward_points` DOUBLE( 15, 4 ) NOT NULL ,
`status` TINYINT( 1 ) NOT NULL,
UNIQUE (`orders_id`));
REPLACE INTO `configuration_group` (`configuration_group_id` ,`configuration_group_title` ,`configuration_group_description` ,`sort_order` ,`visible`) VALUES (NULL , 'Reward Points', 'Reward Point Module Configuration', '50' , '1');
SET @group_id = '';
SELECT (@group_id := `configuration_group_id`) FROM `configuration_group` WHERE `configuration_group_title` LIKE 'Reward Points';
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Mode', 'REWARD_POINT_MODE', '0', 'Select the Reward Point Mode<br />0= Reward Points are fixed to the product prices and are calculated individually.<br />1= Reward Points are calculated on the Order Total or Subtotal (depending on the setting of the <strong>Allow Redeem of Reward Points on Order Total or Subtotal</strong> configuration).', @group_id, '0', NULL, now(), NULL , 'zen_cfg_select_option(array(''0'', ''1''), ');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Sidebox Display', 'SHOW_REWARD_POINTS_BOX_OPTION', '0', 'Display Reward Points Sidebox<br />0= Always<br />1= Only when logged in<br />2= Only when logged in and has points', @group_id, '1', NULL, now(), NULL , 'zen_cfg_select_option(array(''0'', ''1'', ''2''), ');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Status Track', 'REWARD_POINTS_STATUS_TRACK', '', '<b>Simple mode:</b> All new reward points are set to Pending and are changed to Earned when the Order Status changes. If the Order Status is then changed back to Pending then the reward points are transfered back from Earned.<br /><br /><b>Advanced mode:</b> Set the order status items that will trigger a transfer of the reward points between pending and earned. Points are transfered when the status changes between the "Pending" and "Earned". Status items set to "Ignore" will have no effect if the Order Status changes to it.', @group_id, '2', NULL, now(), 'UseRewardPointStateFunction' , 'SetRewardPointStateFunction(');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Sunrise Period', 'REWARD_POINTS_SUNRISE_PERIOD', '0', 'The number of days after which points pending become points earned. Set to 0 for no sunrise period.', @group_id, '3', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Redeem Minimum', 'REWARD_POINTS_REDEEM_MINIMUM', '0', 'This is the minimum amount of earned points needed before they can be redeemed.', @group_id, '3', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Redeem Maximum', 'REWARD_POINTS_REDEEM_MAXIMUM', '0', 'This is the maximum amount of earned points that can be redeemed against a single order.<br /><i>Note: this can be a absolute value (eg 1000) or a percentage (20%).</i>', @group_id, '4', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Reward Point Rounding', 'REWARD_POINTS_ROUNDING', '0.5', 'Rounding value- This is added to each products price before it is rounded down to 0 decimal places to calculate product Reward Points (default 0.5)', @group_id, '5', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Max Transactions to Display in Customer Admin', 'REWARD_POINTS_MAX_TRANSACTIONS', '12', 'Select the maximum number of records to show on the Pending Reward Points table in Customer Reward Point admininstration.', @group_id, '6', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Delete Old Reward Transactions Period', 'REWARD_POINTS_HOUSEKEEPING', '90', 'Set the age (in days) to keep the reward point transactions. Outstanding reward points pending after this period will be lost. Set to 0 to keep all transactions.', @group_id, '7', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Adjust Reward Points for Sales/Specials', 'REWARD_POINTS_SPECIAL_ADJUST', '0', 'How to calculate Reward Points<br />0= Always use the base price.<br />1= Use price less Discounts and Specials.', @group_id, '7', NULL, now(), NULL , 'zen_cfg_select_option(array(''0'', ''1''), ');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Allow Reward Points on Free Products', 'REWARD_POINTS_ALLOW_ON_FREE', '0', 'Set how points are rewarded for free products.<br />0= Free products give 0 Reward Points.<br />1= Allow Reward Points on free products.', @group_id, '8', NULL, now(), NULL , 'zen_cfg_select_option(array(''0'', ''1''), ');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Allow Redeem of Reward Points on Order Total or Subtotal', 'REWARD_POINTS_ALLOW_TOTAL', '0', 'Allow points to be redeemed against the full order (including shipping) or only against the subtotal.<br />0= Against the subtotal.<br />1= Against the full order.', @group_id, '9', NULL, now(), NULL , 'zen_cfg_select_option(array(''0'', ''1''), ');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Set Minimum Order Value to Redeem Points Against', 'REWARD_POINTS_MINIMUM_VALUE', '0', 'Set the minimum value that the order should be in order for it to qualify for reward point redeem.', @group_id, '10', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Limit Maximum Customers on Listings', 'REWARD_POINTS_CUSTOMER_LIMIT', '50', 'Set the maximum number of records to appear on each page under Customer Reward Point admininstration page.', @group_id, '11', NULL, now(), NULL , NULL);
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Display Products Reward Points When Zero', 'REWARD_POINTS_ALWAYS_DISPLAY', '1', 'Set whether a products reward points are displayed when zero.<br />0= Don\'t display 0 Reward Points.<br />1= Always display reward points even when zero.', @group_id, '12', NULL, now(), NULL , 'zen_cfg_select_option(array(''0'', ''1''), ');
REPLACE INTO `configuration` (`configuration_id` ,`configuration_title` ,`configuration_key` ,`configuration_value` ,`configuration_description` ,`configuration_group_id` ,`sort_order` ,`last_modified` ,`date_added` ,`use_function` ,`set_function`) VALUES (NULL , 'Set New Account Reward Points', 'REWARD_POINTS_NEW_ACCOUNT_REWARD', '0', 'Set the amount of points awarded to a customer when an account is created. The points can either be added to \'Earned\' which will allow the customer to redeem the points straight away; Or the points can be added to \'Pending\' in which case the customer will receive the points after their first successful order.', @group_id, '13', NULL, now(), 'UseRewardPointNewAccountAwardFunction' , 'SetRewardPointNewAccountAwardFunction(');
i did a test again, i created 5 new accounts myself, then i got the points earned for each account. but when the customers creat the accounts, still some got points earned, some got nothing.
Bookmarks