flowecommerce_resultadosdigitais - Version 0.1.3

Version Notes

Módulo de integração entre o magento e a plataforma RD Station da Resultados Digitais para criação e qualificação de leads.

Este módulo executa chamadas para a API do RDStation quando:

Um formulário de contato é enviado
Uma nova conta de cliente é criada
Um novo pedido é criado
Um cliente assina a newsletter da loja virtual

Download this release

Release Info

Developer Flow eCommerce
Extension flowecommerce_resultadosdigitais
Version 0.1.3
Comparing to
See all releases


Code changes from version 0.1.2 to 0.1.3

app/code/local/Flowecommerce/Resultadosdigitais/Model/Api.php CHANGED
@@ -18,7 +18,7 @@ class Flowecommerce_Resultadosdigitais_Model_Api
18
  'email' => $email,
19
  );
20
  $token = $this->_getHelper()->getPrivateToken();
21
- $url = API_URL_SERVICES . "{$token}/generic";
22
  $leadHttpClient = $this->_getHttpClient();
23
  $leadHttpClient
24
  ->resetParameters()
@@ -39,7 +39,6 @@ class Flowecommerce_Resultadosdigitais_Model_Api
39
  $data_query = http_build_query($data);
40
 
41
  # Refactor para utilizar zend_http_client
42
- # Lembrar de parâmetros que estavam sendo setados de maneira tosquíssima
43
  $leadHttpClient = $this->_getHttpClient();
44
  $leadHttpClient
45
  ->resetParameters()
18
  'email' => $email,
19
  );
20
  $token = $this->_getHelper()->getPrivateToken();
21
+ $url = self::API_URL_SERVICES . "{$token}/generic";
22
  $leadHttpClient = $this->_getHttpClient();
23
  $leadHttpClient
24
  ->resetParameters()
39
  $data_query = http_build_query($data);
40
 
41
  # Refactor para utilizar zend_http_client
 
42
  $leadHttpClient = $this->_getHttpClient();
43
  $leadHttpClient
44
  ->resetParameters()
app/code/local/Flowecommerce/Resultadosdigitais/Model/Observer.php CHANGED
@@ -117,6 +117,37 @@ class Flowecommerce_Resultadosdigitais_Model_Observer {
117
  }
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  $this->_getApi()->addLeadConversion(self::LEAD_ORDERPLACE, $data);
121
  $this->_getApi()->markSale($customer->getEmail(), $order_value);
122
  }
117
  }
118
  }
119
 
120
+ # Produtos
121
+ $i = 0;
122
+ /* @var Mage_Sales_Model_Order_Item $item */
123
+ $itemSkus = array();
124
+ $itemNames = array();
125
+ $categoryNames = array();
126
+ foreach($order->getItemsCollection() as $item) {
127
+ $i++;
128
+
129
+ /* @var Mage_Catalog_Model_Product $product */
130
+ $product = $item->getProduct();
131
+
132
+ $itemSkus[] = $item->getSku();
133
+ $itemNames[] = $item->getName();
134
+
135
+ # Categorias dos produtos
136
+ $j = 0;
137
+ /* @var Mage_Catalog_Model_Category $category */
138
+ foreach($product->getCategoryIds() as $categoryId) {
139
+ $j++;
140
+ $category = Mage::getModel('catalog/category')->load($categoryId);
141
+ $categoryNames[] = $category->getName();
142
+ }
143
+ }
144
+
145
+ $data->setData('produto_sku', implode(', ', $itemSkus));
146
+ $data->setData('produto_nome', implode(', ', $itemNames));
147
+ $data->setData('produto__categoria', implode(', ', $categoryNames));
148
+ $data->setData('metodo_pagamento', $order->getPayment()->getMethod());
149
+ $data->setData('metodo_entrega', $order->getShippingMethod());
150
+
151
  $this->_getApi()->addLeadConversion(self::LEAD_ORDERPLACE, $data);
152
  $this->_getApi()->markSale($customer->getEmail(), $order_value);
153
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>flowecommerce_resultadosdigitais</name>
4
- <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -24,9 +24,9 @@ Uma nova conta de cliente &#xE9; criada&#xD;
24
  Um novo pedido &#xE9; criado&#xD;
25
  Um cliente assina a newsletter da loja virtual</notes>
26
  <authors><author><name>Flow eCommerce</name><user>flowecommerce</user><email>contato@flowecommerce.com</email></author><author><name>Gabriel Queiroz Silva</name><user>gabrielqs</user><email>gabriel@flowecommerce.com</email></author></authors>
27
- <date>2014-12-08</date>
28
- <time>14:11:26</time>
29
- <contents><target name="magelocal"><dir name="Flowecommerce"><dir name="Resultadosdigitais"><dir name="Helper"><file name="Data.php" hash="00d2ae49825e162eb99dd72a98895a61"/></dir><dir name="Model"><file name="Api.php" hash="3d1f6c2f0406e79aa11245b46c9df874"/><dir name="Googleanalytics"><file name="Customvar.php" hash="d163ebb5bb590dd7553ed1356c033a2c"/><file name="Tracker.php" hash="be95e10bd1df9ca5319f5a50967f2eed"/><dir name="Utm"><file name="A.php" hash="7604206d87189c56f109231c4a95f00f"/><file name="B.php" hash="e710a66f3c061f4da69e9f468c2eaf5c"/><file name="C.php" hash="27c99ca82b05b11bcba01e88f9a3e5c6"/><file name="V.php" hash="9c77ced8175034ac42b89878e26844f5"/><file name="Z.php" hash="1bb0821f8752993b737a923fcbd4b314"/></dir></dir><file name="Observer.php" hash="3b502ffb66429c620b272d3e534ee6c7"/><file name="Requestdata.php" hash="d97634793fae544f18e5ffda617ed745"/></dir><dir name="etc"><file name="adminhtml.xml" hash="be9b06eed9df502e9759b5cd397f9fa2"/><file name="config.xml" hash="895bd2d9a76ff3bc31811dd2129c0b9f"/><file name="system.xml" hash="da64ea97bc98fe6f42988df79c2ace1f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Flowecommerce_Resultadosdigitais.xml" hash="5d476dea8a51bda77126fa637c5f29f2"/></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.3.0</min><max>5.6.3</max></php></required></dependencies>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>flowecommerce_resultadosdigitais</name>
4
+ <version>0.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
24
  Um novo pedido &#xE9; criado&#xD;
25
  Um cliente assina a newsletter da loja virtual</notes>
26
  <authors><author><name>Flow eCommerce</name><user>flowecommerce</user><email>contato@flowecommerce.com</email></author><author><name>Gabriel Queiroz Silva</name><user>gabrielqs</user><email>gabriel@flowecommerce.com</email></author></authors>
27
+ <date>2015-04-08</date>
28
+ <time>15:45:33</time>
29
+ <contents><target name="magelocal"><dir name="Flowecommerce"><dir name="Resultadosdigitais"><dir name="Helper"><file name="Data.php" hash="00d2ae49825e162eb99dd72a98895a61"/></dir><dir name="Model"><file name="Api.php" hash="e9657c111243ba10c79b32949f6f4d29"/><dir name="Googleanalytics"><file name="Customvar.php" hash="d163ebb5bb590dd7553ed1356c033a2c"/><file name="Tracker.php" hash="be95e10bd1df9ca5319f5a50967f2eed"/><dir name="Utm"><file name="A.php" hash="7604206d87189c56f109231c4a95f00f"/><file name="B.php" hash="e710a66f3c061f4da69e9f468c2eaf5c"/><file name="C.php" hash="27c99ca82b05b11bcba01e88f9a3e5c6"/><file name="V.php" hash="9c77ced8175034ac42b89878e26844f5"/><file name="Z.php" hash="1bb0821f8752993b737a923fcbd4b314"/></dir></dir><file name="Observer.php" hash="2db075f02eb68e24a73a7af8cfc96bf2"/><file name="Requestdata.php" hash="d97634793fae544f18e5ffda617ed745"/></dir><dir name="etc"><file name="adminhtml.xml" hash="be9b06eed9df502e9759b5cd397f9fa2"/><file name="config.xml" hash="895bd2d9a76ff3bc31811dd2129c0b9f"/><file name="system.xml" hash="da64ea97bc98fe6f42988df79c2ace1f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Flowecommerce_Resultadosdigitais.xml" hash="5d476dea8a51bda77126fa637c5f29f2"/></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.3.0</min><max>5.6.3</max></php></required></dependencies>
32
  </package>