codistoconnect - Version 1.90.9

Version Notes

Download this release

Release Info

Developer Codisto
Extension codistoconnect
Version 1.90.9
Comparing to
See all releases


Code changes from version 1.90.7 to 1.90.9

app/code/community/Codisto/Sync/Model/Sync.php CHANGED
@@ -285,14 +285,12 @@ class Codisto_Sync_Model_Sync
285
  $insertSKULink = $db->prepare('INSERT OR REPLACE INTO SKULink (SKUExternalReference, ProductExternalReference, Price) VALUES (?, ?, ?)');
286
  $insertSKUMatrix = $db->prepare('INSERT INTO SKUMatrix(SKUExternalReference, ProductExternalReference, Code, OptionName, OptionValue, ProductOptionExternalReference, ProductOptionValueExternalReference) VALUES(?,?,?,?,?,?,?)');
287
  $insertImage = $db->prepare('INSERT INTO ProductImage(ProductExternalReference, URL, Tag, Sequence, Enabled) VALUES(?,?,?,?,?)');
288
- $insertProductOptionValue = $db->prepare('INSERT INTO ProductOptionValue (ExternalReference, Sequence) VALUES (?,?)');
289
  $insertProductHTML = $db->prepare('INSERT OR IGNORE INTO ProductHTML(ProductExternalReference, Tag, HTML) VALUES (?, ?, ?)');
290
- $clearAttribute = $db->prepare('DELETE FROM ProductAttributeValue WHERE ProductExternalReference = ?');
291
  $insertAttribute = $db->prepare('INSERT OR REPLACE INTO Attribute(ID, Code, Label, Type, Input) VALUES (?, ?, ?, ?, ?)');
292
  $insertAttributeGroup = $db->prepare('INSERT OR IGNORE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
293
  $insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
294
  $insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
295
- $clearProductQuestion = $db->prepare('DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference = ?1); DELETE FROM ProductQuestion WHERE ProductExternalReference = ?1');
296
  $insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
297
  $insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
298
 
@@ -324,16 +322,28 @@ class Codisto_Sync_Model_Sync
324
  $simpleProducts->getSelect()
325
  ->columns(array('codisto_in_store'=> new Zend_Db_Expr('CASE WHEN `e`.entity_id IN (SELECT product_id FROM `'.$catalogWebsiteName.'` WHERE website_id IN (SELECT website_id FROM `'.$storeName.'` WHERE store_id = '.$storeId.' OR EXISTS(SELECT 1 FROM `'.$storeName.'` WHERE store_id = '.$storeId.' AND website_id = 0))) THEN -1 ELSE 0 END')));
326
 
 
 
 
 
 
 
 
 
 
 
327
  $db->exec('BEGIN EXCLUSIVE TRANSACTION');
328
 
329
  $db->exec('DELETE FROM Product WHERE ExternalReference IN ('.implode(',', $ids).')');
330
  $db->exec('DELETE FROM ProductImage WHERE ProductExternalReference IN ('.implode(',', $ids).')');
331
  $db->exec('DELETE FROM ProductHTML WHERE ProductExternalReference IN ('.implode(',', $ids).')');
 
 
 
 
332
  $db->exec('DELETE FROM SKUMatrix WHERE ProductExternalReference IN ('.implode(',', $ids).')');
333
  $db->exec('DELETE FROM SKULink WHERE ProductExternalReference IN ('.implode(',', $ids).')');
334
  $db->exec('DELETE FROM SKU WHERE ProductExternalReference IN ('.implode(',', $ids).')');
335
- $db->exec('DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $ids).'))');
336
- $db->exec('DELETE FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $ids).')');
337
  $db->exec('DELETE FROM CategoryProduct WHERE ProductExternalReference IN ('.implode(',', $ids).')');
338
 
339
  Mage::getSingleton('core/resource_iterator')->walk($configurableProducts->getSelect(), array(array($this, 'SyncConfigurableProductData')),
@@ -347,14 +357,12 @@ class Codisto_Sync_Model_Sync
347
  'preparedskumatrixStatement' => $insertSKUMatrix,
348
  'preparedcategoryproductStatement' => $insertCategoryProduct,
349
  'preparedimageStatement' => $insertImage,
350
- 'preparedproductoptionvalueStatement' => $insertProductOptionValue,
351
  'preparedproducthtmlStatement' => $insertProductHTML,
352
- 'preparedclearattributeStatement' => $clearAttribute,
353
  'preparedattributeStatement' => $insertAttribute,
354
  'preparedattributegroupStatement' => $insertAttributeGroup,
355
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
356
  'preparedproductattributeStatement' => $insertProductAttribute,
357
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
358
  'preparedproductquestionStatement' => $insertProductQuestion,
359
  'preparedproductanswerStatement' => $insertProductAnswer,
360
  'store' => $store )
@@ -369,17 +377,40 @@ class Codisto_Sync_Model_Sync
369
  'preparedcategoryproductStatement' => $insertCategoryProduct,
370
  'preparedimageStatement' => $insertImage,
371
  'preparedproducthtmlStatement' => $insertProductHTML,
372
- 'preparedclearattributeStatement' => $clearAttribute,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  'preparedattributeStatement' => $insertAttribute,
374
  'preparedattributegroupStatement' => $insertAttributeGroup,
375
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
376
  'preparedproductattributeStatement' => $insertProductAttribute,
377
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
378
  'preparedproductquestionStatement' => $insertProductQuestion,
379
  'preparedproductanswerStatement' => $insertProductAnswer,
380
  'store' => $store )
381
  );
382
 
 
 
383
  $insertProductOptionValue = $db->prepare('INSERT INTO ProductOptionValue (ExternalReference, Sequence) VALUES (?,?)');
384
 
385
  $options = Mage::getResourceModel('eav/entity_attribute_option_collection')
@@ -401,22 +432,30 @@ class Codisto_Sync_Model_Sync
401
 
402
  $db->exec('BEGIN EXCLUSIVE TRANSACTION');
403
 
 
 
404
  if(!is_array($ids))
405
  {
406
  $ids = array($ids);
407
  }
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  foreach($ids as $id)
410
  {
411
- $db->exec( 'CREATE TABLE IF NOT EXISTS ProductDelete(ExternalReference text NOT NULL PRIMARY KEY);'.
412
- 'INSERT OR IGNORE INTO ProductDelete VALUES('.$id.');'.
413
- 'DELETE FROM Product WHERE ExternalReference = '.$id.';'.
414
- 'DELETE FROM ProductImage WHERE ProductExternalReference = '.$id.';'.
415
- 'DELETE FROM ProductHTML WHERE ProductExternalReference = '.$id.';'.
416
- 'DELETE FROM SKULink WHERE ProductExternalReference = '.$id.';'.
417
- 'DELETE FROM SKUMatrix WHERE ProductExternalReference = '.$id.';'.
418
- 'DELETE FROM SKU WHERE ProductExternalReference = '.$id.';'.
419
- 'DELETE FROM CategoryProduct WHERE ProductExternalReference = '.$id);
420
  }
421
 
422
  $db->exec('COMMIT TRANSACTION');
@@ -768,12 +807,11 @@ class Codisto_Sync_Model_Sync
768
  $insertCategorySQL = $args['preparedcategoryproductStatement'];
769
  $insertImageSQL = $args['preparedimageStatement'];
770
  $insertHTMLSQL = $args['preparedproducthtmlStatement'];
771
- $clearAttributeSQL = $args['preparedclearattributeStatement'];
772
  $insertAttributeSQL = $args['preparedattributeStatement'];
773
  $insertAttributeGroupSQL = $args['preparedattributegroupStatement'];
774
  $insertAttributeGroupMapSQL = $args['preparedattributegroupmapStatement'];
775
  $insertProductAttributeSQL = $args['preparedproductattributeStatement'];
776
- $clearProductQuestionSQL = $args['preparedclearproductquestionStatement'];
777
  $insertProductQuestionSQL = $args['preparedproductquestionStatement'];
778
  $insertProductAnswerSQL = $args['preparedproductanswerStatement'];
779
 
@@ -859,8 +897,6 @@ class Codisto_Sync_Model_Sync
859
  $insertHTMLSQL->execute(array($product_id, 'Short Description', $shortDescription));
860
  }
861
 
862
- $clearAttributeSQL->execute(array($product_id));
863
-
864
  $attributeSet = array();
865
  $attributeCodes = array();
866
  $attributeTypes = array();
@@ -1252,9 +1288,14 @@ class Codisto_Sync_Model_Sync
1252
  }
1253
  }
1254
 
 
 
 
 
 
 
1255
 
1256
  // process simple product question/answers
1257
- $clearProductQuestionSQL->execute(array($product_id));
1258
 
1259
  $options = $product->getProductOptionsCollection();
1260
 
@@ -1432,6 +1473,10 @@ class Codisto_Sync_Model_Sync
1432
  'DELETE FROM Product WHERE ExternalReference IN ('.implode(',', $productUpdateIds).');'.
1433
  'DELETE FROM ProductImage WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1434
  'DELETE FROM ProductHTML WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
 
 
 
 
1435
  'DELETE FROM SKULink WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1436
  'DELETE FROM SKUMatrix WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1437
  'DELETE FROM SKU WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
@@ -1445,20 +1490,18 @@ class Codisto_Sync_Model_Sync
1445
  $insertSKULink = $db->prepare('INSERT OR REPLACE INTO SKULink (SKUExternalReference, ProductExternalReference, Price) VALUES (?, ?, ?)');
1446
  $insertSKUMatrix = $db->prepare('INSERT INTO SKUMatrix(SKUExternalReference, ProductExternalReference, Code, OptionName, OptionValue, ProductOptionExternalReference, ProductOptionValueExternalReference) VALUES(?,?,?,?,?,?,?)');
1447
  $insertImage = $db->prepare('INSERT INTO ProductImage(ProductExternalReference, URL, Tag, Sequence, Enabled) VALUES(?,?,?,?,?)');
1448
- $insertProductOptionValue = $db->prepare('INSERT INTO ProductOptionValue (ExternalReference, Sequence) VALUES (?,?)');
1449
  $insertProductHTML = $db->prepare('INSERT OR IGNORE INTO ProductHTML(ProductExternalReference, Tag, HTML) VALUES (?, ?, ?)');
1450
- $clearAttribute = $db->prepare('DELETE FROM ProductAttributeValue WHERE ProductExternalReference = ?');
1451
  $insertAttribute = $db->prepare('INSERT OR REPLACE INTO Attribute(ID, Code, Label, Type, Input) VALUES (?, ?, ?, ?, ?)');
1452
  $insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
1453
  $insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
1454
  $insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
1455
- $clearProductQuestion = $db->prepare('DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference = ?1); DELETE FROM ProductQuestion WHERE ProductExternalReference = ?1');
1456
  $insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
1457
  $insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
1458
 
1459
  // Simple Products not participating as configurable skus
1460
  $simpleProducts = $this->getProductCollection()
1461
- ->addAttributeToSelect(array('entity_id', 'sku', 'name', 'image', 'description', 'short_description', 'price', 'special_price', 'special_from_date', 'special_to_date', 'status', 'tax_class_id', 'weight'), 'left')
1462
  ->addAttributeToFilter('type_id', array('eq' => 'simple'))
1463
  ->addAttributeToFilter('entity_id', array('in' => $productUpdateIds) );
1464
  $simpleProducts->getSelect()
@@ -1469,22 +1512,22 @@ class Codisto_Sync_Model_Sync
1469
  'type' => 'simple',
1470
  'db' => $db,
1471
  'preparedStatement' => $insertProduct,
 
1472
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1473
  'preparedimageStatement' => $insertImage,
1474
  'preparedproducthtmlStatement' => $insertProductHTML,
1475
- 'preparedclearattributeStatement' => $clearAttribute,
1476
  'preparedattributeStatement' => $insertAttribute,
1477
  'preparedattributegroupStatement' => $insertAttributeGroup,
1478
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1479
  'preparedproductattributeStatement' => $insertProductAttribute,
1480
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
1481
  'preparedproductquestionStatement' => $insertProductQuestion,
1482
  'preparedproductanswerStatement' => $insertProductAnswer,
1483
  'store' => $storeObject ));
1484
 
1485
  // Configurable products
1486
  $configurableProducts = $this->getProductCollection()
1487
- ->addAttributeToSelect(array('entity_id', 'sku', 'name', 'image', 'description', 'short_description', 'price', 'special_price', 'special_from_date', 'special_to_date', 'status', 'tax_class_id', 'weight'), 'left')
1488
  ->addAttributeToFilter('type_id', array('eq' => 'configurable'))
1489
  ->addAttributeToFilter('entity_id', array('in' => $productUpdateIds));
1490
  $configurableProducts->getSelect()
@@ -1495,18 +1538,18 @@ class Codisto_Sync_Model_Sync
1495
  'type' => 'configurable',
1496
  'db' => $db,
1497
  'preparedStatement' => $insertProduct,
 
1498
  'preparedskuStatement' => $insertSKU,
1499
  'preparedskulinkStatement' => $insertSKULink,
1500
  'preparedskumatrixStatement' => $insertSKUMatrix,
1501
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1502
  'preparedimageStatement' => $insertImage,
1503
  'preparedproducthtmlStatement' => $insertProductHTML,
1504
- 'preparedclearattributeStatement' => $clearAttribute,
1505
  'preparedattributeStatement' => $insertAttribute,
1506
  'preparedattributegroupStatement' => $insertAttributeGroup,
1507
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1508
  'preparedproductattributeStatement' => $insertProductAttribute,
1509
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
1510
  'preparedproductquestionStatement' => $insertProductQuestion,
1511
  'preparedproductanswerStatement' => $insertProductAnswer,
1512
  'store' => $storeObject )
@@ -1514,7 +1557,7 @@ class Codisto_Sync_Model_Sync
1514
 
1515
  // Grouped products
1516
  $groupedProducts = $this->getProductCollection()
1517
- ->addAttributeToSelect(array('entity_id', 'sku', 'name', 'image', 'description', 'short_description', 'price', 'special_price', 'special_from_date', 'special_to_date', 'status', 'tax_class_id', 'weight'), 'left')
1518
  ->addAttributeToFilter('type_id', array('eq' => 'grouped'))
1519
  ->addAttributeToFilter('entity_id', array('in' => $productUpdateIds ));
1520
 
@@ -1526,18 +1569,18 @@ class Codisto_Sync_Model_Sync
1526
  'type' => 'grouped',
1527
  'db' => $db,
1528
  'preparedStatement' => $insertProduct,
 
1529
  'preparedskuStatement' => $insertSKU,
1530
  'preparedskulinkStatement' => $insertSKULink,
1531
  'preparedskumatrixStatement' => $insertSKUMatrix,
1532
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1533
  'preparedimageStatement' => $insertImage,
1534
  'preparedproducthtmlStatement' => $insertProductHTML,
1535
- 'preparedclearattributeStatement' => $clearAttribute,
1536
  'preparedattributeStatement' => $insertAttribute,
1537
  'preparedattributegroupStatement' => $insertAttributeGroup,
1538
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1539
  'preparedproductattributeStatement' => $insertProductAttribute,
1540
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
1541
  'preparedproductquestionStatement' => $insertProductQuestion,
1542
  'preparedproductanswerStatement' => $insertProductAnswer,
1543
  'store' => $storeObject )
@@ -1622,6 +1665,20 @@ class Codisto_Sync_Model_Sync
1622
  {
1623
  $db->exec('INSERT OR REPLACE INTO ProductChange (ExternalReference) VALUES ('.$updateId.')');
1624
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1625
  }
1626
 
1627
  if(!empty($categoryUpdateIds))
@@ -1777,14 +1834,12 @@ class Codisto_Sync_Model_Sync
1777
  $insertSKULink = $db->prepare('INSERT OR REPLACE INTO SKULink (SKUExternalReference, ProductExternalReference, Price) VALUES (?, ?, ?)');
1778
  $insertSKUMatrix = $db->prepare('INSERT INTO SKUMatrix(SKUExternalReference, ProductExternalReference, Code, OptionName, OptionValue, ProductOptionExternalReference, ProductOptionValueExternalReference) VALUES(?,?,?,?,?,?,?)');
1779
  $insertImage = $db->prepare('INSERT INTO ProductImage(ProductExternalReference, URL, Tag, Sequence, Enabled) VALUES(?,?,?,?,?)');
1780
- $insertProductOptionValue = $db->prepare('INSERT INTO ProductOptionValue (ExternalReference, Sequence) VALUES (?,?)');
1781
  $insertProductHTML = $db->prepare('INSERT OR IGNORE INTO ProductHTML(ProductExternalReference, Tag, HTML) VALUES (?, ?, ?)');
1782
- $clearAttribute = $db->prepare('DELETE FROM ProductAttributeValue WHERE ProductExternalReference = ?');
1783
  $insertAttribute = $db->prepare('INSERT OR REPLACE INTO Attribute(ID, Code, Label, Type, Input) VALUES (?, ?, ?, ?, ?)');
1784
  $insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
1785
  $insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
1786
  $insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
1787
- $clearProductQuestion = $db->prepare('DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference = ?1); DELETE FROM ProductQuestion WHERE ProductExternalReference = ?1');
1788
  $insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
1789
  $insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
1790
  $insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber) VALUES (?, ?, ?, ?, ?, ?)');
@@ -1895,12 +1950,11 @@ class Codisto_Sync_Model_Sync
1895
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1896
  'preparedimageStatement' => $insertImage,
1897
  'preparedproducthtmlStatement' => $insertProductHTML,
1898
- 'preparedclearattributeStatement' => $clearAttribute,
1899
  'preparedattributeStatement' => $insertAttribute,
1900
  'preparedattributegroupStatement' => $insertAttributeGroup,
1901
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1902
  'preparedproductattributeStatement' => $insertProductAttribute,
1903
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
1904
  'preparedproductquestionStatement' => $insertProductQuestion,
1905
  'preparedproductanswerStatement' => $insertProductAnswer,
1906
  'store' => $store ));
@@ -1942,12 +1996,11 @@ class Codisto_Sync_Model_Sync
1942
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1943
  'preparedimageStatement' => $insertImage,
1944
  'preparedproducthtmlStatement' => $insertProductHTML,
1945
- 'preparedclearattributeStatement' => $clearAttribute,
1946
  'preparedattributeStatement' => $insertAttribute,
1947
  'preparedattributegroupStatement' => $insertAttributeGroup,
1948
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1949
  'preparedproductattributeStatement' => $insertProductAttribute,
1950
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
1951
  'preparedproductquestionStatement' => $insertProductQuestion,
1952
  'preparedproductanswerStatement' => $insertProductAnswer,
1953
  'store' => $store )
@@ -1990,12 +2043,11 @@ class Codisto_Sync_Model_Sync
1990
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1991
  'preparedimageStatement' => $insertImage,
1992
  'preparedproducthtmlStatement' => $insertProductHTML,
1993
- 'preparedclearattributeStatement' => $clearAttribute,
1994
  'preparedattributeStatement' => $insertAttribute,
1995
  'preparedattributegroupStatement' => $insertAttributeGroup,
1996
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1997
  'preparedproductattributeStatement' => $insertProductAttribute,
1998
- 'preparedclearproductquestionStatement' => $clearProductQuestion,
1999
  'preparedproductquestionStatement' => $insertProductQuestion,
2000
  'preparedproductanswerStatement' => $insertProductAnswer,
2001
  'store' => $store )
@@ -2437,6 +2489,8 @@ class Codisto_Sync_Model_Sync
2437
  $db->exec('CREATE TABLE IF NOT EXISTS ProductHTML (ProductExternalReference text NOT NULL, Tag text NOT NULL, HTML text NOT NULL, PRIMARY KEY (ProductExternalReference, Tag))');
2438
  $db->exec('CREATE INDEX IF NOT EXISTS IX_ProductHTML_ProductExternalReference ON ProductHTML(ProductExternalReference)');
2439
 
 
 
2440
  $db->exec('CREATE TABLE IF NOT EXISTS Attribute (ID integer NOT NULL PRIMARY KEY, Code text NOT NULL, Label text NOT NULL, Type text NOT NULL, Input text NOT NULL)');
2441
  $db->exec('CREATE TABLE IF NOT EXISTS AttributeGroupMap (AttributeID integer NOT NULL, GroupID integer NOT NULL, PRIMARY KEY(AttributeID, GroupID))');
2442
  $db->exec('CREATE TABLE IF NOT EXISTS AttributeGroup (ID integer NOT NULL PRIMARY KEY, Name text NOT NULL)');
285
  $insertSKULink = $db->prepare('INSERT OR REPLACE INTO SKULink (SKUExternalReference, ProductExternalReference, Price) VALUES (?, ?, ?)');
286
  $insertSKUMatrix = $db->prepare('INSERT INTO SKUMatrix(SKUExternalReference, ProductExternalReference, Code, OptionName, OptionValue, ProductOptionExternalReference, ProductOptionValueExternalReference) VALUES(?,?,?,?,?,?,?)');
287
  $insertImage = $db->prepare('INSERT INTO ProductImage(ProductExternalReference, URL, Tag, Sequence, Enabled) VALUES(?,?,?,?,?)');
 
288
  $insertProductHTML = $db->prepare('INSERT OR IGNORE INTO ProductHTML(ProductExternalReference, Tag, HTML) VALUES (?, ?, ?)');
289
+ $insertProductRelated = $db->prepare('INSERT OR IGNORE INTO ProductRelated (RelatedProductExternalReference, ProductExternalReference) VALUES (?, ?)');
290
  $insertAttribute = $db->prepare('INSERT OR REPLACE INTO Attribute(ID, Code, Label, Type, Input) VALUES (?, ?, ?, ?, ?)');
291
  $insertAttributeGroup = $db->prepare('INSERT OR IGNORE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
292
  $insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
293
  $insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
 
294
  $insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
295
  $insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
296
 
322
  $simpleProducts->getSelect()
323
  ->columns(array('codisto_in_store'=> new Zend_Db_Expr('CASE WHEN `e`.entity_id IN (SELECT product_id FROM `'.$catalogWebsiteName.'` WHERE website_id IN (SELECT website_id FROM `'.$storeName.'` WHERE store_id = '.$storeId.' OR EXISTS(SELECT 1 FROM `'.$storeName.'` WHERE store_id = '.$storeId.' AND website_id = 0))) THEN -1 ELSE 0 END')));
324
 
325
+ // Grouped products
326
+ $groupedProducts = $this->getProductCollection()
327
+ ->addAttributeToSelect($this->availableProductFields, 'left')
328
+ ->addAttributeToFilter('type_id', array('eq' => 'grouped'))
329
+ ->addAttributeToFilter('entity_id', array('in' => $ids ));
330
+
331
+ $groupedProducts->getSelect()
332
+ ->columns(array('codisto_in_store' => new Zend_Db_Expr('CASE WHEN `e`.entity_id IN (SELECT product_id FROM `'.$catalogWebsiteName.'` WHERE website_id IN (SELECT website_id FROM `'.$storeName.'` WHERE store_id = '.$storeId.' OR EXISTS(SELECT 1 FROM `'.$storeName.'` WHERE store_id = '.$storeId.' AND website_id = 0))) THEN -1 ELSE 0 END')));
333
+
334
+
335
  $db->exec('BEGIN EXCLUSIVE TRANSACTION');
336
 
337
  $db->exec('DELETE FROM Product WHERE ExternalReference IN ('.implode(',', $ids).')');
338
  $db->exec('DELETE FROM ProductImage WHERE ProductExternalReference IN ('.implode(',', $ids).')');
339
  $db->exec('DELETE FROM ProductHTML WHERE ProductExternalReference IN ('.implode(',', $ids).')');
340
+ $db->exec('DELETE FROM ProductRelated WHERE ProductExternalReference IN ('.implode(',', $ids).')');
341
+ $db->exec('DELETE FROM ProductAttributeValue WHERE ProductExternalReference IN ('.implode(',', $ids).')');
342
+ $db->exec('DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $ids).'))');
343
+ $db->exec('DELETE FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $ids).')');
344
  $db->exec('DELETE FROM SKUMatrix WHERE ProductExternalReference IN ('.implode(',', $ids).')');
345
  $db->exec('DELETE FROM SKULink WHERE ProductExternalReference IN ('.implode(',', $ids).')');
346
  $db->exec('DELETE FROM SKU WHERE ProductExternalReference IN ('.implode(',', $ids).')');
 
 
347
  $db->exec('DELETE FROM CategoryProduct WHERE ProductExternalReference IN ('.implode(',', $ids).')');
348
 
349
  Mage::getSingleton('core/resource_iterator')->walk($configurableProducts->getSelect(), array(array($this, 'SyncConfigurableProductData')),
357
  'preparedskumatrixStatement' => $insertSKUMatrix,
358
  'preparedcategoryproductStatement' => $insertCategoryProduct,
359
  'preparedimageStatement' => $insertImage,
 
360
  'preparedproducthtmlStatement' => $insertProductHTML,
361
+ 'preparedproductrelatedStatement' => $insertProductRelated,
362
  'preparedattributeStatement' => $insertAttribute,
363
  'preparedattributegroupStatement' => $insertAttributeGroup,
364
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
365
  'preparedproductattributeStatement' => $insertProductAttribute,
 
366
  'preparedproductquestionStatement' => $insertProductQuestion,
367
  'preparedproductanswerStatement' => $insertProductAnswer,
368
  'store' => $store )
377
  'preparedcategoryproductStatement' => $insertCategoryProduct,
378
  'preparedimageStatement' => $insertImage,
379
  'preparedproducthtmlStatement' => $insertProductHTML,
380
+ 'preparedproductrelatedStatement' => $insertProductRelated,
381
+ 'preparedattributeStatement' => $insertAttribute,
382
+ 'preparedattributegroupStatement' => $insertAttributeGroup,
383
+ 'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
384
+ 'preparedproductattributeStatement' => $insertProductAttribute,
385
+ 'preparedproductquestionStatement' => $insertProductQuestion,
386
+ 'preparedproductanswerStatement' => $insertProductAnswer,
387
+ 'store' => $store )
388
+ );
389
+
390
+ Mage::getSingleton('core/resource_iterator')->walk($groupedProducts->getSelect(), array(array($this, 'SyncGroupedProductData')),
391
+ array(
392
+ 'type' => 'grouped',
393
+ 'db' => $db,
394
+ 'preparedStatement' => $insertProduct,
395
+ 'preparedcheckproductStatement' => $checkProduct,
396
+ 'preparedskuStatement' => $insertSKU,
397
+ 'preparedskulinkStatement' => $insertSKULink,
398
+ 'preparedskumatrixStatement' => $insertSKUMatrix,
399
+ 'preparedcategoryproductStatement' => $insertCategoryProduct,
400
+ 'preparedimageStatement' => $insertImage,
401
+ 'preparedproducthtmlStatement' => $insertProductHTML,
402
+ 'preparedproductrelatedStatement' => $insertProductRelated,
403
  'preparedattributeStatement' => $insertAttribute,
404
  'preparedattributegroupStatement' => $insertAttributeGroup,
405
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
406
  'preparedproductattributeStatement' => $insertProductAttribute,
 
407
  'preparedproductquestionStatement' => $insertProductQuestion,
408
  'preparedproductanswerStatement' => $insertProductAnswer,
409
  'store' => $store )
410
  );
411
 
412
+ $db->exec('DELETE FROM ProductOptionValue');
413
+
414
  $insertProductOptionValue = $db->prepare('INSERT INTO ProductOptionValue (ExternalReference, Sequence) VALUES (?,?)');
415
 
416
  $options = Mage::getResourceModel('eav/entity_attribute_option_collection')
432
 
433
  $db->exec('BEGIN EXCLUSIVE TRANSACTION');
434
 
435
+ $db->exec('CREATE TABLE IF NOT EXISTS ProductDelete(ExternalReference text NOT NULL PRIMARY KEY)');
436
+
437
  if(!is_array($ids))
438
  {
439
  $ids = array($ids);
440
  }
441
 
442
+ $db->exec(
443
+ 'DELETE FROM Product WHERE ExternalReference IN ('.implode(',', $ids).');'.
444
+ 'DELETE FROM ProductImage WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
445
+ 'DELETE FROM ProductHTML WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
446
+ 'DELETE FROM ProductRelated WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
447
+ 'DELETE FROM ProductAttributeValue WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
448
+ 'DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $ids).'));'.
449
+ 'DELETE FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
450
+ 'DELETE FROM SKULink WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
451
+ 'DELETE FROM SKUMatrix WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
452
+ 'DELETE FROM SKU WHERE ProductExternalReference IN ('.implode(',', $ids).');'.
453
+ 'DELETE FROM CategoryProduct WHERE ProductExternalReference IN ('.implode(',', $ids).')'
454
+ );
455
+
456
  foreach($ids as $id)
457
  {
458
+ $db->exec('INSERT OR IGNORE INTO ProductDelete VALUES('.$id.')');
 
 
 
 
 
 
 
 
459
  }
460
 
461
  $db->exec('COMMIT TRANSACTION');
807
  $insertCategorySQL = $args['preparedcategoryproductStatement'];
808
  $insertImageSQL = $args['preparedimageStatement'];
809
  $insertHTMLSQL = $args['preparedproducthtmlStatement'];
810
+ $insertRelatedSQL = $args['preparedproductrelatedStatement'];
811
  $insertAttributeSQL = $args['preparedattributeStatement'];
812
  $insertAttributeGroupSQL = $args['preparedattributegroupStatement'];
813
  $insertAttributeGroupMapSQL = $args['preparedattributegroupmapStatement'];
814
  $insertProductAttributeSQL = $args['preparedproductattributeStatement'];
 
815
  $insertProductQuestionSQL = $args['preparedproductquestionStatement'];
816
  $insertProductAnswerSQL = $args['preparedproductanswerStatement'];
817
 
897
  $insertHTMLSQL->execute(array($product_id, 'Short Description', $shortDescription));
898
  }
899
 
 
 
900
  $attributeSet = array();
901
  $attributeCodes = array();
902
  $attributeTypes = array();
1288
  }
1289
  }
1290
 
1291
+ // process related products
1292
+ $relatedProductIds = $product->getRelatedProductIds();
1293
+ foreach($relatedProductIds as $relatedProductId)
1294
+ {
1295
+ $insertRelatedSQL->execute(array($relatedProductId, $product_id));
1296
+ }
1297
 
1298
  // process simple product question/answers
 
1299
 
1300
  $options = $product->getProductOptionsCollection();
1301
 
1473
  'DELETE FROM Product WHERE ExternalReference IN ('.implode(',', $productUpdateIds).');'.
1474
  'DELETE FROM ProductImage WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1475
  'DELETE FROM ProductHTML WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1476
+ 'DELETE FROM ProductRelated WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1477
+ 'DELETE FROM ProductAttributeValue WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1478
+ 'DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).'));'.
1479
+ 'DELETE FROM ProductQuestion WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1480
  'DELETE FROM SKULink WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1481
  'DELETE FROM SKUMatrix WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1482
  'DELETE FROM SKU WHERE ProductExternalReference IN ('.implode(',', $productUpdateIds).');'.
1490
  $insertSKULink = $db->prepare('INSERT OR REPLACE INTO SKULink (SKUExternalReference, ProductExternalReference, Price) VALUES (?, ?, ?)');
1491
  $insertSKUMatrix = $db->prepare('INSERT INTO SKUMatrix(SKUExternalReference, ProductExternalReference, Code, OptionName, OptionValue, ProductOptionExternalReference, ProductOptionValueExternalReference) VALUES(?,?,?,?,?,?,?)');
1492
  $insertImage = $db->prepare('INSERT INTO ProductImage(ProductExternalReference, URL, Tag, Sequence, Enabled) VALUES(?,?,?,?,?)');
 
1493
  $insertProductHTML = $db->prepare('INSERT OR IGNORE INTO ProductHTML(ProductExternalReference, Tag, HTML) VALUES (?, ?, ?)');
1494
+ $insertProductRelated = $db->prepare('INSERT OR IGNORE INTO ProductRelated(RelatedProductExternalReference, ProductExternalReference) VALUES (?, ?)');
1495
  $insertAttribute = $db->prepare('INSERT OR REPLACE INTO Attribute(ID, Code, Label, Type, Input) VALUES (?, ?, ?, ?, ?)');
1496
  $insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
1497
  $insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
1498
  $insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
 
1499
  $insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
1500
  $insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
1501
 
1502
  // Simple Products not participating as configurable skus
1503
  $simpleProducts = $this->getProductCollection()
1504
+ ->addAttributeToSelect($this->availableProductFields, 'left')
1505
  ->addAttributeToFilter('type_id', array('eq' => 'simple'))
1506
  ->addAttributeToFilter('entity_id', array('in' => $productUpdateIds) );
1507
  $simpleProducts->getSelect()
1512
  'type' => 'simple',
1513
  'db' => $db,
1514
  'preparedStatement' => $insertProduct,
1515
+ 'preparedcheckproductStatement' => $checkProduct,
1516
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1517
  'preparedimageStatement' => $insertImage,
1518
  'preparedproducthtmlStatement' => $insertProductHTML,
1519
+ 'preparedproductrelatedStatement' => $insertProductRelated,
1520
  'preparedattributeStatement' => $insertAttribute,
1521
  'preparedattributegroupStatement' => $insertAttributeGroup,
1522
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1523
  'preparedproductattributeStatement' => $insertProductAttribute,
 
1524
  'preparedproductquestionStatement' => $insertProductQuestion,
1525
  'preparedproductanswerStatement' => $insertProductAnswer,
1526
  'store' => $storeObject ));
1527
 
1528
  // Configurable products
1529
  $configurableProducts = $this->getProductCollection()
1530
+ ->addAttributeToSelect($this->availableProductFields, 'left')
1531
  ->addAttributeToFilter('type_id', array('eq' => 'configurable'))
1532
  ->addAttributeToFilter('entity_id', array('in' => $productUpdateIds));
1533
  $configurableProducts->getSelect()
1538
  'type' => 'configurable',
1539
  'db' => $db,
1540
  'preparedStatement' => $insertProduct,
1541
+ 'preparedcheckproductStatement' => $checkProduct,
1542
  'preparedskuStatement' => $insertSKU,
1543
  'preparedskulinkStatement' => $insertSKULink,
1544
  'preparedskumatrixStatement' => $insertSKUMatrix,
1545
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1546
  'preparedimageStatement' => $insertImage,
1547
  'preparedproducthtmlStatement' => $insertProductHTML,
1548
+ 'preparedproductrelatedStatement' => $insertProductRelated,
1549
  'preparedattributeStatement' => $insertAttribute,
1550
  'preparedattributegroupStatement' => $insertAttributeGroup,
1551
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1552
  'preparedproductattributeStatement' => $insertProductAttribute,
 
1553
  'preparedproductquestionStatement' => $insertProductQuestion,
1554
  'preparedproductanswerStatement' => $insertProductAnswer,
1555
  'store' => $storeObject )
1557
 
1558
  // Grouped products
1559
  $groupedProducts = $this->getProductCollection()
1560
+ ->addAttributeToSelect($this->availableProductFields, 'left')
1561
  ->addAttributeToFilter('type_id', array('eq' => 'grouped'))
1562
  ->addAttributeToFilter('entity_id', array('in' => $productUpdateIds ));
1563
 
1569
  'type' => 'grouped',
1570
  'db' => $db,
1571
  'preparedStatement' => $insertProduct,
1572
+ 'preparedcheckproductStatement' => $checkProduct,
1573
  'preparedskuStatement' => $insertSKU,
1574
  'preparedskulinkStatement' => $insertSKULink,
1575
  'preparedskumatrixStatement' => $insertSKUMatrix,
1576
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1577
  'preparedimageStatement' => $insertImage,
1578
  'preparedproducthtmlStatement' => $insertProductHTML,
1579
+ 'preparedproductrelatedStatement' => $insertProductRelated,
1580
  'preparedattributeStatement' => $insertAttribute,
1581
  'preparedattributegroupStatement' => $insertAttributeGroup,
1582
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1583
  'preparedproductattributeStatement' => $insertProductAttribute,
 
1584
  'preparedproductquestionStatement' => $insertProductQuestion,
1585
  'preparedproductanswerStatement' => $insertProductAnswer,
1586
  'store' => $storeObject )
1665
  {
1666
  $db->exec('INSERT OR REPLACE INTO ProductChange (ExternalReference) VALUES ('.$updateId.')');
1667
  }
1668
+
1669
+ $db->exec('DELETE FROM ProductOptionValue');
1670
+
1671
+ $insertProductOptionValue = $db->prepare('INSERT INTO ProductOptionValue (ExternalReference, Sequence) VALUES (?,?)');
1672
+
1673
+ $options = Mage::getResourceModel('eav/entity_attribute_option_collection')
1674
+ ->setPositionOrder('asc', true)
1675
+ ->load();
1676
+
1677
+ foreach($options as $opt){
1678
+ $sequence = $opt->getSortOrder();
1679
+ $optId = $opt->getId();
1680
+ $insertProductOptionValue->execute(array($optId, $sequence));
1681
+ }
1682
  }
1683
 
1684
  if(!empty($categoryUpdateIds))
1834
  $insertSKULink = $db->prepare('INSERT OR REPLACE INTO SKULink (SKUExternalReference, ProductExternalReference, Price) VALUES (?, ?, ?)');
1835
  $insertSKUMatrix = $db->prepare('INSERT INTO SKUMatrix(SKUExternalReference, ProductExternalReference, Code, OptionName, OptionValue, ProductOptionExternalReference, ProductOptionValueExternalReference) VALUES(?,?,?,?,?,?,?)');
1836
  $insertImage = $db->prepare('INSERT INTO ProductImage(ProductExternalReference, URL, Tag, Sequence, Enabled) VALUES(?,?,?,?,?)');
 
1837
  $insertProductHTML = $db->prepare('INSERT OR IGNORE INTO ProductHTML(ProductExternalReference, Tag, HTML) VALUES (?, ?, ?)');
1838
+ $insertProductRelated = $db->prepare('INSERT OR IGNORE INTO ProductRelated(RelatedProductExternalReference, ProductExternalReference) VALUES (?, ?)');
1839
  $insertAttribute = $db->prepare('INSERT OR REPLACE INTO Attribute(ID, Code, Label, Type, Input) VALUES (?, ?, ?, ?, ?)');
1840
  $insertAttributeGroup = $db->prepare('INSERT OR REPLACE INTO AttributeGroup(ID, Name) VALUES(?, ?)');
1841
  $insertAttributeGroupMap = $db->prepare('INSERT OR IGNORE INTO AttributeGroupMap(GroupID, AttributeID) VALUES(?,?)');
1842
  $insertProductAttribute = $db->prepare('INSERT OR IGNORE INTO ProductAttributeValue(ProductExternalReference, AttributeID, Value) VALUES (?, ?, ?)');
 
1843
  $insertProductQuestion = $db->prepare('INSERT OR REPLACE INTO ProductQuestion(ExternalReference, ProductExternalReference, Name, Type, Sequence) VALUES (?, ?, ?, ?, ?)');
1844
  $insertProductAnswer = $db->prepare('INSERT INTO ProductQuestionAnswer(ProductQuestionExternalReference, Value, PriceModifier, SKUModifier, Sequence) VALUES (?, ?, ?, ?, ?)');
1845
  $insertOrders = $db->prepare('INSERT OR REPLACE INTO [Order] (ID, Status, PaymentDate, ShipmentDate, Carrier, TrackingNumber) VALUES (?, ?, ?, ?, ?, ?)');
1950
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1951
  'preparedimageStatement' => $insertImage,
1952
  'preparedproducthtmlStatement' => $insertProductHTML,
1953
+ 'preparedproductrelatedStatement' => $insertProductRelated,
1954
  'preparedattributeStatement' => $insertAttribute,
1955
  'preparedattributegroupStatement' => $insertAttributeGroup,
1956
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
1957
  'preparedproductattributeStatement' => $insertProductAttribute,
 
1958
  'preparedproductquestionStatement' => $insertProductQuestion,
1959
  'preparedproductanswerStatement' => $insertProductAnswer,
1960
  'store' => $store ));
1996
  'preparedcategoryproductStatement' => $insertCategoryProduct,
1997
  'preparedimageStatement' => $insertImage,
1998
  'preparedproducthtmlStatement' => $insertProductHTML,
1999
+ 'preparedproductrelatedStatement' => $insertProductRelated,
2000
  'preparedattributeStatement' => $insertAttribute,
2001
  'preparedattributegroupStatement' => $insertAttributeGroup,
2002
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
2003
  'preparedproductattributeStatement' => $insertProductAttribute,
 
2004
  'preparedproductquestionStatement' => $insertProductQuestion,
2005
  'preparedproductanswerStatement' => $insertProductAnswer,
2006
  'store' => $store )
2043
  'preparedcategoryproductStatement' => $insertCategoryProduct,
2044
  'preparedimageStatement' => $insertImage,
2045
  'preparedproducthtmlStatement' => $insertProductHTML,
2046
+ 'preparedproductrelatedStatement' => $insertProductRelated,
2047
  'preparedattributeStatement' => $insertAttribute,
2048
  'preparedattributegroupStatement' => $insertAttributeGroup,
2049
  'preparedattributegroupmapStatement' => $insertAttributeGroupMap,
2050
  'preparedproductattributeStatement' => $insertProductAttribute,
 
2051
  'preparedproductquestionStatement' => $insertProductQuestion,
2052
  'preparedproductanswerStatement' => $insertProductAnswer,
2053
  'store' => $store )
2489
  $db->exec('CREATE TABLE IF NOT EXISTS ProductHTML (ProductExternalReference text NOT NULL, Tag text NOT NULL, HTML text NOT NULL, PRIMARY KEY (ProductExternalReference, Tag))');
2490
  $db->exec('CREATE INDEX IF NOT EXISTS IX_ProductHTML_ProductExternalReference ON ProductHTML(ProductExternalReference)');
2491
 
2492
+ $db->exec('CREATE TABLE IF NOT EXISTS ProductRelated (RelatedProductExternalReference text NOT NULL, ProductExternalReference text NOT NULL, PRIMARY KEY (ProductExternalReference, RelatedProductExternalReference))');
2493
+
2494
  $db->exec('CREATE TABLE IF NOT EXISTS Attribute (ID integer NOT NULL PRIMARY KEY, Code text NOT NULL, Label text NOT NULL, Type text NOT NULL, Input text NOT NULL)');
2495
  $db->exec('CREATE TABLE IF NOT EXISTS AttributeGroupMap (AttributeID integer NOT NULL, GroupID integer NOT NULL, PRIMARY KEY(AttributeID, GroupID))');
2496
  $db->exec('CREATE TABLE IF NOT EXISTS AttributeGroup (ID integer NOT NULL PRIMARY KEY, Name text NOT NULL)');
app/code/community/Codisto/Sync/controllers/CodistoController.php CHANGED
@@ -68,6 +68,13 @@ class Codisto_Sync_CodistoController extends Mage_Adminhtml_Controller_Action
68
  $this->renderPane($url, 'codisto-attributemapping');
69
  }
70
 
 
 
 
 
 
 
 
71
  public function settingsAction()
72
  {
73
  $url = preg_replace('/\/ebaytab(?:\/index)?(\/key\/)?/', '/settings$1', Mage::getModel('adminhtml/url')->getUrl('codisto/ebaytab'));
68
  $this->renderPane($url, 'codisto-attributemapping');
69
  }
70
 
71
+ public function accountAction()
72
+ {
73
+ $url = preg_replace('/\/ebaytab(?:\/index)?(\/key\/)?/', '/account$1', Mage::getModel('adminhtml/url')->getUrl('codisto/ebaytab'));
74
+
75
+ $this->renderPane($url, 'codisto-account');
76
+ }
77
+
78
  public function settingsAction()
79
  {
80
  $url = preg_replace('/\/ebaytab(?:\/index)?(\/key\/)?/', '/settings$1', Mage::getModel('adminhtml/url')->getUrl('codisto/ebaytab'));
app/code/community/Codisto/Sync/controllers/IndexController.php CHANGED
@@ -379,7 +379,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
379
  {
380
  $quote = Mage::getModel('sales/quote');
381
 
382
- $this->ProcessQuote($quote, $xml, $store);
383
  }
384
  catch(Exception $e)
385
  {
@@ -410,11 +410,11 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
410
 
411
  if($order && $order->getId())
412
  {
413
- $this->ProcessOrderSync($quote, $order, $xml, $productsToReindex, $ordersProcessed, $invoicesProcessed, $store);
414
  }
415
  else
416
  {
417
- $this->ProcessOrderCreate($quote, $xml, $productsToReindex, $ordersProcessed, $invoicesProcessed, $store);
418
  }
419
 
420
  $connection->commit();
@@ -532,8 +532,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
532
  }
533
  }
534
 
535
- private function ProcessOrderCreate($quote, $xml, &$productsToReindex, &$orderids, &$invoiceids, $store)
536
  {
 
537
  $ordercontent = $xml->entry->content->children('http://api.codisto.com/schemas/2009/');
538
 
539
  $paypaltransactionid = $ordercontent->orderpayments[0]->orderpayment->transactionid;
@@ -608,6 +609,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
608
  $productid = intval($productid);
609
 
610
  $product = Mage::getModel('catalog/product')->load($productid);
 
611
  if($product->getId())
612
  {
613
  $productcode = $product->getSku();
@@ -621,6 +623,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
621
 
622
  if(!$product)
623
  {
 
 
 
624
  $product = Mage::getModel('catalog/product');
625
  $adjustStock = false;
626
  }
@@ -798,7 +803,8 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
798
 
799
  try
800
  {
801
- $order->place();
 
802
  }
803
  catch(Exception $e)
804
  {
@@ -832,6 +838,10 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
832
 
833
  }
834
 
 
 
 
 
835
  $order->setBaseTotalPaid(0);
836
  $order->setTotalPaid(0);
837
  $order->setBaseTotalDue(0);
@@ -933,8 +943,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
933
  $orderids[] = $order->getId();
934
  }
935
 
936
- private function ProcessOrderSync($quote, $order, $xml, &$productsToReindex, &$orderids, &$invoiceids, $store)
937
  {
 
938
  $orderstatus = $order->getStatus();
939
  $ordercontent = $xml->entry->content->children('http://api.codisto.com/schemas/2009/');
940
 
@@ -988,7 +999,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
988
  if(!$ebaysalesrecordnumber)
989
  $ebaysalesrecordnumber = '';
990
 
991
- $currencyCode = (string)$ordercontent->transactcurrency;
992
  $ordertotal = floatval($ordercontent->ordertotal[0]);
993
  $ordersubtotal = floatval($ordercontent->ordersubtotal[0]);
994
  $ordertaxtotal = floatval($ordercontent->ordertaxtotal[0]);
@@ -1097,11 +1108,13 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1097
  $productname = (string)$productname;
1098
 
1099
  $productid = $orderline->externalreference[0];
 
1100
  if($productid != null)
1101
  {
1102
  $productid = intval($productid);
1103
 
1104
  $product = Mage::getModel('catalog/product')->load($productid);
 
1105
  if($product->getId())
1106
  {
1107
  $productcode = $product->getSku();
@@ -1115,6 +1128,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1115
 
1116
  if(!$product)
1117
  {
 
 
 
1118
  $product = Mage::getModel('catalog/product');
1119
  $adjustStock = false;
1120
  }
@@ -1492,8 +1508,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1492
  $orderids[] = $order->getId();
1493
  }
1494
 
1495
- private function ProcessQuote($quote, $xml, $store)
1496
  {
 
1497
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
1498
 
1499
  $ordercontent = $xml->entry->content->children('http://api.codisto.com/schemas/2009/');
@@ -1671,7 +1688,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1671
  }
1672
  }
1673
 
1674
- $currencyCode = $ordercontent->transactcurrency[0];
1675
  $ordertotal = floatval($ordercontent->ordertotal[0]);
1676
  $ordersubtotal = floatval($ordercontent->ordersubtotal[0]);
1677
  $ordertaxtotal = floatval($ordercontent->ordertaxtotal[0]);
@@ -1735,6 +1752,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1735
  $productid = intval($productid);
1736
 
1737
  $product = Mage::getModel('catalog/product')->load($productid);
 
1738
  if($product->getId())
1739
  {
1740
  $productcode = $product->getSku();
@@ -1748,6 +1766,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1748
 
1749
  if(!$product)
1750
  {
 
 
 
1751
  $product = Mage::getModel('catalog/product');
1752
  }
1753
 
@@ -1897,53 +1918,55 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1897
 
1898
  try {
1899
 
1900
- $shippingRequest = Mage::getModel('shipping/rate_request');
1901
- $shippingRequest->setAllItems($quote->getAllItems());
1902
- $shippingRequest->setDestCountryId($shippingAddress->getCountryId());
1903
- $shippingRequest->setDestRegionId($shippingAddress->getRegionId());
1904
- $shippingRequest->setDestRegionCode($shippingAddress->getRegionCode());
1905
- $shippingRequest->setDestStreet($shippingAddress->getStreet(-1));
1906
- $shippingRequest->setDestCity($shippingAddress->getCity());
1907
- $shippingRequest->setDestPostcode($shippingAddress->getPostcode());
1908
- $shippingRequest->setPackageValue($quote->getBaseSubtotal());
1909
- $shippingRequest->setPackageValueWithDiscount($quote->getBaseSubtotalWithDiscount());
1910
- $shippingRequest->setPackageWeight($quote->getWeight());
1911
- $shippingRequest->setPackageQty($quote->getItemQty());
1912
- $shippingRequest->setPackagePhysicalValue($quote->getBaseSubtotal());
1913
- $shippingRequest->setFreeMethodWeight(0);
1914
- $shippingRequest->setStoreId($store->getId());
1915
- $shippingRequest->setWebsiteId($store->getWebsiteId());
1916
- $shippingRequest->setFreeShipping(false);
1917
- $shippingRequest->setBaseCurrency($currencyCode);
1918
- $shippingRequest->setPackageCurrency($currencyCode);
1919
- $shippingRequest->setBaseSubtotalInclTax($quote->getBaseSubtotalInclTax());
1920
-
1921
- $shippingResult = Mage::getModel('shipping/shipping')->collectRates($shippingRequest)->getResult();
1922
-
1923
- $shippingRates = $shippingResult->getAllRates();
1924
-
1925
- foreach($shippingRates as $shippingRate)
1926
- {
1927
- if($shippingRate instanceof Mage_Shipping_Model_Rate_Result_Method)
1928
  {
1929
- if(is_null($freightcost) || (!is_null($shippingRate->getPrice()) && $shippingRate->getPrice() < $freightcost))
1930
  {
1931
- $isPickup = $shippingRate->getPrice() == 0 &&
1932
- (preg_match('/(?:^|\W|_)pick\s*up(?:\W|_|$)/i', strval($shippingRate->getMethod())) ||
1933
- preg_match('/(?:^|\W|_)pick\s*up(?:\W|_|$)/i', strval($shippingRate->getCarrierTitle())) ||
1934
- preg_match('/(?:^|\W|_)pick\s*up(?:\W|_|$)/i', strval($shippingRate->getMethodTitle())));
1935
-
1936
- if(!$isPickup)
1937
  {
1938
- $freightRate = Mage::getModel('sales/quote_address_rate')
1939
- ->importShippingRate($shippingRate);
1940
-
1941
- $freightcode = $freightRate->getCode();
1942
- $freightcarrier = $freightRate->getCarrier();
1943
- $freightcarriertitle = $freightRate->getCarrierTitle();
1944
- $freightmethod = $freightRate->getMethod();
1945
- $freightmethodtitle = $freightRate->getMethodTitle();
1946
- $freightmethoddescription = $freightRate->getMethodDescription();
 
 
 
 
 
 
 
 
1947
  }
1948
  }
1949
  }
@@ -1968,7 +1991,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1968
 
1969
  $shippingAddress->addShippingRate($freightRate);
1970
  $shippingAddress->setShippingMethod($freightcode);
1971
- $shippingAddress->setShippingDescription($freightmethodtitle);
1972
  $shippingAddress->setShippingAmount($freighttotal);
1973
  $shippingAddress->setBaseShippingAmount($freighttotal);
1974
  $shippingAddress->save();
379
  {
380
  $quote = Mage::getModel('sales/quote');
381
 
382
+ $this->ProcessQuote($quote, $xml, $store, $request);
383
  }
384
  catch(Exception $e)
385
  {
410
 
411
  if($order && $order->getId())
412
  {
413
+ $this->ProcessOrderSync($quote, $order, $xml, $productsToReindex, $ordersProcessed, $invoicesProcessed, $store, $request);
414
  }
415
  else
416
  {
417
+ $this->ProcessOrderCreate($quote, $xml, $productsToReindex, $ordersProcessed, $invoicesProcessed, $store, $request);
418
  }
419
 
420
  $connection->commit();
532
  }
533
  }
534
 
535
+ private function ProcessOrderCreate($quote, $xml, &$productsToReindex, &$orderids, &$invoiceids, $store, $request)
536
  {
537
+
538
  $ordercontent = $xml->entry->content->children('http://api.codisto.com/schemas/2009/');
539
 
540
  $paypaltransactionid = $ordercontent->orderpayments[0]->orderpayment->transactionid;
609
  $productid = intval($productid);
610
 
611
  $product = Mage::getModel('catalog/product')->load($productid);
612
+
613
  if($product->getId())
614
  {
615
  $productcode = $product->getSku();
623
 
624
  if(!$product)
625
  {
626
+ if($request->getQuery('checkproduct')) {
627
+ throw new Exception("external reference not found");
628
+ }
629
  $product = Mage::getModel('catalog/product');
630
  $adjustStock = false;
631
  }
803
 
804
  try
805
  {
806
+ if(!$request->getQuery('skiporderevent'))
807
+ $order->place();
808
  }
809
  catch(Exception $e)
810
  {
838
 
839
  }
840
 
841
+ if($adjustStock == false) {
842
+ $order->addStatusToHistory($order->getStatus(), "NOTE: Stock level not adjusted, please check your inventory.");
843
+ }
844
+
845
  $order->setBaseTotalPaid(0);
846
  $order->setTotalPaid(0);
847
  $order->setBaseTotalDue(0);
943
  $orderids[] = $order->getId();
944
  }
945
 
946
+ private function ProcessOrderSync($quote, $order, $xml, &$productsToReindex, &$orderids, &$invoiceids, $store, $request)
947
  {
948
+
949
  $orderstatus = $order->getStatus();
950
  $ordercontent = $xml->entry->content->children('http://api.codisto.com/schemas/2009/');
951
 
999
  if(!$ebaysalesrecordnumber)
1000
  $ebaysalesrecordnumber = '';
1001
 
1002
+ $currencyCode = (string)$ordercontent->transactcurrency[0];
1003
  $ordertotal = floatval($ordercontent->ordertotal[0]);
1004
  $ordersubtotal = floatval($ordercontent->ordersubtotal[0]);
1005
  $ordertaxtotal = floatval($ordercontent->ordertaxtotal[0]);
1108
  $productname = (string)$productname;
1109
 
1110
  $productid = $orderline->externalreference[0];
1111
+
1112
  if($productid != null)
1113
  {
1114
  $productid = intval($productid);
1115
 
1116
  $product = Mage::getModel('catalog/product')->load($productid);
1117
+
1118
  if($product->getId())
1119
  {
1120
  $productcode = $product->getSku();
1128
 
1129
  if(!$product)
1130
  {
1131
+ if($request->getQuery('checkproduct')) {
1132
+ throw new Exception('externalreference not found');
1133
+ }
1134
  $product = Mage::getModel('catalog/product');
1135
  $adjustStock = false;
1136
  }
1508
  $orderids[] = $order->getId();
1509
  }
1510
 
1511
+ private function ProcessQuote($quote, $xml, $store, $request)
1512
  {
1513
+
1514
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
1515
 
1516
  $ordercontent = $xml->entry->content->children('http://api.codisto.com/schemas/2009/');
1688
  }
1689
  }
1690
 
1691
+ $currencyCode = (string)$ordercontent->transactcurrency[0];
1692
  $ordertotal = floatval($ordercontent->ordertotal[0]);
1693
  $ordersubtotal = floatval($ordercontent->ordersubtotal[0]);
1694
  $ordertaxtotal = floatval($ordercontent->ordertaxtotal[0]);
1752
  $productid = intval($productid);
1753
 
1754
  $product = Mage::getModel('catalog/product')->load($productid);
1755
+
1756
  if($product->getId())
1757
  {
1758
  $productcode = $product->getSku();
1766
 
1767
  if(!$product)
1768
  {
1769
+ if($request->getQuery('checkproduct')) {
1770
+ throw new Exception('externalreference not found');
1771
+ }
1772
  $product = Mage::getModel('catalog/product');
1773
  }
1774
 
1918
 
1919
  try {
1920
 
1921
+ if(!$request->getQuery('skipshipping')) {
1922
+ $shippingRequest = Mage::getModel('shipping/rate_request');
1923
+ $shippingRequest->setAllItems($quote->getAllItems());
1924
+ $shippingRequest->setDestCountryId($shippingAddress->getCountryId());
1925
+ $shippingRequest->setDestRegionId($shippingAddress->getRegionId());
1926
+ $shippingRequest->setDestRegionCode($shippingAddress->getRegionCode());
1927
+ $shippingRequest->setDestStreet($shippingAddress->getStreet(-1));
1928
+ $shippingRequest->setDestCity($shippingAddress->getCity());
1929
+ $shippingRequest->setDestPostcode($shippingAddress->getPostcode());
1930
+ $shippingRequest->setPackageValue($quote->getBaseSubtotal());
1931
+ $shippingRequest->setPackageValueWithDiscount($quote->getBaseSubtotalWithDiscount());
1932
+ $shippingRequest->setPackageWeight($quote->getWeight());
1933
+ $shippingRequest->setPackageQty($quote->getItemQty());
1934
+ $shippingRequest->setPackagePhysicalValue($quote->getBaseSubtotal());
1935
+ $shippingRequest->setFreeMethodWeight($quote->getWeight());
1936
+ $shippingRequest->setStoreId($store->getId());
1937
+ $shippingRequest->setWebsiteId($store->getWebsiteId());
1938
+ $shippingRequest->setFreeShipping(false);
1939
+ $shippingRequest->setBaseCurrency($currencyCode);
1940
+ $shippingRequest->setPackageCurrency($currencyCode);
1941
+ $shippingRequest->setBaseSubtotalInclTax($quote->getBaseSubtotalInclTax());
1942
+
1943
+ $shippingResult = Mage::getModel('shipping/shipping')->collectRates($shippingRequest)->getResult();
1944
+
1945
+ $shippingRates = $shippingResult->getAllRates();
1946
+
1947
+ foreach($shippingRates as $shippingRate)
 
1948
  {
1949
+ if($shippingRate instanceof Mage_Shipping_Model_Rate_Result_Method)
1950
  {
1951
+ if(is_null($freightcost) || (!is_null($shippingRate->getPrice()) && $shippingRate->getPrice() < $freightcost))
 
 
 
 
 
1952
  {
1953
+ $isPickup = $shippingRate->getPrice() == 0 &&
1954
+ (preg_match('/(?:^|\W|_)pick\s*up(?:\W|_|$)/i', strval($shippingRate->getMethod())) ||
1955
+ preg_match('/(?:^|\W|_)pick\s*up(?:\W|_|$)/i', strval($shippingRate->getCarrierTitle())) ||
1956
+ preg_match('/(?:^|\W|_)pick\s*up(?:\W|_|$)/i', strval($shippingRate->getMethodTitle())));
1957
+
1958
+ if(!$isPickup)
1959
+ {
1960
+ $freightRate = Mage::getModel('sales/quote_address_rate')
1961
+ ->importShippingRate($shippingRate);
1962
+
1963
+ $freightcode = $freightRate->getCode();
1964
+ $freightcarrier = $freightRate->getCarrier();
1965
+ $freightcarriertitle = $freightRate->getCarrierTitle();
1966
+ $freightmethod = $freightRate->getMethod();
1967
+ $freightmethodtitle = $freightRate->getMethodTitle();
1968
+ $freightmethoddescription = $freightRate->getMethodDescription();
1969
+ }
1970
  }
1971
  }
1972
  }
1991
 
1992
  $shippingAddress->addShippingRate($freightRate);
1993
  $shippingAddress->setShippingMethod($freightcode);
1994
+ $shippingAddress->setShippingDescription($freightcarriertitle.' - '.$freightmethodtitle);
1995
  $shippingAddress->setShippingAmount($freighttotal);
1996
  $shippingAddress->setBaseShippingAmount($freighttotal);
1997
  $shippingAddress->save();
app/code/community/Codisto/Sync/controllers/SyncController.php CHANGED
@@ -145,6 +145,7 @@ class Codisto_Sync_SyncController extends Mage_Core_Controller_Front_Action
145
  $db->exec('CREATE TABLE SKUMatrix AS SELECT * FROM SyncDb.SKUMatrix WHERE ProductExternalReference IN (SELECT ExternalReference FROM Product)');
146
  $db->exec('CREATE TABLE ProductOptionValue AS SELECT DISTINCT * FROM SyncDb.ProductOptionValue');
147
  $db->exec('CREATE TABLE ProductHTML AS SELECT * FROM SyncDb.ProductHTML WHERE ProductExternalReference IN (SELECT ExternalReference FROM Product)');
 
148
  $db->exec('CREATE TABLE Attribute AS SELECT * FROM SyncDb.Attribute');
149
  $db->exec('CREATE TABLE AttributeGroup AS SELECT * FROM SyncDb.AttributeGroup');
150
  $db->exec('CREATE TABLE AttributeGroupMap AS SELECT * FROM SyncDb.AttributeGroupMap');
@@ -215,6 +216,7 @@ class Codisto_Sync_SyncController extends Mage_Core_Controller_Front_Action
215
  $db->exec('CREATE TABLE SKUMatrix AS SELECT * FROM SyncDb.SKUMatrix WHERE ProductExternalReference IN (SELECT ExternalReference FROM SyncDb.ProductChange)');
216
  $db->exec('CREATE TABLE ProductOptionValue AS SELECT DISTINCT * FROM SyncDb.ProductOptionValue');
217
  $db->exec('CREATE TABLE ProductHTML AS SELECT * FROM SyncDb.ProductHTML WHERE ProductExternalReference IN (SELECT ExternalReference FROM SyncDb.ProductChange)');
 
218
  $db->exec('CREATE TABLE Attribute AS SELECT * FROM SyncDb.Attribute');
219
  $db->exec('CREATE TABLE AttributeGroup AS SELECT * FROM SyncDb.AttributeGroup');
220
  $db->exec('CREATE TABLE AttributeGroupMap AS SELECT * FROM SyncDb.AttributeGroupMap');
145
  $db->exec('CREATE TABLE SKUMatrix AS SELECT * FROM SyncDb.SKUMatrix WHERE ProductExternalReference IN (SELECT ExternalReference FROM Product)');
146
  $db->exec('CREATE TABLE ProductOptionValue AS SELECT DISTINCT * FROM SyncDb.ProductOptionValue');
147
  $db->exec('CREATE TABLE ProductHTML AS SELECT * FROM SyncDb.ProductHTML WHERE ProductExternalReference IN (SELECT ExternalReference FROM Product)');
148
+ $db->exec('CREATE TABLE ProductRelated AS SELECT * FROM SyncDb.ProductRelated WHERE ProductExternalReference IN (SELECT ExternalReference FROM Product)');
149
  $db->exec('CREATE TABLE Attribute AS SELECT * FROM SyncDb.Attribute');
150
  $db->exec('CREATE TABLE AttributeGroup AS SELECT * FROM SyncDb.AttributeGroup');
151
  $db->exec('CREATE TABLE AttributeGroupMap AS SELECT * FROM SyncDb.AttributeGroupMap');
216
  $db->exec('CREATE TABLE SKUMatrix AS SELECT * FROM SyncDb.SKUMatrix WHERE ProductExternalReference IN (SELECT ExternalReference FROM SyncDb.ProductChange)');
217
  $db->exec('CREATE TABLE ProductOptionValue AS SELECT DISTINCT * FROM SyncDb.ProductOptionValue');
218
  $db->exec('CREATE TABLE ProductHTML AS SELECT * FROM SyncDb.ProductHTML WHERE ProductExternalReference IN (SELECT ExternalReference FROM SyncDb.ProductChange)');
219
+ $db->exec('CREATE TABLE ProductRelated AS SELECT * FROM SyncDb.ProductRelated WHERE ProductExternalReference IN (SELECT ExternalReference FROM SyncDb.ProductChange)');
220
  $db->exec('CREATE TABLE Attribute AS SELECT * FROM SyncDb.Attribute');
221
  $db->exec('CREATE TABLE AttributeGroup AS SELECT * FROM SyncDb.AttributeGroup');
222
  $db->exec('CREATE TABLE AttributeGroupMap AS SELECT * FROM SyncDb.AttributeGroupMap');
app/code/community/Codisto/Sync/data/codisto_setup/{data-install-1.90.7.php → data-install-1.90.9.php} RENAMED
File without changes
app/code/community/Codisto/Sync/etc/adminhtml.xml CHANGED
@@ -56,9 +56,14 @@
56
  <sort_order>6</sort_order>
57
  <action>adminhtml/codisto/intro</action>
58
  </getstarted>
 
 
 
 
 
59
  <settings translate="title">
60
  <title>Settings</title>
61
- <sort_order>7</sort_order>
62
  <action>adminhtml/codisto/settings</action>
63
  </settings>
64
  </children>
@@ -97,9 +102,13 @@
97
  <title>Getting Started</title>
98
  <sort_order>6</sort_order>
99
  </getstarted>
 
 
 
 
100
  <settings>
101
  <title>Settings</title>
102
- <sort_order>7</sort_order>
103
  </settings>
104
  </children>
105
  </codisto>
56
  <sort_order>6</sort_order>
57
  <action>adminhtml/codisto/intro</action>
58
  </getstarted>
59
+ <account translate="title">
60
+ <title>Account</title>
61
+ <sort_order>7</sort_order>
62
+ <action>adminhtml/codisto/account</action>
63
+ </account>
64
  <settings translate="title">
65
  <title>Settings</title>
66
+ <sort_order>8</sort_order>
67
  <action>adminhtml/codisto/settings</action>
68
  </settings>
69
  </children>
102
  <title>Getting Started</title>
103
  <sort_order>6</sort_order>
104
  </getstarted>
105
+ <account>
106
+ <title>Getting Started</title>
107
+ <sort_order>7</sort_order>
108
+ </account>
109
  <settings>
110
  <title>Settings</title>
111
+ <sort_order>8</sort_order>
112
  </settings>
113
  </children>
114
  </codisto>
app/code/community/Codisto/Sync/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <config>
24
  <modules>
25
  <Codisto_Sync>
26
- <version>1.90.7</version>
27
  <depends>
28
  <Mage_Payment/>
29
  </depends>
23
  <config>
24
  <modules>
25
  <Codisto_Sync>
26
+ <version>1.90.9</version>
27
  <depends>
28
  <Mage_Payment/>
29
  </depends>
app/code/community/Codisto/Sync/sql/codisto_setup/{mysql4-install-1.90.7.php → mysql4-install-1.90.9.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.7</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-08-04</date><time>0:28:27</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="e5db211cdecaace51453f276e3e27268"/><file name="Signal.php" hash="b624f962056ceffae9c3160ed3e5655e"/></dir><dir name="controllers"><file name="CodistoController.php" hash="4992c5f9d6d2f7422f409f0321b0e455"/><file name="IndexController.php" hash="4c0eed777c4959cd500c3e034b46ef75"/><file name="SyncController.php" hash="f859203597e4f49e9107f77a6ce40d7f"/></dir><dir name="Controller"><file name="Router.php" hash="6e5ab9b0012590acf986459b5acec54c"/></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.7.php" hash="6d07d4e22ae5d907df1f4389c3a829d4"/></dir></dir><dir name="data"><dir name="codisto_setup"><file name="data-install-1.90.7.php" hash="a42cf5f15b68ac92d4c207bed8472c7d"/></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="4ef592c4047f610b6943758fa4fd43a6"/><file name="config.xml" hash="b707e7bbc503594a70b05dcf818a848d"/></dir><dir name="Model"><file name="Observer.php" hash="8b309ae85f2bf696e97ff6777c1d64f2"/><file name="Sync.php" hash="d1abd4ce04b7b965be1aa1c630465580"/><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>
1
  <?xml version="1.0"?>
2
+ <package><name>codistoconnect</name><version>1.90.9</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-08-11</date><time>18:42:48</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="e5db211cdecaace51453f276e3e27268"/><file name="Signal.php" hash="b624f962056ceffae9c3160ed3e5655e"/></dir><dir name="controllers"><file name="CodistoController.php" hash="eccbf167582d60ae559b7455b9b8e7ea"/><file name="IndexController.php" hash="d26acda7db312bf68e7bedce6bc49fc2"/><file name="SyncController.php" hash="337315134c4a86f1aa6b1882e9b64937"/></dir><dir name="Controller"><file name="Router.php" hash="6e5ab9b0012590acf986459b5acec54c"/></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.9.php" hash="6d07d4e22ae5d907df1f4389c3a829d4"/></dir></dir><dir name="data"><dir name="codisto_setup"><file name="data-install-1.90.9.php" hash="a42cf5f15b68ac92d4c207bed8472c7d"/></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="c5cdb49f8522fc213c8a65630ffb0cb4"/><file name="config.xml" hash="949b14e70b2528fa5c3ee6f660ddcff4"/></dir><dir name="Model"><file name="Observer.php" hash="8b309ae85f2bf696e97ff6777c1d64f2"/><file name="Sync.php" hash="07662f6eb15475f27edea545a69f72e7"/><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>