Converdo_Analytics - Version 2.1.0.0

Version Notes

More reliable way to track orders and product metadata.

Download this release

Release Info

Developer Roeland van Oostenbrugge
Extension Converdo_Analytics
Version 2.1.0.0
Comparing to
See all releases


Code changes from version 2.0.0.0 to 2.1.0.0

app/code/community/Converdo/Analytics/Helper/Data.php CHANGED
@@ -39,7 +39,7 @@ class Converdo_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
39
 
40
  public static function getSiteUrl()
41
  {
42
- return '//tracker.converdo.com/';
43
  }
44
 
45
  public static function getPhpTracker($full = false)
@@ -60,15 +60,46 @@ class Converdo_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
60
  return 'tracker.js';
61
  }
62
 
 
 
 
 
 
63
  public function isSearchPage()
64
  {
65
- return isset(Converdo_Analytics_Tracker::attributes()['pt2'])
66
- && Converdo_Analytics_Tracker::attributes()['pt2'] === 'search_results';
67
  }
68
 
 
 
 
 
 
69
  public function isSuccessPage()
70
  {
71
  return isset(Converdo_Analytics_Tracker::attributes()['pt2'])
72
  && Converdo_Analytics_Tracker::attributes()['pt2'] === 'success_index';
73
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
39
 
40
  public static function getSiteUrl()
41
  {
42
+ return 'https://tracker.converdo.com/';
43
  }
44
 
45
  public static function getPhpTracker($full = false)
60
  return 'tracker.js';
61
  }
62
 
63
+ /**
64
+ * Gets whether the current page is a 'search' page.
65
+ *
66
+ * @return bool
67
+ */
68
  public function isSearchPage()
69
  {
70
+ return Mage::app()->getFrontController()->getRequest()->getControllerName() === 'result';
 
71
  }
72
 
73
+ /**
74
+ * Gets whether the current page is a 'order success' page.
75
+ *
76
+ * @return bool
77
+ */
78
  public function isSuccessPage()
79
  {
80
  return isset(Converdo_Analytics_Tracker::attributes()['pt2'])
81
  && Converdo_Analytics_Tracker::attributes()['pt2'] === 'success_index';
82
  }
83
+
84
+ /**
85
+ * Gets whether the current page is a 'category' page.
86
+ *
87
+ * @return bool
88
+ */
89
+ public function isCategoryPage()
90
+ {
91
+ return Mage::app()->getFrontController()->getRequest()->getControllerName() === 'category'
92
+ && Mage::registry('current_category');
93
+ }
94
+
95
+ /**
96
+ * Gets whether the current page is a 'product' page.
97
+ *
98
+ * @return bool
99
+ */
100
+ public function isProductPage()
101
+ {
102
+ return Mage::app()->getFrontController()->getRequest()->getControllerName() === 'product'
103
+ && Mage::registry('current_product');
104
+ }
105
  }
app/code/community/Converdo/Analytics/Model/Logger.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_Model_Logger
4
+ {
5
+ /**
6
+ * Writes a info-level entry to the log file.
7
+ *
8
+ * @param $input
9
+ * @return void
10
+ */
11
+ public static function info($input)
12
+ {
13
+ self::message($input, Zend_Log::INFO);
14
+ }
15
+
16
+ /**
17
+ * Writes a debug-level entry to the log file.
18
+ *
19
+ * @param $input
20
+ * @return void
21
+ */
22
+ public static function debug($input)
23
+ {
24
+ self::message($input, Zend_Log::DEBUG);
25
+ }
26
+
27
+ /**
28
+ * Writes a alert-level entry to the log file.
29
+ *
30
+ * @param $input
31
+ * @return void
32
+ */
33
+ public static function alert($input)
34
+ {
35
+ self::message($input, Zend_Log::ALERT);
36
+ }
37
+
38
+ /**
39
+ * Writes a critical-level entry to the log file.
40
+ *
41
+ * @param $input
42
+ * @return void
43
+ */
44
+ public static function critical($input)
45
+ {
46
+ self::message($input, Zend_Log::CRIT);
47
+ }
48
+
49
+ /**
50
+ * Writes a emergency-level entry to the log file.
51
+ *
52
+ * @param $input
53
+ * @return void
54
+ */
55
+ public static function emergency($input)
56
+ {
57
+ self::message($input, Zend_Log::EMERG);
58
+ }
59
+
60
+ /**
61
+ * Writes a notice-level entry to the log file.
62
+ *
63
+ * @param $input
64
+ * @return void
65
+ */
66
+ public static function notice($input)
67
+ {
68
+ self::message($input, Zend_Log::NOTICE);
69
+ }
70
+
71
+ /**
72
+ * Writes a warning-level entry to the log file.
73
+ *
74
+ * @param $input
75
+ * @return void
76
+ */
77
+ public static function warning($input)
78
+ {
79
+ self::message($input, Zend_Log::WARN);
80
+ }
81
+
82
+ /**
83
+ * Writes the message to the log file.
84
+ *
85
+ * @param string $input
86
+ * @param string $level
87
+ */
88
+ protected static function message($input, $level)
89
+ {
90
+ Mage::log($input, $level, 'ConverdoAnalytics.log');
91
+ }
92
+ }
app/code/community/Converdo/Analytics/Model/Observer.php CHANGED
@@ -1,44 +1,73 @@
1
  <?php
2
- /**
3
- *
4
- * Piwik Extension for Magento created by Adrian Speyer
5
- * Get Piwik at http://www.piwik.org - Open source web analytics
6
- *
7
- * @category PiwikMage
8
- * @package PiwikMage_PiwikAnalytics
9
- * @copyright Copyright (c) 2012 Adrian Speyer. (http://www.adrianspeyer.com)
10
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
11
- *
12
- */
13
-
14
-
15
- /**
16
- * Piwik module observer
17
- *
18
- * @category PiwikMage
19
- * @package PiwikMage_PiwikAnalytics
20
- */
21
  class Converdo_Analytics_Model_Observer
22
  {
23
  /**
24
- * Add order information into Piwik block to render on checkout success pages
25
  *
26
- * @param Varien_Event_Observer $observer
 
27
  */
28
- public function onCheckout(Varien_Event_Observer $observer)
29
  {
30
- $orderIds = $observer->getEvent()->getOrderIds();
 
 
 
 
 
 
 
 
 
31
 
32
- if (empty($orderIds) || !is_array($orderIds)) {
33
- return;
 
34
  }
 
35
 
36
- $block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('converdo_analytics');
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
- if ($block) {
39
- $block->setOrderedIds($orderIds);
 
 
 
40
  }
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
-
44
-
1
  <?php
2
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  class Converdo_Analytics_Model_Observer
4
  {
5
  /**
6
+ * Listens to placed orders. Sends the order to the Converdo Analytics API.
7
  *
8
+ * @param Varien_Event_Observer $observer
9
+ * @throws Exception
10
  */
11
+ public function onOrderPlacedEvent(Varien_Event_Observer $observer)
12
  {
13
+ try {
14
+ $order = $this->getOrder($observer);
15
+
16
+ if (! $this->enabled() || ! $order) {
17
+ return;
18
+ }
19
+
20
+ (new Converdo_Analytics_API_ConverdoAPI())->order()->create(
21
+ (new Converdo_Analytics_API_Factories_Order())->make($order)
22
+ );
23
 
24
+ Converdo_Analytics_Cookie_Manager::logEcommerce();
25
+ } catch (Exception $e) {
26
+ Converdo_Analytics_Model_Logger::info($e->getMessage());
27
  }
28
+ }
29
 
30
+ /**
31
+ * Listens to changed orders. Sends the new order status to the Converdo Analytics API.
32
+ *
33
+ * @param Varien_Event_Observer $observer
34
+ * @throws Exception
35
+ */
36
+ public function onOrderStatusChangedEvent(Varien_Event_Observer $observer)
37
+ {
38
+ try {
39
+ $order = $this->getOrder($observer);
40
+
41
+ if (! $this->enabled() || ! $order) {
42
+ return;
43
+ }
44
 
45
+ (new Converdo_Analytics_API_ConverdoAPI())->order()->modifyStatus(
46
+ (new Converdo_Analytics_API_Factories_Order())->make($order)
47
+ );
48
+ } catch (Exception $e) {
49
+ Converdo_Analytics_Model_Logger::info($e->getMessage());
50
  }
51
  }
52
+
53
+ /**
54
+ * Checks whether the Converdo Analytics plugin is enabled.
55
+ *
56
+ * @return bool
57
+ */
58
+ protected function enabled()
59
+ {
60
+ return Mage::helper('analytics')->isEnabled();
61
+ }
62
+
63
+ /**
64
+ * Retrieves the Magento order from the event.
65
+ *
66
+ * @param Varien_Event_Observer $observer
67
+ * @return Mage_Sales_Model_Order
68
+ */
69
+ protected function getOrder(Varien_Event_Observer $observer)
70
+ {
71
+ return $observer->getEvent()->getOrder();
72
+ }
73
  }
 
 
app/code/community/Converdo/Analytics/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Converdo_Analytics>
6
- <version>2.0.0.0</version>
7
  </Converdo_Analytics>
8
  </modules>
9
  <global>
@@ -34,22 +34,24 @@
34
  </modules>
35
  </translate>
36
  <events>
37
- <checkout_onepage_controller_success_action>
38
  <observers>
39
- <analytics_order_success>
 
40
  <class>analytics/observer</class>
41
- <method>onCheckout</method>
42
- </analytics_order_success>
43
  </observers>
44
- </checkout_onepage_controller_success_action>
45
- <checkout_multishipping_controller_success_action>
46
  <observers>
47
- <analytics_order_success>
 
48
  <class>analytics/observer</class>
49
- <method>onCheckout</method>
50
- </analytics_order_success>
51
  </observers>
52
- </checkout_multishipping_controller_success_action>
53
  </events>
54
  <layout>
55
  <updates>
@@ -78,6 +80,17 @@
78
  </Converdo_Analytics>
79
  </modules>
80
  </translate>
 
 
 
 
 
 
 
 
 
 
 
81
  <layout>
82
  <updates>
83
  <namespace_module>
3
  <config>
4
  <modules>
5
  <Converdo_Analytics>
6
+ <version>2.1.0.0</version>
7
  </Converdo_Analytics>
8
  </modules>
9
  <global>
34
  </modules>
35
  </translate>
36
  <events>
37
+ <sales_order_place_after>
38
  <observers>
39
+ <analytics_order_placed>
40
+ <type>model</type>
41
  <class>analytics/observer</class>
42
+ <method>onOrderPlacedEvent</method>
43
+ </analytics_order_placed>
44
  </observers>
45
+ </sales_order_place_after>
46
+ <sales_order_save_after>
47
  <observers>
48
+ <analytics_order_saved>
49
+ <type>model</type>
50
  <class>analytics/observer</class>
51
+ <method>onOrderStatusChangedEvent</method>
52
+ </analytics_order_saved>
53
  </observers>
54
+ </sales_order_save_after>
55
  </events>
56
  <layout>
57
  <updates>
80
  </Converdo_Analytics>
81
  </modules>
82
  </translate>
83
+ <events>
84
+ <sales_order_save_after>
85
+ <observers>
86
+ <analytics_order_saved>
87
+ <type>model</type>
88
+ <class>analytics/observer</class>
89
+ <method>onOrderStatusChangedEvent</method>
90
+ </analytics_order_saved>
91
+ </observers>
92
+ </sales_order_save_after>
93
+ </events>
94
  <layout>
95
  <updates>
96
  <namespace_module>
lib/Converdo/Analytics/API/ConverdoAPI.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_API_ConverdoAPI
4
+ {
5
+ public static function order()
6
+ {
7
+ return new Converdo_Analytics_API_Sections_ConverdoOrderAPI();
8
+ }
9
+ }
lib/Converdo/Analytics/API/ConverdoClient.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_API_ConverdoClient
4
+ {
5
+ /**
6
+ * @var string
7
+ */
8
+ protected $module;
9
+
10
+ /**
11
+ * @var array
12
+ */
13
+ protected $parameters = [];
14
+
15
+ /**
16
+ * @var int
17
+ */
18
+ protected $limit = 10000;
19
+
20
+ /**
21
+ * Set Module.
22
+ *
23
+ * @param string $module
24
+ * @return $this
25
+ */
26
+ public function setModule($module)
27
+ {
28
+ $this->module = $module;
29
+
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ * Get Module.
35
+ *
36
+ * @return mixed
37
+ */
38
+ public function getModule()
39
+ {
40
+ return $this->module;
41
+ }
42
+
43
+ /**
44
+ * Set Parameters.
45
+ *
46
+ * @param array $parameters
47
+ * @return $this
48
+ */
49
+ public function setParameters($parameters)
50
+ {
51
+ $this->parameters = $parameters + $this->defaultParameters();
52
+
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * Appends the default parameters needed for each request.
58
+ *
59
+ * @return array
60
+ */
61
+ public function defaultParameters()
62
+ {
63
+ $cookie = Converdo_Analytics_Cookie_Manager::find();
64
+
65
+ return [
66
+ 'visitor' => $cookie->getVisitor(),
67
+ ];
68
+ }
69
+
70
+ /**
71
+ * Get Parameters.
72
+ *
73
+ * @return array
74
+ */
75
+ public function getParameters()
76
+ {
77
+ return (array) $this->parameters;
78
+ }
79
+
80
+ /**
81
+ * Set Limit.
82
+ *
83
+ * @param int $limit
84
+ * @return $this
85
+ */
86
+ public function setLimit($limit)
87
+ {
88
+ $this->limit = $limit;
89
+
90
+ return $this;
91
+ }
92
+
93
+ /**
94
+ * Get Limit.
95
+ *
96
+ * @return int
97
+ */
98
+ public function getLimit()
99
+ {
100
+ return (int) $this->limit;
101
+ }
102
+
103
+ protected function buildUrl()
104
+ {
105
+ $siteId = Mage::getStoreConfig('converdo/analytics/site');
106
+ $userId = Mage::getStoreConfig('converdo/analytics/token');
107
+
108
+ return Mage::helper('analytics')->getSiteUrl() .
109
+ "index.php?module=API" .
110
+ "&method={$this->module}" .
111
+ "&idSite={$siteId}" .
112
+ "&token_auth={$userId}" .
113
+ "&format=json";
114
+ }
115
+
116
+ public function post()
117
+ {
118
+ try {
119
+ $ch = curl_init($this->buildUrl());
120
+
121
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
122
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
123
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->getParameters());
124
+ curl_exec($ch);
125
+
126
+ curl_close($ch);
127
+ } catch (\Exception $e) {
128
+ // Whoops...
129
+ }
130
+
131
+ return true;
132
+ }
133
+ }
lib/Converdo/Analytics/API/Factories/Order.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_API_Factories_Order
4
+ {
5
+ /**
6
+ * @var Mage_Sales_Model_Order
7
+ */
8
+ protected $order;
9
+
10
+ /**
11
+ * @var Converdo_Analytics_API_Models_Order
12
+ */
13
+ protected $model;
14
+
15
+ /**
16
+ * @param Mage_Sales_Model_Order $order
17
+ * @return Converdo_Analytics_API_Models_Order
18
+ */
19
+ public function make(Mage_Sales_Model_Order $order)
20
+ {
21
+ $this->order = $order;
22
+ $this->model = (new Converdo_Analytics_API_Models_Order())
23
+ ->setOrderId($order->getRealOrderId())
24
+ ->setCustomer($this->customer())
25
+ ->setProducts($this->products())
26
+ ->setSubtotal($order->getSubtotal())
27
+ ->setTax($order->getBaseTaxAmount())
28
+ ->setShipping($order->getBaseShippingAmount())
29
+ ->setStatus($order->getState())
30
+ ;
31
+
32
+ return $this->model;
33
+ }
34
+
35
+ /**
36
+ * Retrieve all customer data.
37
+ *
38
+ * @return array
39
+ */
40
+ protected function customer()
41
+ {
42
+ $billing = $this->order->getBillingAddress();
43
+
44
+ return [
45
+ 'prefix' => $billing->getPrefix(),
46
+ 'name' => $billing->getName(),
47
+ 'address' => $billing->getStreet(-1),
48
+ 'postal_code' => $billing->getPostcode(),
49
+ 'city' => $billing->getCity(),
50
+ 'country' => $billing->getCountryModel()->getName(),
51
+ 'email' => $billing->getEmail() ?: $this->order->getCustomerEmail(),
52
+ 'telephone' => $billing->getTelephone(),
53
+ ];
54
+ }
55
+
56
+ /**
57
+ * Retrieve all (parent) products in the cart.
58
+ *
59
+ * @return array
60
+ */
61
+ protected function products()
62
+ {
63
+ $products = [];
64
+
65
+ foreach (Mage::getModel('checkout/cart')->getQuote()->getAllVisibleItems() as $item) {
66
+ if ($item->getPrice() < 0.01) {
67
+ continue;
68
+ }
69
+
70
+ $product = Mage::getModel('catalog/product')->load($item->product_id);
71
+
72
+ $products[] = [
73
+ 'name' => $product->getName(),
74
+ 'sku' => $product->getSku(),
75
+ 'price' => $item->getPrice(),
76
+ 'quantity' => $item->getQtyOrdered(),
77
+ ];
78
+ }
79
+
80
+ return $products;
81
+ }
82
+ }
lib/Converdo/Analytics/API/Models/Order.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_API_Models_Order
4
+ {
5
+ /**
6
+ * @var mixed
7
+ */
8
+ protected $orderId;
9
+
10
+ /**
11
+ * @var string
12
+ */
13
+ protected $orderIdUrl;
14
+
15
+ /**
16
+ * @var float
17
+ */
18
+ protected $subtotal;
19
+
20
+ /**
21
+ * @var float
22
+ */
23
+ protected $tax;
24
+
25
+ /**
26
+ * @var float
27
+ */
28
+ protected $shipping;
29
+
30
+ /**
31
+ * @var array
32
+ */
33
+ protected $customer = [];
34
+
35
+ /**
36
+ * @var array
37
+ */
38
+ protected $products = [];
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ protected $status;
44
+
45
+ /**
46
+ * Sets the order id.
47
+ *
48
+ * @param mixed $orderId
49
+ * @return $this
50
+ */
51
+ public function setOrderId($orderId)
52
+ {
53
+ $this->orderId = $orderId;
54
+
55
+ $this->setOrderIdUrl($orderId);
56
+
57
+ return $this;
58
+ }
59
+
60
+ /**
61
+ * Sets the order id url.
62
+ *
63
+ * @param mixed $orderId
64
+ * @return $this
65
+ */
66
+ public function setOrderIdUrl($orderId)
67
+ {
68
+ $this->orderIdUrl = Mage::getUrl('adminhtml/sales_order/view', [
69
+ 'order_id' => $orderId,
70
+ '_type' => Mage_Core_Model_Store::URL_TYPE_WEB,
71
+ ]);
72
+
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Gets the order id url.
78
+ *
79
+ * @return string
80
+ */
81
+ public function getOrderIdUrl()
82
+ {
83
+ return $this->orderIdUrl;
84
+ }
85
+
86
+ /**
87
+ * Gets the order id.
88
+ *
89
+ * @return mixed
90
+ */
91
+ public function getOrderId()
92
+ {
93
+ return $this->orderId;
94
+ }
95
+
96
+ /**
97
+ * Sets the subtotal.
98
+ *
99
+ * @param float $subtotal
100
+ * @return $this
101
+ */
102
+ public function setSubtotal($subtotal)
103
+ {
104
+ $this->subtotal = round($subtotal, 2);
105
+
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * Gets the subtotal.
111
+ *
112
+ * @return float
113
+ */
114
+ public function getSubtotal()
115
+ {
116
+ return (float) $this->subtotal;
117
+ }
118
+
119
+ /**
120
+ * Sets the tax fees.
121
+ *
122
+ * @param float $tax
123
+ * @return $this
124
+ */
125
+ public function setTax($tax)
126
+ {
127
+ $this->tax = $tax;
128
+
129
+ return $this;
130
+ }
131
+
132
+ /**
133
+ * Gets the tax fees.
134
+ *
135
+ * @return float
136
+ */
137
+ public function getTax()
138
+ {
139
+ return (float) $this->tax;
140
+ }
141
+
142
+ /**
143
+ * Sets the shipping fees.
144
+ *
145
+ * @param float $shipping
146
+ * @return $this
147
+ */
148
+ public function setShipping($shipping)
149
+ {
150
+ $this->shipping = $shipping;
151
+
152
+ return $this;
153
+ }
154
+
155
+ /**
156
+ * Gets the shipping fees.
157
+ *
158
+ * @return float
159
+ */
160
+ public function getShipping()
161
+ {
162
+ return (float) $this->shipping;
163
+ }
164
+
165
+ /**
166
+ * Sets the customer data.
167
+ *
168
+ * @param array $customer
169
+ * @return $this
170
+ */
171
+ public function setCustomer(array $customer)
172
+ {
173
+ $this->customer = $customer;
174
+
175
+ return $this;
176
+ }
177
+
178
+ /**
179
+ * Gets the customer data.
180
+ *
181
+ * @param mixed|null $key
182
+ * @return array
183
+ */
184
+ public function getCustomer($key = null)
185
+ {
186
+ if ($key) {
187
+ return $this->customer[$key];
188
+ }
189
+
190
+ return (array) $this->customer;
191
+ }
192
+
193
+ /**
194
+ * Sets the products.
195
+ *
196
+ * @param array $products
197
+ * @return $this
198
+ */
199
+ public function setProducts($products)
200
+ {
201
+ $this->products = $products;
202
+
203
+ return $this;
204
+ }
205
+
206
+ /**
207
+ * Gets the products.
208
+ *
209
+ * @return array
210
+ */
211
+ public function getProducts()
212
+ {
213
+ return (array) $this->products;
214
+ }
215
+
216
+ /**
217
+ * Sets the order status.
218
+ *
219
+ * @param string $status
220
+ * @return $this
221
+ */
222
+ public function setStatus($status)
223
+ {
224
+ $this->status = $status;
225
+
226
+ return $this;
227
+ }
228
+
229
+ /**
230
+ * Gets the order status.
231
+ *
232
+ * @return string
233
+ */
234
+ public function getStatus()
235
+ {
236
+ return (string) $this->status;
237
+ }
238
+
239
+ /**
240
+ * Gets the SKUs of all products in the cart.
241
+ *
242
+ * @return array
243
+ */
244
+ public function getProductSkus()
245
+ {
246
+ $skus = [];
247
+
248
+ foreach ($this->getProducts() as $product) {
249
+ $skus[] = $product['sku'];
250
+ }
251
+
252
+ return $skus;
253
+ }
254
+ }
lib/Converdo/Analytics/API/Sections/ConverdoOrderAPI.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_API_Sections_ConverdoOrderAPI
4
+ {
5
+ public function create(Converdo_Analytics_API_Models_Order $order)
6
+ {
7
+ return (new Converdo_Analytics_API_ConverdoClient())
8
+ ->setModule('ConverdoEcommerce.completeOrderCVD')
9
+ ->setParameters([
10
+ 'orderId' => $order->getOrderId(),
11
+ 'orderIdUrl' => $order->getOrderIdUrl(),
12
+ 'subtotal' => $order->getSubtotal(),
13
+ 'tax' => $order->getTax(),
14
+ 'shipping' => $order->getShipping(),
15
+ 'customer_prefix' => $order->getCustomer('prefix'),
16
+ 'customer_name' => $order->getCustomer('name'),
17
+ 'customer_address' => $order->getCustomer('address'),
18
+ 'customer_postal_code' => $order->getCustomer('postal_code'),
19
+ 'customer_city' => $order->getCustomer('city'),
20
+ 'customer_country' => $order->getCustomer('country'),
21
+ 'customer_email' => $order->getCustomer('email'),
22
+ 'customer_telephone' => $order->getCustomer('telephone'),
23
+ 'products' => base64_encode(json_encode($order->getProductSkus())),
24
+ ])
25
+ ->post();
26
+ }
27
+
28
+ public function modifyStatus(Converdo_Analytics_API_Models_Order $order)
29
+ {
30
+ return (new Converdo_Analytics_API_ConverdoClient())
31
+ ->setModule('ConverdoEcommerce.changeOrderStatusCVD')
32
+ ->setParameters([
33
+ 'orderId' => $order->getOrderId(),
34
+ 'status' => $order->getStatus(),
35
+ ])
36
+ ->post();
37
+ }
38
+ }
lib/Converdo/Analytics/Cookie/Manager.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_Cookie_Manager
4
+ {
5
+ /**
6
+ * @var string|null
7
+ */
8
+ protected static $name = null;
9
+
10
+ /**
11
+ * @var Converdo_Analytics_Cookie_Model|null
12
+ */
13
+ protected static $cookie = null;
14
+
15
+ /**
16
+ * @return Converdo_Analytics_Cookie_Model|null;
17
+ */
18
+ public static function find()
19
+ {
20
+ if (self::$cookie) {
21
+ return self::$cookie;
22
+ }
23
+
24
+ foreach ($_COOKIE as $key => $cookie) {
25
+ if (strpos($key, '_pk_id_' . Mage::getStoreConfig('converdo/analytics/site')) === false) {
26
+ continue;
27
+ }
28
+
29
+ $values = explode('.', $cookie);
30
+
31
+ self::$name = str_replace('.pk.id', '_pk_id', str_replace('_', '.', $key));
32
+ self::$cookie = self::factory($values);
33
+
34
+ return self::$cookie;
35
+ }
36
+
37
+ return null;
38
+ }
39
+
40
+
41
+ public static function logEcommerce()
42
+ {
43
+ self::$cookie->setLastVisitedAt(time());
44
+ self::$cookie->setUpdatedAt(time());
45
+
46
+ self::update();
47
+ }
48
+
49
+ protected static function factory(array $values)
50
+ {
51
+ return (new Converdo_Analytics_Cookie_Model())
52
+ ->setVisitor($values[0])
53
+ ->setUuid($values[1])
54
+ ->setCreatedAt($values[2])
55
+ ->setVisitCount($values[3])
56
+ ->setUpdatedAt($values[4])
57
+ ->setLastVisitedAt($values[5]);
58
+ }
59
+
60
+ protected static function update()
61
+ {
62
+ setcookie(self::$name, self::$cookie, time() + (86400 * 30), "/");
63
+ }
64
+ }
lib/Converdo/Analytics/Cookie/Model.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_Cookie_Model
4
+ {
5
+ /**
6
+ * @var string
7
+ */
8
+ protected $visitor;
9
+
10
+ /**
11
+ * @var int
12
+ */
13
+ protected $uuid;
14
+
15
+ /**
16
+ * @var int
17
+ */
18
+ protected $visitCount;
19
+
20
+ /**
21
+ * @var int
22
+ */
23
+ protected $lastVisitedAt;
24
+
25
+ /**
26
+ * @var int
27
+ */
28
+ protected $createdAt;
29
+
30
+ /**
31
+ * @var int
32
+ */
33
+ protected $updatedAt;
34
+
35
+ /**
36
+ * Sets the visitor ID.
37
+ *
38
+ * @param string $visitor
39
+ * @return $this
40
+ */
41
+ public function setVisitor($visitor)
42
+ {
43
+ $this->visitor = $visitor;
44
+
45
+ return $this;
46
+ }
47
+
48
+ /**
49
+ * Gets the visitor ID.
50
+ *
51
+ * @return string
52
+ */
53
+ public function getVisitor()
54
+ {
55
+ return (string) $this->visitor;
56
+ }
57
+
58
+ /**
59
+ * Sets the uuid.
60
+ *
61
+ * @param int $uuid
62
+ * @return $this
63
+ */
64
+ public function setUuid($uuid)
65
+ {
66
+ $this->uuid = $uuid;
67
+
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * Gets the uuid.
73
+ *
74
+ * @return int
75
+ */
76
+ public function getUuid()
77
+ {
78
+ return (int) $this->uuid;
79
+ }
80
+
81
+ /**
82
+ * Sets the visit count.
83
+ *
84
+ * @param int $visitCount
85
+ * @return $this
86
+ */
87
+ public function setVisitCount($visitCount)
88
+ {
89
+ $this->visitCount = $visitCount;
90
+
91
+ return $this;
92
+ }
93
+
94
+ /**
95
+ * Gets the visit count.
96
+ *
97
+ * @return int
98
+ */
99
+ public function getVisitCount()
100
+ {
101
+ return (int) $this->visitCount;
102
+ }
103
+
104
+ /**
105
+ * Sets the last visit timestamp.
106
+ *
107
+ * @param int $lastVisitedAt
108
+ * @return $this
109
+ */
110
+ public function setLastVisitedAt($lastVisitedAt)
111
+ {
112
+ $this->lastVisitedAt = $lastVisitedAt;
113
+
114
+ return $this;
115
+ }
116
+
117
+ /**
118
+ * Gets the last visit timestamp.
119
+ *
120
+ * @return int
121
+ */
122
+ public function getLastVisitedAt()
123
+ {
124
+ return (int) $this->lastVisitedAt;
125
+ }
126
+
127
+ /**
128
+ * Sets the created at timestamp.
129
+ *
130
+ * @param int $createdAt
131
+ * @return $this
132
+ */
133
+ public function setCreatedAt($createdAt)
134
+ {
135
+ $this->createdAt = $createdAt;
136
+
137
+ return $this;
138
+ }
139
+
140
+ /**
141
+ * Gets the created at timestamp.
142
+ *
143
+ * @return int
144
+ */
145
+ public function getCreatedAt()
146
+ {
147
+ return (int) $this->createdAt;
148
+ }
149
+
150
+ /**
151
+ * Sets the updated at timestamp.
152
+ *
153
+ * @param int $updatedAt
154
+ * @return $this
155
+ */
156
+ public function setUpdatedAt($updatedAt)
157
+ {
158
+ $this->updatedAt = $updatedAt;
159
+
160
+ return $this;
161
+ }
162
+
163
+ /**
164
+ * Gets the updated at timestamp.
165
+ *
166
+ * @return int
167
+ */
168
+ public function getUpdatedAt()
169
+ {
170
+ return (int) $this->updatedAt;
171
+ }
172
+
173
+ public function __toString()
174
+ {
175
+ return implode('.', [
176
+ $this->getVisitor(),
177
+ $this->getUuid(),
178
+ $this->getCreatedAt(),
179
+ $this->getVisitCount(),
180
+ $this->getUpdatedAt(),
181
+ $this->getLastVisitedAt()
182
+ ]);
183
+ }
184
+ }
lib/Converdo/Analytics/Models/EcommerceView.php CHANGED
@@ -51,7 +51,17 @@ class Converdo_Analytics_Models_EcommerceView
51
  protected $stockQuantity;
52
 
53
  /**
54
- * Sets the Product ID.
 
 
 
 
 
 
 
 
 
 
55
  *
56
  * @param int $id
57
  * @return $this
@@ -64,7 +74,7 @@ class Converdo_Analytics_Models_EcommerceView
64
  }
65
 
66
  /**
67
- * Gets the Product ID.
68
  *
69
  * @return int
70
  */
@@ -74,7 +84,7 @@ class Converdo_Analytics_Models_EcommerceView
74
  }
75
 
76
  /**
77
- * Sets the Product Sku.
78
  *
79
  * @param string $sku
80
  * @return $this
@@ -87,7 +97,7 @@ class Converdo_Analytics_Models_EcommerceView
87
  }
88
 
89
  /**
90
- * Gets the Product Sku.
91
  *
92
  * @return string
93
  */
@@ -97,7 +107,7 @@ class Converdo_Analytics_Models_EcommerceView
97
  }
98
 
99
  /**
100
- * Sets the Product Name.
101
  *
102
  * @param string $name
103
  * @return $this
@@ -110,7 +120,7 @@ class Converdo_Analytics_Models_EcommerceView
110
  }
111
 
112
  /**
113
- * Gets the Product Name.
114
  *
115
  * @return string
116
  */
@@ -120,7 +130,7 @@ class Converdo_Analytics_Models_EcommerceView
120
  }
121
 
122
  /**
123
- * Sets the Product Categories (up to five).
124
  *
125
  * @param array $categories
126
  * @return $this
@@ -132,15 +142,16 @@ class Converdo_Analytics_Models_EcommerceView
132
  $this->categories[] = addslashes($category->getName());
133
  }
134
 
135
- $this->categories = array_splice(array_filter($this->categories), 0, 5);
 
136
 
137
  return $this;
138
  }
139
 
140
  /**
141
- * Gets the Product Categories.
142
  *
143
- * @return null|string
144
  */
145
  public function getCategories()
146
  {
@@ -148,7 +159,7 @@ class Converdo_Analytics_Models_EcommerceView
148
  }
149
 
150
  /**
151
- * Sets the Product Price.
152
  *
153
  * @param float $price
154
  * @return $this
@@ -161,7 +172,7 @@ class Converdo_Analytics_Models_EcommerceView
161
  }
162
 
163
  /**
164
- * Gets the Product Price.
165
  *
166
  * @return float|null
167
  */
@@ -171,7 +182,7 @@ class Converdo_Analytics_Models_EcommerceView
171
  }
172
 
173
  /**
174
- * Sets the Product Image URL.
175
  *
176
  * @param string $imageUrl
177
  * @return $this
@@ -184,7 +195,7 @@ class Converdo_Analytics_Models_EcommerceView
184
  }
185
 
186
  /**
187
- * Gets the Product Image URL.
188
  *
189
  * @return string
190
  */
@@ -194,9 +205,9 @@ class Converdo_Analytics_Models_EcommerceView
194
  }
195
 
196
  /**
197
- * Sets the Product Type.
198
  *
199
- * @param int $type
200
  * @return $this
201
  */
202
  public function setType($type)
@@ -207,7 +218,7 @@ class Converdo_Analytics_Models_EcommerceView
207
  }
208
 
209
  /**
210
- * Gets the Product Type.
211
  *
212
  * @return int
213
  */
@@ -217,9 +228,9 @@ class Converdo_Analytics_Models_EcommerceView
217
  }
218
 
219
  /**
220
- * Sets the Product Stock.
221
  *
222
- * @param bool $isInStock
223
  * @return $this
224
  */
225
  public function setIsInStock($isInStock)
@@ -230,7 +241,7 @@ class Converdo_Analytics_Models_EcommerceView
230
  }
231
 
232
  /**
233
- * Gets the Product Stock.
234
  *
235
  * @return bool
236
  */
@@ -240,9 +251,9 @@ class Converdo_Analytics_Models_EcommerceView
240
  }
241
 
242
  /**
243
- * Sets the Product Stock Quantity.
244
  *
245
- * @param int $quantity
246
  * @return $this
247
  */
248
  public function setStockQuantity($quantity)
@@ -253,7 +264,7 @@ class Converdo_Analytics_Models_EcommerceView
253
  }
254
 
255
  /**
256
- * Gets the Product Stock Quantity.
257
  *
258
  * @return bool
259
  */
@@ -262,6 +273,52 @@ class Converdo_Analytics_Models_EcommerceView
262
  return (float) $this->stockQuantity;
263
  }
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  /**
266
  * Retrieves the Product IDs of children for a configurable product.
267
  *
@@ -275,7 +332,7 @@ class Converdo_Analytics_Models_EcommerceView
275
 
276
  $children = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($this->getId());
277
 
278
- if (count($children) < 0) {
279
  return [];
280
  }
281
 
@@ -319,8 +376,11 @@ class Converdo_Analytics_Models_EcommerceView
319
  // Product Is In Stock
320
  'stb' => $this->getIsInStock(),
321
 
322
- // Product Is In Stock
323
- 'bra' => null,
 
 
 
324
 
325
  // Product Stock Quantity
326
  'sqn' => $this->getStockQuantity(),
51
  protected $stockQuantity;
52
 
53
  /**
54
+ * @var string
55
+ */
56
+ protected $manufacturer;
57
+
58
+ /**
59
+ * @var float
60
+ */
61
+ protected $cost;
62
+
63
+ /**
64
+ * Sets the product id.
65
  *
66
  * @param int $id
67
  * @return $this
74
  }
75
 
76
  /**
77
+ * Gets the product id.
78
  *
79
  * @return int
80
  */
84
  }
85
 
86
  /**
87
+ * Sets the product sku.
88
  *
89
  * @param string $sku
90
  * @return $this
97
  }
98
 
99
  /**
100
+ * Gets the product sku.
101
  *
102
  * @return string
103
  */
107
  }
108
 
109
  /**
110
+ * Sets the product name.
111
  *
112
  * @param string $name
113
  * @return $this
120
  }
121
 
122
  /**
123
+ * Gets the product name.
124
  *
125
  * @return string
126
  */
130
  }
131
 
132
  /**
133
+ * Sets the product categories (up to five).
134
  *
135
  * @param array $categories
136
  * @return $this
142
  $this->categories[] = addslashes($category->getName());
143
  }
144
 
145
+ $this->categories = array_filter($this->categories);
146
+ $this->categories = array_splice($this->categories, 0, 5);
147
 
148
  return $this;
149
  }
150
 
151
  /**
152
+ * Gets the product categories.
153
  *
154
+ * @return string
155
  */
156
  public function getCategories()
157
  {
159
  }
160
 
161
  /**
162
+ * Sets the product price.
163
  *
164
  * @param float $price
165
  * @return $this
172
  }
173
 
174
  /**
175
+ * Gets the product price.
176
  *
177
  * @return float|null
178
  */
182
  }
183
 
184
  /**
185
+ * Sets the product image url.
186
  *
187
  * @param string $imageUrl
188
  * @return $this
195
  }
196
 
197
  /**
198
+ * Gets the product image url.
199
  *
200
  * @return string
201
  */
205
  }
206
 
207
  /**
208
+ * Sets the product type.
209
  *
210
+ * @param int $type
211
  * @return $this
212
  */
213
  public function setType($type)
218
  }
219
 
220
  /**
221
+ * Gets the product type.
222
  *
223
  * @return int
224
  */
228
  }
229
 
230
  /**
231
+ * Sets the product stock.
232
  *
233
+ * @param bool $isInStock
234
  * @return $this
235
  */
236
  public function setIsInStock($isInStock)
241
  }
242
 
243
  /**
244
+ * Gets the product stock.
245
  *
246
  * @return bool
247
  */
251
  }
252
 
253
  /**
254
+ * Sets the product stock quantity.
255
  *
256
+ * @param int $quantity
257
  * @return $this
258
  */
259
  public function setStockQuantity($quantity)
264
  }
265
 
266
  /**
267
+ * Gets the product stock quantity.
268
  *
269
  * @return bool
270
  */
273
  return (float) $this->stockQuantity;
274
  }
275
 
276
+ /**
277
+ * Sets the manufacturer.
278
+ *
279
+ * @param string $manufacturer
280
+ * @return $this
281
+ */
282
+ public function setManufacturer($manufacturer)
283
+ {
284
+ $this->manufacturer = $manufacturer;
285
+
286
+ return $this;
287
+ }
288
+
289
+ /**
290
+ * Gets the manufacturer.
291
+ *
292
+ * @return string
293
+ */
294
+ public function getManufacturer()
295
+ {
296
+ return (string) $this->manufacturer;
297
+ }
298
+
299
+ /**
300
+ * Sets the product cost.
301
+ *
302
+ * @param float $cost
303
+ * @return $this
304
+ */
305
+ public function setCost($cost)
306
+ {
307
+ $this->cost = $cost;
308
+
309
+ return $this;
310
+ }
311
+
312
+ /**
313
+ * Gets the Product cost.
314
+ *
315
+ * @return float
316
+ */
317
+ public function getCost()
318
+ {
319
+ return (float) $this->cost;
320
+ }
321
+
322
  /**
323
  * Retrieves the Product IDs of children for a configurable product.
324
  *
332
 
333
  $children = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($this->getId());
334
 
335
+ if (count($children) <= 0) {
336
  return [];
337
  }
338
 
376
  // Product Is In Stock
377
  'stb' => $this->getIsInStock(),
378
 
379
+ // Product Brand
380
+ 'bra' => $this->getManufacturer(),
381
+
382
+ // Product Cost
383
+ 'cos' => $this->getCost(),
384
 
385
  // Product Stock Quantity
386
  'sqn' => $this->getStockQuantity(),
lib/Converdo/Analytics/Support/Cookie.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Converdo_Analytics_Support_Cookie
4
+ {
5
+ public static function find()
6
+ {
7
+ foreach ($_COOKIE as $key => $cookie) {
8
+ if (strpos($key, '_pk_id_' . Mage::getStoreConfig('converdo/analytics/site')) === false) {
9
+ continue;
10
+ }
11
+
12
+ return $cookie;
13
+ }
14
+
15
+ return null;
16
+ }
17
+
18
+ protected static function factory($cookie)
19
+ {
20
+
21
+ }
22
+ }
lib/Converdo/Analytics/Support/Crypt.php CHANGED
@@ -3,29 +3,29 @@
3
  class Converdo_Analytics_Support_Crypt
4
  {
5
  /**
6
- * Encrypt a given input.
7
  *
8
- * @param $input
9
  * @return string
10
  */
11
  public static function encrypt($input)
12
  {
13
- return openssl_encrypt(base64_encode($input), 'AES-256-CFB', self::key());
14
  }
15
 
16
  /**
17
- * Decrypt a given input.
18
  *
19
- * @param $input
20
  * @return string
21
  */
22
  public static function decrypt($input)
23
  {
24
- return base64_decode(openssl_decrypt($input, 'AES-256-CFB', self::key()));
25
  }
26
 
27
  /**
28
- * Return the encryption key.
29
  *
30
  * @return string
31
  */
3
  class Converdo_Analytics_Support_Crypt
4
  {
5
  /**
6
+ * Encrypts a given input.
7
  *
8
+ * @param string $input
9
  * @return string
10
  */
11
  public static function encrypt($input)
12
  {
13
+ return @openssl_encrypt(base64_encode($input), 'AES-256-CFB', self::key());
14
  }
15
 
16
  /**
17
+ * Decrypts a given input.
18
  *
19
+ * @param string $input
20
  * @return string
21
  */
22
  public static function decrypt($input)
23
  {
24
+ return @base64_decode(openssl_decrypt($input, 'AES-256-CFB', self::key()));
25
  }
26
 
27
  /**
28
+ * Returns the encryption key.
29
  *
30
  * @return string
31
  */
lib/Converdo/Analytics/Trackers/Cart.php CHANGED
@@ -39,7 +39,7 @@ class Converdo_Analytics_Trackers_Cart extends Converdo_Analytics_Support_Abstra
39
  ->setSku($product->getSku())
40
  ->setName($product->getName())
41
  ->setCategory($category)
42
- ->setPrice($product->getFinalPrice())
43
  ->setQuantity($cartItem->getQty());
44
  }
45
 
39
  ->setSku($product->getSku())
40
  ->setName($product->getName())
41
  ->setCategory($category)
42
+ ->setPrice($cartItem->getPrice())
43
  ->setQuantity($cartItem->getQty());
44
  }
45
 
lib/Converdo/Analytics/Trackers/CategoryView.php CHANGED
@@ -12,9 +12,7 @@ class Converdo_Analytics_Trackers_CategoryView extends Converdo_Analytics_Suppor
12
  */
13
  public function responsible()
14
  {
15
- return Mage::registry('current_category')
16
- && Mage::registry('current_category') instanceof Mage_Catalog_Model_Category
17
- && ! Mage::registry('current_product');
18
  }
19
 
20
  /**
12
  */
13
  public function responsible()
14
  {
15
+ return Mage::helper('analytics')->isCategoryPage();
 
 
16
  }
17
 
18
  /**
lib/Converdo/Analytics/Trackers/EcommerceView.php CHANGED
@@ -12,9 +12,7 @@ class Converdo_Analytics_Trackers_EcommerceView extends Converdo_Analytics_Suppo
12
  */
13
  public function responsible()
14
  {
15
- return Mage::registry('current_product')
16
- && Mage::registry('current_product') instanceof Mage_Catalog_Model_Product
17
- && Mage::app()->getFrontController()->getRequest()->getRouteName() !== 'catalogsearch';
18
  }
19
 
20
  /**
@@ -34,6 +32,8 @@ class Converdo_Analytics_Trackers_EcommerceView extends Converdo_Analytics_Suppo
34
  ->setType(Mage::registry('current_product')->getTypeID())
35
  ->setIsInStock(Mage::registry('current_product')->getStockItem()->getIsInStock())
36
  ->setStockQuantity(Mage::registry('current_product')->getStockItem()->getQty())
 
 
37
  ;
38
  }
39
 
12
  */
13
  public function responsible()
14
  {
15
+ return Mage::helper('analytics')->isProductPage();
 
 
16
  }
17
 
18
  /**
32
  ->setType(Mage::registry('current_product')->getTypeID())
33
  ->setIsInStock(Mage::registry('current_product')->getStockItem()->getIsInStock())
34
  ->setStockQuantity(Mage::registry('current_product')->getStockItem()->getQty())
35
+ ->setManufacturer(Mage::registry('current_product')->getData('manufacturer'))
36
+ ->setCost(Mage::registry('current_product')->getData('cost'))
37
  ;
38
  }
39
 
lib/Converdo/Analytics/Trackers/Order.php CHANGED
@@ -14,6 +14,7 @@ class Converdo_Analytics_Trackers_Order extends Converdo_Analytics_Support_Abstr
14
  */
15
  public function responsible()
16
  {
 
17
  return Mage::helper('analytics')->isSuccessPage();
18
  }
19
 
14
  */
15
  public function responsible()
16
  {
17
+ return false;
18
  return Mage::helper('analytics')->isSuccessPage();
19
  }
20
 
lib/Converdo/Analytics/Trackers/SearchView.php CHANGED
@@ -12,7 +12,7 @@ class Converdo_Analytics_Trackers_SearchView extends Converdo_Analytics_Support_
12
  */
13
  public function responsible()
14
  {
15
- return Mage::app()->getFrontController()->getRequest()->getRouteName() == 'catalogsearch';
16
  }
17
 
18
  /**
12
  */
13
  public function responsible()
14
  {
15
+ return Mage::helper('analytics')->isSearchPage();
16
  }
17
 
18
  /**
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Converdo_Analytics</name>
4
- <version>2.0.0.0</version>
5
  <stability>stable</stability>
6
  <license>MITL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Better E-commerce Analytics. Clear, actionable insight in the behavior of your visitors. Improve your campaigns and conversion rate easily.</summary>
10
  <description>Better E-commerce Analytics. Clear, actionable insight in the behavior of your visitors. Improve your campaigns and conversion rate easily. This plugin, installed in a minute, is all you need to have a complete and powerfull Analytics Suite. View your KPI's and sales funnels, segmented on dozens of dimensions like page type, device, landing page, campaign, etc. This plugin collects your users behaviour so you can view the insights on your dashboard on converdo.com. You can use Converdo Analytics side by side with Google Analytics without a problem. It works asynchronous so it will never impact your user experience. This extension is made especially for Magento ecommerce stores, which provides you powerfull insights out of the box.</description>
11
- <notes>Rewrite</notes>
12
  <authors><author><name>Roeland van Oostenbrugge</name><user>converdo</user><email>roeland@converdo.nl</email></author></authors>
13
- <date>2017-02-13</date>
14
- <time>14:35:37</time>
15
- <contents><target name="magecommunity"><dir name="Converdo"><dir name="Analytics"><dir name="Block"><file name="Tracker.php" hash="d161b6c297bd69574efb0452a388be27"/></dir><dir name="Helper"><file name="Data.php" hash="c7437902716c6695e9794baea72c2c1b"/></dir><dir name="Model"><file name="Observer.php" hash="0b1e93efcb995705bda3c99a136f66ae"/></dir><dir name="controllers"><file name="PingController.php" hash="98437b8791e27b3ad1db915c805b5063"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9923bfe8c0f4aa318166e15cd373cf09"/><file name="config.xml" hash="cf9268f1181da64533af3fc72e51b575"/><file name="system.xml" hash="7f90adaa9874a50b30e7d65cb8eb173b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="analytics.xml" hash="d3f9d35df1981968a55a331c2b92d473"/></dir><dir name="template"><dir name="analytics"><file name="analytics.phtml" hash="59d017e5f7e71cc59a638a9dd2056a42"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Converdo_Analytics.xml" hash="119a038ca81bdf03767b1b12d81414ad"/></dir></target><target name="magelib"><dir name="Converdo"><dir name="Analytics"><dir name="Models"><file name="CategoryView.php" hash="4807abcd95dc03913f50d7a659af2ceb"/><file name="Configuration.php" hash="27c2b1af7cab96602b1ce16d78d3d26f"/><file name="EcommerceCartUpdate.php" hash="1b3bf769de5f89745850232737157e3a"/><file name="EcommerceOrder.php" hash="0fba70eb9260c602de6ac4ce6bab68b4"/><file name="EcommerceProduct.php" hash="f51778a075e4b37c169675db94f3692c"/><file name="EcommerceView.php" hash="1bfe9e0e2af54b89cd8c5bac7d152dd1"/><file name="PageView.php" hash="3ddba9f413ddd669f704c7a8bb9bdca2"/><file name="SearchView.php" hash="1af494ba379a47d9354de5a9cc1a8a1f"/></dir><dir name="Support"><file name="AbstractTracker.php" hash="a109cd7691e62ed66e268de9a4d2f4d5"/><file name="Arrayable.php" hash="6f4f522e26ff9c327f4ae764fb4bb4bf"/><file name="Crypt.php" hash="4eb80851c9d38113adbad86a6809bbcc"/><file name="HoldsAttributes.php" hash="0600d8c3d15c327e07de31679a79aa6c"/></dir><file name="Tracker.php" hash="0bb1a1e9a7590ca67ccc9ff8f62dbeda"/><dir name="Trackers"><file name="Cart.php" hash="f228c95dbe51ce569948fa594d196ab8"/><file name="CategoryView.php" hash="de918f7324f96b8ba67a2fe247b8168f"/><file name="Configuration.php" hash="c9fa8d249ebd86035e4b442bb4b9c5d9"/><file name="EcommerceView.php" hash="3906d42f13449afabb8ded4ca96b8f72"/><file name="Options.php" hash="7fb970c74dd4f1ee9373cd63136b67d4"/><file name="Order.php" hash="1b75a5fca9a6b60cd6cd68e46812c53c"/><file name="PageView.php" hash="18fa62007a9d19df3e176c0291fddedc"/><file name="SearchView.php" hash="de9b3f6caa9a5ab695e30a2fc9d6aa42"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Converdo_Magento.csv" hash=""/></dir><dir name="nl_NL"><file name="Converdo_Magento.csv" hash=""/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="converdoanalytics"><dir name="css"><file name="system_config_edit.css" hash="fd6f5337fd9a9b69b85079e17aa0e40b"/></dir><dir name="images"><file name="favicon.png" hash="674c9388eba1ea89e200fe6b1a62fc24"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="converdoanalytics.xml" hash="b949a1ad4594eeb82ae7138c60afc19e"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.5.37</min><max>7.0.5</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Converdo_Analytics</name>
4
+ <version>2.1.0.0</version>
5
  <stability>stable</stability>
6
  <license>MITL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Better E-commerce Analytics. Clear, actionable insight in the behavior of your visitors. Improve your campaigns and conversion rate easily.</summary>
10
  <description>Better E-commerce Analytics. Clear, actionable insight in the behavior of your visitors. Improve your campaigns and conversion rate easily. This plugin, installed in a minute, is all you need to have a complete and powerfull Analytics Suite. View your KPI's and sales funnels, segmented on dozens of dimensions like page type, device, landing page, campaign, etc. This plugin collects your users behaviour so you can view the insights on your dashboard on converdo.com. You can use Converdo Analytics side by side with Google Analytics without a problem. It works asynchronous so it will never impact your user experience. This extension is made especially for Magento ecommerce stores, which provides you powerfull insights out of the box.</description>
11
+ <notes>More reliable way to track orders and product metadata.</notes>
12
  <authors><author><name>Roeland van Oostenbrugge</name><user>converdo</user><email>roeland@converdo.nl</email></author></authors>
13
+ <date>2017-03-13</date>
14
+ <time>15:42:53</time>
15
+ <contents><target name="magecommunity"><dir name="Converdo"><dir name="Analytics"><dir name="Block"><file name="Tracker.php" hash="d161b6c297bd69574efb0452a388be27"/></dir><dir name="Helper"><file name="Data.php" hash="8d503153b0ac6a7e2e379c7594d4bce1"/></dir><dir name="Model"><file name="Logger.php" hash="a669303f59f6a6c10122e36186c29098"/><file name="Observer.php" hash="20fba145d19dc010dbac77830ddfe4ff"/></dir><dir name="controllers"><file name="PingController.php" hash="98437b8791e27b3ad1db915c805b5063"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9923bfe8c0f4aa318166e15cd373cf09"/><file name="config.xml" hash="b32ee34f1bffe8db352b01fe98255bae"/><file name="system.xml" hash="7f90adaa9874a50b30e7d65cb8eb173b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="analytics.xml" hash="d3f9d35df1981968a55a331c2b92d473"/></dir><dir name="template"><dir name="analytics"><file name="analytics.phtml" hash="59d017e5f7e71cc59a638a9dd2056a42"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Converdo_Analytics.xml" hash="119a038ca81bdf03767b1b12d81414ad"/></dir></target><target name="magelib"><dir name="Converdo"><dir name="Analytics"><dir name="API"><file name="ConverdoAPI.php" hash="8166a448775739c9fd74064876dbae39"/><file name="ConverdoClient.php" hash="b213e99759f3c74ce1829d7315ce3d03"/><dir name="Factories"><file name="Order.php" hash="461d0e0f02a3af4d01f2204e1bb2782a"/></dir><dir name="Models"><file name="Order.php" hash="34c21bda31b8903781a873954a641305"/></dir><dir name="Sections"><file name="ConverdoOrderAPI.php" hash="e19c13ce4ad709b242cfa5f6a8a286aa"/></dir></dir><dir name="Cookie"><file name="Manager.php" hash="a20e47d660dc48acda4183d7778bc79b"/><file name="Model.php" hash="511393f751b2bec27252d1122b84645b"/></dir><dir name="Models"><file name="CategoryView.php" hash="4807abcd95dc03913f50d7a659af2ceb"/><file name="Configuration.php" hash="27c2b1af7cab96602b1ce16d78d3d26f"/><file name="EcommerceCartUpdate.php" hash="1b3bf769de5f89745850232737157e3a"/><file name="EcommerceOrder.php" hash="0fba70eb9260c602de6ac4ce6bab68b4"/><file name="EcommerceProduct.php" hash="f51778a075e4b37c169675db94f3692c"/><file name="EcommerceView.php" hash="1e39c7fcb5586a2be37c460a25ff5e4a"/><file name="PageView.php" hash="3ddba9f413ddd669f704c7a8bb9bdca2"/><file name="SearchView.php" hash="1af494ba379a47d9354de5a9cc1a8a1f"/></dir><dir name="Support"><file name="AbstractTracker.php" hash="a109cd7691e62ed66e268de9a4d2f4d5"/><file name="Arrayable.php" hash="6f4f522e26ff9c327f4ae764fb4bb4bf"/><file name="Cookie.php" hash="db533e757e48b67a49fdf69adcf8afd3"/><file name="Crypt.php" hash="5b703e96f4173f4ebfe69286246ca916"/><file name="HoldsAttributes.php" hash="0600d8c3d15c327e07de31679a79aa6c"/></dir><file name="Tracker.php" hash="0bb1a1e9a7590ca67ccc9ff8f62dbeda"/><dir name="Trackers"><file name="Cart.php" hash="258ebc1d35e6cc51b56f39674625feeb"/><file name="CategoryView.php" hash="11b3c23dd27da3db5e62827d183475f7"/><file name="Configuration.php" hash="c9fa8d249ebd86035e4b442bb4b9c5d9"/><file name="EcommerceView.php" hash="a89624ac686af194e9b6dcd9484cd51c"/><file name="Options.php" hash="7fb970c74dd4f1ee9373cd63136b67d4"/><file name="Order.php" hash="c14db50faf80ffa3035ccf802dae65d1"/><file name="PageView.php" hash="18fa62007a9d19df3e176c0291fddedc"/><file name="SearchView.php" hash="fe1b6ae46a52e0464536b6187ef69595"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Converdo_Magento.csv" hash=""/></dir><dir name="nl_NL"><file name="Converdo_Magento.csv" hash=""/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="converdoanalytics"><dir name="css"><file name="system_config_edit.css" hash="fd6f5337fd9a9b69b85079e17aa0e40b"/></dir><dir name="images"><file name="favicon.png" hash="674c9388eba1ea89e200fe6b1a62fc24"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="converdoanalytics.xml" hash="b949a1ad4594eeb82ae7138c60afc19e"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.5.37</min><max>7.0.5</max></php></required></dependencies>
18
  </package>