Version Notes
Added automatic post-purchase review collection
Download this release
Release Info
Developer | Bastien Libersa |
Extension | monaviscompte_widget |
Version | 0.0.3 |
Comparing to | |
See all releases |
Code changes from version 0.0.2 to 0.0.3
- app/code/local/Monaviscompte/Widget/Block/Widget.php +7 -9
- app/code/local/Monaviscompte/Widget/Helper/Data.php +8 -4
- app/code/local/Monaviscompte/Widget/Model/Observer.php +33 -0
- app/code/local/Monaviscompte/Widget/etc/.DS_Store +0 -0
- app/code/local/Monaviscompte/Widget/etc/config.xml +38 -1
- app/code/local/Monaviscompte/Widget/etc/system.xml +48 -0
- app/code/local/Monaviscompte/Widget/etc/widget.xml +0 -14
- package.xml +9 -7
app/code/local/Monaviscompte/Widget/Block/Widget.php
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
<?php
|
2 |
class Monaviscompte_Widget_Block_Widget extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface {
|
3 |
-
/**
|
4 |
* Produce the HTML code of a widget
|
5 |
*
|
6 |
* @return string
|
7 |
*/
|
8 |
-
protected function _toHtml()
|
9 |
-
|
10 |
-
$
|
11 |
-
|
12 |
-
|
13 |
-
$accessKey = str_replace(' ', '', $accessKey);
|
14 |
-
|
15 |
return
|
16 |
'<div id="widget-' . $itemId .'">'
|
17 |
-
. '<script type="text/javascript" src="
|
18 |
. '</div>';
|
19 |
}
|
20 |
}
|
1 |
<?php
|
2 |
class Monaviscompte_Widget_Block_Widget extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface {
|
3 |
+
/**
|
4 |
* Produce the HTML code of a widget
|
5 |
*
|
6 |
* @return string
|
7 |
*/
|
8 |
+
protected function _toHtml()
|
9 |
+
{
|
10 |
+
$itemId = Mage::getStoreConfig('mac_widget/general/item_id');
|
11 |
+
$accessKey = Mage::getStoreConfig('mac_widget/general/access_key');
|
12 |
+
|
|
|
|
|
13 |
return
|
14 |
'<div id="widget-' . $itemId .'">'
|
15 |
+
. '<script type="text/javascript" src="https://www.monaviscompte.fr/widget?id=' . $itemId . '&public_key=' . $accessKey . '&div=widget-' . $itemId . '"></script>'
|
16 |
. '</div>';
|
17 |
}
|
18 |
}
|
app/code/local/Monaviscompte/Widget/Helper/Data.php
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
<?php
|
2 |
-
// app/code/local/Envato/WidgetLinks/Helper/Data.php
|
3 |
-
/**
|
4 |
-
* Sample Widget Helper
|
5 |
-
*/
|
6 |
class Monaviscompte_Widget_Helper_Data extends Mage_Core_Helper_Abstract
|
7 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
2 |
class Monaviscompte_Widget_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
{
|
4 |
+
public function getSettings()
|
5 |
+
{
|
6 |
+
$itemId = Mage::getStoreConfig('mac_widget/general/item_id');
|
7 |
+
$accessKey = Mage::getStoreConfig('mac_widget/general/access_key');
|
8 |
+
$apiKey = Mage::getStoreConfig('mac_widget/general/api_key');
|
9 |
+
|
10 |
+
return array('itemId' => $itemId, 'accessKey' => $accessKey, 'apiKey' => $apiKey);
|
11 |
+
}
|
12 |
}
|
app/code/local/Monaviscompte/Widget/Model/Observer.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Monaviscompte_Widget_Model_Observer
|
4 |
+
{
|
5 |
+
public function send_post_purchase_email($event) {
|
6 |
+
$order = new Mage_Sales_Model_Order();
|
7 |
+
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
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/");
|
23 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
24 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
25 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
26 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10000);
|
27 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 10000);
|
28 |
+
curl_setopt($curl, CURLOPT_POST, true);
|
29 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
30 |
+
curl_exec($curl);
|
31 |
+
curl_close($curl);
|
32 |
+
}
|
33 |
+
}
|
app/code/local/Monaviscompte/Widget/etc/.DS_Store
ADDED
Binary file
|
app/code/local/Monaviscompte/Widget/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Monaviscompte_Widget>
|
5 |
-
<version>0.0.
|
6 |
</Monaviscompte_Widget>
|
7 |
</modules>
|
8 |
<global>
|
@@ -11,10 +11,47 @@
|
|
11 |
<class>Monaviscompte_Widget_Helper</class>
|
12 |
</mac_widget>
|
13 |
</helpers>
|
|
|
|
|
|
|
|
|
|
|
14 |
<blocks>
|
15 |
<mac_widget>
|
16 |
<class>Monaviscompte_Widget_Block</class>
|
17 |
</mac_widget>
|
18 |
</blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Monaviscompte_Widget>
|
5 |
+
<version>0.0.2</version>
|
6 |
</Monaviscompte_Widget>
|
7 |
</modules>
|
8 |
<global>
|
11 |
<class>Monaviscompte_Widget_Helper</class>
|
12 |
</mac_widget>
|
13 |
</helpers>
|
14 |
+
<models>
|
15 |
+
<mac_widget>
|
16 |
+
<class>Monaviscompte_Widget_Model</class>
|
17 |
+
</mac_widget>
|
18 |
+
</models>
|
19 |
<blocks>
|
20 |
<mac_widget>
|
21 |
<class>Monaviscompte_Widget_Block</class>
|
22 |
</mac_widget>
|
23 |
</blocks>
|
24 |
+
<events>
|
25 |
+
<checkout_onepage_controller_success_action>
|
26 |
+
<observers>
|
27 |
+
<mac_observer>
|
28 |
+
<type>singleton</type>
|
29 |
+
<class>Monaviscompte_Widget_Model_Observer</class>
|
30 |
+
<method>send_post_purchase_email</method>
|
31 |
+
</mac_observer>
|
32 |
+
</observers>
|
33 |
+
</checkout_onepage_controller_success_action>
|
34 |
+
</events>
|
35 |
</global>
|
36 |
+
<adminhtml>
|
37 |
+
<acl>
|
38 |
+
<resources>
|
39 |
+
<admin>
|
40 |
+
<children>
|
41 |
+
<system>
|
42 |
+
<children>
|
43 |
+
<config>
|
44 |
+
<children>
|
45 |
+
<mac_widget>
|
46 |
+
<title>Configuration</title>
|
47 |
+
</mac_widget>
|
48 |
+
</children>
|
49 |
+
</config>
|
50 |
+
</children>
|
51 |
+
</system>
|
52 |
+
</children>
|
53 |
+
</admin>
|
54 |
+
</resources>
|
55 |
+
</acl>
|
56 |
+
</adminhtml>
|
57 |
</config>
|
app/code/local/Monaviscompte/Widget/etc/system.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<mac_widget translate="label" module="adminhtml">
|
5 |
+
<label>monaviscompte</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>900</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>0</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<general translate="label">
|
14 |
+
<label>Configuration</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>1</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>0</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<item_id translate="label">
|
22 |
+
<label>Identifiant de la fiche</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>0</show_in_store>
|
27 |
+
</item_id>
|
28 |
+
<access_key translate="label">
|
29 |
+
<label>Clé d'accès</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>0</show_in_store>
|
34 |
+
</access_key>
|
35 |
+
<api_key translate="label">
|
36 |
+
<label>Clé d'API</label>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<sort_order>3</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>0</show_in_store>
|
42 |
+
</api_key>
|
43 |
+
</fields>
|
44 |
+
</general>
|
45 |
+
</groups>
|
46 |
+
</mac_widget>
|
47 |
+
</sections>
|
48 |
+
</config>
|
app/code/local/Monaviscompte/Widget/etc/widget.xml
CHANGED
@@ -3,19 +3,5 @@
|
|
3 |
<mac_widget type="mac_widget/widget" translate="name description" module="mac_widget">
|
4 |
<name>monaviscompte widget</name>
|
5 |
<description>Allows to display the monaviscompte widget</description>
|
6 |
-
<parameters>
|
7 |
-
<item_id>
|
8 |
-
<label>Item identifier</label>
|
9 |
-
<visible>1</visible>
|
10 |
-
<required>1</required>
|
11 |
-
<type>text</type>
|
12 |
-
</item_id>
|
13 |
-
<access_key>
|
14 |
-
<label>Access key</label>
|
15 |
-
<visible>1</visible>
|
16 |
-
<required>1</required>
|
17 |
-
<type>text</type>
|
18 |
-
</access_key>
|
19 |
-
</parameters>
|
20 |
</mac_widget>
|
21 |
</widgets>
|
3 |
<mac_widget type="mac_widget/widget" translate="name description" module="mac_widget">
|
4 |
<name>monaviscompte widget</name>
|
5 |
<description>Allows to display the monaviscompte widget</description>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</mac_widget>
|
7 |
</widgets>
|
package.xml
CHANGED
@@ -1,22 +1,24 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>monaviscompte_widget</name>
|
4 |
-
<version>0.0.
|
5 |
<stability>devel</stability>
|
6 |
<license>AFL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Permet d’installer en quelques minutes une vignette de notation sur votre site pour assurer vos visiteurs</summary>
|
10 |
<description>Ce module permet d’installer en quelques minutes une vignette de notation (widget) sur votre site pour une collecte immédiate d’avis de vos clients. 
|
11 |
- Améliorez dès les premiers avis votre référencement sur les moteurs de recherche 
|
12 |
- Multipliez vos commandes grâce à la puissance des avis (+15% de ventes dès le premier avis) 
|
13 |
- Améliorez votre service et innovez grâce au contenu des avis 
|
14 |
-
- Affirmez votre culture client et différenciez vous de vos concurrents
|
15 |
-
|
|
|
|
|
16 |
<authors><author><name>Bastien Libersa</name><user>monaviscompte</user><email>support@monaviscompte.fr</email></author></authors>
|
17 |
-
<date>2016-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magelocal"><dir name="Monaviscompte"><dir name="Widget"><dir name="Block"><file name="Widget.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>monaviscompte_widget</name>
|
4 |
+
<version>0.0.3</version>
|
5 |
<stability>devel</stability>
|
6 |
<license>AFL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Permet d’installer en quelques minutes une vignette de notation sur votre site pour assurer vos visiteurs et d'envoyer automatiquement des emails de collecte d'avis post-achat</summary>
|
10 |
<description>Ce module permet d’installer en quelques minutes une vignette de notation (widget) sur votre site pour une collecte immédiate d’avis de vos clients. 
|
11 |
- Améliorez dès les premiers avis votre référencement sur les moteurs de recherche 
|
12 |
- Multipliez vos commandes grâce à la puissance des avis (+15% de ventes dès le premier avis) 
|
13 |
- Améliorez votre service et innovez grâce au contenu des avis 
|
14 |
+
- Affirmez votre culture client et différenciez vous de vos concurrents
|
15 |
+

|
16 |
+
Il permet é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-04-15</date>
|
20 |
+
<time>13:53:54</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="91c22fa29d6e39458757254cea9310fb"/><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></contents>
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
|
24 |
</package>
|