Buscape_Ebit - Version 0.1.0

Version Notes

Buscapé e-bit é compatível com Magento Enterprise Edition 1.7.0.0 ou superior, Professional Edition 1.9.0.0 ou superior, e Magento Community Edition 1.3.3.0 ou superior.

Download this release

Release Info

Developer Magento Core Team
Extension Buscape_Ebit
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Buscape/Ebit/Block/Checkout/Success.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
+ *
15
+ * @category Buscape
16
+ * @package Buscape_Ebit
17
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Buscape_Ebit_Block_Checkout_Success extends Mage_Core_Block_Text
22
+ {
23
+ protected function _toHtml()
24
+ {
25
+ if (!Mage::helper('ebit')->isAvailable()) {
26
+ return '';
27
+ }
28
+
29
+ return '
30
+ <!-- BEGIN EBIT CODE -->
31
+ <form name="formebit" method="get" target="_blank" action="' . $this->getUrlAction() . '">
32
+ <input type="hidden" name="empresa" value="' . $this->getAccount() . '" />
33
+ <input type="image" border="0" name="banner" src="' . $this->getSrc() . '" alt="O que você achou desta loja?" width="468" height="60" />
34
+ </form>
35
+ <!-- END EBIT CODE -->';
36
+ }
37
+ }
app/code/community/Buscape/Ebit/Block/Template/Seal.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
+ *
15
+ * @category Buscape
16
+ * @package Buscape_Ebit
17
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Buscape_Ebit_Block_Template_Seal extends Mage_Core_Block_Template
22
+ {
23
+
24
+ protected function _getConfig()
25
+ {
26
+ return Mage::getModel('ebit/config');
27
+ }
28
+
29
+ protected function _toHtml()
30
+ {
31
+ if (!Mage::helper('ebit')->isSealAvailable()) {
32
+ return '';
33
+ }
34
+
35
+ return '
36
+ <!-- BEGIN EBIT SEAL CODE -->
37
+ <a id="seloEbit" style="float: right;" href="http://www.ebit.com.br/#' . $this->_getConfig()->getStore() . '" target="_blank" onclick="redir(this.href);">Avaliação de Lojas e-bit</a>
38
+ <script type="text/javascript" id="getSelo" src="https://a248.e.akamai.net/f/248/52872/0s/img.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js?' . $this->_getConfig()->getAccount() . '"></script>
39
+ <!-- END EBIT SEAL CODE -->';
40
+ }
41
+ }
app/code/community/Buscape/Ebit/Helper/Data.php ADDED
@@ -0,0 +1,34 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
+ *
15
+ * @category Buscape
16
+ * @package Buscape_Ebit
17
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Buscape_Ebit_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+ public function isAvailable($store = null)
24
+ {
25
+ $accountId = Mage::getStoreConfig(Buscape_Ebit_Model_Config::XML_PATH_ACCOUNT, $store);
26
+ return $accountId && Mage::getStoreConfigFlag(Buscape_Ebit_Model_Config::XML_PATH_ACTIVE, $store);
27
+ }
28
+
29
+ public function isSealAvailable($store = null)
30
+ {
31
+ $accountId = Mage::getStoreConfig(Buscape_Ebit_Model_Config::XML_PATH_STORE_NAME, $store);
32
+ return $accountId && Mage::getStoreConfigFlag(Buscape_Ebit_Model_Config::XML_PATH_ACTIVE, $store);
33
+ }
34
+ }
app/code/community/Buscape/Ebit/Model/Config.php ADDED
@@ -0,0 +1,81 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
+ *
15
+ * @category Buscape
16
+ * @package Buscape_Ebit
17
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Buscape_Ebit_Model_Config extends Varien_Object
22
+ {
23
+ const XML_PATH = 'sales/ebit/';
24
+
25
+ const XML_PATH_ACTIVE = 'sales/ebit/active';
26
+
27
+ const XML_PATH_ACCOUNT = 'sales/ebit/account';
28
+
29
+ const XML_PATH_STORE_NAME = 'sales/ebit/store';
30
+
31
+ protected $_urlAction = "https://www.ebitempresa.com.br/bitrate/pesquisa1.asp";
32
+
33
+ protected $_srcAction = "https://www.ebitempresa.com.br/bitrate/banners/b%s.gif";
34
+
35
+ protected $_config = array();
36
+
37
+ public function getConfigData($key, $storeId = null)
38
+ {
39
+ if (!isset($this->_config[$key][$storeId])) {
40
+ $value = Mage::getStoreConfig(self::XML_PATH . $key, $storeId);
41
+ $this->_config[$key][$storeId] = $value;
42
+ }
43
+ return $this->_config[$key][$storeId];
44
+ }
45
+
46
+ public function getAccount($store = null)
47
+ {
48
+ if (!$this->hasData('ebit_account')) {
49
+ $this->setData('ebit_account', $this->getConfigData('account', $store));
50
+ }
51
+
52
+ return $this->getData('ebit_account');
53
+ }
54
+
55
+ public function getStore($store = null)
56
+ {
57
+ if (!$this->hasData('ebit_store')) {
58
+ $this->setData('ebit_store', $this->getConfigData('store', $store));
59
+ }
60
+
61
+ return $this->getData('ebit_store');
62
+ }
63
+
64
+ public function getUrlAction()
65
+ {
66
+ if (!$this->hasData('ebit_url_action')) {
67
+ $this->setData('ebit_url_action', $this->_urlAction);
68
+ }
69
+
70
+ return $this->getData('ebit_url_action');
71
+ }
72
+
73
+ public function getSrc()
74
+ {
75
+ if (!$this->hasData('ebit_src')) {
76
+ $this->setData('ebit_src', sprintf($this->_srcAction, '1' . $this->getAccount() . '5'));
77
+ }
78
+
79
+ return $this->getData('ebit_src');
80
+ }
81
+ }
app/code/community/Buscape/Ebit/Model/Observer.php ADDED
@@ -0,0 +1,66 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
14
+ *
15
+ * @category Buscape
16
+ * @package Buscape_Ebit
17
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Buscape_Ebit_Model_Observer
22
+ {
23
+
24
+ const BLOCK_CHECKOUT_SUCCESS = 'Buscape_Ebit_Block_Checkout_Success';
25
+
26
+ protected function _getOnepage()
27
+ {
28
+ return Mage::getSingleton('checkout/type_onepage');
29
+ }
30
+
31
+ private function getConfig()
32
+ {
33
+ return Mage::getModel('ebit/config');
34
+ }
35
+
36
+ public function setEbitSuccessPageView(Varien_Event_Observer $observer)
37
+ {
38
+
39
+ $lastOrderId = $this->_getOnepage()->getCheckout()->getLastOrderId();
40
+
41
+ $block = Mage::app()->getFrontController()->getAction()->getLayout()->createBlock(
42
+ self::BLOCK_CHECKOUT_SUCCESS,
43
+ 'ebit_checkout_success',
44
+ array(
45
+ 'as' => 'ebit_checkout_success'
46
+ )
47
+ );
48
+
49
+ $content = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('content');
50
+
51
+ if($content) {
52
+
53
+ $block->setOrderIds($lastOrderId);
54
+
55
+ $block->setUrlAction($this->getConfig()->getUrlAction());
56
+
57
+ $block->setSrc($this->getConfig()->getSrc());
58
+
59
+ $block->setAccount($this->getConfig()->getAccount());
60
+
61
+ //$content->insert($block); before
62
+
63
+ $content->append($block); // after
64
+ }
65
+ }
66
+ }
app/code/community/Buscape/Ebit/etc/config.xml ADDED
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
15
+ *
16
+ * @category Buscape
17
+ * @package Buscape_Ebit
18
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Buscape_Ebit>
25
+ <version>0.1.0</version>
26
+ </Buscape_Ebit>
27
+ </modules>
28
+ <global>
29
+ <models>
30
+ <ebit>
31
+ <class>Buscape_Ebit_Model</class>
32
+ </ebit>
33
+ </models>
34
+ <blocks>
35
+ <ebit>
36
+ <class>Buscape_Ebit_Block</class>
37
+ </ebit>
38
+ </blocks>
39
+ <helpers>
40
+ <ebit>
41
+ <class>Buscape_Ebit_Helper</class>
42
+ </ebit>
43
+ </helpers>
44
+ </global>
45
+ <frontend>
46
+ <events>
47
+ <checkout_onepage_controller_success_action>
48
+ <observers>
49
+ <ebit_checkout_success>
50
+ <class>ebit/observer</class>
51
+ <method>setEbitSuccessPageView</method>
52
+ </ebit_checkout_success>
53
+ </observers>
54
+ </checkout_onepage_controller_success_action>
55
+ <checkout_multishipping_controller_success_action>
56
+ <observers>
57
+ <ebit_checkout_success>
58
+ <class>ebit/observer</class>
59
+ <method>setEbitSuccessPageView</method>
60
+ </ebit_checkout_success>
61
+ </observers>
62
+ </checkout_multishipping_controller_success_action>
63
+ </events>
64
+ <layout>
65
+ <updates>
66
+ <ebit>
67
+ <file>buscape_ebit.xml</file>
68
+ </ebit>
69
+ </updates>
70
+ </layout>
71
+ </frontend>
72
+ </config>
app/code/community/Buscape/Ebit/etc/system.xml ADDED
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
15
+ *
16
+ * @category Buscape
17
+ * @package Buscape_Ebit
18
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <sections>
24
+ <sales translate="label" module="ebit">
25
+ <groups>
26
+ <ebit translate="label">
27
+ <label>BuscaPé e-bit</label>
28
+ <sort_order>0</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <comment>
33
+ <![CDATA[
34
+ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
35
+ Este módulo foi desenvolvido pelo <a href="http://developer.buscape.com" target="_blank">BuscaPé Developer</a>.
36
+ Por favor reportar bugs para <a href="mailto:suporte.developer@buscape-inc.com">suporte.developer@buscape-inc.com</a>.
37
+ </div>
38
+ ]]>
39
+ </comment>
40
+ <fields>
41
+ <active translate="label">
42
+ <label>Enable</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <sort_order>1</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>0</show_in_store>
49
+ </active>
50
+ <account translate="label">
51
+ <label>Código da Loja na e-bit</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>67</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ </account>
58
+ <store translate="label">
59
+ <label>Nome da Loja na e-bit</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>67</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ <comment><![CDATA[Para saber o nome da loja na e-bit, basta digitar WWW.ebit.com.br/nome <b>de fantasia da loja</b>. Caso o nome seja composto, separar por "–". Ex.: WWW.ebit.com.br/universidade-buscape]]></comment>
66
+ </store>
67
+ </fields>
68
+ </ebit>
69
+ </groups>
70
+ </sales>
71
+ </sections>
72
+ </config>
app/design/frontend/base/default/layout/buscape_ebit.xml ADDED
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
15
+ *
16
+ * @category Buscape
17
+ * @package Buscape_Ebit
18
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <layout version="0.1.0">
23
+ <default>
24
+ <reference name="footer">
25
+ <block type="ebit/template_seal" name="selo_ebit" as="selo_ebit" before="-" />
26
+ </reference>
27
+ </default>
28
+ </layout>
app/etc/modules/Buscape_Ebit.xml ADDED
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to suporte.developer@buscape-inc.com so we can send you a copy immediately.
15
+ *
16
+ * @category Buscape
17
+ * @package Buscape_Ebit
18
+ * @copyright Copyright (c) 2010 Buscapé Company (http://www.buscapecompany.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Buscape_Ebit>
25
+ <active>true</active>
26
+ <codePool>community</codePool>
27
+ </Buscape_Ebit>
28
+ </modules>
29
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Buscape_Ebit</name>
4
+ <version>0.1.0</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>
8
+ <extends/>
9
+ <summary>Extens&#xE3;o Buscap&#xE9; e-bit para Magento</summary>
10
+ <description>A e-bit possui um sistema de avalia&#xE7;&#xE3;o que re&#xFA;ne informa&#xE7;&#xF5;es sobre com&#xE9;rcio eletr&#xF4;nico coletadas junto a consumidores ap&#xF3;s realizarem compras em aproximadamente 2.000 lojas virtuais.</description>
11
+ <notes>Buscap&#xE9; e-bit &#xE9; compat&#xED;vel com Magento Enterprise Edition 1.7.0.0 ou superior, Professional Edition 1.9.0.0 ou superior, e Magento Community Edition 1.3.3.0 ou superior.</notes>
12
+ <authors><author><name>Adriano Aguiar</name><user>auto-converted</user><email>adrianoaguiaralves@gmail.com</email></author></authors>
13
+ <date>2011-11-29</date>
14
+ <time>16:18:42</time>
15
+ <contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="buscape_ebit.xml" hash="7224da03520512e1aa9229f6154249bb"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Buscape_Ebit.xml" hash="3a4f1faefee4fd109d6f9512527b7eb3"/></dir></target><target name="magecommunity"><dir name="Buscape"><dir name="Ebit"><dir name="Block"><dir name="Checkout"><file name="Success.php" hash="bfa41306d3929b5a916dd0c62969a74a"/></dir><dir name="Template"><file name="Seal.php" hash="42af8d09437a3c643e8638563af5529a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="df31daa2f2dcf4139787c3c61664bb85"/></dir><dir name="Model"><file name="Config.php" hash="8f7ca12dc1d3453622fab3471a1d6e6c"/><file name="Observer.php" hash="97db11e2e3a123f0c8691be1c4f0de70"/></dir><dir name="etc"><file name="config.xml" hash="b2edec65a5bf7ffa0e5e4b439b03f9c2"/><file name="system.xml" hash="4e85e53d3f94d1c22a99bab856edd004"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>