$sql = 'SELECT AffiliateCommission, (SubTotal+ShippingCost+VAT) AS TotalAmount, OrderId FROM '.$order->TableName.' WHERE OrderDate >= %s AND OrderDate <= %s';
$amount_to_pay_before = 0;
$amount_to_pay_after = 0;
$order_update_sql = 'UPDATE '.$order->TableName.' SET AffiliateCommission = %s WHERE '.$order->IDField.' = %s';
-INSERT INTO ConfigurationAdmin VALUES ('Comm_Country', 'la_Text_StoreAddress', 'la_Country', 'select', NULL, '0=lu_none,<SQL>SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM <PREFIX>StdDestinations WHERE DestParentId IS NULL Order BY OptionName</SQL>', 20.05, 0, 1);
-INSERT INTO ConfigurationAdmin VALUES ('Comm_Shipping_Country', 'la_Text_ShippingAddress', 'la_Country', 'select', NULL, '0=lu_none,<SQL>SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM <PREFIX>StdDestinations WHERE DestParentId IS NULL Order BY OptionName</SQL>', 30.05, 0, 1);
-INSERT INTO ConfigurationAdmin VALUES ('product_OrderProductsBy', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, '=la_none,Name=la_fld_Title,SKU=la_fld_SKU,Manufacturer=la_fld_Manufacturer,Price=la_fld_Price,CreatedOn=la_fld_CreatedOn,Modified=la_fld_Modified,Qty=la_fld_Qty,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 11) AND (IsSystem = 0)</SQL>', 10.01, 1, 1);
-INSERT INTO ConfigurationAdmin VALUES ('product_OrderProductsThenBy', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, '=la_none,Name=la_fld_Title,SKU=la_fld_SKU,Manufacturer=la_fld_Manufacturer,Price=la_fld_Price,CreatedOn=la_fld_CreatedOn,Modified=la_fld_Modified,Qty=la_fld_Qty,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 11) AND (IsSystem = 0)</SQL>', 10.02, 1, 1);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_Country', 'select', NULL, '0=lu_none,<SQL>SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM <PREFIX>StdDestinations WHERE DestParentId IS NULL Order BY OptionName</SQL>', 20.05, 0, 1);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_Country', 'select', NULL, '0=lu_none,<SQL>SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM <PREFIX>StdDestinations WHERE DestParentId IS NULL Order BY OptionName</SQL>', 30.05, 0, 1);
INSERT INTO PaymentTypes VALUES (1, 'Credit Card (manual)', 'Credit Card', 'Please enter your credit card details.', NULL, 1, 0, 1, 1, 3, DEFAULT, DEFAULT, ',15,');
INSERT INTO PaymentTypes VALUES (4, 'PayPal', 'PayPal', 'You will be redirected to PayPal site to make the payment after confirming your order on the next checkout step.', NULL, 0, 0, 0, 1, 4, DEFAULT, DEFAULT, ',15,');
INSERT INTO PaymentTypes VALUES (2, 'Check/MO', 'Check or Money Order', NULL, NULL, 0, 0, 0, 1, 1, 1, DEFAULT, ',15,');
INSERT INTO PaymentTypes VALUES (3, 'Authorize.Net', 'Credit Card', 'Please enter your Credit Card details below. Your credit card will not be charged until you confirm your purchase on the next(last) step of checkout process.', NULL, 0, 0, 0, 1, 2, DEFAULT, DEFAULT, ',15,');
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 4, 131);
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 2, 131);
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 3, 131);
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 1, 131);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.RATE', 'lu_PermName_Product.Rate_desc', 'lu_PermName_Product.Rate_error', 'In-Commerce');
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.REVIEW', 'lu_PermName_Product.Review_desc', 'lu_PermName_Product.Review_error', 'In-Commerce');
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.REVIEW.PENDING', 'lu_PermName_Product.Review_Pending_desc', ' lu_PermName_Product.Review_Pending_error', 'In-Commerce');
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.ADD', 'lu_PermName_Product.Add_desc', 'lu_PermName_Product.Add_error', 'In-Commerce');
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.DELETE', 'lu_PermName_Product.Delete_desc', 'lu_PermName_Product.Delete_error', 'In-Commerce');
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.MODIFY', 'lu_PermName_Product.Modify_desc', 'lu_PermName_Product.Modify_desc', 'In-Commerce');
INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.VIEW', 'lu_PermName_Product.View_desc', 'lu_PermName_Product.View_error', 'In-Commerce');
INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 14, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 14, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.RATE', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.REVIEW', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.REVIEW.PENDING', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 12, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 12, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.ADD', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.DELETE', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.MODIFY', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:products.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:setting_folder.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:deny', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:archive', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:place', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:process', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:ship', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:reset_to_pending', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:move_up', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:move_down', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:update_rate', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:move_up', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:move_down', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:general.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:general.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:output.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:output.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:search.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:search.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:incommerce_configemail.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:incommerce_configemail.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:contacts.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:contacts.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:paymentlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:downloadlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:downloadlog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:reports.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:reports.add', 11, 1, 1, 0);
INSERT INTO StylesheetSelectors VALUES (162, 1, 'Calendar''s top and bottom titles', '.calendar .title', 'a:0:{}', '', 1, 'color: #00309C;\r\nbackground-color: #98CEE4;\r\nborder: 1px solid #83B2C5;\r\nborder-top: 0px;\r\npadding: 1px;', 0);
INSERT INTO StylesheetSelectors VALUES (163, 1, 'Calendar''s control buttons', '.calendar .calendar_button', 'a:0:{}', '', 1, 'color: black;\r\nfont-size: 12px;\r\nbackground-color: #eeeeee;', 0);
INSERT INTO StylesheetSelectors VALUES (30, 1, 'Block without a border', '.block-no-border', 'a:2:{s:6:"border";s:4:"none";s:13:"margin-bottom";s:4:"10px";}', 'Block without a border', 1, '', 0);