+INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Comm_Contacts_Name', '', 'In-Commerce', 'in-commerce:contacts');
+
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.04 WHERE VariableName = 'Comm_Contacts_Phone';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.05 WHERE VariableName = 'Comm_Contacts_Fax';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.06 WHERE VariableName = 'Comm_Contacts_Email';
+UPDATE ConfigurationAdmin SET DisplayOrder = 10.07 WHERE VariableName = 'Comm_Contacts_Additional';
+
+DELETE FROM Phrase WHERE Phrase IN ('la_fld_ManufacturerId', 'la_fld_DiscountId', 'la_fld_CouponId', 'la_fld_AffiliatePlanId', 'la_fld_AffiliateId', 'la_fld_ZoneId', 'la_fld_EngineId', 'la_fld_ShippingId', 'la_fld_ProductId', 'la_fld_OptionId', 'la_fld_CurrencyId', 'la_fld_Zone_Name');
+
+UPDATE Phrase SET Module = 'In-Commerce' WHERE ((Phrase LIKE '%Product%' OR Phrase LIKE '%Shipping%' OR Phrase LIKE '%Coupon%' OR Phrase LIKE '%Discount%' OR Phrase LIKE '%Report%' OR Phrase LIKE '%Currency%' OR Phrase LIKE '%Cart%') AND (Module = 'Core'));
+
+# ===== v 5.0.1 =====
+UPDATE ConfigurationValues SET VariableValue = 'in-commerce/products/product_detail' WHERE VariableName = 'p_ItemTemplate';
+
+UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_Session,2=la_opt_PermanentCookie' WHERE VariableName = 'Comm_AffiliateStorageMethod';
+
+UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
+WHERE VariableName IN ('product_OrderProductsByDir', 'product_OrderProductsThenByDir');
+
+UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_PriceCalculationByPrimary,2=la_opt_PriceCalculationByOptimal'
+UPDATE Modules SET Path = 'modules/in-commerce/' WHERE `Name` = 'In-Commerce';
+
+UPDATE ConfigurationValues
+SET ValueList = '0=lu_none||<SQL+>SELECT l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>'
+WHERE ValueList = '0=lu_none||<SQL>SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM <PREFIX>StdDestinations WHERE DestParentId IS NULL Order BY OptionName</SQL>';
+
+ALTER TABLE SiteDomains
+ ADD COLUMN BillingCountry varchar(3) NOT NULL DEFAULT '',
+ ADD COLUMN ShippingCountry varchar(3) NOT NULL DEFAULT '',
+ ADD COLUMN PrimaryCurrencyId int(11) NOT NULL DEFAULT '0',
+ ADD COLUMN Currencies varchar(255) NOT NULL DEFAULT '',
+ ADD COLUMN PrimaryPaymentTypeId int(11) NOT NULL DEFAULT '0',
+ ADD COLUMN PaymentTypes varchar(255) NOT NULL DEFAULT '',
+ ADD INDEX (BillingCountry),
+ ADD INDEX (ShippingCountry),
+ ADD INDEX (PrimaryCurrencyId),
+ ADD INDEX (Currencies),
+ ADD INDEX (PrimaryPaymentTypeId),
+ ADD INDEX (PaymentTypes);
+
+UPDATE Phrase SET Module = 'Core' WHERE Phrase IN ('la_btn_Add', 'la_fld_RecipientName', 'la_fld_SenderName');
+DELETE FROM Permissions WHERE Permission LIKE 'in-commerce:incommerce_configemail%';
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_Country', 'select', NULL, '0=lu_none||<SQL+>SELECT l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>', 20.05, 0, 1, NULL);
+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 l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>', 30.05, 0, 1, NULL);
+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', 'la_PermName_Product.Rate_desc', 'la_PermName_Product.Rate_error', 'In-Commerce');
+INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.REVIEW', 'la_PermName_Product.Review_desc', 'la_PermName_Product.Review_error', 'In-Commerce');
+INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.REVIEW.PENDING', 'la_PermName_Product.Review_Pending_desc', ' la_PermName_Product.Review_Pending_error', 'In-Commerce');
+INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.ADD', 'la_PermName_Product.Add_desc', 'la_PermName_Product.Add_error', 'In-Commerce');
+INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.DELETE', 'la_PermName_Product.Delete_desc', 'la_PermName_Product.Delete_error', 'In-Commerce');
+INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.MODIFY', 'la_PermName_Product.Modify_desc', 'la_PermName_Product.Modify_desc', 'In-Commerce');
+INSERT INTO PermissionConfig VALUES (DEFAULT, 'PRODUCT.VIEW', 'la_PermName_Product.View_desc', 'la_PermName_Product.View_error', 'In-Commerce');
+
+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, 'FAVORITES', 13, 1, 0, {ProductCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 13, 1, 0, {ProductCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 12, 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: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);
+ $has_required = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$opt_object->TableName.' WHERE Required = 1 AND ProductId = '.$object->GetDBField('ProductId'));
+ //we need to imitate data sumbit, as parent' PreSave sets object values from $items_info
+ $total_weight = $this->Conn->GetOne('SELECT SUM(Weight) FROM '.TABLE_PREFIX.'Products WHERE ProductId IN ('.implode(', ', $content_ids).') AND Type=1');
+
+ if (!$total_weight) $total_weight = 0;
+
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET Weight='.$total_weight.' WHERE ProductId='.$object->GetID());
+* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
+* @license Commercial License
+* This software is protected by copyright law and international treaties.
+* Unauthorized reproduction or unlicensed usage of the code of this program,
+* or any portion of it may result in severe civil and criminal penalties,
+* and will be prosecuted to the maximum extent possible under the law
+* See http://www.in-portal.org/commercial-license for copyright notices and details.
+*/
+
+defined('FULL_PATH') or die('restricted access!');
+
+define('MODULE_SHIPPING_USPS_TEXT_TITLE', 'United States Postal Service');
+define('MODULE_SHIPPING_USPS_TEXT_DESCRIPTION', 'You will need to have registered an account with USPS. Click <a target="_blank" href="https://secure.shippingapis.com/registration/"><strong>HERE</strong></a> for registration details. USPS expects you to use pounds as weight measure for your products.');
+define('MODULE_SHIPPING_USPS_TEXT_ERROR', 'An error occured with the USPS shipping calculations.<br>If you prefer to use USPS as your shipping method, please contact the store owner.');
+define('MODULE_SHIPPING_USPS_STATUS', 'True'); // Do you want to offer USPS shipping?
+define('MODULE_SHIPPING_USPS_SERVER', 'production'); // An account at USPS is needed to use the Production server // production othervise value may be 'test'
+define('MODULE_SHIPPING_USPS_HANDLING', '0'); // Handling fee for this shipping method
+define('MODULE_SHIPPING_USPS_TAX_CLASS', '0'); // Use the following tax class on the shipping fee
+define('MODULE_SHIPPING_USPS_ZONE', '0'); // If a zone is selected, only enable this shipping method for that zone.
+define('MODULE_SHIPPING_USPS_SORT_ORDER', '0'); // Sort order of display.
+define('MODULE_SHIPPING_USPS_TYPES', 'PRIORITY, PARCEL'); // EXPRESS, FIRST CLASS, BMP, MEDIA 'Select the domestic services to be offered:
+define('MODULE_SHIPPING_USPS_TYPES_INTL', 'EXPRESS MAIL INTERNATIONAL (EMS), EXPRESS MAIL INT, EXPRESS MAIL INT FLAT RATE ENV, PRIORITY MAIL INT, PRIORITY MAIL INT FLAT RATE ENV, PRIORITY MAILINT FLAT RATE BOX, FIRST-CLASS MAIL INT');// 'GLOBAL EXPRESS, GLOBAL EXPRESS NON-DOC RECT, GLOBAL EXPRESS NON-DOC NON-RECT, Select the international services to be offered:
+ // Note by Erik: DO NOT CHANGE THIS ARRAY. It's values are sent to USPS service and any changes may impact class main functionality.
+ $this->countries = array(
+ 'AF' => 'Afghanistan',
+ 'AL' => 'Albania',
+ 'DZ' => 'Algeria',
+ 'AD' => 'Andorra',
+ 'AO' => 'Angola',
+ 'AI' => 'Anguilla',
+ 'AG' => 'Antigua and Barbuda',
+ 'AR' => 'Argentina',
+ 'AM' => 'Armenia',
+ 'AW' => 'Aruba',
+ 'AU' => 'Australia',
+ 'AT' => 'Austria',
+ 'AZ' => 'Azerbaijan',
+ 'BS' => 'Bahamas',
+ 'BH' => 'Bahrain',
+ 'BD' => 'Bangladesh',
+ 'BB' => 'Barbados',
+ 'BY' => 'Belarus',
+ 'BE' => 'Belgium',
+ 'BZ' => 'Belize',
+ 'BJ' => 'Benin',
+ 'BM' => 'Bermuda',
+ 'BT' => 'Bhutan',
+ 'BO' => 'Bolivia',
+ 'BA' => 'Bosnia-Herzegovina',
+ 'BW' => 'Botswana',
+ 'BR' => 'Brazil',
+ 'VG' => 'British Virgin Islands',
+ 'BN' => 'Brunei Darussalam',
+ 'BG' => 'Bulgaria',
+ 'BF' => 'Burkina Faso',
+ 'MM' => 'Burma',
+ 'BI' => 'Burundi',
+ 'KH' => 'Cambodia',
+ 'CM' => 'Cameroon',
+ 'CA' => 'Canada',
+ 'CV' => 'Cape Verde',
+ 'KY' => 'Cayman Islands',
+ 'CF' => 'Central African Republic',
+ 'TD' => 'Chad',
+ 'CL' => 'Chile',
+ 'CN' => 'China',
+ 'CX' => 'Christmas Island (Australia)',
+ 'CC' => 'Cocos Island (Australia)',
+ 'CO' => 'Colombia',
+ 'KM' => 'Comoros',
+ 'CG' => 'Congo (Brazzaville),Republic of the',
+ 'ZR' => 'Congo, Democratic Republic of the',
+ 'CK' => 'Cook Islands (New Zealand)',
+ 'CR' => 'Costa Rica',
+ 'CI' => 'Cote d\'Ivoire (Ivory Coast)',
+ 'HR' => 'Croatia',
+ 'CU' => 'Cuba',
+ 'CY' => 'Cyprus',
+ 'CZ' => 'Czech Republic',
+ 'DK' => 'Denmark',
+ 'DJ' => 'Djibouti',
+ 'DM' => 'Dominica',
+ 'DO' => 'Dominican Republic',
+ 'TP' => 'East Timor (Indonesia)',
+ 'EC' => 'Ecuador',
+ 'EG' => 'Egypt',
+ 'SV' => 'El Salvador',
+ 'GQ' => 'Equatorial Guinea',
+ 'ER' => 'Eritrea',
+ 'EE' => 'Estonia',
+ 'ET' => 'Ethiopia',
+ 'FK' => 'Falkland Islands',
+ 'FO' => 'Faroe Islands',
+ 'FJ' => 'Fiji',
+ 'FI' => 'Finland',
+ 'FR' => 'France',
+ 'GF' => 'French Guiana',
+ 'PF' => 'French Polynesia',
+ 'GA' => 'Gabon',
+ 'GM' => 'Gambia',
+ 'GE' => 'Georgia, Republic of',
+ 'DE' => 'Germany',
+ 'GH' => 'Ghana',
+ 'GI' => 'Gibraltar',
+ 'GB' => 'Great Britain and Northern Ireland',
+ 'GR' => 'Greece',
+ 'GL' => 'Greenland',
+ 'GD' => 'Grenada',
+ 'GP' => 'Guadeloupe',
+ 'GT' => 'Guatemala',
+ 'GN' => 'Guinea',
+ 'GW' => 'Guinea-Bissau',
+ 'GY' => 'Guyana',
+ 'HT' => 'Haiti',
+ 'HN' => 'Honduras',
+ 'HK' => 'Hong Kong',
+ 'HU' => 'Hungary',
+ 'IS' => 'Iceland',
+ 'IN' => 'India',
+ 'ID' => 'Indonesia',
+ 'IR' => 'Iran',
+ 'IQ' => 'Iraq',
+ 'IE' => 'Ireland',
+ 'IL' => 'Israel',
+ 'IT' => 'Italy',
+ 'JM' => 'Jamaica',
+ 'JP' => 'Japan',
+ 'JO' => 'Jordan',
+ 'KZ' => 'Kazakhstan',
+ 'KE' => 'Kenya',
+ 'KI' => 'Kiribati',
+ 'KW' => 'Kuwait',
+ 'KG' => 'Kyrgyzstan',
+ 'LA' => 'Laos',
+ 'LV' => 'Latvia',
+ 'LB' => 'Lebanon',
+ 'LS' => 'Lesotho',
+ 'LR' => 'Liberia',
+ 'LY' => 'Libya',
+ 'LI' => 'Liechtenstein',
+ 'LT' => 'Lithuania',
+ 'LU' => 'Luxembourg',
+ 'MO' => 'Macao',
+ 'MK' => 'Macedonia, Republic of',
+ 'MG' => 'Madagascar',
+ 'MW' => 'Malawi',
+ 'MY' => 'Malaysia',
+ 'MV' => 'Maldives',
+ 'ML' => 'Mali',
+ 'MT' => 'Malta',
+ 'MQ' => 'Martinique',
+ 'MR' => 'Mauritania',
+ 'MU' => 'Mauritius',
+ 'YT' => 'Mayotte (France)',
+ 'MX' => 'Mexico',
+ 'MD' => 'Moldova',
+ 'MC' => 'Monaco (France)',
+ 'MN' => 'Mongolia',
+ 'MS' => 'Montserrat',
+ 'MA' => 'Morocco',
+ 'MZ' => 'Mozambique',
+ 'NA' => 'Namibia',
+ 'NR' => 'Nauru',
+ 'NP' => 'Nepal',
+ 'NL' => 'Netherlands',
+ 'AN' => 'Netherlands Antilles',
+ 'NC' => 'New Caledonia',
+ 'NZ' => 'New Zealand',
+ 'NI' => 'Nicaragua',
+ 'NE' => 'Niger',
+ 'NG' => 'Nigeria',
+ 'KP' => 'North Korea (Korea, Democratic People\'s Republic of)',
+ 'NO' => 'Norway',
+ 'OM' => 'Oman',
+ 'PK' => 'Pakistan',
+ 'PA' => 'Panama',
+ 'PG' => 'Papua New Guinea',
+ 'PY' => 'Paraguay',
+ 'PE' => 'Peru',
+ 'PH' => 'Philippines',
+ 'PN' => 'Pitcairn Island',
+ 'PL' => 'Poland',
+ 'PT' => 'Portugal',
+ 'QA' => 'Qatar',
+ 'RE' => 'Reunion',
+ 'RO' => 'Romania',
+ 'RU' => 'Russia',
+ 'RW' => 'Rwanda',
+ 'SH' => 'Saint Helena',
+ 'KN' => 'Saint Kitts (St. Christopher and Nevis)',
+ 'LC' => 'Saint Lucia',
+ 'PM' => 'Saint Pierre and Miquelon',
+ 'VC' => 'Saint Vincent and the Grenadines',
+ 'SM' => 'San Marino',
+ 'ST' => 'Sao Tome and Principe',
+ 'SA' => 'Saudi Arabia',
+ 'SN' => 'Senegal',
+ 'YU' => 'Serbia-Montenegro',
+ 'SC' => 'Seychelles',
+ 'SL' => 'Sierra Leone',
+ 'SG' => 'Singapore',
+ 'SK' => 'Slovak Republic',
+ 'SI' => 'Slovenia',
+ 'SB' => 'Solomon Islands',
+ 'SO' => 'Somalia',
+ 'ZA' => 'South Africa',
+ 'GS' => 'South Georgia (Falkland Islands)',
+ 'KR' => 'South Korea (Korea, Republic of)',
+ 'ES' => 'Spain',
+ 'LK' => 'Sri Lanka',
+ 'SD' => 'Sudan',
+ 'SR' => 'Suriname',
+ 'SZ' => 'Swaziland',
+ 'SE' => 'Sweden',
+ 'CH' => 'Switzerland',
+ 'SY' => 'Syrian Arab Republic',
+ 'TW' => 'Taiwan',
+ 'TJ' => 'Tajikistan',
+ 'TZ' => 'Tanzania',
+ 'TH' => 'Thailand',
+ 'TG' => 'Togo',
+ 'TK' => 'Tokelau (Union) Group (Western Samoa)',
+ 'TO' => 'Tonga',
+ 'TT' => 'Trinidad and Tobago',
+ 'TN' => 'Tunisia',
+ 'TR' => 'Turkey',
+ 'TM' => 'Turkmenistan',
+ 'TC' => 'Turks and Caicos Islands',
+ 'TV' => 'Tuvalu',
+ 'UG' => 'Uganda',
+ 'UA' => 'Ukraine',
+ 'AE' => 'United Arab Emirates',
+ 'UY' => 'Uruguay',
+ 'UZ' => 'Uzbekistan',
+ 'VU' => 'Vanuatu',
+ 'VA' => 'Vatican City',
+ 'VE' => 'Venezuela',
+ 'VN' => 'Vietnam',
+ 'WF' => 'Wallis and Futuna Islands',
+ 'WS' => 'Western Samoa',
+ 'YE' => 'Yemen',
+ 'ZM' => 'Zambia',
+ 'ZW' => 'Zimbabwe'
+ );
+
+ $this->countryinsure = array(
+ 'AF' => 0,
+ 'AL' => 0,
+ 'DZ' => 2185,
+ 'AD' => 5000,
+ 'AO' => 0,
+ 'AI' => 415,
+ 'AG' => 60,
+ 'AR' => 5000,
+ 'AM' => 1350,
+ 'AW' => 830,
+ 'AU' => 3370,
+ 'AT' => 5000,
+ 'AZ' => 5000,
+ 'BS' => 2795,
+ 'BH' => 0,
+ 'BD' => 5000,
+ 'BB' => 220,
+ 'BY' => 1323,
+ 'BE' => 5000,
+ 'BZ' => 1600,
+ 'BJ' => 170,
+ 'BM' => 440,
+ 'BT' => 440,
+ 'BO' => 0,
+ 'BA' => 5000,
+ 'BW' => 145,
+ 'BR' => 5000,
+ 'VG' => 165,
+ 'BN' => 4405,
+ 'BG' => 1030,
+ 'BF' => 530,
+ 'MM' => 4045,
+ 'BI' => 790,
+ 'KH' => 0,
+ 'CM' => 5000,
+ 'CA' => 675,
+ 'CV' => 0,
+ 'KY' => 0,
+ 'CF' => 4405,
+ 'TD' => 440,
+ 'CL' => 0,
+ 'CN' => 1130,
+ 'CX' => 3370,
+ 'CC' => 3370,
+ 'CO' => 0,
+ 'KM' => 690,
+ 'CG' => 1685,
+ 'ZR' => 0,
+ 'CK' => 980,
+ 'CR' => 0,
+ 'CI' => 5000,
+ 'HR' => 5000,
+ 'CU' => 0,
+ 'CY' => 5000,
+ 'CZ' => 5000,
+ 'DK' => 5000,
+ 'DJ' => 880,
+ 'DM' => 0,
+ 'DO' => 0,
+ 'TP' => 0,
+ 'EC' => 0,
+ 'EG' => 1685,
+ 'SV' => 0,
+ 'GQ' => 0,
+ 'ER' => 0,
+ 'EE' => 2020,
+ 'ET' => 1000,
+ 'FK' => 510,
+ 'FO' => 5000,
+ 'FJ' => 600,
+ 'FI' => 5000,
+ 'FR' => 5000,
+ 'GF' => 5000,
+ 'PF' => 1015,
+ 'GA' => 485,
+ 'GM' => 2575,
+ 'GE' => 1350,
+ 'DE' => 5000,
+ 'GH' => 5000,
+ 'GI' => 5000,
+ 'GB' => 857,
+ 'GR' => 5000,
+ 'GL' => 5000,
+ 'GD' => 350,
+ 'GP' => 5000,
+ 'GT' => 0,
+ 'GN' => 875,
+ 'GW' => 21,
+ 'GY' => 10,
+ 'HT' => 0,
+ 'HN' => 0,
+ 'HK' => 5000,
+ 'HU' => 5000,
+ 'IS' => 5000,
+ 'IN' => 2265,
+ 'ID' => 0,
+ 'IR' => 0,
+ 'IQ' => 0,
+ 'IE' => 5000,
+ 'IL' => 0,
+ 'IT' => 5000,
+ 'JM' => 0,
+ 'JP' => 5000,
+ 'JO' => 0,
+ 'KZ' => 5000,
+ 'KE' => 815,
+ 'KI' => 0,
+ 'KW' => 1765,
+ 'KG' => 1350,
+ 'LA' => 0,
+ 'LV' => 1350,
+ 'LB' => 440,
+ 'LS' => 440,
+ 'LR' => 440,
+ 'LY' => 0,
+ 'LI' => 5000,
+ 'LT' => 5000,
+ 'LU' => 5000,
+ 'MO' => 4262,
+ 'MK' => 2200,
+ 'MG' => 675,
+ 'MW' => 50,
+ 'MY' => 1320,
+ 'MV' => 0,
+ 'ML' => 950,
+ 'MT' => 5000,
+ 'MQ' => 5000,
+ 'MR' => 635,
+ 'MU' => 270,
+ 'YT' => 5000,
+ 'MX' => 0,
+ 'MD' => 1350,
+ 'MC' => 5000,
+ 'MN' => 440,
+ 'MS' => 2200,
+ 'MA' => 5000,
+ 'MZ' => 0,
+ 'NA' => 4405,
+ 'NR' => 220,
+ 'NP' => 0,
+ 'NL' => 5000,
+ 'AN' => 830,
+ 'NC' => 1615,
+ 'NZ' => 980,
+ 'NI' => 440,
+ 'NE' => 810,
+ 'NG' => 205,
+ 'KP' => 0,
+ 'NO' => 0,
+ 'OM' => 575,
+ 'PK' => 270,
+ 'PA' => 0,
+ 'PG' => 445,
+ 'PY' => 0,
+ 'PE' => 0,
+ 'PH' => 270,
+ 'PN' => 0,
+ 'PL' => 1350,
+ 'PT' => 5000,
+ 'QA' => 2515,
+ 'RE' => 5000,
+ 'RO' => 5000,
+ 'RU' => 5000,
+ 'RW' => 0,
+ 'SH' => 170,
+ 'KN' => 210,
+ 'LC' => 400,
+ 'PM' => 5000,
+ 'VC' => 130,
+ 'SM' => 5000,
+ 'ST' => 440,
+ 'SA' => 0,
+ 'SN' => 865,
+ 'YU' => 5000,
+ 'SC' => 0,
+ 'SL' => 0,
+ 'SG' => 4580,
+ 'SK' => 5000,
+ 'SI' => 4400,
+ 'SB' => 0,
+ 'SO' => 440,
+ 'ZA' => 1760,
+ 'GS' => 510,
+ 'KR' => 5000,
+ 'ES' => 5000,
+ 'LK' => 35,
+ 'SD' => 0,
+ 'SR' => 535,
+ 'SZ' => 560,
+ 'SE' => 5000,
+ 'CH' => 5000,
+ 'SY' => 3080,
+ 'TW' => 1350,
+ 'TJ' => 1350,
+ 'TZ' => 230,
+ 'TH' => 1350,
+ 'TG' => 2190,
+ 'TK' => 295,
+ 'TO' => 515,
+ 'TT' => 930,
+ 'TN' => 2200,
+ 'TR' => 880,
+ 'TM' => 675,
+ 'TC' => 0,
+ 'TV' => 4715,
+ 'UG' => 0,
+ 'UA' => 5000,
+ 'AE' => 5000,
+ 'UY' => 0,
+ 'UZ' => 5000,
+ 'VU' => 0,
+ 'VA' => 5000,
+ 'VE' => 0,
+ 'VN' => 0,
+ 'WF' => 1615,
+ 'WS' => 295,
+ 'YE' => 0,
+ 'ZM' => 540,
+ 'ZW' => 600,
+ 'US' => 5000
+ );
+ }
+
+ function SetInsurance()
+ {
+ $this->insurance_cost = 0;
+
+ // Insurance module by Kevin Shelton
+ // divide the value of the order among the packages based on the order total or subtotal depending on whether or not you have configured to insure tax
+ // retrieve the maximum allowed insurance for the destination country and if the package value exceeds it then set package value to the maximum allowed
+ LEFT JOIN '.TABLE_PREFIX.'Products ON '.TABLE_PREFIX.'Products.ProductId = '.TABLE_PREFIX.'OrderItems.ProductId
+ LEFT JOIN '.$poc_table.' ON ('.$poc_table.'.CombinationCRC = '.TABLE_PREFIX.'OrderItems.OptionsSalt) AND ('.$poc_table.'.ProductId = '.TABLE_PREFIX.'OrderItems.ProductId)
+ $sql = 'UPDATE '.$table.' SET Status = 0 WHERE '.$id_field.' = '.$id;
+ $this->Conn->Query($sql);
+ }
+
+
+ /* ======================== COMMON CODE ======================== */
+
+ /**
+ * Split one timestamp field into 2 virtual fields
+ *
+ * @param kEvent $event
+ * @access public
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ // get user fields
+ $object =& $event->getObject();
+ $user_id = $object->GetDBField('PortalUserId');
+ if($user_id)
+ {
+ $user_info = $this->Conn->GetRow('SELECT *, CONCAT(FirstName,\' \',LastName) AS UserTo FROM '.TABLE_PREFIX.'PortalUser WHERE PortalUserId = '.$user_id);
+ IF('.TABLE_PREFIX.'Products.InventoryStatus = 2, '.$poc_table.'.QtyInStock, '.TABLE_PREFIX.'Products.QtyInStock) AS QtyInStock, '.
+ TABLE_PREFIX.'Products.QtyInStockMin, '.
+ $table_prefix.'OrderItems.ProductId, '.
+ TABLE_PREFIX.'Products.InventoryStatus,'.
+ $table_prefix.'OrderItems.OptionsSalt AS CombinationCRC
+ FROM '.$table_prefix.'OrderItems
+ LEFT JOIN '.TABLE_PREFIX.'Products ON '.TABLE_PREFIX.'Products.ProductId = '.$table_prefix.'OrderItems.ProductId
+ LEFT JOIN '.$poc_table.' ON ('.$poc_table.'.CombinationCRC = '.$table_prefix.'OrderItems.OptionsSalt) AND ('.$poc_table.'.ProductId = '.$table_prefix.'OrderItems.ProductId)
+ WHERE OrderId = '.$ord_id.' AND '.TABLE_PREFIX.'Products.Type = 1
+ if ($an_item['BackOrderFlag'] > 0) { // we don't need to reserve if it's backordered item
+ $to_reserve = 0;
+ }
+ else {
+ $to_reserve = min($an_item['Quantity']-$an_item['QuantityReserved'], $an_item['QtyInStock']-$an_item['QtyInStockMin']); //it should be equal, but just in case
+ $item_data['t3'] = $cycle_units; //cycle units D (days), W (weeks), M (months), Y (years)
+ $item_data['src'] = '1'; // Recurring payments. If set to 1, the payment will recur unless your customer cancels the subscription before the end of the billing cycle.
+ $item_data['sra'] = '1'; // Reattempt on failure. If set to 1, and the payment fails, the payment will be reattempted two more times. After the third failure, the subscription will be cancelled.
+ $item_data['srt'] = ''; // Recurring Times. This is the number of payments which will occur at the regular rate.
+ * @param Array $gw_params gateway params from payment type config
+ * @return string
+ */
+ function getFormAction($gw_params)
+ {
+ return $gw_params['submit_url'];
+ }
+
+ /**
+ * Processed input data and convets it to fields understandable by gateway
+ *
+ * @param Array $item_data
+ * @param Array $tag_params additional params for gateway passed through tag
+ * @param Array $gw_params gateway params from payment type config
+ * @return Array
+ */
+ function getHiddenFields($item_data, $tag_params, $gw_params)
+ {
+ $ret = Array();
+
+ $ret['instId'] = $gw_params['instId'];
+ $ret['cartId'] = $item_data['OrderNumber'];
+
+ if (!$this->IsTestMode()) {
+ $ret['amount'] = sprintf('%.2f', $item_data['TotalAmount']); // the total amount to be billed, in decimal form, without a currency symbol. (8 characters, decimal, 2 characters: Example: 99999999.99)
+ $stored_ids = $this->Conn->GetCol("SELECT PriceId FROM ".$object->TableName." WHERE ProductId=".$this->Application->GetVar("p_id").' '.$where_group);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (PriceId = '.$id.')');
+ $primary_group = $this->Conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId='.$this->Application->GetVar('u_id').' AND PrimaryGroup=1');
+ $pricing_group = $primary_group;
+ if ($pricing_group) {
+ $pricing_for_group_exists = $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'ProductsPricing WHERE ProductId='.$this->Application->GetVar('p_id').' AND GroupId='.$primary_group.' AND Price IS NOT NULL');
+ }
+ if ($pricing_group && $pricing_for_group_exists > 0) {
+ //$cheapest_group = $this->Conn->GetOne('SELECT GroupId FROM '.$object->TableName.' WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') AND MinQty = 1 GROUP BY GroupId ORDER BY Price ASC');
+ $effective_brackets = $this->Conn->Query('SELECT PriceId, Price, GroupId FROM '.$object->TableName.'
+ WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') ORDER BY GroupId ASC, MinQty ASC', 'PriceId');
+ $group_prices = array();
+ $min_price = -1;
+ $cheapest_group = 0;
+
+ foreach ($effective_brackets as $bracket) {
+ if (!isset($group_prices[$bracket['GroupId']])) {
+ LEFT JOIN '.TABLE_PREFIX.'Products ON '.TABLE_PREFIX.'Products.ProductId = %1$s.ProductId
+ LEFT JOIN '.TABLE_PREFIX.'ProductsPricing ON '.TABLE_PREFIX.'ProductsPricing.ProductId = %1$s.ProductId AND '.TABLE_PREFIX.'ProductsPricing.IsPrimary = 1
+ $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';
+ $combs = $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'ProductOptionCombinations WHERE CombinationCRC = '.$crc.' AND ProductId = '.$object->GetDBField('ProductId').' AND (Price != 0 OR (PriceType = 1 AND Price = 0))');
+ return $combs == 0; // no overriding combinations found
+ }
+}
\ No newline at end of file
Property changes on: releases/5.1.1-RC1/units/order_items/order_items_tag_processor.php
+ 'formatter'=>'kOptionsFormatter', 'options_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalGroup WHERE Personal = 0 ORDER BY Name', 'option_key_field'=>'GroupId', 'option_title_field'=>'Name',
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Currencies WHERE Status = 1 ORDER BY ISO', 'option_key_field' => 'CurrencyId', 'option_title_field' => 'Name', 'use_phrases' => 1,
+ 'not_null' => 1, 'default' => 0
+ ),
+ 'Currencies' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Currencies WHERE Status = 1 ORDER BY ISO', 'option_key_field' => 'CurrencyId', 'option_title_field' => 'Name', 'use_phrases' => 1,
+ 'not_null' => 1, 'default' => ''
+ ),
+ 'PrimaryPaymentTypeId' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PaymentTypes WHERE Status = 1 ORDER BY Name ASC', 'option_key_field' => 'PaymentTypeId', 'option_title_field' => 'Name',
+ 'not_null' => 1, 'default' => 0
+ ),
+ 'PaymentTypes' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PaymentTypes WHERE Status = 1 ORDER BY Name ASC', 'option_key_field' => 'PaymentTypeId', 'option_title_field' => 'Name',
+ function OptionsSalt($options, $comb_only=false)
+ {
+ if (!is_array($options)) return 0;
+ if (!$comb_only) {
+ ksort($options);
+ return crc32(serialize($options));
+ }
+
+ $option_keys = array_keys($options);
+ if (!$option_keys) return ;
+ $included = $this->Conn->GetCol('SELECT ProductOptionId FROM '.TABLE_PREFIX.'ProductOptions WHERE ProductOptionId IN ('.join(',', $option_keys).') AND OptionType IN (1,3,6)');
+ foreach ($option_keys as $key) {
+ if (!in_array($key, $included)) {
+ unset($options[$key]);
+ }
+ }
+ return $this->OptionsSalt($options);
+ }
+ }
\ No newline at end of file
Property changes on: releases/5.1.1-RC1/units/product_options/product_options_helper.php
+ Grids['<inp2:m_param name="prefix"/>'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));