codistoconnect - Version 1.90.11

Version Notes

Download this release

Release Info

Developer Codisto
Extension codistoconnect
Version 1.90.11
Comparing to
See all releases


Code changes from version 1.90.10 to 1.90.11

app/code/community/Codisto/Sync/Controller/Router.php CHANGED
@@ -37,8 +37,7 @@ class Codisto_Sync_Controller_Router extends Mage_Core_Controller_Varien_Router_
37
throw new PDOException('(sqlite PDO Driver) please refer to <a target="#blank" href="http://help.codisto.com/article/64-what-is-pdoexception-could-not-find-driver">Codisto help article</a>', 999);
38
}
39
40
- //Can this request create a new merchant ?
41
- $createMerchant = Mage::helper('codistosync')->createMerchantwithLock();
42
}
43
44
//Something else happened such as PDO related exception
@@ -109,6 +108,12 @@ class Codisto_Sync_Controller_Router extends Mage_Core_Controller_Varien_Router_
109
return true;
110
}
111
112
$loggedIn = false;
113
114
if($request->getCookie('adminhtml'))
@@ -149,7 +154,6 @@ class Codisto_Sync_Controller_Router extends Mage_Core_Controller_Varien_Router_
149
if(class_exists('Zend_Session', false) && Zend_Session::isStarted())
150
{
151
Zend_Session::writeClose();
152
- Zend_Session::destroy();
153
}
154
if(isset($_SESSION))
155
{
37
throw new PDOException('(sqlite PDO Driver) please refer to <a target="#blank" href="http://help.codisto.com/article/64-what-is-pdoexception-could-not-find-driver">Codisto help article</a>', 999);
38
}
39
40
+ $createMerchant = Mage::helper('codistosync')->createMerchantwithLock(5.0);
41
}
42
43
//Something else happened such as PDO related exception
108
return true;
109
}
110
111
+ if(isset($_SESSION))
112
+ {
113
+ session_write_close();
114
+ unset($_SESSION);
115
+ }
116
+
117
$loggedIn = false;
118
119
if($request->getCookie('adminhtml'))
154
if(class_exists('Zend_Session', false) && Zend_Session::isStarted())
155
{
156
Zend_Session::writeClose();
157
}
158
if(isset($_SESSION))
159
{
app/code/community/Codisto/Sync/Helper/Data.php CHANGED
@@ -12,10 +12,10 @@
12
* obtain it through the world-wide-web, please send an email
13
* to license@magentocommerce.com so we can send you a copy immediately.
14
*
15
- * @category Codisto
16
- * @package Codisto_Sync
17
* @copyright Copyright (c) 2015 On Technology Pty. Ltd. (http://codisto.com/)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
*/
20
21
@@ -106,6 +106,14 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
106
}
107
catch(Exception $e)
108
{
109
$this->logExceptionCodisto($e, 'https://ui.codisto.com/installed');
110
}
111
@@ -145,7 +153,7 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
145
}
146
147
//Determine if we can create a new merchant. Prevent multiple requests from being able to complete signups
148
- public function createMerchantwithLock()
149
{
150
$createMerchant = false;
151
@@ -180,7 +188,7 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
180
181
$lockQuery->closeCursor();
182
183
- if($timeStamp + 5000000 < microtime(true))
184
{
185
$createMerchant = true;
186
@@ -376,315 +384,322 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
376
if(!$this->getTriggerMode())
377
return false;
378
379
- $adapter = Mage::getModel('core/resource')->getConnection(Mage_Core_Model_Resource::DEFAULT_WRITE_RESOURCE);
380
381
- $tablePrefix = Mage::getConfig()->getTablePrefix();
382
383
- // change tables
384
- $changeTableDefs = array(
385
- 'codisto_product_change' => 'CREATE TABLE `'.$tablePrefix.'codisto_product_change` (product_id int(10) unsigned NOT NULL PRIMARY KEY, stamp datetime NOT NULL)',
386
- 'codisto_order_change' => 'CREATE TABLE `'.$tablePrefix.'codisto_order_change` (order_id int(10) unsigned NOT NULL PRIMARY KEY, stamp datetime NOT NULL)',
387
- 'codisto_category_change' => 'CREATE TABLE `'.$tablePrefix.'codisto_category_change` (category_id int(10) unsigned NOT NULL PRIMARY KEY, stamp datetime NOT NULL)'
388
- );
389
390
- $changeTablesExist = true;
391
392
- $changeTables = $adapter->fetchCol('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE \''.$tablePrefix.'codisto_%_change\'');
393
- if(is_array($changeTables))
394
- {
395
- $changeTables = array_flip( $changeTables );
396
-
397
- foreach($changeTableDefs as $table => $createStatement)
398
{
399
- if(!isset($changeTables[$tablePrefix.$table]))
400
{
401
- $adapter->query($changeTableDefs[$table]);
402
403
- $changeTablesExist = false;
404
}
405
}
406
- }
407
-
408
- // trigger management
409
- $stdCodistoProductChangeStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;';
410
- $stdCodistoProductDeleteStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;';
411
- $stdCodistoCategoryChangeStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;';
412
- $stdCodistoCategoryDeleteStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = OLD.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;';
413
-
414
- $triggerStaticRules = array(
415
- 'catalog_product_entity' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
416
- 'catalog_product_entity_datetime' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
417
- 'catalog_product_entity_decimal' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
418
- 'catalog_product_entity_gallery' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
419
- 'catalog_product_entity_group_price' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
420
- 'catalog_product_entity_int' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
421
- 'catalog_product_entity_media_gallery' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
422
- 'catalog_product_entity_text' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
423
- 'catalog_product_entity_varchar' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
424
- 'cataloginventory_stock_item' => array(
425
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
426
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
427
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'
428
- ),
429
- 'cataloginventory_stock_status' => array(
430
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
431
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
432
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'
433
- ),
434
- 'catalog_category_entity' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
435
- 'catalog_category_entity_datetime' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
436
- 'catalog_category_entity_decimal' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
437
- 'catalog_category_entity_int' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
438
- 'catalog_category_entity_text' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
439
- 'catalog_category_entity_varchar' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
440
- 'catalog_category_product' => array(
441
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'.
442
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = NEW.category_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;',
443
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'.
444
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = NEW.category_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;',
445
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'.
446
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = OLD.category_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;'
447
- ),
448
- 'sales_flat_order' => array(
449
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND COALESCE(NEW.codisto_orderid, \'\') != \'\' THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
450
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND COALESCE(NEW.codisto_orderid, \'\') != \'\' THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
451
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND COALESCE(OLD.codisto_orderid, \'\') != \'\' THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
452
- ),
453
- 'sales_flat_invoice' => array(
454
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
455
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
456
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = OLD.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
457
- ),
458
- 'sales_flat_shipment' => array(
459
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
460
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
461
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = OLD.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
462
- ),
463
- 'sales_flat_shipment_track' => array(
464
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
465
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
466
- 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = OLD.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
467
- )
468
- );
469
-
470
- $triggerRules = array();
471
- foreach($triggerStaticRules as $table => $statements)
472
- {
473
- $triggerRules[$tablePrefix.$table] = array( 'table' => $table, 'statements' => $statements );
474
- }
475
-
476
- $adapter->query('CREATE TEMPORARY TABLE `codisto_triggers` ( `table` varchar(100) NOT NULL PRIMARY KEY, `insert_statement` varchar(2000) NOT NULL, `update_statement` varchar(2000) NOT NULL, `delete_statement` varchar(2000) NOT NULL )');
477
- foreach($triggerRules as $table => $tableData)
478
- {
479
- $adapter->insert('codisto_triggers', array( 'table' => $table, 'insert_statement' => $tableData['statements'][0], 'update_statement' => $tableData['statements'][1], 'delete_statement' => $tableData['statements'][2] ) );
480
- }
481
-
482
- $missingTriggers = $adapter->fetchAll(
483
- 'SELECT T.`table`, '.
484
- 'TYPE.`type`, '.
485
- 'CASE WHEN TRIGGER_NAME IS NULL THEN 0 ELSE -1 END AS `exists`, '.
486
- 'COALESCE(EXISTING.TRIGGER_CATALOG, \'\') AS `current_catalog`, '.
487
- 'COALESCE(EXISTING.TRIGGER_SCHEMA, \'\') AS `current_schema`, '.
488
- 'COALESCE(EXISTING.TRIGGER_NAME, \'\') AS `current_name`, '.
489
- 'COALESCE(EXISTING.ACTION_STATEMENT, \'\') AS `current_statement`, '.
490
- 'COALESCE(EXISTING.DEFINER, \'\') AS `current_definer`, '.
491
- 'COALESCE(EXISTING.SQL_MODE, \'\') AS `current_sqlmode` '.
492
- 'FROM `codisto_triggers` AS T '.
493
- 'CROSS JOIN (SELECT \'UPDATE\' AS `type` UNION ALL SELECT \'INSERT\' UNION ALL SELECT \'DELETE\') AS TYPE '.
494
- 'LEFT JOIN INFORMATION_SCHEMA.TRIGGERS AS EXISTING ON EXISTING.EVENT_OBJECT_TABLE = T.`table` AND EXISTING.ACTION_TIMING = \'AFTER\' AND EXISTING.EVENT_MANIPULATION = TYPE.`type` '.
495
- 'WHERE NOT EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TRIGGERS WHERE EVENT_OBJECT_TABLE = T.`table` AND ACTION_TIMING = \'AFTER\' AND EVENT_MANIPULATION = TYPE.`type` AND ACTION_STATEMENT LIKE CONCAT(\'%\', CASE WHEN TYPE.`type` = \'INSERT\' THEN T.`insert_statement` WHEN TYPE.`type` = \'UPDATE\' THEN T.`update_statement` WHEN TYPE.`type` = \'DELETE\' THEN T.`delete_statement` END, \'%\'))');
496
-
497
- $changeTriggersExist = true;
498
-
499
- if(count($missingTriggers) > 0)
500
- {
501
- $changeTriggersExist = false;
502
503
- $triggerTypeMap = array( 'INSERT' => 0, 'UPDATE' => 1, 'DELETE' => 2 );
504
-
505
- $existingTriggers = array();
506
- foreach($missingTriggers as $trigger)
507
{
508
- if(isset($trigger['current_name']) && $trigger['current_name'] &&
509
- $trigger['current_statement'])
510
- {
511
- $existingTriggers[] = array(
512
- 'current_definer' => $trigger['current_definer'],
513
- 'current_schema' => $trigger['current_schema'],
514
- 'current_name' => $trigger['current_name'],
515
- 'current_statement' => $trigger['current_statement'],
516
- 'current_sqlmode' => $trigger['current_sqlmode'],
517
- 'type' => $trigger['type'],
518
- 'table' => $trigger['table']
519
- );
520
- }
521
}
522
523
- if(!empty($existingTriggers))
524
{
525
- $adapter->query('CREATE TABLE IF NOT EXISTS `'.$tablePrefix.'codisto_trigger_backup` (definer text NOT NULL, current_schema text NOT NULL, current_name text NOT NULL, current_statement text NOT NULL, type text NOT NULL, `table` text NOT NULL, stamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP)');
526
-
527
- foreach($existingTriggers as $trigger)
528
- {
529
- $adapter->insert($tablePrefix.'codisto_trigger_backup', array(
530
- 'definer' => $trigger['current_definer'],
531
- 'current_schema' => $trigger['current_schema'],
532
- 'current_name' => $trigger['current_name'],
533
- 'current_statement' => $trigger['current_statement'],
534
- 'type' => $trigger['type'],
535
- 'table' => $trigger['table']
536
- ));
537
- }
538
}
539
540
- foreach($missingTriggers as $trigger)
541
{
542
- $triggerRule = $triggerRules[$trigger['table']];
543
544
- $table = $triggerRule['table'];
545
- $statement = $triggerRule['statements'][$triggerTypeMap[$trigger['type']]];
546
547
- try
548
{
549
- $final_statement = "\n/* start codisto change tracking trigger */\n".$statement."\n/* end codisto change tracking trigger */\n";
550
551
- $adapter->query('DROP TRIGGER IF EXISTS codisto_'.$table.'_'.strtolower($trigger['type']));
552
- $adapter->query('CREATE DEFINER = CURRENT_USER TRIGGER codisto_'.$table.'_'.strtolower($trigger['type']).' AFTER '.$trigger['type'].' ON `'.$trigger['table'].'`'."\n".'FOR EACH ROW BEGIN '.$final_statement.'END');
553
554
- // TODO: loop on existing triggers for this class that match /* start codisto change tracking trigger */ and remove
555
}
556
- catch(Exception $e)
557
{
558
- if(method_exists($e, 'hasChainedException') &&
559
- $e->hasChainedException() &&
560
- $e->getChainedException() instanceof PDOException &&
561
- is_array($e->getChainedException()->errorInfo) &&
562
- $e->getChainedException()->errorInfo[1] == 1235)
563
{
564
- // this version of mysql doesn't support multiple triggers so let's modify the existing trigger
565
566
- $current_statement = preg_replace('/^BEGIN|END#x2F;i', '', $trigger['current_statement']);
567
- $cleaned_statement = preg_replace('/\s*\/\*\s+start\s+codisto\s+change\s+tracking\s+trigger\s+\*\/.*\/\*\s+end\s+codisto\s+change\s+tracking\s+trigger\s+\*\/\n?\s*/is', '', $current_statement);
568
- $final_statement = preg_replace('/;\s*;/', ';', $cleaned_statement."\n/* start codisto change tracking trigger */\n".$statement)
569
- ."\n/* end codisto change tracking trigger */\n";
570
571
- if(!preg_match('/^\s/', $final_statement))
572
- {
573
- $final_statement = "\n".$final_statement;
574
- }
575
- if(!preg_match('/\s#x2F;', $final_statement))
576
{
577
- $final_statement = $final_statement."\n";
578
- }
579
580
- $definer = $trigger['current_definer'];
581
- if(strpos($definer, '@') !== false)
582
- {
583
- $definer = explode('@', $definer);
584
- $definer[0] = '\''.$definer[0].'\'';
585
- $definer[1] = '\''.$definer[1].'\'';
586
- $definer = implode('@', $definer);
587
- }
588
589
- try
590
- {
591
- $adapter->query('SET @saved_sql_mode = @@sql_mode');
592
- $adapter->query('SET sql_mode = \''.$trigger['current_sqlmode'].'\'');
593
- $adapter->query('DROP TRIGGER `'.$trigger['current_schema'].'`.`'.$trigger['current_name'].'`');
594
- $adapter->query('CREATE DEFINER = '.$definer.' TRIGGER `'.$trigger['current_name'].'` AFTER '.$trigger['type'].' ON `'.$trigger['table'].'`'."\n".' FOR EACH ROW BEGIN'.$final_statement.'END');
595
- $adapter->query('SET sql_mode = @saved_sql_mode');
596
- }
597
- catch(Exception $e2)
598
- {
599
try
600
{
601
$adapter->query('SET @saved_sql_mode = @@sql_mode');
602
$adapter->query('SET sql_mode = \''.$trigger['current_sqlmode'].'\'');
603
- $adapter->query('CREATE DEFINER = '.$definer.' TRIGGER `'.$trigger['current_name'].'` AFTER '.$trigger['type'].' ON `'.$trigger['table'].'`'."\n".'FOR EACH ROW '.$trigger['current_statement']);
604
$adapter->query('SET sql_mode = @saved_sql_mode');
605
}
606
- catch(Exception $e3)
607
{
608
- throw new Exception($e2->getMessage().' '.$e3->getMessage());
609
- }
610
611
- throw $e2;
612
}
613
- }
614
- else
615
- {
616
- throw $e;
617
}
618
}
619
}
620
- }
621
622
- $adapter->query('DROP TABLE codisto_triggers');
623
624
- // check sync db exists
625
- $syncDbExists = false;
626
- $syncDb = null;
627
628
- try
629
- {
630
- $syncDb = new PDO('sqlite:' . $syncDbPath);
631
632
- $this->prepareSqliteDatabase( $syncDb, 60 );
633
634
- $qry = $syncDb->query('PRAGMA quick_check');
635
636
- $checkResult = $qry->fetchColumn();
637
638
- $qry->closeCursor();
639
640
- if($checkResult == 'ok')
641
- $syncDbExists = true;
642
- }
643
- catch(Exception $e)
644
- {
645
646
- }
647
648
- // check sync db uuid and mage uuid
649
- $changeToken = null;
650
- try
651
- {
652
- $changeToken = $adapter->fetchOne('SELECT token FROM `'.$tablePrefix.'codisto_sync` WHERE store_id = '.(int)$storeId);
653
- }
654
- catch(Exception $e)
655
- {
656
657
- }
658
659
- $syncToken = null;
660
- if($syncDb)
661
- {
662
- $qry = null;
663
- try
664
{
665
try
666
{
667
- $qry = $syncDb->query('SELECT token FROM sync');
668
669
- $syncToken = $qry->fetchColumn();
670
}
671
catch(Exception $e)
672
{
673
- if($qry)
674
- $qry->closeCursor();
675
}
676
}
677
- catch(Exception $e)
678
- {
679
680
- }
681
}
682
-
683
- return (!is_null($changeToken) && $changeToken != '') &&
684
- ($changeToken == $syncToken) &&
685
- $changeTablesExist &&
686
- $changeTriggersExist &&
687
- $syncDbExists;
688
}
689
690
public function cleanSyncFolder()
@@ -802,16 +817,49 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
802
array('pipe', 'w')
803
), $pipes);
804
805
- @fwrite($pipes[0], $script);
806
- fclose($pipes[0]);
807
808
$result = @stream_get_contents($pipes[1]);
809
if(!$result)
810
$result = '';
811
812
- fclose($pipes[1]);
813
-
814
- proc_close($process);
815
816
return $result;
817
}
@@ -1020,7 +1068,7 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
1020
1021
if(is_resource($process))
1022
{
1023
- proc_close($process);
1024
return true;
1025
}
1026
}
@@ -1077,24 +1125,43 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
1077
$descriptors, $pipes, Mage::getBaseDir('base'), array( 'CURL_CA_BUNDLE' => $curl_cainfo ));
1078
if(is_resource($process))
1079
{
1080
if(is_string($stdin))
1081
{
1082
for($written = 0; $written < strlen($stdin); )
1083
{
1084
$writecount = fwrite($pipes[0], substr($stdin, $written));
1085
if($writecount === false)
1086
- break;
1087
1088
$written += $writecount;
1089
}
1090
1091
- fclose($pipes[0]);
1092
}
1093
1094
- $result = stream_get_contents($pipes[1]);
1095
- fclose($pipes[1]);
1096
1097
- proc_close($process);
1098
return $result;
1099
}
1100
}
@@ -1108,7 +1175,7 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
1108
if(strpos($content, '{{') === false)
1109
return trim($content);
1110
1111
- $result = $this->runProcess('app/code/community/Codisto/Sync/Helper/CmsContent.php', null, array('pdo', 'curl', 'simplexml'), $content);
1112
if($result != null)
1113
return $result;
1114
@@ -1154,7 +1221,7 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
1154
1155
if($eventtype == Mage_Index_Model_Event::TYPE_DELETE)
1156
{
1157
- $syncObject->DeleteProduct($syncDb, $productids, $storeId);
1158
}
1159
else
1160
{
@@ -1166,7 +1233,7 @@ class Codisto_Sync_Helper_Data extends Mage_Core_Helper_Abstract
1166
}
1167
}
1168
1169
- $backgroundSignal = $this->runProcessBackground('app/code/community/Codisto/Sync/Helper/Signal.php', array(serialize($merchants), $msg), array('pdo', 'curl', 'simplexml'));
1170
if($backgroundSignal)
1171
return;
1172
12
* obtain it through the world-wide-web, please send an email
13
* to license@magentocommerce.com so we can send you a copy immediately.
14
*
15
+ * @category Codisto
16
+ * @package Codisto_Sync
17
* @copyright Copyright (c) 2015 On Technology Pty. Ltd. (http://codisto.com/)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
*/
20
21
106
}
107
catch(Exception $e)
108
{
109
+ if(property_exists($e, 'errorInfo') &&
110
+ $e->errorInfo[0] == 'HY000' &&
111
+ $e->errorInfo[1] == 8 &&
112
+ $e->errorInfo[2] == 'attempt to write a readonly database')
113
+ {
114
+ if(file_exists($nonceDbPath))
115
+ unlink($nonceDbPath);
116
+ }
117
$this->logExceptionCodisto($e, 'https://ui.codisto.com/installed');
118
}
119
153
}
154
155
//Determine if we can create a new merchant. Prevent multiple requests from being able to complete signups
156
+ public function createMerchantwithLock($timeout)
157
{
158
$createMerchant = false;
159
188
189
$lockQuery->closeCursor();
190
191
+ if($timeStamp + $timeout < microtime(true))
192
{
193
$createMerchant = true;
194
384
if(!$this->getTriggerMode())
385
return false;
386
387
+ try
388
+ {
389
+ $adapter = Mage::getModel('core/resource')->getConnection(Mage_Core_Model_Resource::DEFAULT_WRITE_RESOURCE);
390
391
+ $tablePrefix = Mage::getConfig()->getTablePrefix();
392
393
+ // change tables
394
+ $changeTableDefs = array(
395
+ 'codisto_product_change' => 'CREATE TABLE `'.$tablePrefix.'codisto_product_change` (product_id int(10) unsigned NOT NULL PRIMARY KEY, stamp datetime NOT NULL)',
396
+ 'codisto_order_change' => 'CREATE TABLE `'.$tablePrefix.'codisto_order_change` (order_id int(10) unsigned NOT NULL PRIMARY KEY, stamp datetime NOT NULL)',
397
+ 'codisto_category_change' => 'CREATE TABLE `'.$tablePrefix.'codisto_category_change` (category_id int(10) unsigned NOT NULL PRIMARY KEY, stamp datetime NOT NULL)'
398
+ );
399
400
+ $changeTablesExist = true;
401
402
+ $changeTables = $adapter->fetchCol('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE \''.$tablePrefix.'codisto_%_change\'');
403
+ if(is_array($changeTables))
404
{
405
+ $changeTables = array_flip( $changeTables );
406
+
407
+ foreach($changeTableDefs as $table => $createStatement)
408
{
409
+ if(!isset($changeTables[$tablePrefix.$table]))
410
+ {
411
+ $adapter->query($changeTableDefs[$table]);
412
413
+ $changeTablesExist = false;
414
+ }
415
}
416
}
417
418
+ // trigger management
419
+ $stdCodistoProductChangeStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;';
420
+ $stdCodistoProductDeleteStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;';
421
+ $stdCodistoCategoryChangeStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;';
422
+ $stdCodistoCategoryDeleteStmt = 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = OLD.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;';
423
+
424
+ $triggerStaticRules = array(
425
+ 'catalog_product_entity' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
426
+ 'catalog_product_entity_datetime' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
427
+ 'catalog_product_entity_decimal' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
428
+ 'catalog_product_entity_gallery' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
429
+ 'catalog_product_entity_group_price' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
430
+ 'catalog_product_entity_int' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
431
+ 'catalog_product_entity_media_gallery' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
432
+ 'catalog_product_entity_text' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
433
+ 'catalog_product_entity_varchar' => array( $stdCodistoProductChangeStmt, $stdCodistoProductChangeStmt, $stdCodistoProductDeleteStmt ),
434
+ 'cataloginventory_stock_item' => array(
435
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
436
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
437
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'
438
+ ),
439
+ 'cataloginventory_stock_status' => array(
440
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
441
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;',
442
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'
443
+ ),
444
+ 'catalog_category_entity' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
445
+ 'catalog_category_entity_datetime' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
446
+ 'catalog_category_entity_decimal' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
447
+ 'catalog_category_entity_int' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
448
+ 'catalog_category_entity_text' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
449
+ 'catalog_category_entity_varchar' => array( $stdCodistoCategoryChangeStmt, $stdCodistoCategoryChangeStmt, $stdCodistoCategoryDeleteStmt ),
450
+ 'catalog_category_product' => array(
451
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'.
452
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = NEW.category_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;',
453
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = NEW.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'.
454
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = NEW.category_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;',
455
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_product_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_product_change` SET product_id = OLD.product_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE product_id = product_id, stamp = UTC_TIMESTAMP(); END IF;'.
456
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_category_change\') THEN INSERT INTO `'.$tablePrefix.'codisto_category_change` SET category_id = OLD.category_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE category_id = category_id, stamp = UTC_TIMESTAMP(); END IF;'
457
+ ),
458
+ 'sales_flat_order' => array(
459
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND COALESCE(NEW.codisto_orderid, \'\') != \'\' THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
460
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND COALESCE(NEW.codisto_orderid, \'\') != \'\' THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
461
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND COALESCE(OLD.codisto_orderid, \'\') != \'\' THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.entity_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
462
+ ),
463
+ 'sales_flat_invoice' => array(
464
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
465
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
466
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = OLD.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
467
+ ),
468
+ 'sales_flat_shipment' => array(
469
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
470
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
471
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = OLD.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
472
+ ),
473
+ 'sales_flat_shipment_track' => array(
474
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
475
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = NEW.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = NEW.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;',
476
+ 'IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \''.$tablePrefix.'codisto_order_change\') AND EXISTS(SELECT 1 FROM `'.$tablePrefix.'sales_flat_order` WHERE entity_id = OLD.order_id AND COALESCE(codisto_orderid, \'\') != \'\') THEN INSERT INTO `'.$tablePrefix.'codisto_order_change` SET order_id = OLD.order_id, stamp = UTC_TIMESTAMP() ON DUPLICATE KEY UPDATE order_id = order_id, stamp = UTC_TIMESTAMP(); END IF;'
477
+ )
478
+ );
479
+
480
+ $triggerRules = array();
481
+ foreach($triggerStaticRules as $table => $statements)
482
{
483
+ $triggerRules[$tablePrefix.$table] = array( 'table' => $table, 'statements' => $statements );
484
}
485
486
+ $adapter->query('CREATE TEMPORARY TABLE `codisto_triggers` ( `table` varchar(100) NOT NULL PRIMARY KEY, `insert_statement` varchar(2000) NOT NULL, `update_statement` varchar(2000) NOT NULL, `delete_statement` varchar(2000) NOT NULL )');
487
+ foreach($triggerRules as $table => $tableData)
488
{
489
+ $adapter->insert('codisto_triggers', array( 'table' => $table, 'insert_statement' => $tableData['statements'][0], 'update_statement' => $tableData['statements'][1], 'delete_statement' => $tableData['statements'][2] ) );
490
}
491
492
+ $missingTriggers = $adapter->fetchAll(
493
+ 'SELECT T.`table`, '.
494
+ 'TYPE.`type`, '.
495
+ 'CASE WHEN TRIGGER_NAME IS NULL THEN 0 ELSE -1 END AS `exists`, '.
496
+ 'COALESCE(EXISTING.TRIGGER_CATALOG, \'\') AS `current_catalog`, '.
497
+ 'COALESCE(EXISTING.TRIGGER_SCHEMA, \'\') AS `current_schema`, '.
498
+ 'COALESCE(EXISTING.TRIGGER_NAME, \'\') AS `current_name`, '.
499
+ 'COALESCE(EXISTING.ACTION_STATEMENT, \'\') AS `current_statement`, '.
500
+ 'COALESCE(EXISTING.DEFINER, \'\') AS `current_definer`, '.
501
+ 'COALESCE(EXISTING.SQL_MODE, \'\') AS `current_sqlmode` '.
502
+ 'FROM `codisto_triggers` AS T '.
503
+ 'CROSS JOIN (SELECT \'UPDATE\' AS `type` UNION ALL SELECT \'INSERT\' UNION ALL SELECT \'DELETE\') AS TYPE '.
504
+ 'LEFT JOIN INFORMATION_SCHEMA.TRIGGERS AS EXISTING ON EXISTING.EVENT_OBJECT_TABLE = T.`table` AND EXISTING.ACTION_TIMING = \'AFTER\' AND EXISTING.EVENT_MANIPULATION = TYPE.`type` '.
505
+ 'WHERE NOT EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TRIGGERS WHERE EVENT_OBJECT_TABLE = T.`table` AND ACTION_TIMING = \'AFTER\' AND EVENT_MANIPULATION = TYPE.`type` AND ACTION_STATEMENT LIKE CONCAT(\'%\', CASE WHEN TYPE.`type` = \'INSERT\' THEN T.`insert_statement` WHEN TYPE.`type` = \'UPDATE\' THEN T.`update_statement` WHEN TYPE.`type` = \'DELETE\' THEN T.`delete_statement` END, \'%\'))');
506
+
507
+ $changeTriggersExist = true;
508
+
509
+ if(count($missingTriggers) > 0)
510
{
511
+ $changeTriggersExist = false;
512
513
+ $triggerTypeMap = array( 'INSERT' => 0, 'UPDATE' => 1, 'DELETE' => 2 );
514
515
+ $existingTriggers = array();
516
+ foreach($missingTriggers as $trigger)
517
{
518
+ if(isset($trigger['current_name']) && $trigger['current_name'] &&
519
+ $trigger['current_statement'])
520
+ {
521
+ $existingTriggers[] = array(
522
+ 'current_definer' => $trigger['current_definer'],
523
+ 'current_schema' => $trigger['current_schema'],
524
+ 'current_name' => $trigger['current_name'],
525
+ 'current_statement' => $trigger['current_statement'],
526
+ 'current_sqlmode' => $trigger['current_sqlmode'],
527
+ 'type' => $trigger['type'],
528
+ 'table' => $trigger['table']
529
+ );
530
+ }
531
+ }
532
533
+ if(!empty($existingTriggers))
534
+ {
535
+ $adapter->query('CREATE TABLE IF NOT EXISTS `'.$tablePrefix.'codisto_trigger_backup` (definer text NOT NULL, current_schema text NOT NULL, current_name text NOT NULL, current_statement text NOT NULL, type text NOT NULL, `table` text NOT NULL, stamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP)');
536
537
+ foreach($existingTriggers as $trigger)
538
+ {
539
+ $adapter->insert($tablePrefix.'codisto_trigger_backup', array(
540
+ 'definer' => $trigger['current_definer'],
541
+ 'current_schema' => $trigger['current_schema'],
542
+ 'current_name' => $trigger['current_name'],
543
+ 'current_statement' => $trigger['current_statement'],
544
+ 'type' => $trigger['type'],
545
+ 'table' => $trigger['table']
546
+ ));
547
+ }
548
}
549
+
550
+ foreach($missingTriggers as $trigger)
551
{
552
+ $triggerRule = $triggerRules[$trigger['table']];
553
+
554
+ $table = $triggerRule['table'];
555
+ $statement = $triggerRule['statements'][$triggerTypeMap[$trigger['type']]];
556
+
557
+ try
558
{
559
+ $final_statement = "\n/* start codisto change tracking trigger */\n".$statement."\n/* end codisto change tracking trigger */\n";
560
561
+ $adapter->query('DROP TRIGGER IF EXISTS codisto_'.$table.'_'.strtolower($trigger['type']));
562
+ $adapter->query('CREATE DEFINER = CURRENT_USER TRIGGER codisto_'.$table.'_'.strtolower($trigger['type']).' AFTER '.$trigger['type'].' ON `'.$trigger['table'].'`'."\n".'FOR EACH ROW BEGIN '.$final_statement.'END');
563
564
+ // TODO: loop on existing triggers for this class that match /* start codisto change tracking trigger */ and remove
565
+ }
566
+ catch(Exception $e)
567
+ {
568
+ if(method_exists($e, 'hasChainedException') &&
569
+ $e->hasChainedException() &&
570
+ $e->getChainedException() instanceof PDOException &&
571
+ is_array($e->getChainedException()->errorInfo) &&
572
+ $e->getChainedException()->errorInfo[1] == 1235)
573
{
574
+ // this version of mysql doesn't support multiple triggers so let's modify the existing trigger
575
576
+ $current_statement = preg_replace('/^BEGIN|END#x2F;i', '', $trigger['current_statement']);
577
+ $cleaned_statement = preg_replace('/\s*\/\*\s+start\s+codisto\s+change\s+tracking\s+trigger\s+\*\/.*\/\*\s+end\s+codisto\s+change\s+tracking\s+trigger\s+\*\/\n?\s*/is', '', $current_statement);
578
+ $final_statement = preg_replace('/;\s*;/', ';', $cleaned_statement."\n/* start codisto change tracking trigger */\n".$statement)
579
+ ."\n/* end codisto change tracking trigger */\n";
580
+
581
+ if(!preg_match('/^\s/', $final_statement))
582
+ {
583
+ $final_statement = "\n".$final_statement;
584
+ }
585
+ if(!preg_match('/\s#x2F;', $final_statement))
586
+ {
587
+ $final_statement = $final_statement."\n";
588
+ }
589
+
590
+ $definer = $trigger['current_definer'];
591
+ if(strpos($definer, '@') !== false)
592
+ {
593
+ $definer = explode('@', $definer);
594
+ $definer[0] = '\''.$definer[0].'\'';
595
+ $definer[1] = '\''.$definer[1].'\'';
596
+ $definer = implode('@', $definer);
597
+ }
598
599
try
600
{
601
$adapter->query('SET @saved_sql_mode = @@sql_mode');
602
$adapter->query('SET sql_mode = \''.$trigger['current_sqlmode'].'\'');
603
+ $adapter->query('DROP TRIGGER `'.$trigger['current_schema'].'`.`'.$trigger['current_name'].'`');
604
+ $adapter->query('CREATE DEFINER = '.$definer.' TRIGGER `'.$trigger['current_name'].'` AFTER '.$trigger['type'].' ON `'.$trigger['table'].'`'."\n".' FOR EACH ROW BEGIN'.$final_statement.'END');
605
$adapter->query('SET sql_mode = @saved_sql_mode');
606
}
607
+ catch(Exception $e2)
608
{
609
+ try
610
+ {
611
+ $adapter->query('SET @saved_sql_mode = @@sql_mode');
612
+ $adapter->query('SET sql_mode = \''.$trigger['current_sqlmode'].'\'');
613
+ $adapter->query('CREATE DEFINER = '.$definer.' TRIGGER `'.$trigger['current_name'].'` AFTER '.$trigger['type'].' ON `'.$trigger['table'].'`'."\n".'FOR EACH ROW '.$trigger['current_statement']);
614
+ $adapter->query('SET sql_mode = @saved_sql_mode');
615
+ }
616
+ catch(Exception $e3)
617
+ {
618
+ throw new Exception($e2->getMessage().' '.$e3->getMessage());
619
+ }
620
621
+ throw $e2;
622
+ }
623
+ }
624
+ else
625
+ {
626
+ throw $e;
627
}
628
}
629
}
630
}
631
632
+ $adapter->query('DROP TABLE codisto_triggers');
633
634
+ // check sync db exists
635
+ $syncDbExists = false;
636
+ $syncDb = null;
637
638
+ try
639
+ {
640
+ $syncDb = new PDO('sqlite:' . $syncDbPath);
641
642
+ $this->prepareSqliteDatabase( $syncDb, 60 );
643
644
+ $qry = $syncDb->query('PRAGMA quick_check');
645
646
+ $checkResult = $qry->fetchColumn();
647
648
+ $qry->closeCursor();
649
650
+ if($checkResult == 'ok')
651
+ $syncDbExists = true;
652
+ }
653
+ catch(Exception $e)
654
+ {
655
656
+ }
657
658
+ // check sync db uuid and mage uuid
659
+ $changeToken = null;
660
+ try
661
+ {
662
+ $changeToken = $adapter->fetchOne('SELECT token FROM `'.$tablePrefix.'codisto_sync` WHERE store_id = '.(int)$storeId);
663
+ }
664
+ catch(Exception $e)
665
+ {
666
667
+ }
668
669
+ $syncToken = null;
670
+ if($syncDb)
671
{
672
+ $qry = null;
673
try
674
{
675
+ try
676
+ {
677
+ $qry = $syncDb->query('SELECT token FROM sync');
678
679
+ $syncToken = $qry->fetchColumn();
680
+ }
681
+ catch(Exception $e)
682
+ {
683
+ if($qry)
684
+ $qry->closeCursor();
685
+ }
686
}
687
catch(Exception $e)
688
{
689
+
690
}
691
}
692
693
+ return (!is_null($changeToken) && $changeToken != '') &&
694
+ ($changeToken == $syncToken) &&
695
+ $changeTablesExist &&
696
+ $changeTriggersExist &&
697
+ $syncDbExists;
698
+ }
699
+ catch(Exception $e)
700
+ {
701
+ return false;
702
}
703
}
704
705
public function cleanSyncFolder()
817
array('pipe', 'w')
818
), $pipes);
819
820
+ stream_set_blocking( $pipes[0], 0 );
821
+ stream_set_blocking( $pipes[1], 0 );
822
+
823
+ stream_set_timeout( $pipes[0], 5 );
824
+ stream_set_timeout( $pipes[1], 10 );
825
+
826
+ $write_total = strlen( $script );
827
+ $written = 0;
828
+
829
+ while($write_total > 0)
830
+ {
831
+ $write_count = @fwrite($pipes[0], substr( $script, $written ) );
832
+ if($write_count === false)
833
+ {
834
+ @fclose( $pipes[0] );
835
+ @fclose( $pipes[1] );
836
+ @proc_terminate( $process, 9 );
837
+ @proc_close( $process );
838
+
839
+ return '';
840
+ }
841
+
842
+ $write_total -= $write_count;
843
+ $written += $write_count;
844
+ }
845
+
846
+ @fclose( $pipes[0] );
847
848
$result = @stream_get_contents($pipes[1]);
849
+ if($result === false)
850
+ {
851
+ @fclose( $pipes[1] );
852
+ @proc_terminate( $process, 9 );
853
+ @proc_close( $process );
854
+
855
+ return '';
856
+ }
857
+
858
if(!$result)
859
$result = '';
860
861
+ @fclose( $pipes[1] );
862
+ @proc_close( $process );
863
864
return $result;
865
}
1068
1069
if(is_resource($process))
1070
{
1071
+ @proc_close($process);
1072
return true;
1073
}
1074
}
1125
$descriptors, $pipes, Mage::getBaseDir('base'), array( 'CURL_CA_BUNDLE' => $curl_cainfo ));
1126
if(is_resource($process))
1127
{
1128
+ stream_set_blocking( $pipes[0], 0 );
1129
+ stream_set_blocking( $pipes[1], 0 );
1130
+
1131
+ stream_set_timeout( $pipes[0], 5 );
1132
+ stream_set_timeout( $pipes[1], 30 );
1133
+
1134
if(is_string($stdin))
1135
{
1136
for($written = 0; $written < strlen($stdin); )
1137
{
1138
$writecount = fwrite($pipes[0], substr($stdin, $written));
1139
if($writecount === false)
1140
+ {
1141
+ @fclose( $pipes[0] );
1142
+ @fclose( $pipes[1] );
1143
+ @proc_terminate( $process, 9 );
1144
+ @proc_close( $process );
1145
+ return null;
1146
+ }
1147
1148
$written += $writecount;
1149
}
1150
1151
+ @fclose($pipes[0]);
1152
}
1153
1154
+ $result = @stream_get_contents($pipes[1]);
1155
+ if($result === false)
1156
+ {
1157
+ @fclose( $pipes[1] );
1158
+ @proc_terminate( $process, 9 );
1159
+ @proc_close( $process );
1160
+ return null;
1161
+ }
1162
1163
+ @fclose($pipes[1]);
1164
+ @proc_close($process);
1165
return $result;
1166
}
1167
}
1175
if(strpos($content, '{{') === false)
1176
return trim($content);
1177
1178
+ $result = $this->runProcess(realpath(dirname(__FILE__)).'/CmsContent.php', null, array('pdo', 'curl', 'simplexml'), $content);
1179
if($result != null)
1180
return $result;
1181
1221
1222
if($eventtype == Mage_Index_Model_Event::TYPE_DELETE)
1223
{
1224
+ $syncObject->DeleteProducts($syncDb, $productids, $storeId);
1225
}
1226
else
1227
{
1233
}
1234
}
1235
1236
+ $backgroundSignal = $this->runProcessBackground(realpath(dirname(__FILE__)).'/Signal.php', array(serialize($merchants), $msg), array('pdo', 'curl', 'simplexml'));
1237
if($backgroundSignal)
1238
return;
1239
app/code/community/Codisto/Sync/Model/Sync.php CHANGED
@@ -12,10 +12,10 @@
12
* obtain it through the world-wide-web, please send an email
13
* to license@magentocommerce.com so we can send you a copy immediately.
14
*
15
- * @category Codisto
16
- * @package Codisto_Sync
17
* @copyright Copyright (c) 2015 On Technology Pty. Ltd. (http://codisto.com/)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
*/
20
21
class Codisto_Sync_Model_Sync
@@ -82,52 +82,18 @@ class Codisto_Sync_Model_Sync
82
83
private function AvailableProductFields($selectArr) {
84
85
- $attributes = array();
86
- $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
87
- foreach ($productAttrs as $productAttr) {
88
- $attributes[] = $productAttr->getAttributeCode();
89
- }
90
- $selectAvailable = array();
91
- foreach($attributes as $attr){
92
- if (in_array($attr, $selectArr)) {
93
- $selectAvailable[] = $attr;
94
- }
95
- }
96
- return $selectAvailable;
97
-
98
- }
99
100
- private function FilesInDir($dir, $prefix = '')
101
- {
102
- $dir = rtrim($dir, '\\/');
103
- $result = array();
104
-
105
- try
106
{
107
- if(is_dir($dir))
108
{
109
- $scan = @scandir($dir);
110
-
111
- if($scan !== false)
112
- {
113
- foreach ($scan as $f) {
114
- if ($f !== '.' and $f !== '..') {
115
- if (is_dir("$dir/$f")) {
116
- $result = array_merge($result, $this->FilesInDir("$dir/$f", "$f/"));
117
- } else {
118
- $result[] = $prefix.$f;
119
- }
120
- }
121
- }
122
- }
123
}
124
}
125
- catch(Exception $e)
126
- {
127
128
- }
129
-
130
- return $result;
131
}
132
133
public function TemplateRead($templateDb)
@@ -259,9 +225,6 @@ class Codisto_Sync_Model_Sync
259
{
260
$db = $this->GetSyncDb($syncDb, 60 );
261
262
- $args = array();
263
- $args[] = $id;
264
-
265
$db->exec('BEGIN EXCLUSIVE TRANSACTION');
266
267
$db->exec('CREATE TABLE IF NOT EXISTS CategoryDelete(ExternalReference text NOT NULL PRIMARY KEY);'.
@@ -334,17 +297,33 @@ class Codisto_Sync_Model_Sync
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')),
350
array(
@@ -426,7 +405,7 @@ class Codisto_Sync_Model_Sync
426
$db->exec('COMMIT TRANSACTION');
427
}
428
429
- public function DeleteProduct($syncDb, $ids, $storeId)
430
{
431
$db = $this->GetSyncDb($syncDb, 60 );
432
@@ -439,25 +418,30 @@ class Codisto_Sync_Model_Sync
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');
462
}
463
@@ -477,7 +461,6 @@ class Codisto_Sync_Model_Sync
477
$data = array();
478
foreach ($insertFields as $key)
479
{
480
-
481
$value = $categoryData[$key];
482
483
if(!$value) {
@@ -572,53 +555,73 @@ class Codisto_Sync_Model_Sync
572
$productParent = $args['parent_product'];
573
574
$attributeCodes = array();
575
576
foreach($attributes as $attribute)
577
{
578
- $attributeCodes[] = $attribute->getProductAttribute()->getAttributeCode();
579
}
580
581
- $attributeValues = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($skuData['entity_id'], $attributeCodes, $store->getId());
582
-
583
- if(!is_array($attributeValues))
584
- $attributeValues = array( $attributeCodes[0] => $attributeValues );
585
-
586
- $options = array();
587
-
588
- foreach($attributes as $attribute)
589
{
590
- $productAttribute = $attribute->getProductAttribute();
591
592
- $options[$productAttribute->getId()] = $attributeValues[$productAttribute->getAttributeCode()];
593
}
594
- $price = $this->SyncProductPrice($store, $productParent, $options);
595
596
- if(!$price)
597
$price = 0;
598
599
$insertSKULinkSQL->execute(array($skuData['entity_id'], $args['parent_id'], $price));
600
601
-
602
// SKU Matrix
603
foreach($attributes as $attribute)
604
{
605
$productAttribute = $attribute->getProductAttribute();
606
- $productOptionId = $productAttribute->getId();
607
- $productOptionValueId = $attributeValues[$productAttribute->getAttributeCode()];
608
609
- if(isset($productOptionValueId))
610
{
611
- $attributeName = $attribute->getLabel();
612
- $attributeValue = $productAttribute->getSource()->getOptionText($productOptionValueId);
613
-
614
- $insertSKUMatrixSQL->execute(array(
615
- $skuData['entity_id'],
616
- $args['parent_id'],
617
- '',
618
- $attributeName,
619
- $attributeValue,
620
- $productOptionId,
621
- $productOptionValueId));
622
}
623
}
624
}
@@ -872,7 +875,7 @@ class Codisto_Sync_Model_Sync
872
$data[] = $product_id;
873
$data[] = $type == 'configurable' ? 'c' : ($type == 'grouped' ? 'g' : 's');
874
$data[] = $productData['sku'];
875
- $data[] = $productName;
876
$data[] = $price;
877
$data[] = $listPrice;
878
$data[] = isset($productData['tax_class_id']) && $productData['tax_class_id'] ? $productData['tax_class_id'] : '';
@@ -916,6 +919,9 @@ class Codisto_Sync_Model_Sync
916
917
foreach($attributes as $attribute)
918
{
919
$backend = $attribute->getBackEnd();
920
if(!$backend->isStatic())
921
{
@@ -1050,128 +1056,131 @@ class Codisto_Sync_Model_Sync
1050
$attrTypeSelects[] = $attrTypeSelect;
1051
}
1052
1053
- $attributeValues = array();
1054
-
1055
- $attrSelect = $adapter->select()->union($attrTypeSelects, Zend_Db_Select::SQL_UNION_ALL);
1056
-
1057
- $attrArgs = array(
1058
- 'entity_type_id' => 4,
1059
- 'entity_id' => $product_id,
1060
- 'store_id' => $store->getId()
1061
- );
1062
-
1063
- $attributeRows = $adapter->fetchPairs($attrSelect, $attrArgs);
1064
- foreach ($attributeRows as $attributeId => $attributeValue)
1065
- {
1066
- $attributeCode = $attributeCodeIDMap[$attributeId];
1067
- $attributeValues[$attributeCode] = $attributeValue;
1068
- }
1069
-
1070
- foreach($attributeSet as $attributeData)
1071
{
1072
- if(isset($attributeValues[$attributeData['code']]))
1073
- $attributeValue = $attributeValues[$attributeData['code']];
1074
- else
1075
- $attributeValue = null;
1076
1077
- if(isset($attributeData['source']) &&
1078
- $attributeData['source_model'] == 'eav/entity_attribute_source_boolean')
1079
- {
1080
- $attributeData['backend_type'] = 'boolean';
1081
1082
- if(isset($attributeValue) && $attributeValue)
1083
- $attributeValue = -1;
1084
- else
1085
- $attributeValue = 0;
1086
- }
1087
1088
- else if($attributeData['html'])
1089
{
1090
- $attributeValue = Mage::helper('codistosync')->processCmsContent($attributeValue);
1091
}
1092
1093
- else if( in_array($attributeData['frontend_type'], array( 'select', 'multiselect' ) ) )
1094
{
1095
- if(is_array($attributeValue))
1096
{
1097
- if(isset($attributeData['source']) &&
1098
- method_exists( $attributeData['source'], 'getOptionText') )
1099
{
1100
- $attributeValueSet = array();
1101
1102
- foreach($attributeValue as $attributeOptionId)
1103
{
1104
- if(isset($this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeOptionId]))
1105
{
1106
- $attributeValueSet[] = $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeOptionId];
1107
}
1108
else
1109
{
1110
try
1111
{
1112
- $attributeText = $attributeData['source']->getOptionText($attributeOptionId);
1113
1114
- $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeOptionId] = $attributeText;
1115
1116
- $attributeValueSet[] = $attributeText;
1117
}
1118
catch(Exception $e)
1119
{
1120
-
1121
}
1122
}
1123
}
1124
-
1125
- $attributeValue = $attributeValueSet;
1126
}
1127
}
1128
- else
1129
{
1130
- if(isset($attributeData['source']) &&
1131
- method_exists( $attributeData['source'], 'getOptionText') )
1132
{
1133
- if(isset($this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeValue]))
1134
- {
1135
- $attributeValue = $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeValue];
1136
- }
1137
- else
1138
- {
1139
- try
1140
- {
1141
- $attributeText = $attributeData['source']->getOptionText($attributeValue);
1142
1143
- $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeValue] = $attributeText;
1144
1145
- $attributeValue = $attributeText;
1146
- }
1147
- catch(Exception $e)
1148
- {
1149
- $attributeValue = null;
1150
- }
1151
- }
1152
}
1153
- }
1154
- }
1155
-
1156
- if(isset($attributeValue) && !is_null($attributeValue))
1157
- {
1158
- if($attributeData['html'])
1159
- {
1160
- $insertHTMLSQL->execute(array($product_id, $attributeData['label'], $attributeValue));
1161
- }
1162
1163
- $insertAttributeSQL->execute(array($attributeData['id'], $attributeData['name'], $attributeData['label'], $attributeData['backend_type'], $attributeData['frontend_type']));
1164
1165
- if($attributeData['groupid'])
1166
- {
1167
- $insertAttributeGroupSQL->execute(array($attributeData['groupid'], $attributeData['groupname']));
1168
- $insertAttributeGroupMapSQL->execute(array($attributeData['groupid'], $attributeData['id']));
1169
}
1170
-
1171
- if(is_array($attributeValue))
1172
- $attributeValue = implode(',', $attributeValue);
1173
-
1174
- $insertProductAttributeSQL->execute(array($product_id, $attributeData['id'], $attributeValue));
1175
}
1176
}
1177
@@ -2690,4 +2699,37 @@ class Codisto_Sync_Model_Sync
2690
2691
return $price;
2692
}
2693
}
12
* obtain it through the world-wide-web, please send an email
13
* to license@magentocommerce.com so we can send you a copy immediately.
14
*
15
+ * @category Codisto
16
+ * @package Codisto_Sync
17
* @copyright Copyright (c) 2015 On Technology Pty. Ltd. (http://codisto.com/)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
*/
20
21
class Codisto_Sync_Model_Sync
82
83
private function AvailableProductFields($selectArr) {
84
85
+ $attributes = array('entity_id');
86
87
+ $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
88
+ foreach ($productAttrs as $productAttr)
89
{
90
+ if( in_array( $productAttr->getAttributeCode(), $selectArr ) )
91
{
92
+ $attributes[] = $productAttr->getAttributeCode();
93
}
94
}
95
96
+ return $attributes;
97
}
98
99
public function TemplateRead($templateDb)
225
{
226
$db = $this->GetSyncDb($syncDb, 60 );
227
228
$db->exec('BEGIN EXCLUSIVE TRANSACTION');
229
230
$db->exec('CREATE TABLE IF NOT EXISTS CategoryDelete(ExternalReference text NOT NULL PRIMARY KEY);'.
297
298
$db->exec('BEGIN EXCLUSIVE TRANSACTION');
299
300
+ $db->exec('CREATE TEMPORARY TABLE TmpChanged (entity_id text NOT NULL PRIMARY KEY)');
301
+ foreach($ids as $id)
302
+ {
303
+ $db->exec('INSERT INTO TmpChanged (entity_id) VALUES('.$id.')');
304
+ }
305
+
306
+ try
307
+ {
308
+ $db->exec('DELETE FROM ProductDelete WHERE ExternalReference IN (SELECT entity_id FROM TmpChanged)');
309
+ }
310
+ catch(Exception $e)
311
+ {
312
+
313
+ }
314
+ $db->exec('DELETE FROM Product WHERE ExternalReference IN (SELECT entity_id FROM TmpChanged)');
315
+ $db->exec('DELETE FROM ProductImage WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
316
+ $db->exec('DELETE FROM ProductHTML WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
317
+ $db->exec('DELETE FROM ProductRelated WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
318
+ $db->exec('DELETE FROM ProductAttributeValue WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
319
+ $db->exec('DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged))');
320
+ $db->exec('DELETE FROM ProductQuestion WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
321
+ $db->exec('DELETE FROM SKUMatrix WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
322
+ $db->exec('DELETE FROM SKULink WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
323
+ $db->exec('DELETE FROM SKU WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
324
+ $db->exec('DELETE FROM CategoryProduct WHERE ProductExternalReference IN (SELECT entity_id FROM TmpChanged)');
325
+
326
+ $db->exec('DROP TABLE TmpChanged');
327
328
Mage::getSingleton('core/resource_iterator')->walk($configurableProducts->getSelect(), array(array($this, 'SyncConfigurableProductData')),
329
array(
405
$db->exec('COMMIT TRANSACTION');
406
}
407
408
+ public function DeleteProducts($syncDb, $ids, $storeId)
409
{
410
$db = $this->GetSyncDb($syncDb, 60 );
411
418
$ids = array($ids);
419
}
420
421
+ $db->exec('CREATE TEMPORARY TABLE TmpDeleted(entity_id text NOT NULL PRIMARY KEY)');
422
423
foreach($ids as $id)
424
{
425
+ $db->exec('INSERT OR IGNORE INTO TmpDeleted (entity_id) VALUES ('.$id.')');
426
$db->exec('INSERT OR IGNORE INTO ProductDelete VALUES('.$id.')');
427
}
428
429
+ $db->exec(
430
+ 'DELETE FROM Product WHERE ExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
431
+ 'DELETE FROM ProductImage WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
432
+ 'DELETE FROM ProductHTML WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
433
+ 'DELETE FROM ProductRelated WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
434
+ 'DELETE FROM ProductAttributeValue WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
435
+ 'DELETE FROM ProductQuestionAnswer WHERE ProductQuestionExternalReference IN (SELECT ExternalReference FROM ProductQuestion WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted));'.
436
+ 'DELETE FROM ProductQuestion WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
437
+ 'DELETE FROM SKULink WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
438
+ 'DELETE FROM SKUMatrix WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
439
+ 'DELETE FROM SKU WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted);'.
440
+ 'DELETE FROM CategoryProduct WHERE ProductExternalReference IN (SELECT entity_id FROM TmpDeleted)'
441
+ );
442
+
443
+ $db->exec('DROP TABLE TmpDeleted');
444
+
445
$db->exec('COMMIT TRANSACTION');
446
}
447
461
$data = array();
462
foreach ($insertFields as $key)
463
{
464
$value = $categoryData[$key];
465
466
if(!$value) {
555
$productParent = $args['parent_product'];
556
557
$attributeCodes = array();
558
+ $productAttributes = array();
559
+ $attributeValues = array();
560
561
foreach($attributes as $attribute)
562
{
563
+ $prodAttr = $attribute->getProductAttribute();
564
+ if($prodAttr)
565
+ {
566
+ $attributeCodes[] = $prodAttr->getAttributeCode();
567
+ $productAttributes[] = $prodAttr;
568
+ }
569
}
570
571
+ if(!empty($attributeCodes))
572
{
573
+ $attributeValues = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($skuData['entity_id'], $attributeCodes, $store->getId());
574
+ if(!is_array($attributeValues))
575
+ $attributeValues = array( $attributeCodes[0] => $attributeValues );
576
577
+ $options = array();
578
+ foreach($productAttributes as $attribute)
579
+ {
580
+ $options[$attribute->getId()] = $attributeValues[$attribute->getAttributeCode()];
581
+ }
582
}
583
584
+ if(!empty($options))
585
+ {
586
+ $price = $this->SyncProductPrice($store, $productParent, $options);
587
+ if(!$price)
588
+ $price = 0;
589
+ }
590
+ else
591
+ {
592
$price = 0;
593
+ }
594
595
$insertSKULinkSQL->execute(array($skuData['entity_id'], $args['parent_id'], $price));
596
597
// SKU Matrix
598
foreach($attributes as $attribute)
599
{
600
$productAttribute = $attribute->getProductAttribute();
601
602
+ if($productAttribute)
603
{
604
+ $productAttribute->setStoreId($store->getId());
605
+ $productAttribute->setStore($store);
606
+
607
+ $productOptionId = $productAttribute->getId();
608
+ $productOptionValueId = isset($attributeValues[$productAttribute->getAttributeCode()]) ?
609
+ $attributeValues[$productAttribute->getAttributeCode()] : null;
610
+
611
+ if($productOptionValueId != null)
612
+ {
613
+ $attributeName = $attribute->getLabel();
614
+ $attributeValue = $productAttribute->getSource()->getOptionText($productOptionValueId);
615
+
616
+ $insertSKUMatrixSQL->execute(array(
617
+ $skuData['entity_id'],
618
+ $args['parent_id'],
619
+ '',
620
+ $attributeName,
621
+ $attributeValue,
622
+ $productOptionId,
623
+ $productOptionValueId));
624
+ }
625
}
626
}
627
}
875
$data[] = $product_id;
876
$data[] = $type == 'configurable' ? 'c' : ($type == 'grouped' ? 'g' : 's');
877
$data[] = $productData['sku'];
878
+ $data[] = html_entity_decode($productName);
879
$data[] = $price;
880
$data[] = $listPrice;
881
$data[] = isset($productData['tax_class_id']) && $productData['tax_class_id'] ? $productData['tax_class_id'] : '';
919
920
foreach($attributes as $attribute)
921
{
922
+ $attribute->setStoreId($store->getId());
923
+ $attribute->setStore($store);
924
+
925
$backend = $attribute->getBackEnd();
926
if(!$backend->isStatic())
927
{
1056
$attrTypeSelects[] = $attrTypeSelect;
1057
}
1058
1059
+ if(!empty($attrTypeSelects))
1060
{
1061
+ $attributeValues = array();
1062
1063
+ $attrSelect = $adapter->select()->union($attrTypeSelects, Zend_Db_Select::SQL_UNION_ALL);
1064
1065
+ $attrArgs = array(
1066
+ 'entity_type_id' => 4,
1067
+ 'entity_id' => $product_id,
1068
+ 'store_id' => $store->getId()
1069
+ );
1070
1071
+ $attributeRows = $adapter->fetchPairs($attrSelect, $attrArgs);
1072
+ foreach ($attributeRows as $attributeId => $attributeValue)
1073
{
1074
+ $attributeCode = $attributeCodeIDMap[$attributeId];
1075
+ $attributeValues[$attributeCode] = $attributeValue;
1076
}
1077
1078
+ foreach($attributeSet as $attributeData)
1079
{
1080
+ if(isset($attributeValues[$attributeData['code']]))
1081
+ $attributeValue = $attributeValues[$attributeData['code']];
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
1093
+ $attributeValue = 0;
1094
+ }
1095
+
1096
+ else if($attributeData['html'])
1097
+ {
1098
+ $attributeValue = Mage::helper('codistosync')->processCmsContent($attributeValue);
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']) &&
1106
+ method_exists( $attributeData['source'], 'getOptionText') )
1107
+ {
1108
+ $attributeValueSet = array();
1109
+
1110
+ foreach($attributeValue as $attributeOptionId)
1111
+ {
1112
+ if(isset($this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeOptionId]))
1113
+ {
1114
+ $attributeValueSet[] = $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeOptionId];
1115
+ }
1116
+ else
1117
+ {
1118
+ try
1119
+ {
1120
+ $attributeText = $attributeData['source']->getOptionText($attributeOptionId);
1121
+
1122
+ $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeOptionId] = $attributeText;
1123
+
1124
+ $attributeValueSet[] = $attributeText;
1125
+ }
1126
+ catch(Exception $e)
1127
+ {
1128
+
1129
+ }
1130
+ }
1131
+ }
1132
1133
+ $attributeValue = $attributeValueSet;
1134
+ }
1135
+ }
1136
+ else
1137
+ {
1138
+ if(isset($attributeData['source']) &&
1139
+ method_exists( $attributeData['source'], 'getOptionText') )
1140
{
1141
+ if(isset($this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeValue]))
1142
{
1143
+ $attributeValue = $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeValue];
1144
}
1145
else
1146
{
1147
try
1148
{
1149
+ $attributeText = $attributeData['source']->getOptionText($attributeValue);
1150
1151
+ $this->optionTextCache[$store->getId().'-'.$attributeData['id'].'-'.$attributeValue] = $attributeText;
1152
1153
+ $attributeValue = $attributeText;
1154
}
1155
catch(Exception $e)
1156
{
1157
+ $attributeValue = null;
1158
}
1159
}
1160
}
1161
}
1162
}
1163
+
1164
+ if(isset($attributeValue) && !is_null($attributeValue))
1165
{
1166
+ if($attributeData['html'])
1167
{
1168
+ $insertHTMLSQL->execute(array($product_id, $attributeData['label'], $attributeValue));
1169
+ }
1170
1171
+ $insertAttributeSQL->execute(array($attributeData['id'], $attributeData['name'], $attributeData['label'], $attributeData['backend_type'], $attributeData['frontend_type']));
1172
1173
+ if($attributeData['groupid'])
1174
+ {
1175
+ $insertAttributeGroupSQL->execute(array($attributeData['groupid'], $attributeData['groupname']));
1176
+ $insertAttributeGroupMapSQL->execute(array($attributeData['groupid'], $attributeData['id']));
1177
}
1178
1179
+ if(is_array($attributeValue))
1180
+ $attributeValue = implode(',', $attributeValue);
1181
1182
+ $insertProductAttributeSQL->execute(array($product_id, $attributeData['id'], $attributeValue));
1183
}
1184
}
1185
}
1186
2699
2700
return $price;
2701
}
2702
+
2703
+ private function FilesInDir($dir, $prefix = '')
2704
+ {
2705
+ $dir = rtrim($dir, '\\/');
2706
+ $result = array();
2707
+
2708
+ try
2709
+ {
2710
+ if(is_dir($dir))
2711
+ {
2712
+ $scan = @scandir($dir);
2713
+
2714
+ if($scan !== false)
2715
+ {
2716
+ foreach ($scan as $f) {
2717
+ if ($f !== '.' and $f !== '..') {
2718
+ if (is_dir("$dir/$f")) {
2719
+ $result = array_merge($result, $this->FilesInDir("$dir/$f", "$f/"));
2720
+ } else {
2721
+ $result[] = $prefix.$f;
2722
+ }
2723
+ }
2724
+ }
2725
+ }
2726
+ }
2727
+ }
2728
+ catch(Exception $e)
2729
+ {
2730
+
2731
+ }
2732
+
2733
+ return $result;
2734
+ }
2735
}
app/code/community/Codisto/Sync/controllers/IndexController.php CHANGED
@@ -184,8 +184,8 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
184
$item->setDiscountAmount(0);
185
$item->setBaseDiscountAmount(0);
186
$item->setTaxPercent($taxpercent);
187
- $item->setTaxAmount($producttax);
188
- $item->setBaseTaxAmount($producttax);
189
$item->setRowTotal($productprice * $productqty);
190
$item->setBaseRowTotal($productprice * $productqty);
191
$item->setRowTotalWithDiscount($productprice * $productqty);
@@ -297,9 +297,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
297
298
$request = $this->getRequest();
299
$response = $this->getResponse();
300
- $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
301
- $contenttype = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '';
302
$server = $request->getServer();
303
304
if($method == 'POST')
305
{
@@ -566,7 +566,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
566
$order->setShippingAddress($quoteConverter->addressToOrderAddress($quote->getShippingAddress()));
567
$order->setPayment($quoteConverter->paymentToOrderPayment($quote->getPayment()));
568
$order->setCustomer($quote->getCustomer());
569
- $order->setCodistoOrderid($ordercontent->orderid);
570
571
if(preg_match('/\{ordernumber\}|\{ebaysalesrecordnumber\}|\{ebaytransactionid\}/', $ordernumberformat))
572
{
@@ -683,9 +683,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
683
$orderItem->setBasePrice($price);
684
$orderItem->setBasePriceInclTax($priceinctax);
685
$orderItem->setTaxPercent($taxpercent);
686
- $orderItem->setTaxAmount($taxamount);
687
- $orderItem->setTaxBeforeDiscount($taxamount);
688
- $orderItem->setBaseTaxBeforeDiscount($taxamount);
689
$orderItem->setDiscountAmount(0);
690
$orderItem->setWeight($weight);
691
$orderItem->setBaseRowTotal($subtotal);
@@ -1220,9 +1220,9 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1220
$item->setBasePrice($price);
1221
$item->setBasePriceInclTax($priceinctax);
1222
$item->setTaxPercent($taxpercent);
1223
- $item->setTaxAmount($taxamount);
1224
- $item->setTaxBeforeDiscount($taxamount);
1225
- $item->setBaseTaxBeforeDiscount($taxamount);
1226
$item->setDiscountAmount(0);
1227
$item->setWeight($weight);
1228
$item->setBaseRowTotal($subtotal);
@@ -1533,6 +1533,10 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1533
$billing_first_name = $billing_address->name;
1534
}
1535
1536
$shipping_address = $ordercontent->orderaddresses->orderaddress[1];
1537
$shipping_first_name = $shipping_last_name = '';
1538
@@ -1544,8 +1548,12 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1544
$shipping_first_name = $shipping_address->name;
1545
}
1546
1547
$email = (string)$billing_address->email;
1548
- if(!$email)
1549
$email = 'mail@example.com';
1550
1551
$regionCollection = $this->getRegionCollection($billing_address->countrycode);
@@ -1571,7 +1579,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1571
'street' => (string)$billing_address->address1.($billing_address->address2 ? "\n".$billing_address->address2 : ''),
1572
'city' => (string)$billing_address->place,
1573
'postcode' => (string)$billing_address->postalcode,
1574
- 'telephone' => (string)$billing_address->phone,
1575
'fax' => '',
1576
'country_id' => (string)$billing_address->countrycode,
1577
'region_id' => $regionsel_id, // id from directory_country_region table
@@ -1598,7 +1606,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1598
'street' => (string)$shipping_address->address1.($shipping_address->address2 ? "\n".$shipping_address->address2 : ''),
1599
'city' => (string)$shipping_address->place,
1600
'postcode' => (string)$shipping_address->postalcode,
1601
- 'telephone' => (string)$shipping_address->phone,
1602
'fax' => '',
1603
'country_id' => (string)$shipping_address->countrycode,
1604
'region_id' => $regionsel_id_ship, // id from directory_country_region table
@@ -1607,7 +1615,7 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1607
1608
$customer = null;
1609
1610
- if($register_customer)
1611
{
1612
$customer = Mage::getModel('customer/customer');
1613
$customer->setWebsiteId($websiteId);
@@ -1819,8 +1827,8 @@ class Codisto_Sync_IndexController extends Mage_Core_Controller_Front_Action
1819
$item->setDiscountAmount(0);
1820
$item->setBaseDiscountAmount(0);
1821
$item->setTaxPercent($taxpercent);
1822
- $item->setTaxAmount($taxamount);
1823
- $item->setBaseTaxAmount($taxamount);
1824
$item->setRowTotal($subtotal);
1825
$item->setBaseRowTotal($subtotal);
1826
$item->setRowTotalWithDiscount($subtotal);
184
$item->setDiscountAmount(0);
185
$item->setBaseDiscountAmount(0);
186
$item->setTaxPercent($taxpercent);
187
+ $item->setTaxAmount($producttax * $productqty);
188
+ $item->setBaseTaxAmount($producttax * $productqty);
189
$item->setRowTotal($productprice * $productqty);
190
$item->setBaseRowTotal($productprice * $productqty);
191
$item->setRowTotalWithDiscount($productprice * $productqty);
297
298
$request = $this->getRequest();
299
$response = $this->getResponse();
300
$server = $request->getServer();
301
+ $method = isset($server['REQUEST_METHOD']) ? $server['REQUEST_METHOD'] : 'GET';
302
+ $contenttype = isset($server['CONTENT_TYPE']) ? $server['CONTENT_TYPE'] : '';
303
304
if($method == 'POST')
305
{
566
$order->setShippingAddress($quoteConverter->addressToOrderAddress($quote->getShippingAddress()));
567
$order->setPayment($quoteConverter->paymentToOrderPayment($quote->getPayment()));
568
$order->setCustomer($quote->getCustomer());
569
+ $order->setCodistoOrderid((string)$ordercontent->orderid);
570
571
if(preg_match('/\{ordernumber\}|\{ebaysalesrecordnumber\}|\{ebaytransactionid\}/', $ordernumberformat))
572
{
683
$orderItem->setBasePrice($price);
684
$orderItem->setBasePriceInclTax($priceinctax);
685
$orderItem->setTaxPercent($taxpercent);
686
+ $orderItem->setTaxAmount($taxamount * $qty);
687
+ $orderItem->setTaxBeforeDiscount($taxamount * $qty);
688
+ $orderItem->setBaseTaxBeforeDiscount($taxamount * $qty);
689
$orderItem->setDiscountAmount(0);
690
$orderItem->setWeight($weight);
691
$orderItem->setBaseRowTotal($subtotal);
1220
$item->setBasePrice($price);
1221
$item->setBasePriceInclTax($priceinctax);
1222
$item->setTaxPercent($taxpercent);
1223
+ $item->setTaxAmount($taxamount * $qty);
1224
+ $item->setTaxBeforeDiscount($taxamount * $qty);
1225
+ $item->setBaseTaxBeforeDiscount($taxamount * $qty);
1226
$item->setDiscountAmount(0);
1227
$item->setWeight($weight);
1228
$item->setBaseRowTotal($subtotal);
1533
$billing_first_name = $billing_address->name;
1534
}
1535
1536
+ $billing_phone = (string)$billing_address->phone;
1537
+ if(!$billing_phone)
1538
+ $billing_phone = 'Not Available';
1539
+
1540
$shipping_address = $ordercontent->orderaddresses->orderaddress[1];
1541
$shipping_first_name = $shipping_last_name = '';
1542
1548
$shipping_first_name = $shipping_address->name;
1549
}
1550
1551
+ $shipping_phone = (string)$shipping_address->phone;
1552
+ if(!$shipping_phone)
1553
+ $shipping_phone = 'Not Available';
1554
+
1555
$email = (string)$billing_address->email;
1556
+ if(!$email || $email == 'Invalid Request')
1557
$email = 'mail@example.com';
1558
1559
$regionCollection = $this->getRegionCollection($billing_address->countrycode);
1579
'street' => (string)$billing_address->address1.($billing_address->address2 ? "\n".$billing_address->address2 : ''),
1580
'city' => (string)$billing_address->place,
1581
'postcode' => (string)$billing_address->postalcode,
1582
+ 'telephone' => (string)$billing_phone,
1583
'fax' => '',
1584
'country_id' => (string)$billing_address->countrycode,
1585
'region_id' => $regionsel_id, // id from directory_country_region table
1606
'street' => (string)$shipping_address->address1.($shipping_address->address2 ? "\n".$shipping_address->address2 : ''),
1607
'city' => (string)$shipping_address->place,
1608
'postcode' => (string)$shipping_address->postalcode,
1609
+ 'telephone' => (string)$shipping_phone,
1610
'fax' => '',
1611
'country_id' => (string)$shipping_address->countrycode,
1612
'region_id' => $regionsel_id_ship, // id from directory_country_region table
1615
1616
$customer = null;
1617
1618
+ if($register_customer && $email != 'mail@example.com')
1619
{
1620
$customer = Mage::getModel('customer/customer');
1621
$customer->setWebsiteId($websiteId);
1827
$item->setDiscountAmount(0);
1828
$item->setBaseDiscountAmount(0);
1829
$item->setTaxPercent($taxpercent);
1830
+ $item->setTaxAmount($taxamount * $qty);
1831
+ $item->setBaseTaxAmount($taxamount * $qty);
1832
$item->setRowTotal($subtotal);
1833
$item->setBaseRowTotal($subtotal);
1834
$item->setRowTotalWithDiscount($subtotal);
app/code/community/Codisto/Sync/controllers/SyncController.php CHANGED
@@ -517,6 +517,16 @@ class Codisto_Sync_SyncController extends Mage_Core_Controller_Front_Action
517
$this->sendPlainResponse($response, 200, 'OK', 'throttle');
518
$response->sendResponse();
519
}
520
else
521
{
522
$this->sendExceptionError($response, $e);
517
$this->sendPlainResponse($response, 200, 'OK', 'throttle');
518
$response->sendResponse();
519
}
520
+ else if(property_exists($e, 'errorInfo') &&
521
+ $e->errorInfo[0] == 'HY000' &&
522
+ $e->errorInfo[1] == 8 &&
523
+ $e->errorInfo[2] == 'attempt to write a readonly database')
524
+ {
525
+ if(file_exists($syncDb))
526
+ unlink($syncDb);
527
+ $this->sendExceptionError($response, $e);
528
+ $response->sendResponse();
529
+ }
530
else
531
{
532
$this->sendExceptionError($response, $e);
app/code/community/Codisto/Sync/data/codisto_setup/{data-install-1.90.10.php → data-install-1.90.11.php} RENAMED
@@ -44,7 +44,7 @@ if(!isset($MerchantID) || !isset($HostKey))
44
}
45
46
//Can this request create a new merchant ?
47
- $createMerchant = Mage::helper('codistosync')->createMerchantwithLock();
48
49
}
50
44
}
45
46
//Can this request create a new merchant ?
47
+ $createMerchant = Mage::helper('codistosync')->createMerchantwithLock(20.0);
48
49
}
50
app/code/community/Codisto/Sync/etc/adminhtml.xml CHANGED
@@ -32,40 +32,40 @@
32
<action>adminhtml/codisto/index</action>
33
</listings>
34
<orders translate="title">
35
- <title>Manage Orders</title>
36
<sort_order>2</sort_order>
37
<action>adminhtml/codisto/orders</action>
38
</orders>
39
<categories translate="title">
40
- <title>Manage Categories</title>
41
<sort_order>3</sort_order>
42
<action>adminhtml/codisto/categories</action>
43
</categories>
44
<attributes translate="title">
45
- <title>Manage Attributes</title>
46
<sort_order>4</sort_order>
47
<action>adminhtml/codisto/attributemapping</action>
48
</attributes>
49
<import translate="title">
50
- <title>Import Listings</title>
51
<sort_order>5</sort_order>
52
<action>adminhtml/codisto/import</action>
53
</import>
54
- <getstarted translate="title">
55
<title>Getting Started</title>
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>
70
</codisto>
71
</menu>
32
<action>adminhtml/codisto/index</action>
33
</listings>
34
<orders translate="title">
35
+ <title>eBay Orders View</title>
36
<sort_order>2</sort_order>
37
<action>adminhtml/codisto/orders</action>
38
</orders>
39
<categories translate="title">
40
+ <title>Manage eBay Store Categories</title>
41
<sort_order>3</sort_order>
42
<action>adminhtml/codisto/categories</action>
43
</categories>
44
<attributes translate="title">
45
+ <title>Manage Custom Attributes</title>
46
<sort_order>4</sort_order>
47
<action>adminhtml/codisto/attributemapping</action>
48
</attributes>
49
<import translate="title">
50
+ <title>Link eBay Listings</title>
51
<sort_order>5</sort_order>
52
<action>adminhtml/codisto/import</action>
53
</import>
54
+ <!-- getstarted translate="title">
55
<title>Getting Started</title>
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
+ <account translate="title">
65
+ <title>Account</title>
66
+ <sort_order>8</sort_order>
67
+ <action>adminhtml/codisto/account</action>
68
+ </account>
69
</children>
70
</codisto>
71
</menu>
app/code/community/Codisto/Sync/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
<config>
24
<modules>
25
<Codisto_Sync>
26
- <version>1.90.10</version>
27
<depends>
28
<Mage_Payment/>
29
</depends>
23
<config>
24
<modules>
25
<Codisto_Sync>
26
+ <version>1.90.11</version>
27
<depends>
28
<Mage_Payment/>
29
</depends>
app/code/community/Codisto/Sync/sql/codisto_setup/{mysql4-install-1.90.10.php → mysql4-install-1.90.11.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.10</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-17</date><time>23:16:08</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="3926b34de61b45b2351b8b0d166ec6e1"/><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.10.php" hash="6d07d4e22ae5d907df1f4389c3a829d4"/></dir></dir><dir name="data"><dir name="codisto_setup"><file name="data-install-1.90.10.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="9cdd38b9425be8a38bb570f03c6ff9e6"/></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>
1
<?xml version="1.0"?>
2
+ <package><name>codistoconnect</name><version>1.90.11</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-05</date><time>16:24:09</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="0977ec0ac6a697c918f85b165216b689"/><file name="Signal.php" hash="b624f962056ceffae9c3160ed3e5655e"/></dir><dir name="controllers"><file name="CodistoController.php" hash="eccbf167582d60ae559b7455b9b8e7ea"/><file name="IndexController.php" hash="4945ea70ebcca04a3dd0187412095661"/><file name="SyncController.php" hash="8f7077a9c04215f8e09b4a0257049a74"/></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.11.php" hash="6d07d4e22ae5d907df1f4389c3a829d4"/></dir></dir><dir name="data"><dir name="codisto_setup"><file name="data-install-1.90.11.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="5770ec865c6ea755615a2b64aae6b8df"/></dir><dir name="Model"><file name="Observer.php" hash="8b309ae85f2bf696e97ff6777c1d64f2"/><file name="Sync.php" hash="67bf12b927e5d87fb8f87a836d943cb6"/><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>