Wisepricer_Syncer - Version 1.1.4.2

Version Notes

Added
analytics functionality

Download this release

Release Info

Developer Magento Core Team
Extension Wisepricer_Syncer
Version 1.1.4.2
Comparing to
See all releases


Code changes from version 1.1.4.1 to 1.1.4.2

app/code/local/Wisepricer/Syncer/Model/Observer.php CHANGED
@@ -6,21 +6,24 @@ class Wisepricer_Syncer_Model_Observer extends Mage_Core_Model_Abstract
6
 
7
  $product= $observer->getProduct();
8
  $sku = $product->getSku();
 
 
9
  try{
10
 
11
- $connection = $this->_getConnection('core_write');
12
- $sql ="SELECT hits FROM " . $this->_getTableName('wisepricer_syncer_hits_counter') . " WHERE sku = ?";
13
- $hits=$connection->fetchOne($sql, array($sku));
14
 
15
- if($hits){
16
- $hits++;
17
- $sql ="UPDATE " . $this->_getTableName('wisepricer_syncer_hits_counter') . " SET hits=? WHERE sku = ?";
18
- $connection->query($sql, array($hits,$sku));
19
- }else{
 
20
  $hits=1;
21
- $sql ="INSERT INTO " . $this->_getTableName('wisepricer_syncer_hits_counter') . " (sku,hits) VALUES(?,?)";
22
- $connection->query($sql, array($sku,$hits));
23
- }
24
 
25
  }catch(Exception $e){
26
  Mage::log($e->getMessage(),null,'wplog.log');
6
 
7
  $product= $observer->getProduct();
8
  $sku = $product->getSku();
9
+ $dt = strtotime('now');
10
+ $mysqldate = date( 'Y-m-d', $dt );
11
  try{
12
 
13
+ $connection = $this->_getConnection('core_write');
14
+ $sql ="SELECT * FROM " . $this->_getTableName('wisepricer_syncer_hits_counter') . " WHERE sku = ? AND hit_date=?";
15
+ $hits=$connection->fetchAll($sql, array($sku,$mysqldate));
16
 
17
+ if($hits&&count($hits)!=0){
18
+ $counter=$hits[0]['hits'];
19
+ $counter++;
20
+ $sql ="UPDATE " . $this->_getTableName('wisepricer_syncer_hits_counter') . " SET hits=? WHERE hits_id = ?";
21
+ $connection->query($sql, array($counter,$hits[0]['hits_id']));
22
+ }else{
23
  $hits=1;
24
+ $sql ="INSERT INTO " . $this->_getTableName('wisepricer_syncer_hits_counter') . " (sku,hits,hit_date) VALUES(?,?,?)";
25
+ $connection->query($sql, array($sku,$hits,$mysqldate));
26
+ }
27
 
28
  }catch(Exception $e){
29
  Mage::log($e->getMessage(),null,'wplog.log');
app/code/local/Wisepricer/Syncer/controllers/SalesController.php CHANGED
@@ -8,7 +8,7 @@ class Wisepricer_Syncer_SalesController extends Wisepricer_Syncer_BaseController
8
 
9
  $this->_checkAccess();
10
 
11
-
12
 
13
  try{
14
  $connection = $this->_getConnection('core_write');
@@ -39,7 +39,11 @@ class Wisepricer_Syncer_SalesController extends Wisepricer_Syncer_BaseController
39
 
40
  $ordersOut[$orderIncrementId][]=$itemArr;
41
  }
42
- $this->_updateOrderAsSent($orderIncrementId);
 
 
 
 
43
 
44
  }
45
 
@@ -155,4 +159,52 @@ class Wisepricer_Syncer_SalesController extends Wisepricer_Syncer_BaseController
155
 
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
8
 
9
  $this->_checkAccess();
10
 
11
+ $post = $this->getRequest()->getParams();
12
 
13
  try{
14
  $connection = $this->_getConnection('core_write');
39
 
40
  $ordersOut[$orderIncrementId][]=$itemArr;
41
  }
42
+
43
+ if(!isset($post['debug'])||$post['debug']!=1){
44
+ $this->_updateOrderAsSent($orderIncrementId);
45
+ }
46
+
47
 
48
  }
49
 
159
 
160
  }
161
 
162
+ public function gethitsbydateAction(){
163
+
164
+ $this->_checkAccess();
165
+
166
+ $post = $this->getRequest()->getParams();
167
+
168
+ $from = $post['from'];
169
+ if(!isset($post['from'])){
170
+ $returnArr=array(
171
+ 'status'=>'failure',
172
+ 'error_code'=>'767',
173
+ 'error_details'=>'The "from" parameter is mandatory'
174
+ );
175
+ echo json_encode($returnArr);
176
+ die;
177
+ }
178
+
179
+ if(isset($post['to'])){
180
+ $to = $post['to'];
181
+ }else{
182
+ $to = strtotime('now');
183
+ }
184
+
185
+ $fromMysqldate = date( 'Y-m-d', $from );
186
+ $toMysqldate = date( 'Y-m-d', $to );
187
+
188
+ try{
189
+
190
+ $connection = $this->_getConnection('core_write');
191
+ $sql ="SELECT * FROM " . $this->_getTableName('wisepricer_syncer_hits_counter')." WHERE hit_date BETWEEN ? AND ?";
192
+ $hits=$connection->fetchAll($sql,array($fromMysqldate,$toMysqldate));
193
+
194
+
195
+ $output=array();
196
+ $checksum=md5(json_encode($hits));
197
+
198
+ $output['checksum']=$checksum;
199
+ $output['hits']=$hits;
200
+ echo json_encode($output);
201
+
202
+ }catch(Exception $e){
203
+ Mage::log($e->getMessage(),null,'wplog.log');
204
+ echo $e->getMessage(); die;
205
+ }
206
+
207
+
208
+ }
209
+
210
  }
app/code/local/Wisepricer/Syncer/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Wisepricer_Syncer>
5
- <version>1.1.4.1</version>
6
  <url>http://www.wisepricer.com/index.php</url>
7
  <modulename>Wisepricer Syncer</modulename>
8
  </Wisepricer_Syncer>
2
  <config>
3
  <modules>
4
  <Wisepricer_Syncer>
5
+ <version>1.1.4.2</version>
6
  <url>http://www.wisepricer.com/index.php</url>
7
  <modulename>Wisepricer Syncer</modulename>
8
  </Wisepricer_Syncer>
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.1-1.1.4.2.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $insertStr='';
8
+
9
+ try{
10
+
11
+ $dt=strtotime('-180 days');
12
+ $mysqldate = date( 'Y-m-d H:i:s', $dt );
13
+
14
+ $orders=Mage::getModel('sales/order')->getCollection()
15
+ ->addFieldToFilter('status',array('in'=> array('processing', 'processed', 'complete')))
16
+ ->addFieldToFilter('created_at',array('gt'=>$mysqldate));
17
+
18
+ foreach($orders as $order){
19
+
20
+ $insertStr.= 'INSERT INTO '.$this->getTable('wisepricer_syncer_sales').' ( `sales_id` ,`order_id` ,`status`,order_date) VALUES (NULL , '.$order->getIncrementId().', "0","'.$order->getCreatedAt().'");';
21
+ }
22
+
23
+ }catch(Exception $e){
24
+
25
+ }
26
+
27
+ $installer->run("
28
+
29
+
30
+ DROP TABLE IF EXISTS {$this->getTable('wisepricer_syncer_hits_counter')};
31
+
32
+ CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_hits_counter')} (
33
+
34
+ `hits_id` int(11) NOT NULL auto_increment,
35
+
36
+ `sku` varchar(255) character set utf8 NOT NULL,
37
+
38
+ `hits` int(11) unsigned NOT NULL default '0',
39
+
40
+ `hit_date` date DEFAULT NULL,
41
+
42
+ PRIMARY KEY (`hits_id`)
43
+
44
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
45
+
46
+ DROP TABLE IF EXISTS {$this->getTable('wisepricer_syncer_sales')};
47
+
48
+ CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_sales')} (
49
+
50
+ `sales_id` int(11) NOT NULL auto_increment,
51
+
52
+ `order_id` varchar( 1024 ) NOT NULL,
53
+
54
+ `status` int(1) unsigned NOT NULL default '0',
55
+
56
+ `order_date` date DEFAULT NULL,
57
+
58
+ PRIMARY KEY (`sales_id`)
59
+
60
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
61
+
62
+ ".$insertStr."
63
+ ");
64
+
65
+ $installer->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wisepricer_Syncer</name>
4
- <version>1.1.4.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -9,11 +9,11 @@
9
  <summary>WisePricer- Beat your competition</summary>
10
  <description>WisePricer is a new tool that allows you to Track &amp; monitor successful online retailers and update your store prices in real-time. With WisePricer you&#x2019;ll never get left behind the competition.</description>
11
  <notes>Added
12
- don't import out of stock checkbox</notes>
13
  <authors><author><name>Moshe</name><user>auto-converted</user><email>moshe@wisepricer.com</email></author></authors>
14
- <date>2013-02-17</date>
15
- <time>14:12:09</time>
16
- <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="wisepricer"><file name="bullet-green.png" hash="78d917a9d9aea11366bada6e0ae53931"/><file name="validation_advice_bg.gif" hash="ffdad80de989e3b04a977be3778c4347"/><file name="wp-alert-icon.png" hash="0dbbadfbbe2329098d03f8351aa2eaf2"/><file name="wp-logo.png" hash="48db98cdfc570336c942271352f31094"/><file name="wp-save-btn.png" hash="6d8e02c7f5e54dcc705e6436f126c66d"/></dir></dir><dir name="wisepricer"><file name="chosen-sprite.png" hash="8e70d120437ffc6a1bf7cebeca292d5c"/><file name="chosen.css" hash="bcd3f3e697219898e26631ccf29d97ba"/><file name="chosen.proto.js" hash="8259b22f4f337ba9ab63506b5ee4a52f"/><file name="myprototype.js" hash="2325b8b147c5dfaa8531c9d8bafd3648"/><file name="prototype17.js" hash="2325b8b147c5dfaa8531c9d8bafd3648"/><file name="wisepricer.css" hash="bd4dc50e10de4b41ae1c0ab18b2045ad"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="syncer.xml" hash="a9d0f0b5af6b7bc28fb3c3b897c1773c"/></dir><dir name="template"><dir name="wisepricer"><file name="mapping.phtml" hash="7bf8c5d09c4304a4d8d6d74980cc64fa"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wisepricer_Syncer.xml" hash="838dc229469d27db4c96a49591b12f55"/></dir></target><target name="magelocal"><dir name="Wisepricer"><dir name="Syncer"><dir name="Block"><dir name="Adminhtml"><file name="Mapping.php" hash="9c96a6e10821ab940b851ce890d00c2d"/><file name="Register.php" hash="ed2ffde3237ecba2dbdd6002b5077af3"/></dir></dir><dir name="controllers"><file name="BaseController.php" hash="def65eee1964d7c0667e8cb32375e74c"/><file name="ProductsController.php" hash="58c98ef75ef6676ba1f33ad55f03f51b"/><file name="SalesController.php" hash="5e9d9af3b9a0bcb33e7a9f3638416c3a"/><dir name="Adminhtml"><file name="SyncerController.php" hash="22cb1bbb7498960cd518b4b860b185d9"/></dir></dir><dir name="etc"><file name="config.xml" hash="2d42c8bd60f5d4585d0ef4be4aab26d0"/></dir><dir name="Helper"><file name="Data.php" hash="025b73c04ab0ca01d2e7c75aaad7fea6"/></dir><dir name="lib"><dir name="phpseclib"><dir name="Crypt"><file name="AES.php" hash="dd67dd1dbc7706e6c740e8430054d5e0"/><file name="DES.php" hash="47ac443f1edd2833cdc2f4eb80aa9a71"/><file name="Hash.php" hash="9be22f6426f2176caebb34a6cd2cb579"/><file name="Random.php" hash="5befc55c3423792c0cd50bc6d4f527b1"/><file name="RC4.php" hash="c6ec724c3a5d807d5ea4645518c37d29"/><file name="Rijndael.php" hash="7a92c95c750dd9ec1b8ce92915b4aa35"/><file name="RSA.php" hash="9bd5734f28d149d183c603643f6dbbb4"/><file name="TripleDES.php" hash="07c384b505d52802803313126e9e3836"/></dir><dir name="Math"><file name="BigInteger.php" hash="61aa9373ea606c928187d168159ac3f8"/></dir><dir name="Net"><file name="SFTP.php" hash="029f797c16ddd23b1d65636a72141115"/><file name="SSH1.php" hash="818d83815fe9bb5741594226bbdad975"/><file name="SSH2.php" hash="db5145effae044c7a1f6e7d778b566f5"/></dir><dir name="PHP"><dir name="Compat"><dir name="Function"><file name="array_fill.php" hash="840a674cac272c5588fa59f9421ed9a3"/><file name="bcpowmod.php" hash="4cb8fab0ee419f4b5a626980bbf04938"/><file name="str_split.php" hash="85cb5961afa62dde933190ee851a6d9a"/></dir></dir></dir></dir></dir><dir name="Model"><file name="Config.php" hash="d669c3dc977ddf71a58c90fa8df3180c"/><file name="Mapping.php" hash="d924ae8bcf54a3ca1224e8680d847fee"/><file name="Observer.php" hash="e21af75f05e45c298c2edb6f004aacb2"/><file name="Reprice.php" hash="dbc1e153e39869abf2113c087834cfed"/><dir name="Adminhtml"><file name="Attributes.php" hash="081833a6ee1263008d1dd4a956adb5a9"/></dir><dir name="Mysql4"><file name="Config.php" hash="61b7eb73489844aa0ee041c216bab2db"/><file name="Mapping.php" hash="d97574adda931ce798964c67041f6af5"/><dir name="Config"><file name="Collection.php" hash="c7c7b6844e3ff8893163c392f4132f30"/></dir><dir name="Mapping"><file name="Collection.php" hash="c0f15143db582e070cfb83de92c57d09"/></dir></dir></dir><dir name="sql"><dir name="syncer_setup"><file name="mysql4-install-1.1.3.8.php" hash="f149922af5a6e5be8a474b4cc68d415f"/><file name="mysql4-upgrade-1.1.3.8-1.1.3.9.php" hash="8d7bcdc6fb908a4906f3af7dfcb28ab8"/><file name="mysql4-upgrade-1.1.3.9-1.1.4.1.php" hash="99396eeee161d50822de7be3aa76cbec"/></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies/>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wisepricer_Syncer</name>
4
+ <version>1.1.4.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
9
  <summary>WisePricer- Beat your competition</summary>
10
  <description>WisePricer is a new tool that allows you to Track &amp; monitor successful online retailers and update your store prices in real-time. With WisePricer you&#x2019;ll never get left behind the competition.</description>
11
  <notes>Added
12
+ analytics functionality</notes>
13
  <authors><author><name>Moshe</name><user>auto-converted</user><email>moshe@wisepricer.com</email></author></authors>
14
+ <date>2013-02-26</date>
15
+ <time>11:10:33</time>
16
+ <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="wisepricer"><file name="bullet-green.png" hash="78d917a9d9aea11366bada6e0ae53931"/><file name="validation_advice_bg.gif" hash="ffdad80de989e3b04a977be3778c4347"/><file name="wp-alert-icon.png" hash="0dbbadfbbe2329098d03f8351aa2eaf2"/><file name="wp-logo.png" hash="48db98cdfc570336c942271352f31094"/><file name="wp-save-btn.png" hash="6d8e02c7f5e54dcc705e6436f126c66d"/></dir></dir><dir name="wisepricer"><file name="chosen-sprite.png" hash="8e70d120437ffc6a1bf7cebeca292d5c"/><file name="chosen.css" hash="bcd3f3e697219898e26631ccf29d97ba"/><file name="chosen.proto.js" hash="8259b22f4f337ba9ab63506b5ee4a52f"/><file name="myprototype.js" hash="2325b8b147c5dfaa8531c9d8bafd3648"/><file name="prototype17.js" hash="2325b8b147c5dfaa8531c9d8bafd3648"/><file name="wisepricer.css" hash="bd4dc50e10de4b41ae1c0ab18b2045ad"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="syncer.xml" hash="a9d0f0b5af6b7bc28fb3c3b897c1773c"/></dir><dir name="template"><dir name="wisepricer"><file name="mapping.phtml" hash="7bf8c5d09c4304a4d8d6d74980cc64fa"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wisepricer_Syncer.xml" hash="838dc229469d27db4c96a49591b12f55"/></dir></target><target name="magelocal"><dir name="Wisepricer"><dir name="Syncer"><dir name="Block"><dir name="Adminhtml"><file name="Mapping.php" hash="9c96a6e10821ab940b851ce890d00c2d"/><file name="Register.php" hash="ed2ffde3237ecba2dbdd6002b5077af3"/></dir></dir><dir name="controllers"><file name="BaseController.php" hash="def65eee1964d7c0667e8cb32375e74c"/><file name="ProductsController.php" hash="58c98ef75ef6676ba1f33ad55f03f51b"/><file name="SalesController.php" hash="eb9e9d553da503e43632bd5b1451b9be"/><dir name="Adminhtml"><file name="SyncerController.php" hash="22cb1bbb7498960cd518b4b860b185d9"/></dir></dir><dir name="etc"><file name="config.xml" hash="19b6532170510104ff6a73dfc7177bfc"/></dir><dir name="Helper"><file name="Data.php" hash="025b73c04ab0ca01d2e7c75aaad7fea6"/></dir><dir name="lib"><dir name="phpseclib"><dir name="Crypt"><file name="AES.php" hash="dd67dd1dbc7706e6c740e8430054d5e0"/><file name="DES.php" hash="47ac443f1edd2833cdc2f4eb80aa9a71"/><file name="Hash.php" hash="9be22f6426f2176caebb34a6cd2cb579"/><file name="Random.php" hash="5befc55c3423792c0cd50bc6d4f527b1"/><file name="RC4.php" hash="c6ec724c3a5d807d5ea4645518c37d29"/><file name="Rijndael.php" hash="7a92c95c750dd9ec1b8ce92915b4aa35"/><file name="RSA.php" hash="9bd5734f28d149d183c603643f6dbbb4"/><file name="TripleDES.php" hash="07c384b505d52802803313126e9e3836"/></dir><dir name="Math"><file name="BigInteger.php" hash="61aa9373ea606c928187d168159ac3f8"/></dir><dir name="Net"><file name="SFTP.php" hash="029f797c16ddd23b1d65636a72141115"/><file name="SSH1.php" hash="818d83815fe9bb5741594226bbdad975"/><file name="SSH2.php" hash="db5145effae044c7a1f6e7d778b566f5"/></dir><dir name="PHP"><dir name="Compat"><dir name="Function"><file name="array_fill.php" hash="840a674cac272c5588fa59f9421ed9a3"/><file name="bcpowmod.php" hash="4cb8fab0ee419f4b5a626980bbf04938"/><file name="str_split.php" hash="85cb5961afa62dde933190ee851a6d9a"/></dir></dir></dir></dir></dir><dir name="Model"><file name="Config.php" hash="d669c3dc977ddf71a58c90fa8df3180c"/><file name="Mapping.php" hash="d924ae8bcf54a3ca1224e8680d847fee"/><file name="Observer.php" hash="6d7216c55bb46f202a33f61bcad556d6"/><file name="Reprice.php" hash="dbc1e153e39869abf2113c087834cfed"/><dir name="Adminhtml"><file name="Attributes.php" hash="081833a6ee1263008d1dd4a956adb5a9"/></dir><dir name="Mysql4"><file name="Config.php" hash="61b7eb73489844aa0ee041c216bab2db"/><file name="Mapping.php" hash="d97574adda931ce798964c67041f6af5"/><dir name="Config"><file name="Collection.php" hash="c7c7b6844e3ff8893163c392f4132f30"/></dir><dir name="Mapping"><file name="Collection.php" hash="c0f15143db582e070cfb83de92c57d09"/></dir></dir></dir><dir name="sql"><dir name="syncer_setup"><file name="mysql4-install-1.1.3.8.php" hash="f149922af5a6e5be8a474b4cc68d415f"/><file name="mysql4-upgrade-1.1.3.8-1.1.3.9.php" hash="8d7bcdc6fb908a4906f3af7dfcb28ab8"/><file name="mysql4-upgrade-1.1.3.9-1.1.4.1.php" hash="99396eeee161d50822de7be3aa76cbec"/><file name="mysql4-upgrade-1.1.4.1-1.1.4.2.php" hash="f7d4c87537d4cd570f358bebad578056"/></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies/>
19
  </package>