# ===== v 4.3.9 =====
INSERT INTO ImportScripts VALUES (DEFAULT, 'Products from CSV file [In-Commerce]', '', 'p', 'In-Commerce', '', 'CSV', '1');
ALTER TABLE Products ADD OnSale TINYINT(1) NOT NULL default '0' AFTER Featured, ADD INDEX (OnSale);
UPDATE Phrase SET Module = 'In-Commerce' WHERE Phrase IN ('lu_comm_Images', 'lu_comm_ImagesHeader');
# ===== v 5.0.0 =====
UPDATE Category SET Template = '/in-commerce/designs/section' WHERE Template = 'in-commerce/store/category';
UPDATE Category SET CachedTemplate = '/in-commerce/designs/section' WHERE CachedTemplate = 'in-commerce/store/category';
UPDATE ConfigurationValues SET VariableValue = '/in-commerce/designs/section' WHERE VariableName = 'p_CategoryTemplate';
UPDATE ConfigurationValues SET VariableValue = 'in-commerce/designs/detail' WHERE VariableName = 'p_ItemTemplate';
DELETE FROM PersistantSessionData WHERE VariableName IN ('affil_columns_.', 'ap_columns_.', 'apayments_columns_.', 'apayments.log_columns_.', 'd_columns_.', 'coup_columns_.', 'file_columns_.', 'po_columns_.', 'z_columns_.', 'tax_columns_.');
DELETE FROM PersistantSessionData WHERE VariableName LIKE '%ord.%';
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 ShippingQuoteEngines VALUES (DEFAULT, 'USPS.com', 0, 0, 0, 'a:21:{s:12:"AccountLogin";s:0:"";s:15:"AccountPassword";N;s:10:"UPSEnabled";N;s:10:"UPSAccount";s:0:"";s:11:"UPSInvoiced";N;s:10:"FDXEnabled";N;s:10:"FDXAccount";s:0:"";s:10:"DHLEnabled";N;s:10:"DHLAccount";s:0:"";s:11:"DHLInvoiced";N;s:10:"USPEnabled";N;s:10:"USPAccount";s:0:"";s:11:"USPInvoiced";N;s:10:"ARBEnabled";N;s:10:"ARBAccount";s:0:"";s:11:"ARBInvoiced";N;s:10:"1DYEnabled";N;s:10:"2DYEnabled";N;s:10:"3DYEnabled";N;s:10:"GNDEnabled";N;s:10:"ShipMethod";N;}', 'USPS');
INSERT INTO ConfigurationAdmin VALUES ('Comm_CompanyName', 'la_Text_ContactsGeneral', 'la_text_CompanyName', 'text', NULL, NULL, 10.01, 0, 0);
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Comm_CompanyName', '', 'In-Commerce', 'in-commerce:contacts');
UPDATE ConfigurationAdmin SET prompt = 'la_text_StoreName', DisplayOrder = 10.02 WHERE VariableName = 'Comm_StoreName';
INSERT INTO ConfigurationAdmin VALUES ('Comm_Contacts_Name', 'la_Text_ContactsGeneral', 'la_text_ContactName', 'text', NULL, NULL, 10.03, 0, 0);
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'
WHERE VariableName = 'Comm_PriceBracketCalculation';
UPDATE ConfigurationAdmin
SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year'
WHERE VariableName IN ('product_ReviewDelay_Interval', 'product_RatingDelay_Interval');
UPDATE CustomField SET FieldLabel = 'la_fld_cust_p_ItemTemplate', Prompt = 'la_fld_cust_p_ItemTemplate' WHERE FieldName = 'p_ItemTemplate';
UPDATE Events SET Type = 1 WHERE Event = 'BACKORDER.FULLFILL';
UPDATE ConfigurationAdmin SET ValueList = 'style="width: 50px;"' WHERE VariableName IN ('product_RatingDelay_Value', 'product_ReviewDelay_Value');
# ===== v 5.0.2-B1 =====
ALTER TABLE AffiliatePayments
CHANGE Comment Comment text NULL,
CHANGE PaymentDate PaymentDate INT(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE AffiliatePaymentTypes CHANGE Description Description text NULL;
ALTER TABLE Affiliates
CHANGE Comments Comments text NULL,
CHANGE CreatedOn CreatedOn INT(11) NULL DEFAULT NULL;
ALTER TABLE Manufacturers CHANGE Description Description text NULL;
ALTER TABLE Orders
CHANGE UserComment UserComment text NULL,
CHANGE AdminComment AdminComment text NULL,
CHANGE GWResult1 GWResult1 MEDIUMTEXT NULL,
CHANGE GWResult2 GWResult2 MEDIUMTEXT NULL,
CHANGE OrderDate OrderDate INT(10) UNSIGNED NULL DEFAULT NULL,
CHANGE PaymentExpires PaymentExpires INT(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE PaymentTypes CHANGE PortalGroups PortalGroups text NULL;
ALTER TABLE ProductOptionCombinations CHANGE Combination Combination text NULL;
ALTER TABLE Products
CHANGE ShippingLimitation ShippingLimitation text NULL,
CHANGE PackageContent PackageContent MEDIUMTEXT NULL;
ALTER TABLE ShippingQuoteEngines CHANGE Properties Properties text NULL;
ALTER TABLE ShippingType CHANGE PortalGroups PortalGroups text NULL;
ALTER TABLE ProductFiles
CHANGE ProductId ProductId INT(11) NOT NULL DEFAULT '0',
CHANGE `Name` `Name` VARCHAR(255) NOT NULL DEFAULT '',
CHANGE Version Version VARCHAR(100) NOT NULL DEFAULT '',
CHANGE FilePath FilePath VARCHAR(255) NOT NULL DEFAULT '',
CHANGE RealPath RealPath VARCHAR(255) NOT NULL DEFAULT '',
CHANGE Size Size INT(11) NOT NULL DEFAULT '0',
CHANGE AddedOn AddedOn INT(11) NULL DEFAULT NULL;
ALTER TABLE UserFileAccess
CHANGE ProductId ProductId INT( 11 ) NOT NULL DEFAULT '0',
CHANGE PortalUserId PortalUserId INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE GatewayConfigFields CHANGE ValueList ValueList MEDIUMTEXT NULL;
ALTER TABLE Currencies
CHANGE `Status` `Status` SMALLINT(6) NOT NULL DEFAULT '1',
CHANGE Modified Modified INT(11) NULL DEFAULT NULL;
ALTER TABLE GiftCertificates CHANGE `Status` `Status` TINYINT(1) NOT NULL DEFAULT '2';
ALTER TABLE UserDownloads
CHANGE StartedOn StartedOn INT(11) NULL DEFAULT NULL,
CHANGE EndedOn EndedOn INT(11) NULL DEFAULT NULL;
# ===== v 5.0.2-B2 =====
# ===== v 5.0.2-RC1 =====
# ===== v 5.0.2 =====
# ===== v 5.0.3-B1 =====
UPDATE Phrase
SET PhraseType = 1
WHERE Phrase IN (
'la_ship_All_Together', 'la_ship_Backorders_Upon_Avail', 'la_ship_Backorder_Separately',
'lu_ship_Shipment', 'lu_ship_ShippingType'
);
# ===== v 5.0.3-B2 =====
# ===== v 5.0.3-RC1 =====
# ===== v 5.0.3 =====
# ===== v 5.0.4-B1 =====
# ===== v 5.0.4-B2 =====
# ===== v 5.0.4 =====
# ===== v 5.1.0-B1 =====
UPDATE Modules SET Path = 'modules/in-commerce/' WHERE `Name` = 'In-Commerce';
UPDATE ConfigurationValues
SET ValueList = '0=lu_none||SELECT l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM CountryStates WHERE Type = 1 ORDER BY OptionName'
WHERE ValueList = '0=lu_none||SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM StdDestinations WHERE DestParentId IS NULL Order BY OptionName';
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%';
# ===== v 5.1.0-B2 =====
# ===== v 5.1.0-RC1 =====
UPDATE Phrase
SET PhraseType = 1
WHERE Phrase IN (
'la_col_Qty', 'la_col_QtyBackordered', 'la_ItemBackordered', 'la_ship_all_together',
'la_ship_backorders_upon_avail', 'la_ship_backorder_separately', 'la_tooltip_New_Coupon',
'la_tooltip_New_Discount'
);
DELETE FROM Phrase WHERE Phrase = 'la_comm_ProductsByManuf';
# ===== v 5.1.0 =====
ALTER TABLE Products CHANGE CachedRating CachedRating varchar(10) NOT NULL default '0';
# ===== v 5.1.1-B1 =====
ALTER TABLE Orders CHANGE ShippingOption ShippingOption TINYINT(4) NOT NULL DEFAULT '0';
ALTER TABLE ProductFiles CHANGE AddedById AddedById INT(11) NULL DEFAULT NULL;
UPDATE ProductFiles SET AddedById = NULL WHERE AddedById = 0;
ALTER TABLE Products
CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL ,
CHANGE ModifiedById ModifiedById INT(11) NULL DEFAULT NULL;
UPDATE Products SET CreatedById = NULL WHERE CreatedById = 0;
UPDATE Products SET ModifiedById = NULL WHERE ModifiedById = 0;
# ===== v 5.1.1-B2 =====
# ===== v 5.1.1-RC1 =====
# ===== v 5.1.1 =====
# ===== v 5.1.2-B1 =====
DELETE FROM Phrase WHERE PhraseKey = 'LA_TITLE_ADDING_ORDER_ITEM';
# ===== v 5.1.2-B2 =====
UPDATE Phrase SET l<%PRIMARY_LANGUAGE%>_Translation = REPLACE(l<%PRIMARY_LANGUAGE%>_Translation, 'Discounts & Coupons', 'Discounts & Certificates') WHERE PhraseKey = 'LA_TAB_DISCOUNTSANDCOUPONS';
# ===== v 5.1.2-RC1 =====
UPDATE Phrase SET Module = 'Core' WHERE PhraseKey = 'LA_FLD_ISOCODE' OR PhraseKey = 'LA_COL_ISOCODE';
# ===== v 5.1.2 =====
# ===== v 5.1.3-B1 =====
ALTER TABLE AffiliatePlansBrackets CHANGE Percent Percent DECIMAL (10,2) NOT NULL DEFAULT '0.00';
# ===== v 5.1.3-B2 =====
# ===== v 5.1.3-RC1 =====
UPDATE ConfigurationValues
SET VariableValue = 'in-commerce/products/product_detail'
WHERE VariableName = 'p_ItemTemplate' AND VariableValue = 'in-commerce/designs/detail';
# ===== v 5.1.3-RC2 =====
# ===== v 5.1.3 =====
# ===== v 5.2.0-B1 =====
UPDATE SearchConfig
SET DisplayName = REPLACE(DisplayName, 'lu_', 'lc_')
WHERE DisplayName IN ('lu_field_descriptionex', 'lu_field_manufacturer', 'lu_field_qtysold', 'lu_field_topseller');
INSERT INTO SystemSettings VALUES(DEFAULT, 'OrderVATIncluded', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_config_OrderVATIncluded', 'checkbox', NULL, NULL, 10.12, '0', '0', NULL);
ALTER TABLE Orders ADD VATIncluded TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';
INSERT INTO ItemFilters VALUES
(DEFAULT, 'p', 'ManufacturerId', 'checkbox', 1, NULL),
(DEFAULT, 'p', 'Price', 'range', 1, 11),
(DEFAULT, 'p', 'EditorsPick', 'radio', 1, NULL);
DELETE FROM LanguageLabels WHERE PhraseKey = 'LA_COL_ITEMNAME';
DELETE FROM LanguageLabels
WHERE PhraseKey IN ('LA_ALLOWORDERINGINNONPRIMARYCURRENCY', 'LA_ALLOWORDERDIFFERENTTYPES');
DELETE FROM SystemSettings
WHERE VariableName IN ('Comm_AllowOrderingInNonPrimaryCurrency', 'Comm_Allow_Order_Different_Types');
UPDATE SystemSettings
SET DisplayOrder = 20.01
WHERE VariableName = 'Comm_ExchangeRateSource';
UPDATE SystemSettings
SET DisplayOrder = DisplayOrder - 0.01
WHERE VariableName IN (
'Comm_Enable_Backordering', 'Comm_Process_Backorders_Auto', 'Comm_Next_Order_Number', 'Comm_Order_Number_Format_P',
'Comm_Order_Number_Format_S', 'Comm_RecurringChargeInverval', 'Comm_AutoProcessRecurringOrders', 'MaxAddresses',
'Comm_MaskProcessedCreditCards', 'OrderVATIncluded'
);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxCompareProducts', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_MaxCompareProducts', 'text', NULL, NULL, 10.12, 0, 1, NULL);
# ===== v 5.2.0-B2 =====
UPDATE Products main_table
SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId);
# ===== v 5.2.0-B3 =====
ALTER TABLE OrderItems CHANGE OptionsSalt OptionsSalt BIGINT(11) NULL DEFAULT '0';
UPDATE OrderItems
SET OptionsSalt = CAST((OptionsSalt & 0xFFFFFFFF) AS UNSIGNED INTEGER)
WHERE OptionsSalt < 0;
ALTER TABLE ProductOptionCombinations CHANGE CombinationCRC CombinationCRC BIGINT(11) NOT NULL DEFAULT '0';
UPDATE ProductOptionCombinations
SET CombinationCRC = CAST((CombinationCRC & 0xFFFFFFFF) AS UNSIGNED INTEGER)
WHERE CombinationCRC < 0;
# ===== v 5.2.0-RC1 =====
DELETE FROM Currencies WHERE ISO = 'NZD' LIMIT 1;
# ===== v 5.2.0 =====
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:general.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:output.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:contacts.add', 11, 1, 1, 0);
# ===== v 5.2.1-B1 =====
ALTER TABLE Affiliates CHANGE PortalUserId PortalUserId INT(10) NULL DEFAULT NULL;
UPDATE Affiliates SET PortalUserId = NULL WHERE PortalUserId = 0;
# ===== v 5.2.1-B2 =====
UPDATE Modules
SET ClassNamespace = 'Intechnic\\InPortal\\Modules\\InCommerce'
WHERE `Name` = 'In-Commerce';
# ===== v 5.2.1-RC1 =====
# ===== v 5.2.1 =====
# ===== v 5.2.2-B1 =====
# ===== v 5.2.2-B2 =====
UPDATE Modules
SET ClassNamespace = 'InPortal\\Modules\\InCommerce'
WHERE `Name` = 'In-Commerce';
# ===== v 5.3.0-B1 =====
ALTER TABLE Affiliates DROP SSN;
DELETE FROM LanguageLabels WHERE PhraseKey IN ('LA_FLD_SSN', 'LU_COMM_SSNFIELD', 'LU_FLD_SSNFIELD');
# Backported in http://jira.in-portal.org/browse/INP-1690.
# UPDATE Modules
# SET ClassNamespace = 'InPortal\\Modules\\InCommerce'
# WHERE `Name` = 'In-Commerce';
INSERT INTO SearchConfig VALUES ('Products', 'MetaKeywords', 0, 1, '', 'lc_field_MetaKeywords', 'In-Commerce', 'la_Text_Products', 24, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'MetaDescription', 0, 1, '', 'lc_field_MetaDescription', 'In-Commerce', 'la_Text_Products', 25, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
UPDATE SystemSettings
SET VariableValue = CONCAT(VariableValue, ',affiliate_id,shop_cart_cookie,compare_products')
WHERE VariableName = 'EncryptedCookies' AND VariableValue NOT LIKE '%,affiliate_id,shop_cart_cookie,compare_products%';