Version Notes
Fix abcarts reporting multiple times
Download this release
Release Info
Developer | Eduard G. Dumitrescu |
Extension | Intelivemetrics_Unityreports |
Version | 0.8.7 |
Comparing to | |
See all releases |
Code changes from version 0.8.6 to 0.8.7
- app/code/community/Intelivemetrics/Unityreports/Model/Admin/Status/UseShipping.php +2 -1
- app/code/community/Intelivemetrics/Unityreports/Model/Sync/Abcart.php +1 -0
- app/code/community/Intelivemetrics/Unityreports/Model/Sync/Invoice.php +23 -4
- app/code/community/Intelivemetrics/Unityreports/Model/Utmz.php +1 -1
- app/code/community/Intelivemetrics/Unityreports/controllers/TestController.php +4 -0
- package.xml +5 -5
app/code/community/Intelivemetrics/Unityreports/Model/Admin/Status/UseShipping.php
CHANGED
@@ -14,7 +14,8 @@ class Intelivemetrics_Unityreports_Model_Admin_Status_UseShipping extends Mage_C
|
|
14 |
{
|
15 |
return array(
|
16 |
array('value'=>1, 'label'=>'Use invoice data'),
|
17 |
-
array('value'=>2, 'label'=>'Use shipping data')
|
|
|
18 |
);
|
19 |
|
20 |
}
|
14 |
{
|
15 |
return array(
|
16 |
array('value'=>1, 'label'=>'Use invoice data'),
|
17 |
+
array('value'=>2, 'label'=>'Use shipping data'),
|
18 |
+
array('value'=>3, 'label'=>'Use order data')
|
19 |
);
|
20 |
|
21 |
}
|
app/code/community/Intelivemetrics/Unityreports/Model/Sync/Abcart.php
CHANGED
@@ -113,6 +113,7 @@ class Intelivemetrics_Unityreports_Model_Sync_Abcart extends Intelivemetrics_Uni
|
|
113 |
$collection = Mage::getModel('sales/quote')->getCollection();
|
114 |
$collection->getSelect()
|
115 |
->where("items_count>0")
|
|
|
116 |
->where("DATE( `created_at` ) < DATE_SUB( CURDATE( ) , INTERVAL 1 DAY )") //don't sync todays quotes because they may become sales
|
117 |
->where("DATE( `created_at` ) > DATE_SUB( CURDATE( ) , INTERVAL 14 DAY )") //don't sync quotes more than 14 days old
|
118 |
->where("main_table.entity_id NOT IN (SELECT entity_id FROM $abcartsTable WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
113 |
$collection = Mage::getModel('sales/quote')->getCollection();
|
114 |
$collection->getSelect()
|
115 |
->where("items_count>0")
|
116 |
+
->where("is_active=1")
|
117 |
->where("DATE( `created_at` ) < DATE_SUB( CURDATE( ) , INTERVAL 1 DAY )") //don't sync todays quotes because they may become sales
|
118 |
->where("DATE( `created_at` ) > DATE_SUB( CURDATE( ) , INTERVAL 14 DAY )") //don't sync quotes more than 14 days old
|
119 |
->where("main_table.entity_id NOT IN (SELECT entity_id FROM $abcartsTable WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
app/code/community/Intelivemetrics/Unityreports/Model/Sync/Invoice.php
CHANGED
@@ -54,7 +54,8 @@ class Intelivemetrics_Unityreports_Model_Sync_Invoice extends Intelivemetrics_Un
|
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
-
*
|
|
|
58 |
*
|
59 |
* @param date $last_imp_date ultima data di riferimento dll'ultima esportazione
|
60 |
* @param int $max_records numero massimo di records (indicativo)
|
@@ -67,7 +68,22 @@ class Intelivemetrics_Unityreports_Model_Sync_Invoice extends Intelivemetrics_Un
|
|
67 |
$ordersTableMage = Intelivemetrics_Unityreports_Model_Utils::getTableName('sales_flat_order');
|
68 |
$now = date('Y-m-d H:i:s');
|
69 |
try {
|
70 |
-
if (Mage::getStoreConfig('unityreports/advanced/use_shipping')==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
$collection = Mage::getModel('sales/order_shipment')->getCollection()
|
72 |
->addAttributeToSelect('*');
|
73 |
$collection->getSelect()
|
@@ -77,13 +93,15 @@ class Intelivemetrics_Unityreports_Model_Sync_Invoice extends Intelivemetrics_Un
|
|
77 |
->limit($limit)
|
78 |
;
|
79 |
} else {
|
|
|
|
|
|
|
80 |
$collection = Mage::getModel('sales/order_invoice')->getCollection()
|
81 |
->addAttributeToSelect('*');
|
82 |
$collection->getSelect()
|
83 |
->joinLeft(array('orders' => $ordersTableMage), "orders.entity_id=main_table.order_id", array('o_increment_id' => 'increment_id'))
|
84 |
->where("main_table.increment_id NOT IN (SELECT increment_id FROM $invoicesTable WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
85 |
->where("orders.increment_id IN (SELECT increment_id FROM $ordersTable WHERE synced=1)")
|
86 |
-
->where("main_table.created_at > '2014-01-01'")//HMIZATE
|
87 |
->limit($limit)
|
88 |
;
|
89 |
}
|
@@ -115,7 +133,8 @@ class Intelivemetrics_Unityreports_Model_Sync_Invoice extends Intelivemetrics_Un
|
|
115 |
);
|
116 |
//get items info
|
117 |
foreach ($invoice->getItemsCollection() as $item) {
|
118 |
-
$
|
|
|
119 |
}
|
120 |
$data["invoice_" . $invoice->getIncrementId()] = $order_fields;
|
121 |
}
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
+
* Discover payed/unpayed orders based on invoices or shipments
|
58 |
+
* If "orders" is selected, all orders are considered to be payed
|
59 |
*
|
60 |
* @param date $last_imp_date ultima data di riferimento dll'ultima esportazione
|
61 |
* @param int $max_records numero massimo di records (indicativo)
|
68 |
$ordersTableMage = Intelivemetrics_Unityreports_Model_Utils::getTableName('sales_flat_order');
|
69 |
$now = date('Y-m-d H:i:s');
|
70 |
try {
|
71 |
+
if (Mage::getStoreConfig('unityreports/advanced/use_shipping')==3) {
|
72 |
+
/**
|
73 |
+
* using order data - all orders are considered payed
|
74 |
+
*/
|
75 |
+
$collection = Mage::getModel('sales/order')->getCollection()
|
76 |
+
->addAttributeToSelect('*')
|
77 |
+
->addExpressionFieldToSelect('order_id', 'entity_id', 'entity_id');
|
78 |
+
$collection->getSelect()
|
79 |
+
->where("main_table.increment_id NOT IN (SELECT increment_id FROM $invoicesTable WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
80 |
+
->where("main_table.increment_id IN (SELECT increment_id FROM $ordersTable WHERE synced=1)")
|
81 |
+
->limit($limit)
|
82 |
+
;
|
83 |
+
}elseif (Mage::getStoreConfig('unityreports/advanced/use_shipping')==2) {
|
84 |
+
/**
|
85 |
+
* using shipping data - all shipped orders are payed
|
86 |
+
*/
|
87 |
$collection = Mage::getModel('sales/order_shipment')->getCollection()
|
88 |
->addAttributeToSelect('*');
|
89 |
$collection->getSelect()
|
93 |
->limit($limit)
|
94 |
;
|
95 |
} else {
|
96 |
+
/**
|
97 |
+
* using invoice data (default) - all invoiced orders are payed
|
98 |
+
*/
|
99 |
$collection = Mage::getModel('sales/order_invoice')->getCollection()
|
100 |
->addAttributeToSelect('*');
|
101 |
$collection->getSelect()
|
102 |
->joinLeft(array('orders' => $ordersTableMage), "orders.entity_id=main_table.order_id", array('o_increment_id' => 'increment_id'))
|
103 |
->where("main_table.increment_id NOT IN (SELECT increment_id FROM $invoicesTable WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
104 |
->where("orders.increment_id IN (SELECT increment_id FROM $ordersTable WHERE synced=1)")
|
|
|
105 |
->limit($limit)
|
106 |
;
|
107 |
}
|
133 |
);
|
134 |
//get items info
|
135 |
foreach ($invoice->getItemsCollection() as $item) {
|
136 |
+
$qty = (Mage::getStoreConfig('unityreports/advanced/use_shipping')==3?$item->getQtyOrdered():$item->getQty());
|
137 |
+
$order_fields['items'][] = array('id' => $item->getProductId(), 'qty' => $qty);
|
138 |
}
|
139 |
$data["invoice_" . $invoice->getIncrementId()] = $order_fields;
|
140 |
}
|
app/code/community/Intelivemetrics/Unityreports/Model/Utmz.php
CHANGED
@@ -102,7 +102,7 @@ class Intelivemetrics_Unityreports_Model_Utmz {
|
|
102 |
if($this->utmz_gclid){
|
103 |
if(!$this->utmz_source) $this->utmz_source='google';
|
104 |
if(!$this->utmz_campaign) $this->utmz_campaign='(not set)';
|
105 |
-
if(!$this->utmz_medium) $this->
|
106 |
}
|
107 |
}
|
108 |
|
102 |
if($this->utmz_gclid){
|
103 |
if(!$this->utmz_source) $this->utmz_source='google';
|
104 |
if(!$this->utmz_campaign) $this->utmz_campaign='(not set)';
|
105 |
+
if(!$this->utmz_medium) $this->utmz_medium='cpc';
|
106 |
}
|
107 |
}
|
108 |
|
app/code/community/Intelivemetrics/Unityreports/controllers/TestController.php
CHANGED
@@ -8,6 +8,10 @@
|
|
8 |
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
*/
|
|
|
|
|
|
|
|
|
11 |
class Intelivemetrics_Unityreports_TestController extends Mage_Core_Controller_Front_Action {
|
12 |
|
13 |
/**
|
8 |
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
*/
|
11 |
+
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
|
12 |
+
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
|
13 |
+
ini_set('display_errors', 1);
|
14 |
+
|
15 |
class Intelivemetrics_Unityreports_TestController extends Mage_Core_Controller_Front_Action {
|
16 |
|
17 |
/**
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Intelivemetrics_Unityreports</name>
|
4 |
-
<version>0.8.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://choosealicense.com/licenses/apache-2.0/">APACHE</license>
|
7 |
<channel>community</channel>
|
@@ -10,11 +10,11 @@
|
|
10 |
<description>Unityreports brings powerful e-commerce analytics by combining Magento, Google Analytics and Google Adwords data.
|
11 |
http://www.unityreports.com
|
12 |
</description>
|
13 |
-
<notes>
|
14 |
<authors><author><name>Eduard G. Dumitrescu</name><user>bregoiu</user><email>eddie.dumitrescu@gmail.com</email></author></authors>
|
15 |
-
<date>2016-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magecommunity"><dir name="Intelivemetrics"><dir name="Unityreports"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><file name="Test.php" hash="abe7ccd922f31513e0b78e51f3501cb7"/></dir><dir name="Label"><file name="Renderer.php" hash="89a6ec5dddca5fcf86fbe85b83d87650"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="28ec3fc4be05e608c27da2722b75d2d1"/></dir><dir name="Model"><dir name="Admin"><dir name="Status"><file name="Active.php" hash="28d46ddb38425dcdddf34a694fcbcd84"/><file name="Attributes.php" hash="88821a4f01364ff8223409c33a0b6167"/><dir name="Cron"><file name="Count.php" hash="8f8de0b781e5889c63b508dcba24532b"/><file name="GlobalCounters.php" hash="7b89f230d9a4fbd65bbf1dd87fd2d196"/><file name="Mage.php" hash="922159223ba73f6ecb4cb019595009f4"/><file name="Stat.php" hash="64e4b605214a0a966adada181d413d79"/><file name="Sync.php" hash="ab2313a6949823565001b9787a1a255a"/></dir><file name="Cron.php" hash="438fdf0f97428fed2cf30fe91f96f882"/><file name="Ip.php" hash="a6428cc75b1587a26d54086d9d4e1042"/><dir name="Sync"><file name="Customers.php" hash="1446fca53ddd58161169127191c400d6"/><file name="Invoices.php" hash="744b4b376c0e9bbfef8dcaef4e3e9118"/><file name="Orders.php" hash="37374a9ef8d14ecaf4c14aea024db042"/><file name="Products.php" hash="e8372e002264bfcbb8fc8d07e911c13e"/></dir><file name="SyncPercent.php" hash="a8184ca9718a8e72a14c69067dc867bf"/><file name="UseShipping.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Intelivemetrics_Unityreports</name>
|
4 |
+
<version>0.8.7</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://choosealicense.com/licenses/apache-2.0/">APACHE</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Unityreports brings powerful e-commerce analytics by combining Magento, Google Analytics and Google Adwords data.
|
11 |
http://www.unityreports.com
|
12 |
</description>
|
13 |
+
<notes>Fix abcarts reporting multiple times</notes>
|
14 |
<authors><author><name>Eduard G. Dumitrescu</name><user>bregoiu</user><email>eddie.dumitrescu@gmail.com</email></author></authors>
|
15 |
+
<date>2016-12-08</date>
|
16 |
+
<time>07:00:25</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Intelivemetrics"><dir name="Unityreports"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><file name="Test.php" hash="abe7ccd922f31513e0b78e51f3501cb7"/></dir><dir name="Label"><file name="Renderer.php" hash="89a6ec5dddca5fcf86fbe85b83d87650"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="28ec3fc4be05e608c27da2722b75d2d1"/></dir><dir name="Model"><dir name="Admin"><dir name="Status"><file name="Active.php" hash="28d46ddb38425dcdddf34a694fcbcd84"/><file name="Attributes.php" hash="88821a4f01364ff8223409c33a0b6167"/><dir name="Cron"><file name="Count.php" hash="8f8de0b781e5889c63b508dcba24532b"/><file name="GlobalCounters.php" hash="7b89f230d9a4fbd65bbf1dd87fd2d196"/><file name="Mage.php" hash="922159223ba73f6ecb4cb019595009f4"/><file name="Stat.php" hash="64e4b605214a0a966adada181d413d79"/><file name="Sync.php" hash="ab2313a6949823565001b9787a1a255a"/></dir><file name="Cron.php" hash="438fdf0f97428fed2cf30fe91f96f882"/><file name="Ip.php" hash="a6428cc75b1587a26d54086d9d4e1042"/><dir name="Sync"><file name="Customers.php" hash="1446fca53ddd58161169127191c400d6"/><file name="Invoices.php" hash="744b4b376c0e9bbfef8dcaef4e3e9118"/><file name="Orders.php" hash="37374a9ef8d14ecaf4c14aea024db042"/><file name="Products.php" hash="e8372e002264bfcbb8fc8d07e911c13e"/></dir><file name="SyncPercent.php" hash="a8184ca9718a8e72a14c69067dc867bf"/><file name="UseShipping.php" hash="68ef7cb091c7752760c73e197d9ce376"/></dir></dir><file name="Config.php" hash="590dd9e3939f58560d9b004763d48c05"/><dir name="Cron"><file name="Count.php" hash="e9fb746dabb7a9e2c8433f43fa723df8"/><file name="GlobalCounters.php" hash="c55ce27f8ea8c9a22b22053ae3715bff"/><file name="Request.php" hash="d0d5c8e1b3ba294ef4a628148f4eff3f"/><file name="Stock.php" hash="b2e4edf9c16b25b57d224ff41255d249"/><file name="Sync.php" hash="7ee01469a97d64392e0d45df462af342"/></dir><file name="Cron.php" hash="51f800a9c3c0ab0acdcda3aa9ba51104"/><file name="Customer.php" hash="c99b23d2ec6ffd8acdcc11cf7ed6421e"/><file name="Observer.php" hash="6d29e3b6e3b740f8fcdbaf8f78feabba"/><dir name="Request"><file name="Base.php" hash="2c3fea1af836bedb205786d67465b97d"/><file name="Diagnose.php" hash="5e8525e5392c705660e800faf9b3e057"/><file name="Dq.php" hash="813628e7a57c45f37f83024cce909bdb"/><file name="GetCounters.php" hash="58350a26c70f552349a1eac4a29bb729"/><file name="HandShake.php" hash="50f96af6a3ae95ca5c1d8a53e0a7d32c"/><file name="Interface.php" hash="680707fa0a26ecd7237d116bc0b0a3da"/><file name="ResetAbcarts.php" hash="facdc1c2486398a2a62db126c8518174"/><file name="ResetAll.php" hash="b2533da935c5c66f741490f7f082c8df"/><file name="ResetCreditmemos.php" hash="a199f6f07c67e219d85990a3a08454cc"/><file name="ResetCustomers.php" hash="570aff03d862608cea5e09ded7e7fd9b"/><file name="ResetInvoices.php" hash="7c62cfe07c089b6ca64e32c9f4667297"/><file name="ResetOrders.php" hash="b73a88a0b1bd908c9e9e1d386f23087f"/><file name="ResetProductCounters.php" hash="e84ea87e8c2dcf28189e870c84118317"/><file name="ResetProducts.php" hash="9cfbc9b3f2a1388ef61f0af516ea8e02"/><file name="SetSpeed.php" hash="48496a1971c80fdaa689e0d65d0acd16"/><file name="StartSync.php" hash="30d94be6608c4bce5cebb114ad241fdb"/><file name="StopSync.php" hash="61fb6758c1600eed20c40e4ec28fcef1"/><file name="SyncResult.php" hash="c2f9893e2a083f9c792bc43a212196e4"/></dir><dir name="Resource"><dir name="Config"><file name="Collection.php" hash="dc7cc10daf7e597be061d7bf841d0f66"/></dir><file name="Config.php" hash="e3f733d66219ffc946a1b3cd5eca980d"/><file name="Setup.php" hash="2f7cb85c64bd6103faf9208c7d5f451f"/></dir><dir name="Sync"><file name="Abcart.php" hash="711e333daccc2138b9cad82fb590a215"/><file name="Creditnote.php" hash="770d13c3428ad37eeb7d570094f4f011"/><file name="Customer.php" hash="8ec0d49d8935fffbdfb0e9535929fd6c"/><file name="CustomerAction.php" hash="160ace0a2e9fa8e28ce522f0d03db25d"/><file name="Interface.php" hash="d74a42d2d34c34ce8ec3379bb220127f"/><file name="Invoice.php" hash="28ffc9c7aa2c9723305f5b57bca27a6b"/><file name="Order.php" hash="2ac449b1da1d7af9e8c4f8620f746bc2"/><file name="Product.php" hash="991c961a389a1046c7262abae5bba575"/><file name="ProductVariation.php" hash="c3042550b9849335c1af13cc26d61504"/></dir><file name="Sync.php" hash="e715a7b33cf3ba24a7607f28e7fe7534"/><file name="Utils.php" hash="a77825d378f0692900f396288c727358"/><file name="Utmz.php" hash="1b2451079fe8e80cc4fa328c5badb526"/></dir><dir name="controllers"><file name="IndexController.php" hash="d26a260da822058d9576e851fee4be64"/><file name="PublicController.php" hash="49b73f02a1ed29bba55490f82af75608"/><file name="TestController.php" hash="5f8c252f9d3d5ea8c1007ff3727483b9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aab2ef0e4aedb050d8b60937a085537c"/><file name="config.xml" hash="761f55f7267dfb0f0a67061bbd43400a"/><file name="system.xml" hash="c5e857f5e63774de1cf226747c27203b"/></dir><dir name="sql"><dir name="unityreports_setup"><file name="mysql4-install-0.7.2.php" hash="15298718b85d6aa3bec4e1220f804d8f"/><file name="mysql4-install-0.7.3.php" hash="15298718b85d6aa3bec4e1220f804d8f"/><file name="mysql4-upgrade-0.6.2-0.7.2.php" hash="7c1abd7bed806f811ffedf9cdb2c0cc0"/><file name="mysql4-upgrade-0.7.2-0.7.3.php" hash="fcbc4f1c8b216548ee212855142857f8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intelivemetrics_Unityreports.xml" hash="ccb9d92196bbc626b5552746ac3ad08b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="unityreports.xml" hash="1378f49dd55356156426785b3d1e3eab"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="intelivemetrics"><dir name="unityreports"><file name="utmz-alternative.js" hash="1d19f782d1504e70b8337bbc2308e041"/></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
</package>
|