monaviscompte_widget - Version 1.0.0

Version Notes

Added automatic review collection for cart items

Download this release

Release Info

Developer Bastien Libersa
Extension monaviscompte_widget
Version 1.0.0
Comparing to
See all releases


Code changes from version 0.0.4 to 1.0.0

app/code/local/Monaviscompte/Widget/Model/Observer.php CHANGED
@@ -8,15 +8,32 @@ class Monaviscompte_Widget_Model_Observer
8
  $order->loadByIncrementId($incrementId);
9
 
10
  $data = array();
11
- $data['item_id'] = Mage::getStoreConfig('mac_widget/general/item_id');
12
  $data['private_key'] = Mage::getStoreConfig('mac_widget/general/api_key');
13
- $data['order_id'] = $order->id;
14
  $data['source'] = 'magento';
15
  $data['recipient'] = $order->getCustomerEmail();
16
 
17
- if (!empty($customer->firstname)) {
18
  $data['first_name'] = $order->getCustomerName();
19
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  $curl = curl_init();
22
  curl_setopt($curl, CURLOPT_URL, "https://api.monaviscompte.fr/post-purchase/create/");
8
  $order->loadByIncrementId($incrementId);
9
 
10
  $data = array();
 
11
  $data['private_key'] = Mage::getStoreConfig('mac_widget/general/api_key');
12
+ $data['order_id'] = $order->getId();
13
  $data['source'] = 'magento';
14
  $data['recipient'] = $order->getCustomerEmail();
15
 
16
+ if (!empty($order->getCustomerName())) {
17
  $data['first_name'] = $order->getCustomerName();
18
  }
19
+
20
+ $serializedProducts = array();
21
+
22
+ $i = 0;
23
+ foreach($order->getAllVisibleItems() as $item) {
24
+ $productId = $item->getProductId();
25
+ $productObject = Mage::getModel('catalog/product');
26
+ $_product = $productObject->load($productId);
27
+ $serializedProducts['products'][$i] = array(
28
+ "id" => strval($productId),
29
+ "name" => $_product->getName(),
30
+ "summary" => $_product->getShortDescription(),
31
+ "picture" => $_product->getImageUrl()
32
+ );
33
+ $i++;
34
+ }
35
+
36
+ $data['cart'] = json_encode($serializedProducts);
37
 
38
  $curl = curl_init();
39
  curl_setopt($curl, CURLOPT_URL, "https://api.monaviscompte.fr/post-purchase/create/");
app/code/local/Monaviscompte/Widget/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Monaviscompte_Widget>
5
- <version>0.0.4</version>
6
  </Monaviscompte_Widget>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Monaviscompte_Widget>
5
+ <version>1.0.0</version>
6
  </Monaviscompte_Widget>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,8 +1,8 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>monaviscompte_widget</name>
4
- <version>0.0.4</version>
5
- <stability>devel</stability>
6
  <license>AFL</license>
7
  <channel>community</channel>
8
  <extends/>
@@ -14,11 +14,11 @@
14
  - Affirmez votre culture client et diff&#xE9;renciez vous de vos concurrents&#xD;
15
  &#xD;
16
  Il permet &#xE9;galement d'automatiser l'envoi de mails de collecte post-achat.</description>
17
- <notes>Added automatic post-purchase review collection</notes>
18
  <authors><author><name>Bastien Libersa</name><user>monaviscompte</user><email>support@monaviscompte.fr</email></author></authors>
19
- <date>2016-05-25</date>
20
- <time>15:31:31</time>
21
- <contents><target name="magelocal"><dir name="Monaviscompte"><dir name="Widget"><dir name="Block"><file name="Widget.php" hash="ca97bf17ed4650581260115be08f7868"/></dir><dir name="Helper"><file name="Data.php" hash="49b54fecf098b9154698b092c7f2af5c"/></dir><dir name="Model"><file name="Observer.php" hash="63e39091680956a9daf83a3e43a81af6"/></dir><dir name="etc"><file name="config.xml" hash="356278bfb847d617ebe8a19f05f76082"/><file name="system.xml" hash="1858e0e1897ae13023c677f4f66477ba"/><file name="widget.xml" hash="67ebcbd3a199e104bd500b710c76317c"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Monaviscompte_Widget.xml" hash="c6ffb10b5a1aaf4e26cb8daa8b34ffaf"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>monaviscompte_widget</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
  <license>AFL</license>
7
  <channel>community</channel>
8
  <extends/>
14
  - Affirmez votre culture client et diff&#xE9;renciez vous de vos concurrents&#xD;
15
  &#xD;
16
  Il permet &#xE9;galement d'automatiser l'envoi de mails de collecte post-achat.</description>
17
+ <notes>Added automatic review collection for cart items</notes>
18
  <authors><author><name>Bastien Libersa</name><user>monaviscompte</user><email>support@monaviscompte.fr</email></author></authors>
19
+ <date>2016-06-08</date>
20
+ <time>13:55:52</time>
21
+ <contents><target name="magelocal"><dir name="Monaviscompte"><dir name="Widget"><dir name="Block"><file name="Widget.php" hash="ca97bf17ed4650581260115be08f7868"/></dir><dir name="Helper"><file name="Data.php" hash="49b54fecf098b9154698b092c7f2af5c"/></dir><dir name="Model"><file name="Observer.php" hash="aaf46ae145e8a18218265e626a15d7f9"/></dir><dir name="etc"><file name="config.xml" hash="d546caa0ebe2869fbc4530660e76bc3c"/><file name="system.xml" hash="1858e0e1897ae13023c677f4f66477ba"/><file name="widget.xml" hash="67ebcbd3a199e104bd500b710c76317c"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Monaviscompte_Widget.xml" hash="c6ffb10b5a1aaf4e26cb8daa8b34ffaf"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
24
  </package>