Version Notes
Download this release
Release Info
| Developer | Codisto |
| Extension | codistoconnect |
| Version | 1.90.13 |
| Comparing to | |
| See all releases | |
Code changes from version 1.90.12 to 1.90.13
- app/code/community/Codisto/Sync/Model/Sync.php +148 -14
- app/code/community/Codisto/Sync/controllers/IndexController.php +58 -2
- app/code/community/Codisto/Sync/controllers/SyncController.php +1 -1
- app/code/community/Codisto/Sync/data/codisto_setup/{data-install-1.90.12.php → data-install-1.90.13.php} +0 -0
- app/code/community/Codisto/Sync/etc/config.xml +1 -1
- app/code/community/Codisto/Sync/sql/codisto_setup/{mysql4-install-1.90.12.php → mysql4-install-1.90.13.php} +0 -0
- package.xml +1 -1
app/code/community/Codisto/Sync/Model/Sync.php
CHANGED
|
@@ -322,6 +322,7 @@ class Codisto_Sync_Model_Sync
|
|
| 322 |
$insertAttributeGroup = $db->prepare('INSERT OR IGNORE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
|
| 323 |
$insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
|
| 324 |
$insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
|
|
|
| 325 |
$insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 326 |
$insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 327 |
|
|
@@ -342,6 +343,7 @@ class Codisto_Sync_Model_Sync
|
|
| 342 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 343 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 344 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 345 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 346 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 347 |
'store' => $store )
|
|
@@ -361,6 +363,7 @@ class Codisto_Sync_Model_Sync
|
|
| 361 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 362 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 363 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 364 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 365 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 366 |
'store' => $store )
|
|
@@ -383,6 +386,7 @@ class Codisto_Sync_Model_Sync
|
|
| 383 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 384 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 385 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 386 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 387 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 388 |
'store' => $store )
|
|
@@ -696,7 +700,7 @@ class Codisto_Sync_Model_Sync
|
|
| 696 |
$groupedData = Mage::getModel('catalog/product_type_grouped');
|
| 697 |
|
| 698 |
$childProducts = $groupedData->getAssociatedProductCollection($product);
|
| 699 |
-
$childProducts->addAttributeToSelect(array('sku', 'name', 'price', 'special_price', 'special_from_date', 'special_to_date'));
|
| 700 |
|
| 701 |
$skulinkArgs = array();
|
| 702 |
$skumatrixArgs = array();
|
|
@@ -815,6 +819,7 @@ class Codisto_Sync_Model_Sync
|
|
| 815 |
$insertAttributeGroupSQL = $args['preparedattributegroupStatement'];
|
| 816 |
$insertAttributeGroupMapSQL = $args['preparedattributegroupmapStatement'];
|
| 817 |
$insertProductAttributeSQL = $args['preparedproductattributeStatement'];
|
|
|
|
| 818 |
$insertProductQuestionSQL = $args['preparedproductquestionStatement'];
|
| 819 |
$insertProductAnswerSQL = $args['preparedproductanswerStatement'];
|
| 820 |
|
|
@@ -1024,7 +1029,9 @@ class Codisto_Sync_Model_Sync
|
|
| 1024 |
}
|
| 1025 |
}
|
| 1026 |
|
| 1027 |
-
$
|
|
|
|
|
|
|
| 1028 |
|
| 1029 |
$attrTypeSelects = array();
|
| 1030 |
|
|
@@ -1037,17 +1044,22 @@ class Codisto_Sync_Model_Sync
|
|
| 1037 |
->where('default_value.entity_id = :entity_id')
|
| 1038 |
->where('default_value.store_id = 0');
|
| 1039 |
|
| 1040 |
-
|
| 1041 |
if($store->getId() == Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID)
|
| 1042 |
{
|
| 1043 |
$attrTypeSelect->columns(array('attr_value' => new Zend_Db_Expr('CAST(value AS CHAR)')), 'default_value');
|
|
|
|
| 1044 |
$attrTypeSelect->where('default_value.value IS NOT NULL');
|
| 1045 |
}
|
| 1046 |
else
|
| 1047 |
{
|
|
|
|
| 1048 |
$attrTypeSelect->joinLeft(
|
| 1049 |
array('store_value' => $table),
|
| 1050 |
-
'store_value.attribute_id = default_value.attribute_id
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1051 |
array('attr_value' => new Zend_Db_Expr('CAST(COALESCE(store_value.value, default_value.value) AS CHAR)'))
|
| 1052 |
);
|
| 1053 |
$attrTypeSelect->where('store_value.value IS NOT NULL OR default_value.value IS NOT NULL');
|
|
@@ -1068,25 +1080,39 @@ class Codisto_Sync_Model_Sync
|
|
| 1068 |
'store_id' => $store->getId()
|
| 1069 |
);
|
| 1070 |
|
| 1071 |
-
$
|
| 1072 |
-
foreach ($attributeRows as $attributeId => $attributeValue)
|
| 1073 |
{
|
|
|
|
|
|
|
| 1074 |
$attributeCode = $attributeCodeIDMap[$attributeId];
|
| 1075 |
-
$attributeValues[$attributeCode] = $
|
| 1076 |
}
|
| 1077 |
|
| 1078 |
foreach($attributeSet as $attributeData)
|
| 1079 |
{
|
| 1080 |
if(isset($attributeValues[$attributeData['code']]))
|
| 1081 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1082 |
else
|
|
|
|
|
|
|
| 1083 |
$attributeValue = null;
|
|
|
|
| 1084 |
|
| 1085 |
if(isset($attributeData['source']) &&
|
| 1086 |
$attributeData['source_model'] == 'eav/entity_attribute_source_boolean')
|
| 1087 |
{
|
| 1088 |
$attributeData['backend_type'] = 'boolean';
|
| 1089 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1090 |
if(isset($attributeValue) && $attributeValue)
|
| 1091 |
$attributeValue = -1;
|
| 1092 |
else
|
|
@@ -1095,11 +1121,87 @@ class Codisto_Sync_Model_Sync
|
|
| 1095 |
|
| 1096 |
else if($attributeData['html'])
|
| 1097 |
{
|
| 1098 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1099 |
}
|
| 1100 |
|
| 1101 |
else if( in_array($attributeData['frontend_type'], array( 'select', 'multiselect' ) ) )
|
| 1102 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1103 |
if(is_array($attributeValue))
|
| 1104 |
{
|
| 1105 |
if(isset($attributeData['source']) &&
|
|
@@ -1181,6 +1283,17 @@ class Codisto_Sync_Model_Sync
|
|
| 1181 |
|
| 1182 |
$insertProductAttributeSQL->execute(array($product_id, $attributeData['id'], $attributeValue));
|
| 1183 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1184 |
}
|
| 1185 |
}
|
| 1186 |
|
|
@@ -1372,7 +1485,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1372 |
|
| 1373 |
$orderData = $args['row'];
|
| 1374 |
|
| 1375 |
-
$insertOrdersSQL->execute(array($orderData['codisto_orderid'], ($orderData['status'])?$orderData['status']:'processing', $orderData['pay_date'], $orderData['ship_date'], $orderData['carrier'], $orderData['track_number']));
|
| 1376 |
|
| 1377 |
$this->ordersProcessed[] = $orderData['entity_id'];
|
| 1378 |
$this->currentEntityId = $orderData['entity_id'];
|
|
@@ -1505,6 +1618,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1505 |
$insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
|
| 1506 |
$insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
|
| 1507 |
$insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
|
|
|
| 1508 |
$insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1509 |
$insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1510 |
|
|
@@ -1530,6 +1644,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1530 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1531 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1532 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 1533 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1534 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1535 |
'store' => $storeObject ));
|
|
@@ -1559,6 +1674,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1559 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1560 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1561 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 1562 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1563 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1564 |
'store' => $storeObject )
|
|
@@ -1590,6 +1706,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1590 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1591 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1592 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 1593 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1594 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1595 |
'store' => $storeObject )
|
|
@@ -1610,7 +1727,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1610 |
|
| 1611 |
if(!empty($orderUpdateIds))
|
| 1612 |
{
|
| 1613 |
-
$insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber) VALUES (?, ?, ?, ?, ?, ?)');
|
| 1614 |
|
| 1615 |
$orderStoreId = $storeId;
|
| 1616 |
if($storeId == 0)
|
|
@@ -1631,7 +1748,8 @@ class Codisto_Sync_Model_Sync
|
|
| 1631 |
$ts -= 7776000; // 90 days
|
| 1632 |
|
| 1633 |
$orders = Mage::getModel('sales/order')->getCollection()
|
| 1634 |
-
->addFieldToSelect(array('codisto_orderid', 'status'))
|
|
|
|
| 1635 |
->addAttributeToFilter('entity_id', array('in' => $orderUpdateIds ))
|
| 1636 |
->addAttributeToFilter('main_table.store_id', array('eq' => $orderStoreId ))
|
| 1637 |
->addAttributeToFilter('main_table.updated_at', array('gteq' => date('Y-m-d H:i:s', $ts)))
|
|
@@ -1849,6 +1967,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1849 |
$insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
|
| 1850 |
$insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
|
| 1851 |
$insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
|
|
|
| 1852 |
$insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1853 |
$insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1854 |
$insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber) VALUES (?, ?, ?, ?, ?, ?)');
|
|
@@ -1964,6 +2083,7 @@ class Codisto_Sync_Model_Sync
|
|
| 1964 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1965 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1966 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 1967 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1968 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1969 |
'store' => $store ));
|
|
@@ -2010,6 +2130,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2010 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 2011 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 2012 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 2013 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 2014 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 2015 |
'store' => $store )
|
|
@@ -2057,6 +2178,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2057 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 2058 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 2059 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
|
|
|
| 2060 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 2061 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 2062 |
'store' => $store )
|
|
@@ -2111,6 +2233,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2111 |
|
| 2112 |
$orders = Mage::getModel('sales/order')->getCollection()
|
| 2113 |
->addFieldToSelect(array('codisto_orderid', 'status'))
|
|
|
|
| 2114 |
->addAttributeToFilter('entity_id', array('gt' => (int)$this->currentEntityId ))
|
| 2115 |
->addAttributeToFilter('main_table.store_id', array('eq' => $orderStoreId ))
|
| 2116 |
->addAttributeToFilter('main_table.updated_at', array('gteq' => date('Y-m-d H:i:s', $ts)))
|
|
@@ -2434,7 +2557,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2434 |
|
| 2435 |
$db = $this->GetSyncDb($syncDb, 5 );
|
| 2436 |
|
| 2437 |
-
$insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber) VALUES (?, ?, ?, ?, ?, ?)');
|
| 2438 |
|
| 2439 |
$coreResource = Mage::getSingleton('core/resource');
|
| 2440 |
|
|
@@ -2446,6 +2569,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2446 |
|
| 2447 |
$orders = Mage::getModel('sales/order')->getCollection()
|
| 2448 |
->addFieldToSelect(array('codisto_orderid', 'status'))
|
|
|
|
| 2449 |
->addAttributeToFilter('codisto_orderid', array('in' => $orders ));
|
| 2450 |
|
| 2451 |
$orders->getSelect()->joinLeft( array('i' => $invoiceName), 'i.order_id = main_table.entity_id AND i.state = 2', array('pay_date' => 'MIN(i.created_at)'));
|
|
@@ -2504,6 +2628,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2504 |
$db->exec('CREATE TABLE IF NOT EXISTS AttributeGroupMap (AttributeID integer NOT NULL, GroupID integer NOT NULL, PRIMARY KEY(AttributeID, GroupID))');
|
| 2505 |
$db->exec('CREATE TABLE IF NOT EXISTS AttributeGroup (ID integer NOT NULL PRIMARY KEY, Name text NOT NULL)');
|
| 2506 |
$db->exec('CREATE TABLE IF NOT EXISTS ProductAttributeValue (ProductExternalReference text NOT NULL, AttributeID integer NOT NULL, Value any, PRIMARY KEY (ProductExternalReference, AttributeID))');
|
|
|
|
| 2507 |
|
| 2508 |
$db->exec('CREATE TABLE IF NOT EXISTS TaxClass (ID integer NOT NULL PRIMARY KEY, Type text NOT NULL, Name text NOT NULL)');
|
| 2509 |
$db->exec('CREATE TABLE IF NOT EXISTS TaxCalculation(ID integer NOT NULL PRIMARY KEY, TaxRateID integer NOT NULL, TaxRuleID integer NOT NULL, ProductTaxClassID integer NOT NULL, CustomerTaxClassID integer NOT NULL)');
|
|
@@ -2514,7 +2639,7 @@ class Codisto_Sync_Model_Sync
|
|
| 2514 |
$db->exec('CREATE TABLE IF NOT EXISTS Store(ID integer NOT NULL PRIMARY KEY, Code text NOT NULL, Name text NOT NULL, Currency text NOT NULL)');
|
| 2515 |
$db->exec('CREATE TABLE IF NOT EXISTS StoreMerchant(StoreID integer NOT NULL, MerchantID integer NOT NULL, PRIMARY KEY (StoreID, MerchantID))');
|
| 2516 |
|
| 2517 |
-
$db->exec('CREATE TABLE IF NOT EXISTS [Order](ID integer NOT NULL PRIMARY KEY, Status text NOT NULL, PaymentDate datetime NULL, ShipmentDate datetime NULL, Carrier text NOT NULL, TrackingNumber text NOT NULL)');
|
| 2518 |
|
| 2519 |
$db->exec('CREATE TABLE IF NOT EXISTS StaticBlock(BlockID integer NOT NULL PRIMARY KEY, Title text NOT NULL, Identifier text NOT NULL, Content text NOT NULL)');
|
| 2520 |
|
|
@@ -2532,6 +2657,15 @@ class Codisto_Sync_Model_Sync
|
|
| 2532 |
$db->exec('ALTER TABLE NewOrder RENAME TO [Order]');
|
| 2533 |
}
|
| 2534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2535 |
try
|
| 2536 |
{
|
| 2537 |
$db->exec('SELECT 1 FROM ProductAttributeValue WHERE ProductExternalReference IS NULL LIMIT 1');
|
| 322 |
$insertAttributeGroup = $db->prepare('INSERT OR IGNORE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
|
| 323 |
$insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
|
| 324 |
$insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
| 325 |
+
$insertProductAttributeDefault = $db->prepare('INSERT OR IGNORE INTO ProductAttributeDefaultValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
| 326 |
$insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 327 |
$insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 328 |
|
| 343 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 344 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 345 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 346 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 347 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 348 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 349 |
'store' => $store )
|
| 363 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 364 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 365 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 366 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 367 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 368 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 369 |
'store' => $store )
|
| 386 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 387 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 388 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 389 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 390 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 391 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 392 |
'store' => $store )
|
| 700 |
$groupedData = Mage::getModel('catalog/product_type_grouped');
|
| 701 |
|
| 702 |
$childProducts = $groupedData->getAssociatedProductCollection($product);
|
| 703 |
+
$childProducts->addAttributeToSelect(array('sku', 'name', 'price', 'special_price', 'special_from_date', 'special_to_date', 'tax_class_id'));
|
| 704 |
|
| 705 |
$skulinkArgs = array();
|
| 706 |
$skumatrixArgs = array();
|
| 819 |
$insertAttributeGroupSQL = $args['preparedattributegroupStatement'];
|
| 820 |
$insertAttributeGroupMapSQL = $args['preparedattributegroupmapStatement'];
|
| 821 |
$insertProductAttributeSQL = $args['preparedproductattributeStatement'];
|
| 822 |
+
$insertProductAttributeDefaultSQL = $args['preparedproductattributedefaultStatement'];
|
| 823 |
$insertProductQuestionSQL = $args['preparedproductquestionStatement'];
|
| 824 |
$insertProductAnswerSQL = $args['preparedproductanswerStatement'];
|
| 825 |
|
| 1029 |
}
|
| 1030 |
}
|
| 1031 |
|
| 1032 |
+
$coreResource = Mage::getModel('core/resource');
|
| 1033 |
+
|
| 1034 |
+
$adapter = $coreResource->getConnection(Mage_Core_Model_Resource::DEFAULT_READ_RESOURCE);
|
| 1035 |
|
| 1036 |
$attrTypeSelects = array();
|
| 1037 |
|
| 1044 |
->where('default_value.entity_id = :entity_id')
|
| 1045 |
->where('default_value.store_id = 0');
|
| 1046 |
|
|
|
|
| 1047 |
if($store->getId() == Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID)
|
| 1048 |
{
|
| 1049 |
$attrTypeSelect->columns(array('attr_value' => new Zend_Db_Expr('CAST(value AS CHAR)')), 'default_value');
|
| 1050 |
+
$attrTypeSelect->columns(array('default_value' => 'value'), 'default_value');
|
| 1051 |
$attrTypeSelect->where('default_value.value IS NOT NULL');
|
| 1052 |
}
|
| 1053 |
else
|
| 1054 |
{
|
| 1055 |
+
$attrTypeSelect->columns(array('default_value' => 'value'), 'default_value');
|
| 1056 |
$attrTypeSelect->joinLeft(
|
| 1057 |
array('store_value' => $table),
|
| 1058 |
+
'store_value.attribute_id = default_value.attribute_id '.
|
| 1059 |
+
'AND store_value.attribute_id IN (SELECT attribute_id FROM `'.$coreResource->getTableName('catalog/eav_attribute').'` WHERE is_global != 0) '.
|
| 1060 |
+
'AND store_value.entity_type_id = default_value.entity_type_id '.
|
| 1061 |
+
'AND store_value.entity_id = default_value.entity_id '.
|
| 1062 |
+
'AND store_value.store_id = :store_id ',
|
| 1063 |
array('attr_value' => new Zend_Db_Expr('CAST(COALESCE(store_value.value, default_value.value) AS CHAR)'))
|
| 1064 |
);
|
| 1065 |
$attrTypeSelect->where('store_value.value IS NOT NULL OR default_value.value IS NOT NULL');
|
| 1080 |
'store_id' => $store->getId()
|
| 1081 |
);
|
| 1082 |
|
| 1083 |
+
foreach($adapter->fetchAll($attrSelect, $attrArgs, Zend_Db::FETCH_NUM) as $attributeRow)
|
|
|
|
| 1084 |
{
|
| 1085 |
+
$attributeId = $attributeRow[0];
|
| 1086 |
+
|
| 1087 |
$attributeCode = $attributeCodeIDMap[$attributeId];
|
| 1088 |
+
$attributeValues[$attributeCode] = $attributeRow;
|
| 1089 |
}
|
| 1090 |
|
| 1091 |
foreach($attributeSet as $attributeData)
|
| 1092 |
{
|
| 1093 |
if(isset($attributeValues[$attributeData['code']]))
|
| 1094 |
+
{
|
| 1095 |
+
$attributeRow = $attributeValues[$attributeData['code']];
|
| 1096 |
+
|
| 1097 |
+
$defaultValue = $attributeRow[1];
|
| 1098 |
+
$attributeValue = $attributeRow[2];
|
| 1099 |
+
}
|
| 1100 |
else
|
| 1101 |
+
{
|
| 1102 |
+
$defaultValue = null;
|
| 1103 |
$attributeValue = null;
|
| 1104 |
+
}
|
| 1105 |
|
| 1106 |
if(isset($attributeData['source']) &&
|
| 1107 |
$attributeData['source_model'] == 'eav/entity_attribute_source_boolean')
|
| 1108 |
{
|
| 1109 |
$attributeData['backend_type'] = 'boolean';
|
| 1110 |
|
| 1111 |
+
if(isset($defaultValue) && $defaultValue)
|
| 1112 |
+
$defaultValue = -1;
|
| 1113 |
+
else
|
| 1114 |
+
$defaultValue = 0;
|
| 1115 |
+
|
| 1116 |
if(isset($attributeValue) && $attributeValue)
|
| 1117 |
$attributeValue = -1;
|
| 1118 |
else
|
| 1121 |
|
| 1122 |
else if($attributeData['html'])
|
| 1123 |
{
|
| 1124 |
+
if($defaultValue == $attributeValue)
|
| 1125 |
+
{
|
| 1126 |
+
$defaultValue = $attributeValue = Mage::helper('codistosync')->processCmsContent($attributeValue);
|
| 1127 |
+
}
|
| 1128 |
+
else
|
| 1129 |
+
{
|
| 1130 |
+
$defaultValue = Mage::helper('codistosync')->processCmsContent($defaultValue);
|
| 1131 |
+
$attributeValue = Mage::helper('codistosync')->processCmsContent($attributeValue);
|
| 1132 |
+
}
|
| 1133 |
}
|
| 1134 |
|
| 1135 |
else if( in_array($attributeData['frontend_type'], array( 'select', 'multiselect' ) ) )
|
| 1136 |
{
|
| 1137 |
+
if(is_array($attributeValue))
|
| 1138 |
+
{
|
| 1139 |
+
if(isset($attributeData['source']) &&
|
| 1140 |
+
method_exists( $attributeData['source'], 'getOptionText') )
|
| 1141 |
+
{
|
| 1142 |
+
$defaultValueSet = array();
|
| 1143 |
+
|
| 1144 |
+
foreach($attributeValue as $attributeOptionId)
|
| 1145 |
+
{
|
| 1146 |
+
if(isset($this->optionTextCache['0-'.$attributeData['id'].'-'.$attributeOptionId]))
|
| 1147 |
+
{
|
| 1148 |
+
$defaultValueSet[] = $this->optionTextCache['0-'.$attributeData['id'].'-'.$attributeOptionId];
|
| 1149 |
+
}
|
| 1150 |
+
else
|
| 1151 |
+
{
|
| 1152 |
+
try
|
| 1153 |
+
{
|
| 1154 |
+
$attributeData['source']->getAttribute()->setStoreId(0);
|
| 1155 |
+
|
| 1156 |
+
$attributeText = $attributeData['source']->getOptionText($attributeOptionId);
|
| 1157 |
+
|
| 1158 |
+
$attributeData['source']->getAttribute()->setStoreId($store->getId());
|
| 1159 |
+
|
| 1160 |
+
$this->optionTextCache['0-'.$attributeData['id'].'-'.$attributeOptionId] = $attributeText;
|
| 1161 |
+
|
| 1162 |
+
$defaultValueSet[] = $attributeText;
|
| 1163 |
+
}
|
| 1164 |
+
catch(Exception $e)
|
| 1165 |
+
{
|
| 1166 |
+
|
| 1167 |
+
}
|
| 1168 |
+
}
|
| 1169 |
+
}
|
| 1170 |
+
|
| 1171 |
+
$defaultValue = $defaultValueSet;
|
| 1172 |
+
}
|
| 1173 |
+
}
|
| 1174 |
+
else
|
| 1175 |
+
{
|
| 1176 |
+
if(isset($attributeData['source']) &&
|
| 1177 |
+
method_exists( $attributeData['source'], 'getOptionText') )
|
| 1178 |
+
{
|
| 1179 |
+
if(isset($this->optionTextCache['0-'.$attributeData['id'].'-'.$attributeValue]))
|
| 1180 |
+
{
|
| 1181 |
+
$defaultValue = $this->optionTextCache['0-'.$attributeData['id'].'-'.$attributeValue];
|
| 1182 |
+
}
|
| 1183 |
+
else
|
| 1184 |
+
{
|
| 1185 |
+
try
|
| 1186 |
+
{
|
| 1187 |
+
$attributeData['source']->getAttribute()->setStoreId(0);
|
| 1188 |
+
|
| 1189 |
+
$attributeText = $attributeData['source']->getOptionText($attributeValue);
|
| 1190 |
+
|
| 1191 |
+
$attributeData['source']->getAttribute()->setStoreId($store->getId());
|
| 1192 |
+
|
| 1193 |
+
$this->optionTextCache['0-'.$attributeData['id'].'-'.$attributeValue] = $attributeText;
|
| 1194 |
+
|
| 1195 |
+
$defaultValue = $attributeText;
|
| 1196 |
+
}
|
| 1197 |
+
catch(Exception $e)
|
| 1198 |
+
{
|
| 1199 |
+
$defaultValue = null;
|
| 1200 |
+
}
|
| 1201 |
+
}
|
| 1202 |
+
}
|
| 1203 |
+
}
|
| 1204 |
+
|
| 1205 |
if(is_array($attributeValue))
|
| 1206 |
{
|
| 1207 |
if(isset($attributeData['source']) &&
|
| 1283 |
|
| 1284 |
$insertProductAttributeSQL->execute(array($product_id, $attributeData['id'], $attributeValue));
|
| 1285 |
}
|
| 1286 |
+
|
| 1287 |
+
if(isset($defaultValue) && !is_null($defaultValue))
|
| 1288 |
+
{
|
| 1289 |
+
if(is_array($defaultValue))
|
| 1290 |
+
$defaultValue = implode(',', $defaultValue);
|
| 1291 |
+
|
| 1292 |
+
if($defaultValue != $attributeValue)
|
| 1293 |
+
{
|
| 1294 |
+
$insertProductAttributeDefaultSQL->execute(array($product_id, $attributeData['id'], $defaultValue));
|
| 1295 |
+
}
|
| 1296 |
+
}
|
| 1297 |
}
|
| 1298 |
}
|
| 1299 |
|
| 1485 |
|
| 1486 |
$orderData = $args['row'];
|
| 1487 |
|
| 1488 |
+
$insertOrdersSQL->execute(array($orderData['codisto_orderid'], ($orderData['status'])?$orderData['status']:'processing', $orderData['pay_date'], $orderData['ship_date'], $orderData['carrier'], $orderData['track_number'], $orderData['externalreference']));
|
| 1489 |
|
| 1490 |
$this->ordersProcessed[] = $orderData['entity_id'];
|
| 1491 |
$this->currentEntityId = $orderData['entity_id'];
|
| 1618 |
$insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
|
| 1619 |
$insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
|
| 1620 |
$insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
| 1621 |
+
$insertProductAttributeDefault = $db->prepare('INSERT OR IGNORE INTO ProductAttributeDefaultValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
| 1622 |
$insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1623 |
$insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1624 |
|
| 1644 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1645 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1646 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 1647 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 1648 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1649 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1650 |
'store' => $storeObject ));
|
| 1674 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1675 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1676 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 1677 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 1678 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1679 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1680 |
'store' => $storeObject )
|
| 1706 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 1707 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 1708 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 1709 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 1710 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 1711 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 1712 |
'store' => $storeObject )
|
| 1727 |
|
| 1728 |
if(!empty($orderUpdateIds))
|
| 1729 |
{
|
| 1730 |
+
$insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber, ExternalReference) VALUES (?, ?, ?, ?, ?, ?, ?)');
|
| 1731 |
|
| 1732 |
$orderStoreId = $storeId;
|
| 1733 |
if($storeId == 0)
|
| 1748 |
$ts -= 7776000; // 90 days
|
| 1749 |
|
| 1750 |
$orders = Mage::getModel('sales/order')->getCollection()
|
| 1751 |
+
->addFieldToSelect(array('codisto_orderid', 'status' ))
|
| 1752 |
+
->addFieldToSelect('entity_id','externalreference')
|
| 1753 |
->addAttributeToFilter('entity_id', array('in' => $orderUpdateIds ))
|
| 1754 |
->addAttributeToFilter('main_table.store_id', array('eq' => $orderStoreId ))
|
| 1755 |
->addAttributeToFilter('main_table.updated_at', array('gteq' => date('Y-m-d H:i:s', $ts)))
|
| 1967 |
$insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
|
| 1968 |
$insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
|
| 1969 |
$insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
| 1970 |
+
$insertProductAttributeDefault = $db->prepare('INSERT OR IGNORE INTO ProductAttributeDefaultValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
|
| 1971 |
$insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1972 |
$insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
|
| 1973 |
$insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber) VALUES (?, ?, ?, ?, ?, ?)');
|
| 2083 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 2084 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 2085 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 2086 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 2087 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 2088 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 2089 |
'store' => $store ));
|
| 2130 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 2131 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 2132 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 2133 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 2134 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 2135 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 2136 |
'store' => $store )
|
| 2178 |
'preparedattributegroupStatement' => $insertAttributeGroup,
|
| 2179 |
'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
|
| 2180 |
'preparedproductattributeStatement' => $insertProductAttribute,
|
| 2181 |
+
'preparedproductattributedefaultStatement' => $insertProductAttributeDefault,
|
| 2182 |
'preparedproductquestionStatement' => $insertProductQuestion,
|
| 2183 |
'preparedproductanswerStatement' => $insertProductAnswer,
|
| 2184 |
'store' => $store )
|
| 2233 |
|
| 2234 |
$orders = Mage::getModel('sales/order')->getCollection()
|
| 2235 |
->addFieldToSelect(array('codisto_orderid', 'status'))
|
| 2236 |
+
->addFieldToSelect('entity_id','externalreference')
|
| 2237 |
->addAttributeToFilter('entity_id', array('gt' => (int)$this->currentEntityId ))
|
| 2238 |
->addAttributeToFilter('main_table.store_id', array('eq' => $orderStoreId ))
|
| 2239 |
->addAttributeToFilter('main_table.updated_at', array('gteq' => date('Y-m-d H:i:s', $ts)))
|
| 2557 |
|
| 2558 |
$db = $this->GetSyncDb($syncDb, 5 );
|
| 2559 |
|
| 2560 |
+
$insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber, ExternalReference) VALUES (?, ?, ?, ?, ?, ?, ?)');
|
| 2561 |
|
| 2562 |
$coreResource = Mage::getSingleton('core/resource');
|
| 2563 |
|
| 2569 |
|
| 2570 |
$orders = Mage::getModel('sales/order')->getCollection()
|
| 2571 |
->addFieldToSelect(array('codisto_orderid', 'status'))
|
| 2572 |
+
->addFieldToSelect('entity_id','externalreference')
|
| 2573 |
->addAttributeToFilter('codisto_orderid', array('in' => $orders ));
|
| 2574 |
|
| 2575 |
$orders->getSelect()->joinLeft( array('i' => $invoiceName), 'i.order_id = main_table.entity_id AND i.state = 2', array('pay_date' => 'MIN(i.created_at)'));
|
| 2628 |
$db->exec('CREATE TABLE IF NOT EXISTS AttributeGroupMap (AttributeID integer NOT NULL, GroupID integer NOT NULL, PRIMARY KEY(AttributeID, GroupID))');
|
| 2629 |
$db->exec('CREATE TABLE IF NOT EXISTS AttributeGroup (ID integer NOT NULL PRIMARY KEY, Name text NOT NULL)');
|
| 2630 |
$db->exec('CREATE TABLE IF NOT EXISTS ProductAttributeValue (ProductExternalReference text NOT NULL, AttributeID integer NOT NULL, Value any, PRIMARY KEY (ProductExternalReference, AttributeID))');
|
| 2631 |
+
$db->exec('CREATE TABLE IF NOT EXISTS ProductAttributeDefaultValue (ProductExternalReference text NOT NULL, AttributeID integer NOT NULL, Value any, PRIMARY KEY (ProductExternalReference, AttributeID))');
|
| 2632 |
|
| 2633 |
$db->exec('CREATE TABLE IF NOT EXISTS TaxClass (ID integer NOT NULL PRIMARY KEY, Type text NOT NULL, Name text NOT NULL)');
|
| 2634 |
$db->exec('CREATE TABLE IF NOT EXISTS TaxCalculation(ID integer NOT NULL PRIMARY KEY, TaxRateID integer NOT NULL, TaxRuleID integer NOT NULL, ProductTaxClassID integer NOT NULL, CustomerTaxClassID integer NOT NULL)');
|
| 2639 |
$db->exec('CREATE TABLE IF NOT EXISTS Store(ID integer NOT NULL PRIMARY KEY, Code text NOT NULL, Name text NOT NULL, Currency text NOT NULL)');
|
| 2640 |
$db->exec('CREATE TABLE IF NOT EXISTS StoreMerchant(StoreID integer NOT NULL, MerchantID integer NOT NULL, PRIMARY KEY (StoreID, MerchantID))');
|
| 2641 |
|
| 2642 |
+
$db->exec('CREATE TABLE IF NOT EXISTS [Order](ID integer NOT NULL PRIMARY KEY, Status text NOT NULL, PaymentDate datetime NULL, ShipmentDate datetime NULL, Carrier text NOT NULL, TrackingNumber text NOT NULL, ExternalReference text NOT NULL DEFAULT \'\')');
|
| 2643 |
|
| 2644 |
$db->exec('CREATE TABLE IF NOT EXISTS StaticBlock(BlockID integer NOT NULL PRIMARY KEY, Title text NOT NULL, Identifier text NOT NULL, Content text NOT NULL)');
|
| 2645 |
|
| 2657 |
$db->exec('ALTER TABLE NewOrder RENAME TO [Order]');
|
| 2658 |
}
|
| 2659 |
|
| 2660 |
+
try
|
| 2661 |
+
{
|
| 2662 |
+
$db->exec('SELECT 1 FROM [Order] WHERE ExternalReference IS NULL LIMIT 1');
|
| 2663 |
+
}
|
| 2664 |
+
catch(Exception $e)
|
| 2665 |
+
{
|
| 2666 |
+
$db->exec('ALTER TABLE [Order] ADD COLUMN ExternalReference text NOT NULL DEFAULT \'\'');
|
| 2667 |
+
}
|
| 2668 |
+
|
| 2669 |
try
|
| 2670 |
{
|
| 2671 |
$db->exec('SELECT 1 FROM ProductAttributeValue WHERE ProductExternalReference IS NULL LIMIT 1');
|
app/code/community/Codisto/Sync/controllers/IndexController.php
CHANGED
|
@@ -751,7 +751,35 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
|
|
| 751 |
|
| 752 |
if(strtolower($freightservice) != 'freight')
|
| 753 |
{
|
| 754 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 755 |
}
|
| 756 |
|
| 757 |
$ordersubtotal -= $freighttotalextax;
|
|
@@ -1032,7 +1060,35 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
|
|
| 1032 |
|
| 1033 |
if(strtolower($freightservice) != 'freight')
|
| 1034 |
{
|
| 1035 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1036 |
}
|
| 1037 |
|
| 1038 |
$ordersubtotal -= $freighttotalextax;
|
| 751 |
|
| 752 |
if(strtolower($freightservice) != 'freight')
|
| 753 |
{
|
| 754 |
+
$matchFound = false;
|
| 755 |
+
|
| 756 |
+
$shippingDescription = $quote->getShippingAddress()->getShippingDescription();
|
| 757 |
+
if($shippingDescription)
|
| 758 |
+
{
|
| 759 |
+
$shippingRates = $quote->getShippingAddress()->getAllShippingRates();
|
| 760 |
+
|
| 761 |
+
foreach($shippingRates as $rate)
|
| 762 |
+
{
|
| 763 |
+
$shippingMethodTitle = $rate->getMethodTitle();
|
| 764 |
+
|
| 765 |
+
if(strpos($shippingDescription, $shippingMethodTitle) !== false)
|
| 766 |
+
{
|
| 767 |
+
$shippingDescription = str_replace($shippingMethodTitle, $freightservice, $shippingDescription);
|
| 768 |
+
$matchFound = true;
|
| 769 |
+
break;
|
| 770 |
+
}
|
| 771 |
+
}
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
if(!$matchFound)
|
| 775 |
+
{
|
| 776 |
+
$shippingDescription = $freightservice;
|
| 777 |
+
}
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
if($shippingDescription)
|
| 781 |
+
{
|
| 782 |
+
$order->setShippingDescription($shippingDescription);
|
| 783 |
}
|
| 784 |
|
| 785 |
$ordersubtotal -= $freighttotalextax;
|
| 1060 |
|
| 1061 |
if(strtolower($freightservice) != 'freight')
|
| 1062 |
{
|
| 1063 |
+
$matchFound = false;
|
| 1064 |
+
|
| 1065 |
+
$shippingDescription = $quote->getShippingAddress()->getShippingDescription();
|
| 1066 |
+
if($shippingDescription)
|
| 1067 |
+
{
|
| 1068 |
+
$shippingRates = $quote->getShippingAddress()->getAllShippingRates();
|
| 1069 |
+
|
| 1070 |
+
foreach($shippingRates as $rate)
|
| 1071 |
+
{
|
| 1072 |
+
$shippingMethodTitle = $rate->getMethodTitle();
|
| 1073 |
+
|
| 1074 |
+
if(strpos($shippingDescription, $shippingMethodTitle) !== false)
|
| 1075 |
+
{
|
| 1076 |
+
$shippingDescription = str_replace($shippingMethodTitle, $freightservice, $shippingDescription);
|
| 1077 |
+
$matchFound = true;
|
| 1078 |
+
break;
|
| 1079 |
+
}
|
| 1080 |
+
}
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
if(!$matchFound)
|
| 1084 |
+
{
|
| 1085 |
+
$shippingDescription = $freightservice;
|
| 1086 |
+
}
|
| 1087 |
+
}
|
| 1088 |
+
|
| 1089 |
+
if($shippingDescription)
|
| 1090 |
+
{
|
| 1091 |
+
$order->setShippingDescription($shippingDescription);
|
| 1092 |
}
|
| 1093 |
|
| 1094 |
$ordersubtotal -= $freighttotalextax;
|
app/code/community/Codisto/Sync/controllers/SyncController.php
CHANGED
|
@@ -254,7 +254,7 @@ class Codisto_Sync_SyncController extends Mage_Core_Controller_Front_Action
|
|
| 254 |
|
| 255 |
if($ordersAvailable)
|
| 256 |
{
|
| 257 |
-
$db->exec('CREATE TABLE [Order] AS SELECT * FROM SyncDb.[Order] WHERE
|
| 258 |
$db->exec('CREATE TABLE OrderChange AS SELECT * FROM SyncDb.OrderChange');
|
| 259 |
}
|
| 260 |
}
|
| 254 |
|
| 255 |
if($ordersAvailable)
|
| 256 |
{
|
| 257 |
+
$db->exec('CREATE TABLE [Order] AS SELECT * FROM SyncDb.[Order] WHERE ExternalReference = \'\' OR ExternalReference IN (SELECT ExternalReference FROM SyncDb.OrderChange)');
|
| 258 |
$db->exec('CREATE TABLE OrderChange AS SELECT * FROM SyncDb.OrderChange');
|
| 259 |
}
|
| 260 |
}
|
app/code/community/Codisto/Sync/data/codisto_setup/{data-install-1.90.12.php → data-install-1.90.13.php}
RENAMED
|
File without changes
|
app/code/community/Codisto/Sync/etc/config.xml
CHANGED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
<config>
|
| 24 |
<modules>
|
| 25 |
<Codisto_Sync>
|
| 26 |
-
<version>1.90.
|
| 27 |
<depends>
|
| 28 |
<Mage_Payment/>
|
| 29 |
</depends>
|
| 23 |
<config>
|
| 24 |
<modules>
|
| 25 |
<Codisto_Sync>
|
| 26 |
+
<version>1.90.13</version>
|
| 27 |
<depends>
|
| 28 |
<Mage_Payment/>
|
| 29 |
</depends>
|
app/code/community/Codisto/Sync/sql/codisto_setup/{mysql4-install-1.90.12.php → mysql4-install-1.90.13.php}
RENAMED
|
File without changes
|
package.xml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
-
<package><name>codistoconnect</name><version>1.90.
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
+
<package><name>codistoconnect</name><version>1.90.13</version><stability>stable</stability><license>OSL-3.0</license><channel>community</channel><extends></extends><summary>Fastest, Easiest eBay listing</summary><description>CodistoConnect enables you to list on eBay in the simplest way possible with maximum performance</description><notes></notes><authors><author><name>Codisto</name><user>Codisto</user><email>hello@codisto.com</email></author></authors><date>2016-09-15</date><time>18:27:54</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="design"><dir name="ebay"><file name="README" hash="8a3f3351f68ccde9f161cdbe3960392f"/></dir></dir><dir name="code"><dir name="community"><dir name="Codisto"><dir name="Sync"><dir name="Helper"><file name="CmsContent.php" hash="f00b4523d681c60c660089d0de0f2e03"/><file name="Data.php" hash="47f7bc430c410c9989da367a8daff645"/><file name="Signal.php" hash="b624f962056ceffae9c3160ed3e5655e"/></dir><dir name="controllers"><file name="CodistoController.php" hash="eccbf167582d60ae559b7455b9b8e7ea"/><file name="IndexController.php" hash="62e550f21def246ae4a77b531213e988"/><file name="SyncController.php" hash="330295cefacba45b90b4f6e6fb68d72c"/></dir><dir name="Controller"><file name="Router.php" hash="66d43bfbe826fe525dc764d42146cd50"/></dir><dir name="Test"><file name="README" hash="8299e52f9198536ff5fd3fb42f4a29d8"/><dir name="Config"><file name="AdminHtml.php" hash="6ee6404e52ed6376ad41b7556f265c32"/><file name="Config.php" hash="2e9023fcbab484d03936394934f44f13"/><dir name="Config"><dir name="expectations"><file name="testCodistoCoreConfig.yaml" hash="4a4e07f62981139ff6eb8a63420cbf0d"/></dir></dir></dir><dir name="Controllers"><file name="CodistoController.php" hash="a2be4faeac73ff1847c0d7dc4fbdc0e0"/><file name="IndexController.php" hash="f7252fae8d2f7b67397ae56524db49d1"/><file name="SyncController.php" hash="33436e4935631488073765d723a82ff7"/></dir><dir name="Controller"><file name="Router.php" hash="8afc0dca269dd0977ff6b3ac6802d0ee"/></dir><dir name="Model"><file name="Paymentmethod.php" hash="862365909073ffbba057f6f152933826"/><file name="Sync.php" hash="10a38bbb62260208a8b1529e762b7b75"/></dir></dir><dir name="sql"><dir name="codisto_setup"><file name="mysql4-install-1.90.13.php" hash="6d07d4e22ae5d907df1f4389c3a829d4"/></dir></dir><dir name="data"><dir name="codisto_setup"><file name="data-install-1.90.13.php" hash="29334830432cf1a02e4a992b9a42d6c5"/></dir></dir><dir name="Block"><file name="PaymentInfo.php" hash="7aa15fed37766d20d9d5a7d707aff80d"/></dir><dir name="Ebaypayment"><dir name="Model"><file name="Paymentmethod.php" hash="480787461a5b952a739f20a752bffb5d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9503ace98df8dfa2f2ec460b30e1053d"/><file name="config.xml" hash="5805b63c65ce69578d5d27d62a083491"/></dir><dir name="Model"><file name="Observer.php" hash="8b309ae85f2bf696e97ff6777c1d64f2"/><file name="Sync.php" hash="35f5368c4a6db2cfbc0fdb5934621d6e"/><dir name="Indexer"><file name="Ebay.php" hash="556b1aabc7c3202f31a2e6c250e7d590"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="6a6664ea18d93bcdd0f45530caa56244"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Codisto_Sync.xml" hash="a791bc2a9302d085eb29edf77421f525"/></dir></dir></dir></target></contents></package>
|
