Version Notes
* PHPCS and PHPMD checks
* Compatibility of Magento CE 1.7
* Compatibility of Magento EE 1.12
Download this release
Release Info
Developer | Jan Riethmayer |
Extension | Bonusbox_Bonusbox1 |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.5
- app/code/community/Bonusbox/Bonusbox/Block/Checkout/Success.php +74 -27
- app/code/community/Bonusbox/Bonusbox/Exception.php +39 -5
- app/code/community/Bonusbox/Bonusbox/Helper/Data.php +234 -170
- app/code/community/Bonusbox/Bonusbox/Helper/Successpage.php +83 -32
- app/code/community/Bonusbox/Bonusbox/Model/Client.php +235 -169
- app/code/community/Bonusbox/Bonusbox/Model/Client/Badges.php +56 -13
- app/code/community/Bonusbox/Bonusbox/Model/Client/Coupons.php +70 -27
- app/code/community/Bonusbox/Bonusbox/Model/Client/Successpages.php +166 -111
- app/code/community/Bonusbox/Bonusbox/Model/Sales/Observer.php +67 -34
- app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Condition/Bonusbox.php +145 -87
- app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Rule/Condition/Combine.php +87 -0
- app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Validator.php +135 -91
- app/code/community/Bonusbox/Bonusbox/Model/Session.php +74 -23
- app/code/community/Bonusbox/Bonusbox/controllers/TestController.php +62 -16
- app/code/community/Bonusbox/Bonusbox/etc/adminhtml.xml +63 -0
- app/code/community/Bonusbox/Bonusbox/etc/config.xml +141 -142
- app/code/community/Bonusbox/Bonusbox/etc/system.xml +111 -87
- app/design/frontend/base/default/layout/bonusbox.xml +38 -0
- app/design/frontend/base/default/template/bonusbox/checkout/success.phtml +31 -0
- app/design/frontend/default/default/layout/bonusbox.xml +0 -14
- app/design/frontend/default/default/template/bonusbox/checkout/success.phtml +0 -1
- app/etc/modules/Bonusbox_Bonusbox.xml +33 -6
- app/locale/de_DE/bonusbox_admin.csv +1 -0
- package.xml +22 -7
- skin/frontend/default/default/css/bonusbox.css +35 -0
app/code/community/Bonusbox/Bonusbox/Block/Checkout/Success.php
CHANGED
@@ -1,28 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Block to render iFrame.
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Block_Checkout_Success extends Mage_Core_Block_Template
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Default block template.
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $_template = 'bonusbox/checkout/success.phtml';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Checks if a bonusbox success url exits. After rendering the url is removed
|
48 |
+
* from the session. Otherwise nothing is rendered.
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
protected function _toHtml()
|
53 |
+
{
|
54 |
+
$html = '';
|
55 |
+
|
56 |
+
if ($this->getSuccessPageUrl()) {
|
57 |
+
$html = parent::_toHtml();
|
58 |
+
Mage::helper('bonusbox')->getSession()->setSuccessPage(null);
|
59 |
+
}
|
60 |
+
|
61 |
+
return $html;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Retrieves the bonusbox success url from the session.
|
66 |
+
*
|
67 |
+
* @return string|null
|
68 |
+
*/
|
69 |
+
public function getSuccessPageUrl()
|
70 |
+
{
|
71 |
+
$successPage = Mage::helper('bonusbox')->getSession()->getSuccessPage();
|
72 |
+
|
73 |
+
return isset($successPage['url']) ? $successPage['url'] : null;
|
74 |
+
}
|
75 |
}
|
app/code/community/Bonusbox/Bonusbox/Exception.php
CHANGED
@@ -1,5 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Bonusbox module exception class
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Exception extends Zend_Exception
|
38 |
+
{
|
39 |
+
}
|
app/code/community/Bonusbox/Bonusbox/Helper/Data.php
CHANGED
@@ -1,171 +1,235 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Default module helper class.
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Helper_Data extends Mage_Core_Helper_Data
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Part of config XML node.
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $_configCode = 'bonusbox';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Part of config XML node.
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
protected $_configSection = 'general';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Convinience method for access to config data.
|
55 |
+
*
|
56 |
+
* @param string $field Config XML node
|
57 |
+
* @param int $storeId Store ID
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function getConfig($field, $storeId = null)
|
62 |
+
{
|
63 |
+
return Mage::getStoreConfig($this->_configCode . '/' . $this->_configSection . '/' . $field, $storeId);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Check if it is enabled.
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function isEnabled()
|
72 |
+
{
|
73 |
+
return $this->getConfig('enabled');
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Check if in live mode.
|
78 |
+
*
|
79 |
+
* @return bool
|
80 |
+
*/
|
81 |
+
public function isLive()
|
82 |
+
{
|
83 |
+
return $this->getConfig('live');
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Checks if module is enabled and if keys are provided.
|
88 |
+
*
|
89 |
+
* @return bool
|
90 |
+
*/
|
91 |
+
public function isOperational()
|
92 |
+
{
|
93 |
+
return $this->isEnabled() && $this->getKey('public') && $this->getKey('secret');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Returns the key for the selected live mode (live|test) and the given param
|
98 |
+
* (public|secret).
|
99 |
+
*
|
100 |
+
* @param bool $secret Flag indicating secret or public type
|
101 |
+
* @param int $storeId Store ID
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function getKey($secret, $storeId = null)
|
106 |
+
{
|
107 |
+
$mode = $this->isLive() ? 'live' : 'test';
|
108 |
+
$type = $secret ? 'secret' : 'public';
|
109 |
+
return $this->getConfig($mode . '_' . $type . '_key', $storeId);
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* If live mode is enabled an email is sent to the configured debug mail
|
114 |
+
* address (see config.xml). In test mode an excption is thrown.
|
115 |
+
*
|
116 |
+
* @param string|Exception $message Message/Exception to log
|
117 |
+
*
|
118 |
+
* @return void
|
119 |
+
* @throws Bonusbox_Bonusbox_Exception
|
120 |
+
*/
|
121 |
+
public function handleError($message)
|
122 |
+
{
|
123 |
+
if ($this->isLive()) {
|
124 |
+
Mage::log((string) $message);
|
125 |
+
try {
|
126 |
+
$mail = new Zend_Mail('utf-8');
|
127 |
+
$mail
|
128 |
+
->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'))
|
129 |
+
->addTo($this->getConfig('debug_email'))
|
130 |
+
->setSubject('Bonusbox Magento Error')
|
131 |
+
->setBodyText((string) $message)
|
132 |
+
->send();
|
133 |
+
} catch (Exception $ex) {
|
134 |
+
Mage::logException($ex);
|
135 |
+
}
|
136 |
+
} else {
|
137 |
+
Mage::log('TEST ' . (string) $message);
|
138 |
+
if ($message instanceof Exception) {
|
139 |
+
throw $message;
|
140 |
+
} else {
|
141 |
+
require_once 'Bonusbox/Bonusbox/Exception.php';
|
142 |
+
throw new Bonusbox_Bonusbox_Exception($message);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Retrieves an options array with the id, title (incl. the benefit).
|
149 |
+
* The Badges are cached in the session.
|
150 |
+
*
|
151 |
+
* @return array
|
152 |
+
*
|
153 |
+
* @todo refactor and extract to badge helper class
|
154 |
+
*/
|
155 |
+
public function getBadgeOptions()
|
156 |
+
{
|
157 |
+
$session = Mage::getSingleton('bonusbox/session');
|
158 |
+
if (!$session->getData('badge_options')) {
|
159 |
+
$secret = true;
|
160 |
+
foreach (Mage::app()->getGroups() as $storeGroup) {
|
161 |
+
$apiKey = $this->getKey($secret, $storeGroup->getDefaultStoreId());
|
162 |
+
$storeGroups[$apiKey] = $storeGroup;
|
163 |
+
}
|
164 |
+
|
165 |
+
$client = Mage::getModel('bonusbox/client_badges');
|
166 |
+
foreach ($storeGroups as $storeGroup) {
|
167 |
+
$badges = $client->setStoreId($storeGroup->getDefaultStoreId())->get();
|
168 |
+
foreach ($badges as $badge) {
|
169 |
+
$badge = $badge['badge'];
|
170 |
+
$label = $badge['title'];
|
171 |
+
if ($badge['benefit']) {
|
172 |
+
$label = sprintf('%s (%s)', $label, $badge['benefit']);
|
173 |
+
}
|
174 |
+
if (count($storeGroups) > 1) {
|
175 |
+
$label = sprintf('%s - %s', $storeGroup->getName(), $label);
|
176 |
+
}
|
177 |
+
$badgeOptions[] = array('value' => $badge['id'], 'label' => $label);
|
178 |
+
}
|
179 |
+
}
|
180 |
+
$session->setData('badge_options', $badgeOptions);
|
181 |
+
}
|
182 |
+
return $session->getData('badge_options');
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Checks if coupon code is a valid bonusbox code.
|
187 |
+
*
|
188 |
+
* @param string $couponCode Coupon code
|
189 |
+
*
|
190 |
+
* @return bool
|
191 |
+
*/
|
192 |
+
public function isValidBonusboxCouponCode($couponCode)
|
193 |
+
{
|
194 |
+
$request = new Varien_Object();
|
195 |
+
$request->setCouponCode($couponCode);
|
196 |
+
return $this->getCustomerBadge($request) !== null;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Retrieves the badge id for a given coupon code.
|
201 |
+
* The response is cached in the session.
|
202 |
+
*
|
203 |
+
* @param Varien_Object $request Generic data object.
|
204 |
+
*
|
205 |
+
* @return int|void
|
206 |
+
* @todo extract to badge helper class
|
207 |
+
*/
|
208 |
+
public function getCustomerBadge(Varien_Object $request)
|
209 |
+
{
|
210 |
+
$couponCode = $request->getCouponCode();
|
211 |
+
if ($couponCode) {
|
212 |
+
$session = $this->getSession();
|
213 |
+
if (!$session->getCustomerBadgeByCoupon($couponCode)) {
|
214 |
+
$response = Mage::getModel('bonusbox/client_coupons')->get($couponCode);
|
215 |
+
$badge = isset($response['coupon']['user']['badge']['id']) ?
|
216 |
+
$response['coupon']['user']['badge']['id'] :
|
217 |
+
null;
|
218 |
+
|
219 |
+
$session->setCustomerBadgeByCoupon($couponCode, $badge);
|
220 |
+
}
|
221 |
+
return $session->getCustomerBadgeByCoupon($couponCode);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Public accessor to bonusbox session.
|
227 |
+
*
|
228 |
+
* @return Bonusbox_Bonusbox_Model_Session
|
229 |
+
*/
|
230 |
+
public function getSession()
|
231 |
+
{
|
232 |
+
return Mage::getSingleton('bonusbox/session');
|
233 |
+
}
|
234 |
+
|
235 |
}
|
app/code/community/Bonusbox/Bonusbox/Helper/Successpage.php
CHANGED
@@ -1,33 +1,84 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Module helper class for checkout success view.
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Helper_Successpage extends Bonusbox_Bonusbox_Helper_Data
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Part of config XML node.
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $_configSection = 'success_page';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Checks if module is enabled and if keys are provided.
|
48 |
+
*
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
public function isOperational()
|
52 |
+
{
|
53 |
+
return Mage::helper('bonusbox')->isOperational();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Generates CSS URL
|
58 |
+
*
|
59 |
+
* @param bool $appendTimestamp Flag to append a timestamp to CSS resource
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getCssUrl($appendTimestamp = true)
|
64 |
+
{
|
65 |
+
$url = Mage::getDesign()->getSkinUrl($this->getConfig('style_url'), array());
|
66 |
+
if ($appendTimestamp) {
|
67 |
+
$filename = $this->getCssFile();
|
68 |
+
if (file_exists($filename)) {
|
69 |
+
$url .= '?' . filemtime($filename);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
return $url;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Gets CSS file name
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public function getCssFile()
|
81 |
+
{
|
82 |
+
return Mage::getDesign()->getFilename($this->getConfig('style_url'), array('_type' => 'skin'));
|
83 |
+
}
|
84 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/Client.php
CHANGED
@@ -1,170 +1,236 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Basic client to access API
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_Client extends Zend_Http_Client
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Some constants for initializing client
|
41 |
+
*/
|
42 |
+
const CONTENT_TYPE = 'application/json';
|
43 |
+
const METHOD_POST = 'POST',
|
44 |
+
METHOD_PUT = 'PUT',
|
45 |
+
METHOD_GET = 'GET',
|
46 |
+
METHOD_DELETE = 'DELETE';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Name of requested resource -> is set by sub classes
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_resourceName;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* determines store and which config data will be used
|
57 |
+
*
|
58 |
+
* @var int
|
59 |
+
* @TODO resolve with config object
|
60 |
+
*/
|
61 |
+
protected $_storeId;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* object is created with empty array by magento -> if constructor is invoked
|
65 |
+
* with empty array, it requires to contain a valid url
|
66 |
+
*/
|
67 |
+
public function __construct()
|
68 |
+
{
|
69 |
+
parent::__construct();
|
70 |
+
$adapter = new Zend_Http_Client_Adapter_Curl();
|
71 |
+
$this->setAdapter($adapter);
|
72 |
+
$adapter->setConfig(
|
73 |
+
array(
|
74 |
+
'curloptions' => array(
|
75 |
+
CURLOPT_SSL_VERIFYPEER => 0,
|
76 |
+
CURLOPT_SSL_VERIFYHOST => 0
|
77 |
+
)
|
78 |
+
)
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Initialize request
|
84 |
+
*
|
85 |
+
* @param bool $useSecretKey Flag indicates using secret key or not
|
86 |
+
*
|
87 |
+
* @return Bonusbox_Bonusbox_Model_Client
|
88 |
+
*/
|
89 |
+
public function init($useSecretKey = true)
|
90 |
+
{
|
91 |
+
$helper = Mage::helper('bonusbox');
|
92 |
+
$this->resetParameters(true)
|
93 |
+
->setUri($helper->getConfig('url') . $this->_resourceName)
|
94 |
+
->setHeaders('Accept', $helper->getConfig('accept_header'))
|
95 |
+
->setHeaders('Content-Type', self::CONTENT_TYPE)
|
96 |
+
// to collect all badges with multiple shops, request has ti be
|
97 |
+
// executed with different store context
|
98 |
+
->setAuth(trim($helper->getKey($useSecretKey, $this->getStoreId())))
|
99 |
+
->setRawData(null);
|
100 |
+
|
101 |
+
return $this;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Getting store ID
|
106 |
+
*
|
107 |
+
* @return int
|
108 |
+
*/
|
109 |
+
public function getStoreId()
|
110 |
+
{
|
111 |
+
return $this->_storeId;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Setting store ID
|
116 |
+
*
|
117 |
+
* @param int $value Store ID
|
118 |
+
*
|
119 |
+
* @return Bonusbox_Bonusbox_Model_Client
|
120 |
+
*/
|
121 |
+
public function setStoreId($value)
|
122 |
+
{
|
123 |
+
$this->_storeId = $value;
|
124 |
+
return $this;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Encodes data to json format
|
129 |
+
*
|
130 |
+
* @param mixed $body Content to encode
|
131 |
+
*
|
132 |
+
* @return string
|
133 |
+
*/
|
134 |
+
public function encodeData($body)
|
135 |
+
{
|
136 |
+
return json_encode($body);
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Decodes data from json format
|
141 |
+
*
|
142 |
+
* @param mixed $body Content to decode
|
143 |
+
*
|
144 |
+
* @return mixed
|
145 |
+
*/
|
146 |
+
public function decodeData($body)
|
147 |
+
{
|
148 |
+
return json_decode($body, true);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Formats decimal values to int by multiplying and rounding
|
153 |
+
*
|
154 |
+
* @param decimal $value Value to round
|
155 |
+
* @param int $precision Precision to round up to
|
156 |
+
*
|
157 |
+
* @return int
|
158 |
+
*/
|
159 |
+
public function encodeDecimal($value, $precision = 2)
|
160 |
+
{
|
161 |
+
return (int) round($value * pow(10, $precision));
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Request a resource with given method and data.
|
166 |
+
*
|
167 |
+
* @param string $method Request method
|
168 |
+
* @param bool $useSecretKey Flag for secure/public key
|
169 |
+
* @param mixed $queryData GET query data
|
170 |
+
* @param mixed $rawData Raw data for request
|
171 |
+
* @param array $acceptedErrors Codes that do not invoke an exception, if an
|
172 |
+
* error is provided in the response
|
173 |
+
*
|
174 |
+
* @return void
|
175 |
+
* @link https://github.com/bonusboxme/api_documentation/wiki
|
176 |
+
* @TODO move to handleError method for every client
|
177 |
+
*/
|
178 |
+
public function requestResource(
|
179 |
+
$method, $useSecretKey, $queryData = null, $rawData = null, $acceptedErrors = null
|
180 |
+
)
|
181 |
+
{
|
182 |
+
try {
|
183 |
+
$this->init($useSecretKey);
|
184 |
+
if ($queryData) {
|
185 |
+
// @todo if array is provided
|
186 |
+
$this->setUri($this->getUri() . '/' . $queryData);
|
187 |
+
}
|
188 |
+
if ($rawData) {
|
189 |
+
$this->setRawData($this->encodeData($rawData));
|
190 |
+
}
|
191 |
+
$this->setMethod($method);
|
192 |
+
|
193 |
+
$response = $this->request();
|
194 |
+
// codes in the 2xx range indicate success
|
195 |
+
if (strpos($response->getStatus(), '2') === 0) {
|
196 |
+
$responseBody = $this->decodeData($response->getBody());
|
197 |
+
return $responseBody;
|
198 |
+
}
|
199 |
+
if (is_array($acceptedErrors) && in_array($response->getStatus(), $acceptedErrors)) {
|
200 |
+
$responseBody = $this->decodeData($response->getBody());
|
201 |
+
if ($responseBody['error']) {
|
202 |
+
return null;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
require_once 'Bonusbox/Bonusbox/Exception.php';
|
206 |
+
throw new Bonusbox_Bonusbox_Exception(
|
207 |
+
'Invalid Response' . PHP_EOL . (string) $this . PHP_EOL . PHP_EOL . (string) $response
|
208 |
+
);
|
209 |
+
} catch (Exception $exc) {
|
210 |
+
Mage::helper('bonusbox')->handleError($exc);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Super class does not support __toString
|
216 |
+
*
|
217 |
+
* @return string
|
218 |
+
* @codeCoverageIgnore
|
219 |
+
*/
|
220 |
+
public function __toString()
|
221 |
+
{
|
222 |
+
foreach ($this->headers as $header) {
|
223 |
+
$headers[] = $header[0] . ': ' . $header[1];
|
224 |
+
}
|
225 |
+
return implode(
|
226 |
+
"\n",
|
227 |
+
array(
|
228 |
+
$this->method . ' ' . $this->getUri(),
|
229 |
+
implode("\n", $headers),
|
230 |
+
// @codingStandardsIgnoreStart
|
231 |
+
$this->raw_post_data
|
232 |
+
// @codingStandardsIgnoreEnd
|
233 |
+
)
|
234 |
+
);
|
235 |
+
}
|
236 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/Client/Badges.php
CHANGED
@@ -1,14 +1,57 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Model accessing Badges API
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_Client_Badges extends Bonusbox_Bonusbox_Model_Client
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* API resource name
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $_resourceName = 'badges';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Gets all badges of shop, with benefit and threshold values
|
48 |
+
*
|
49 |
+
* @link https://github.com/bonusboxme/api_documentation/wiki/Get--badges
|
50 |
+
*
|
51 |
+
* @return mixed
|
52 |
+
*/
|
53 |
+
public function get()
|
54 |
+
{
|
55 |
+
return $this->requestResource(self::METHOD_GET, true);
|
56 |
+
}
|
57 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/Client/Coupons.php
CHANGED
@@ -1,28 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Model accessing coupons API
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_Client_Coupons extends Bonusbox_Bonusbox_Model_Client
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* API resource name
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $_resourceName = 'coupons';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieves info for a bonusbox coupon
|
48 |
+
*
|
49 |
+
* @param string $couponCode Coupon code to get infos about
|
50 |
+
*
|
51 |
+
* @return mixed
|
52 |
+
* @link https://github.com/bonusboxme/api_documentation/wiki/GET-coupons
|
53 |
+
*/
|
54 |
+
public function get($couponCode)
|
55 |
+
{
|
56 |
+
return $this->requestResource(self::METHOD_GET, true, $couponCode, null, array(404));
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Deletes a bonusbox coupon
|
61 |
+
*
|
62 |
+
* @param string $couponCode Coupon code to get infos about
|
63 |
+
*
|
64 |
+
* @return mixed
|
65 |
+
* @link https://github.com/bonusboxme/api_documentation/wiki/DELETE-coupons
|
66 |
+
*/
|
67 |
+
public function delete($couponCode)
|
68 |
+
{
|
69 |
+
return $this->requestResource(self::METHOD_DELETE, true, $couponCode);
|
70 |
+
}
|
71 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/Client/Successpages.php
CHANGED
@@ -1,112 +1,167 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Model accessing create API
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_Client_Successpages extends Bonusbox_Bonusbox_Model_Client
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* API resource name
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
protected $_resourceName = 'success_pages';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Sets required data from address object to array
|
48 |
+
*
|
49 |
+
* @param Mage_Sales_Model_Order_Address $address Order address instance
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
protected function encodeAddress(Mage_Sales_Model_Order_Address $address)
|
54 |
+
{
|
55 |
+
return array(
|
56 |
+
'code' => $address->getAddressType(),
|
57 |
+
'city' => $address->getCity(),
|
58 |
+
'company' => $address->getCompany(),
|
59 |
+
'region' => $address->getRegion(),
|
60 |
+
'country' => $address->getCountry(),
|
61 |
+
'firstname' => $address->getFirstname(),
|
62 |
+
'lastname' => $address->getLastname(),
|
63 |
+
'phone' => $address->getTelephone(),
|
64 |
+
'fax' => $address->getFax(),
|
65 |
+
'email' => $address->getEmail(),
|
66 |
+
'street' => $address->getStreetFull(),
|
67 |
+
'zip' => $address->getPostcode()
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Sets required data from item object to array
|
73 |
+
*
|
74 |
+
* @param Mage_Sales_Model_Order_Item $item Order item
|
75 |
+
*
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
protected function encodeItem(Mage_Sales_Model_Order_Item $item)
|
79 |
+
{
|
80 |
+
// ensure that all product attributes are loaded
|
81 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
82 |
+
|
83 |
+
return array(
|
84 |
+
'code' => 'product',
|
85 |
+
'sku' => $item->getSku(),
|
86 |
+
'quantity' => round($item->getQtyOrdered()),
|
87 |
+
'title' => $item->getName(),
|
88 |
+
'description' => $item->getDescription(),
|
89 |
+
'price' => $this->encodeDecimal($item->getData('price')),
|
90 |
+
'vat_rate' => $this->encodeDecimal($item->getData('tax_percent')),
|
91 |
+
'vat_amount' => $this->encodeDecimal($item->getData('tax_amount')),
|
92 |
+
'landing_page' => $product->getUrlModel()->getUrl($product, array('_ignore_category' => true)),
|
93 |
+
'image_url' => Mage::helper('catalog/image')->init($product, 'image')->__toString()
|
94 |
+
);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Encodes order to array
|
99 |
+
*
|
100 |
+
* @param Mage_Sales_Model_Order $order Order to encode
|
101 |
+
*
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
public function encodeOrder(Mage_Sales_Model_Order $order)
|
105 |
+
{
|
106 |
+
$helper = Mage::helper('bonusbox/successpage');
|
107 |
+
$payment = $order->getPayment();
|
108 |
+
$vatRate = 0;
|
109 |
+
|
110 |
+
if (($order->getData('shipping_amount') > 0)) {
|
111 |
+
$vatRate = $this->encodeDecimal(
|
112 |
+
$order->getData('shipping_tax_amount') / $order->getData('shipping_amount') * 100
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
$addresses[] = $this->encodeAddress($order->getBillingAddress());
|
117 |
+
if (!$order->getIsVirtual()) {
|
118 |
+
$addresses[] = $this->encodeAddress($order->getShippingAddress());
|
119 |
+
}
|
120 |
+
$data = array(
|
121 |
+
'addresses' => $addresses,
|
122 |
+
'currency' => $order->getData('order_currency_code'),
|
123 |
+
'order_number' => $order->getData('increment_id'),
|
124 |
+
'discounts_used' => $order->getCouponCode() ? array($order->getCouponCode()) : null,
|
125 |
+
'style_url' => $helper->getCssUrl(),
|
126 |
+
'items' => array(
|
127 |
+
array(
|
128 |
+
'code' => 'shipping',
|
129 |
+
'quantity' => $this->encodeDecimal(1),
|
130 |
+
'sku' => $order->getShippingMethod(),
|
131 |
+
'title' => $order->getShippingDescription(),
|
132 |
+
'price' => $this->encodeDecimal($order->getData('shipping_amount')),
|
133 |
+
'vat_amount' => $this->encodeDecimal($order->getData('shipping_tax_amount')),
|
134 |
+
'vat_rate' => $vatRate
|
135 |
+
),
|
136 |
+
array(
|
137 |
+
'code' => 'payment',
|
138 |
+
'quantity' => $this->encodeDecimal(1),
|
139 |
+
'sku' => $payment->getMethod(),
|
140 |
+
'title' => $payment->getMethodInstance()->getTitle(),
|
141 |
+
'price' => 0,
|
142 |
+
'vat_amount' => 0,
|
143 |
+
'vat_rate' => 0
|
144 |
+
)
|
145 |
+
)
|
146 |
+
);
|
147 |
+
|
148 |
+
foreach ($order->getAllItems() as $item) {
|
149 |
+
$data['items'][] = $this->encodeItem($item);
|
150 |
+
}
|
151 |
+
return $data;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Request resource success_pages with order data.
|
156 |
+
* Return url and token, if successful, otherwise detailed error description
|
157 |
+
*
|
158 |
+
* @param Mage_Sales_Model_Order $order Sales order object
|
159 |
+
*
|
160 |
+
* @return mixed
|
161 |
+
* @link https://github.com/bonusboxme/api_documentation/wiki/CREATE-success_pages
|
162 |
+
*/
|
163 |
+
public function post(Mage_Sales_Model_Order $order)
|
164 |
+
{
|
165 |
+
return $this->requestResource(self::METHOD_POST, true, null, $this->encodeOrder($order));
|
166 |
+
}
|
167 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/Sales/Observer.php
CHANGED
@@ -1,35 +1,68 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Event listener to submit order data to API
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_Sales_Observer
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Forwards order to bonuxbox and saves url for success page iframe in session.
|
41 |
+
* Deletes bonusbox coupon code.
|
42 |
+
*
|
43 |
+
* @param Varien_Event_Observer $observer Event observer
|
44 |
+
*
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function forwardOrder(Varien_Event_Observer $observer)
|
48 |
+
{
|
49 |
+
$order = $observer->getOrder();
|
50 |
+
if (Mage::helper('bonusbox')->isEnabled()) {
|
51 |
+
if (Mage::helper('bonusbox/successpage')->isOperational()) {
|
52 |
+
// send order to bonusbox
|
53 |
+
$response = Mage::getModel('bonusbox/client_successpages')->post($order);
|
54 |
+
Mage::helper('bonusbox')->getSession()->setSuccessPage($response['success_page']);
|
55 |
+
|
56 |
+
// delete coupon code from bonusbox
|
57 |
+
if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($order->getCouponCode())) {
|
58 |
+
Mage::getModel('bonusbox/client_coupons')->delete($order->getCouponCode());
|
59 |
+
}
|
60 |
+
|
61 |
+
// invalidate Customer Badge Cache
|
62 |
+
Mage::helper('bonusbox')->getSession()->setCustomerBadgesByCoupon(null);
|
63 |
+
} else {
|
64 |
+
Mage::log('Bonusbox Success Page is missing config data.');
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Condition/Bonusbox.php
CHANGED
@@ -1,88 +1,146 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Custom sales rule condition model
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox extends Mage_Rule_Model_Condition_Abstract
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Listener on 'salesrule_rule_condition_combine' to add additonal conditions.
|
41 |
+
*
|
42 |
+
* BONBOX-12: Moved listener logic for Magento EE compatibility overridden
|
43 |
+
* Mage_SalesRule_Model_Rule_Condition_Combine class.
|
44 |
+
*
|
45 |
+
* @param Varien_Event_Observer $observer Event observer instance
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
public function addConditions(Varien_Event_Observer $observer)
|
50 |
+
{
|
51 |
+
if (!Mage::helper('bonusbox')->isEnabled()) {
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
$class = 'bonusbox/salesRule_condition_bonusbox';
|
55 |
+
$condition = Mage::getModel($class);
|
56 |
+
$condition->loadAttributeOptions();
|
57 |
+
foreach ($condition->getAttributeOption() as $attribute => $label) {
|
58 |
+
$attributes = array(
|
59 |
+
array('value' => $class . '|' . $attribute, 'label' => $label)
|
60 |
+
);
|
61 |
+
}
|
62 |
+
$conditions = array(array('label' => Mage::helper('bonusbox')->__('Bonusbox'), 'value' => $attributes));
|
63 |
+
$observer->getEvent()->getAdditional()->setConditions($conditions);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Adding badge as attribute
|
68 |
+
*
|
69 |
+
* @return Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox
|
70 |
+
*/
|
71 |
+
public function loadAttributeOptions()
|
72 |
+
{
|
73 |
+
$this->setAttributesMeta(
|
74 |
+
array(
|
75 |
+
'badge' => array(
|
76 |
+
'label' => Mage::helper('bonusbox')->__('Badge'),
|
77 |
+
'input_type' => 'select',
|
78 |
+
'value_element_type' => 'select'
|
79 |
+
)
|
80 |
+
)
|
81 |
+
);
|
82 |
+
|
83 |
+
foreach ($this->getAttributesMeta() as $attribute => $attributeMeta) {
|
84 |
+
$attributes[$attribute] = $attributeMeta['label'];
|
85 |
+
}
|
86 |
+
$this->setAttributeOption($attributes);
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Getting badge attribute input type.
|
92 |
+
*
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
public function getInputType()
|
96 |
+
{
|
97 |
+
$attributesMeta = $this->getAttributesMeta();
|
98 |
+
return $attributesMeta[$this->getAttribute()]['input_type'];
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Getting badge attribute value type.
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getValueElementType()
|
107 |
+
{
|
108 |
+
$attributesMeta = $this->getAttributesMeta();
|
109 |
+
return $attributesMeta[$this->getAttribute()]['value_element_type'];
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get a list of available attribute options to select
|
114 |
+
*
|
115 |
+
* @return array
|
116 |
+
*/
|
117 |
+
public function getValueSelectOptions()
|
118 |
+
{
|
119 |
+
if (!$this->hasData('value_select_options')) {
|
120 |
+
switch ($this->getAttribute()) {
|
121 |
+
case 'badge':
|
122 |
+
$options = Mage::helper('bonusbox')->getBadgeOptions();
|
123 |
+
break;
|
124 |
+
}
|
125 |
+
$this->setData('value_select_options', $options);
|
126 |
+
}
|
127 |
+
return $this->getData('value_select_options');
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Validate Bonusbox Badge Conditions
|
132 |
+
*
|
133 |
+
* @param Varien_Object $object Object holding quote.
|
134 |
+
*
|
135 |
+
* @return bool
|
136 |
+
*/
|
137 |
+
public function validate(Varien_Object $object)
|
138 |
+
{
|
139 |
+
if (!Mage::helper('bonusbox')->isEnabled()) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
$bonusbox = new Varien_Object();
|
143 |
+
$bonusbox->setBadge(Mage::helper('bonusbox')->getCustomerBadge($object->getQuote()));
|
144 |
+
return parent::validate($bonusbox);
|
145 |
+
}
|
146 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Rule/Condition/Combine.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* BONBOX-12: Overriding Mage_SalesRule_Model_Rule_Condition_Combine to make sure
|
27 |
+
* additional rule combines will also take affect in Magento EE.
|
28 |
+
*
|
29 |
+
* @category Bonusbox
|
30 |
+
* @package Bonusbox_Bonusbox
|
31 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
32 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
33 |
+
* @copyright 2011-2012 BonusBox GmbH
|
34 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
35 |
+
* @link http://bonusbox.me
|
36 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
37 |
+
*/
|
38 |
+
class Bonusbox_Bonusbox_Model_SalesRule_Rule_Condition_Combine extends Mage_SalesRule_Model_Rule_Condition_Combine
|
39 |
+
{
|
40 |
+
/**
|
41 |
+
* Get inherited conditions selectors and add BonusBox specific ones.
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
* @see Mage_SalesRule_Model_Rule_Condition_Combine::getNewChildSelectOptions()
|
45 |
+
* @see Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox::addConditions()
|
46 |
+
*/
|
47 |
+
public function getNewChildSelectOptions()
|
48 |
+
{
|
49 |
+
$conditions = parent::getNewChildSelectOptions();
|
50 |
+
if (Mage::helper('bonusbox')->isEnabled()) {
|
51 |
+
$attributes = array();
|
52 |
+
$className = 'bonusbox/salesRule_condition_bonusbox';
|
53 |
+
$bonusBoxCondition = Mage::getModel($className)->loadAttributeOptions();
|
54 |
+
/* @var $bonusBoxCondition Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox */
|
55 |
+
|
56 |
+
foreach ($bonusBoxCondition->getAttributeOption() as $attribute => $label) {
|
57 |
+
$attributes[] = array(
|
58 |
+
'value' => $className . '|' . $attribute,
|
59 |
+
'label' => $label
|
60 |
+
);
|
61 |
+
}
|
62 |
+
|
63 |
+
$conditions = array_merge_recursive(
|
64 |
+
$conditions,
|
65 |
+
array(
|
66 |
+
array(
|
67 |
+
'label' => Mage::helper('bonusbox')->__('Bonusbox'),
|
68 |
+
'value' => $attributes
|
69 |
+
)
|
70 |
+
)
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
// 'salesrule_rule_condition_combine' has been dispatched already! Doing some
|
75 |
+
// module specific event dispatching.
|
76 |
+
$additional = new Varien_Object();
|
77 |
+
Mage::dispatchEvent(
|
78 |
+
'bonousbox_salesrule_rule_condition_combine',
|
79 |
+
array('additional' => $additional)
|
80 |
+
);
|
81 |
+
if (($additionalConditions = $additional->getConditions())) {
|
82 |
+
$conditions = array_merge_recursive($conditions, $additionalConditions);
|
83 |
+
}
|
84 |
+
|
85 |
+
return $conditions;
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Validator.php
CHANGED
@@ -1,92 +1,136 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
*
|
81 |
-
* @param
|
82 |
-
*
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Custom sales rule validator model
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_Validator
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Removes the coupon code if it is an bonusbox coupon code an stores it. After
|
41 |
+
* validation the bonusbox code is set order.
|
42 |
+
*
|
43 |
+
* @param int $websiteId Website ID
|
44 |
+
* @param int $customerGroupId Customer group ID
|
45 |
+
* @param string $couponCode Coupon code
|
46 |
+
*
|
47 |
+
* @return Bonusbox_Bonusbox_Model_SalesRule_Validator
|
48 |
+
* @see Mage_SalesRule_Model_Validator::init($websiteId, $customerGroupId, $couponCode)
|
49 |
+
*/
|
50 |
+
public function init($websiteId, $customerGroupId, $couponCode)
|
51 |
+
{
|
52 |
+
if (Mage::helper('bonusbox')->isEnabled() && $couponCode) {
|
53 |
+
if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($couponCode)) {
|
54 |
+
$this->setBonusboxCode($couponCode);
|
55 |
+
$couponCode = null;
|
56 |
+
} else {
|
57 |
+
$this->setBonusboxCode(null);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
return parent::init($websiteId, $customerGroupId, $couponCode);
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Checks if rule contains bonusbox Conditions and if a bonusbox code is set.
|
65 |
+
*
|
66 |
+
* @param Mage_SalesRule_Model_Rule $rule Sales rule model instance
|
67 |
+
*
|
68 |
+
* @return boolean
|
69 |
+
*/
|
70 |
+
private function isBonusboxRule($rule)
|
71 |
+
{
|
72 |
+
if ($this->getBonusboxCode() && !$rule->getCouponCode()) {
|
73 |
+
return $this->hasBonusboxConditions($rule->getConditions()->getConditions());
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Check if $conditions contains a bonusbox condition and searches recursively
|
79 |
+
* if a combine condition is contained.
|
80 |
+
*
|
81 |
+
* @param array $conditions Conditions to check
|
82 |
+
*
|
83 |
+
* @return bool|void
|
84 |
+
*/
|
85 |
+
private function hasBonusboxConditions($conditions)
|
86 |
+
{
|
87 |
+
foreach ($conditions as $condition) {
|
88 |
+
if ($condition instanceof Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox
|
89 |
+
|| $this->hasBonusboxConditions($condition->getConditions())
|
90 |
+
) {
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* If one of the applied rules is a bonusbox rule, the code is set to the address
|
98 |
+
*
|
99 |
+
* @param Mage_Sales_Model_Quote_Item_Abstract $item Sales quote item
|
100 |
+
*
|
101 |
+
* @return Bonusbox_Bonusbox_Model_SalesRule_Validator
|
102 |
+
* @see Mage_SalesRule_Model_Validator::process($item)
|
103 |
+
*/
|
104 |
+
public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
|
105 |
+
{
|
106 |
+
parent::process($item);
|
107 |
+
if (!Mage::helper('bonusbox')->isEnabled() || !$this->getBonusboxCode()) {
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
$appliedRuleIds = explode(',', $item->getQuote()->getAppliedRuleIds());
|
111 |
+
foreach ($this->_getRules() as $rule) {
|
112 |
+
if (in_array($rule->getId(), $appliedRuleIds) && $this->isBonusboxRule($rule)) {
|
113 |
+
$this->_setCouponDataToAddress($item, $rule);
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
return $this;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Set coupon code and description to address
|
122 |
+
*
|
123 |
+
* @param Mage_Sales_Model_Quote_Item_Abstract $item Sales quote item
|
124 |
+
* @param Mage_SalesRule_Model_Rule $rule Sales rule model
|
125 |
+
*
|
126 |
+
* @return void
|
127 |
+
*/
|
128 |
+
private function _setCouponDataToAddress($item, $rule)
|
129 |
+
{
|
130 |
+
$address = $this->_getAddress($item);
|
131 |
+
$address->setCouponCode($this->getBonusboxCode());
|
132 |
+
$rule->setCouponCode($this->getBonusboxCode()); // used in _addDiscountDescription
|
133 |
+
$this->_addDiscountDescription($address, $rule);
|
134 |
+
$rule->setCouponCode(null);
|
135 |
+
}
|
136 |
}
|
app/code/community/Bonusbox/Bonusbox/Model/Session.php
CHANGED
@@ -1,24 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Custom module session model
|
27 |
+
*
|
28 |
+
* @category Bonusbox
|
29 |
+
* @package Bonusbox_Bonusbox
|
30 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
31 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
32 |
+
* @copyright 2011-2012 BonusBox GmbH
|
33 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
34 |
+
* @link http://bonusbox.me
|
35 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
36 |
+
*/
|
37 |
+
class Bonusbox_Bonusbox_Model_Session extends Mage_Core_Model_Session_Abstract
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Initialize session space
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
$this->init('bonusbox');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Getting customer badge by coupon code
|
49 |
+
*
|
50 |
+
* @param string $couponCode Coupon code
|
51 |
+
*
|
52 |
+
* @return mixed
|
53 |
+
*/
|
54 |
+
public function getCustomerBadgeByCoupon($couponCode)
|
55 |
+
{
|
56 |
+
$badges = $this->getCustomerBadgesByCoupon();
|
57 |
+
return isset($badges[$couponCode]) ? $badges[$couponCode] : null;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Set customer badge by coupon
|
62 |
+
*
|
63 |
+
* @param string $couponCode Coupon code
|
64 |
+
* @param mixed $badge Badge to apply
|
65 |
+
*
|
66 |
+
* @return Bonusbox_Bonusbox_Model_Session
|
67 |
+
*/
|
68 |
+
public function setCustomerBadgeByCoupon($couponCode, $badge)
|
69 |
+
{
|
70 |
+
$badges = $this->getCustomerBadgesByCoupon();
|
71 |
+
$badges[$couponCode] = $badge;
|
72 |
+
$this->setCustomerBadgesByCoupon($badges);
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
}
|
app/code/community/Bonusbox/Bonusbox/controllers/TestController.php
CHANGED
@@ -1,26 +1,72 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
|
|
3 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
* @codeCoverageIgnore
|
5 |
*/
|
6 |
-
class Bonusbox_Bonusbox_TestController extends Mage_Checkout_OnepageController
|
7 |
{
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public function successAction()
|
18 |
{
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
25 |
}
|
26 |
}
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Bonusbox
|
16 |
+
* @package Bonusbox_Bonusbox
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
*/
|
24 |
+
|
25 |
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
26 |
+
|
27 |
/**
|
28 |
+
* Testing controller
|
29 |
+
*
|
30 |
+
* @category Bonusbox
|
31 |
+
* @package Bonusbox_Bonusbox
|
32 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
33 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
34 |
+
* @copyright 2011-2012 BonusBox GmbH
|
35 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
36 |
+
* @link http://bonusbox.me
|
37 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
38 |
* @codeCoverageIgnore
|
39 |
*/
|
40 |
+
class Bonusbox_Bonusbox_TestController extends Mage_Checkout_OnepageController
|
41 |
{
|
42 |
+
/**
|
43 |
+
* Getting order object.
|
44 |
+
*
|
45 |
+
* @return Mage_Sales_Model_Order
|
46 |
+
*/
|
47 |
+
protected function getOrder()
|
48 |
+
{
|
49 |
+
return Mage::getModel('sales/order')
|
50 |
+
->getResourceCollection()
|
51 |
+
->setPageSize(1)
|
52 |
+
->getFirstItem();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Order success action.
|
57 |
+
*
|
58 |
+
* @return void
|
59 |
+
*/
|
60 |
public function successAction()
|
61 |
{
|
62 |
+
$order = $this->getOrder();
|
63 |
+
Mage::dispatchEvent('sales_model_service_quote_submit_after', array('order' => $order));
|
64 |
+
|
65 |
+
$this->loadLayout();
|
66 |
+
$this->getLayout()
|
67 |
+
->getBlock('content')
|
68 |
+
->append($this->getLayout()->createBlock('bonusbox/checkout_success'));
|
69 |
+
|
70 |
+
$this->renderLayout();
|
71 |
}
|
72 |
}
|
app/code/community/Bonusbox/Bonusbox/etc/adminhtml.xml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Enterprise Edition
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Magento Enterprise Edition License
|
9 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bonusbox
|
23 |
+
* @package Bonusbox_Bonusbox
|
24 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
25 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
26 |
+
* @copyright 2011-2012 BonusBox GmbH
|
27 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
28 |
+
* @link http://bonusbox.me
|
29 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
30 |
+
*/
|
31 |
+
-->
|
32 |
+
<config>
|
33 |
+
<acl>
|
34 |
+
<resources>
|
35 |
+
<admin>
|
36 |
+
<children>
|
37 |
+
<system>
|
38 |
+
<children>
|
39 |
+
<config>
|
40 |
+
<children>
|
41 |
+
<bonusbox translate="title" module="bonusbox">
|
42 |
+
<title>Bonusbox</title>
|
43 |
+
</bonusbox>
|
44 |
+
</children>
|
45 |
+
</config>
|
46 |
+
</children>
|
47 |
+
</system>
|
48 |
+
|
49 |
+
<bonusbox>
|
50 |
+
<title>Bonusbox</title>
|
51 |
+
<sort_order>71</sort_order>
|
52 |
+
<children>
|
53 |
+
<bonusbox translate="title" module="bonusbox">
|
54 |
+
<title>Config</title>
|
55 |
+
<sort_order>0</sort_order>
|
56 |
+
</bonusbox>
|
57 |
+
</children>
|
58 |
+
</bonusbox>
|
59 |
+
</children>
|
60 |
+
</admin>
|
61 |
+
</resources>
|
62 |
+
</acl>
|
63 |
+
</config>
|
app/code/community/Bonusbox/Bonusbox/etc/config.xml
CHANGED
@@ -1,143 +1,142 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
<
|
129 |
-
<
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
</default>
|
143 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Bonusbox
|
17 |
+
* @package Bonusbox_Bonusbox
|
18 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
19 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
20 |
+
* @copyright 2011-2012 BonusBox GmbH
|
21 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
22 |
+
* @link http://bonusbox.me
|
23 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
24 |
+
*/
|
25 |
+
-->
|
26 |
+
<config>
|
27 |
+
<modules>
|
28 |
+
<bonusbox_bonusbox>
|
29 |
+
<version>1.1.5</version>
|
30 |
+
</bonusbox_bonusbox>
|
31 |
+
</modules>
|
32 |
+
<global>
|
33 |
+
<models>
|
34 |
+
<bonusbox>
|
35 |
+
<class>Bonusbox_Bonusbox_Model</class>
|
36 |
+
</bonusbox>
|
37 |
+
<salesrule>
|
38 |
+
<rewrite>
|
39 |
+
<validator>Bonusbox_Bonusbox_Model_SalesRule_Validator</validator>
|
40 |
+
<rule_condition_combine>Bonusbox_Bonusbox_Model_SalesRule_Rule_Condition_Combine</rule_condition_combine>
|
41 |
+
</rewrite>
|
42 |
+
</salesrule>
|
43 |
+
</models>
|
44 |
+
<helpers>
|
45 |
+
<bonusbox>
|
46 |
+
<class>Bonusbox_Bonusbox_Helper</class>
|
47 |
+
</bonusbox>
|
48 |
+
</helpers>
|
49 |
+
<blocks>
|
50 |
+
<bonusbox>
|
51 |
+
<class>Bonusbox_Bonusbox_Block</class>
|
52 |
+
</bonusbox>
|
53 |
+
</blocks>
|
54 |
+
|
55 |
+
<resources>
|
56 |
+
<bonusbox_setup>
|
57 |
+
<setup>
|
58 |
+
<module>Bonusbox_Bonusbox</module>
|
59 |
+
</setup>
|
60 |
+
<connection>
|
61 |
+
<use>core_setup</use>
|
62 |
+
</connection>
|
63 |
+
</bonusbox_setup>
|
64 |
+
</resources>
|
65 |
+
|
66 |
+
<events>
|
67 |
+
<!--
|
68 |
+
BONBOX-12: Due to Magento EEs CustomerSegment module all additional
|
69 |
+
conditions are deleted and replaced.
|
70 |
+
|
71 |
+
<salesrule_rule_condition_combine>
|
72 |
+
<observers>
|
73 |
+
<bonusbox>
|
74 |
+
<class>bonusbox/salesRule_condition_bonusbox</class>
|
75 |
+
<method>addConditions</method>
|
76 |
+
</bonusbox>
|
77 |
+
</observers>
|
78 |
+
</salesrule_rule_condition_combine>
|
79 |
+
-->
|
80 |
+
|
81 |
+
<sales_model_service_quote_submit_after>
|
82 |
+
<observers>
|
83 |
+
<bonusbox>
|
84 |
+
<class>bonusbox/sales_observer</class>
|
85 |
+
<method>forwardOrder</method>
|
86 |
+
</bonusbox>
|
87 |
+
</observers>
|
88 |
+
</sales_model_service_quote_submit_after>
|
89 |
+
</events>
|
90 |
+
</global>
|
91 |
+
|
92 |
+
<frontend>
|
93 |
+
<routers>
|
94 |
+
<bonusbox_test>
|
95 |
+
<use>standard</use>
|
96 |
+
<args>
|
97 |
+
<module>Bonusbox_Bonusbox</module>
|
98 |
+
<frontName>bonusbox</frontName>
|
99 |
+
</args>
|
100 |
+
</bonusbox_test>
|
101 |
+
</routers>
|
102 |
+
|
103 |
+
<layout>
|
104 |
+
<updates>
|
105 |
+
<bonusbox>
|
106 |
+
<file>bonusbox.xml</file>
|
107 |
+
</bonusbox>
|
108 |
+
</updates>
|
109 |
+
</layout>
|
110 |
+
</frontend>
|
111 |
+
|
112 |
+
<adminhtml>
|
113 |
+
<translate>
|
114 |
+
<modules>
|
115 |
+
<bonusbox_bonusbox>
|
116 |
+
<files>
|
117 |
+
<default>bonusbox_admin.csv</default>
|
118 |
+
</files>
|
119 |
+
</bonusbox_bonusbox>
|
120 |
+
</modules>
|
121 |
+
</translate>
|
122 |
+
</adminhtml>
|
123 |
+
|
124 |
+
<default>
|
125 |
+
<bonusbox>
|
126 |
+
<general>
|
127 |
+
<enabled>0</enabled>
|
128 |
+
<live>0</live>
|
129 |
+
<live_public_key />
|
130 |
+
<live_secret_key />
|
131 |
+
<test_public_key />
|
132 |
+
<test_secret_key />
|
133 |
+
<url><![CDATA[https://api.bonusbox.me/]]></url>
|
134 |
+
<accept_header><![CDATA[application/json,application/vnd.api;ver=1]]></accept_header>
|
135 |
+
<debug_email><![CDATA[no-reply@bonusbox.me]]></debug_email>
|
136 |
+
</general>
|
137 |
+
<success_page>
|
138 |
+
<style_url>css/bonusbox.css</style_url>
|
139 |
+
</success_page>
|
140 |
+
</bonusbox>
|
141 |
+
</default>
|
|
|
142 |
</config>
|
app/code/community/Bonusbox/Bonusbox/etc/system.xml
CHANGED
@@ -1,88 +1,112 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
<
|
47 |
-
<sort_order>
|
48 |
-
<show_in_default>1</show_in_default>
|
49 |
-
<show_in_website>1</show_in_website>
|
50 |
-
<show_in_store>1</show_in_store>
|
51 |
-
</
|
52 |
-
|
53 |
-
<label>
|
54 |
-
<
|
55 |
-
<
|
56 |
-
<
|
57 |
-
<
|
58 |
-
|
59 |
-
|
60 |
-
<
|
61 |
-
|
62 |
-
|
63 |
-
<
|
64 |
-
<
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
<
|
78 |
-
<sort_order>
|
79 |
-
<show_in_default>1</show_in_default>
|
80 |
-
<show_in_website>1</show_in_website>
|
81 |
-
<show_in_store>1</show_in_store>
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
</config>
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Bonusbox
|
17 |
+
* @package Bonusbox_Bonusbox
|
18 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
19 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
20 |
+
* @copyright 2011-2012 BonusBox GmbH
|
21 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
22 |
+
* @link http://bonusbox.me
|
23 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
24 |
+
*/
|
25 |
+
-->
|
26 |
+
<config>
|
27 |
+
<sections>
|
28 |
+
<bonusbox translate="label" module="bonusbox">
|
29 |
+
<label>Bonusbox</label>
|
30 |
+
<tab>sales</tab>
|
31 |
+
<sort_order>70</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<groups>
|
36 |
+
<general>
|
37 |
+
<label>General</label>
|
38 |
+
<sort_order>10</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
<fields>
|
43 |
+
<enabled translate="label">
|
44 |
+
<label>Enabled</label>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
47 |
+
<sort_order>10</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</enabled>
|
52 |
+
<live>
|
53 |
+
<label>Live Mode</label>
|
54 |
+
<frontend_type>select</frontend_type>
|
55 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
56 |
+
<comment>Yes = Live Mode, No = Test Mode.</comment>
|
57 |
+
<sort_order>20</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</live>
|
62 |
+
<live_public_key translate="label">
|
63 |
+
<label>Public Key (Live)</label>
|
64 |
+
<sort_order>30</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>1</show_in_website>
|
67 |
+
<show_in_store>1</show_in_store>
|
68 |
+
</live_public_key>
|
69 |
+
<live_secret_key translate="label">
|
70 |
+
<label>Secret Key (Live)</label>
|
71 |
+
<sort_order>40</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</live_secret_key>
|
76 |
+
<test_public_key translate="label">
|
77 |
+
<label>Public Key (Test)</label>
|
78 |
+
<sort_order>50</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</test_public_key>
|
83 |
+
<test_secret_key translate="label">
|
84 |
+
<label>Secret Key (Test)</label>
|
85 |
+
<sort_order>60</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
</test_secret_key>
|
90 |
+
</fields>
|
91 |
+
</general>
|
92 |
+
<success_page>
|
93 |
+
<label>Checkout Success Page</label>
|
94 |
+
<sort_order>20</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>1</show_in_store>
|
98 |
+
<fields>
|
99 |
+
<style_url translate="label">
|
100 |
+
<label>Stylesheet</label>
|
101 |
+
<comment>Provide the path relative to your skin path (e.g. "css/bonusbox.css").</comment>
|
102 |
+
<sort_order>70</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
</style_url>
|
107 |
+
</fields>
|
108 |
+
</success_page>
|
109 |
+
</groups>
|
110 |
+
</bonusbox>
|
111 |
+
</sections>
|
112 |
</config>
|
app/design/frontend/base/default/layout/bonusbox.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Bonusbox
|
17 |
+
* @package Bonusbox_Bonusbox
|
18 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
19 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
20 |
+
* @copyright 2011-2012 BonusBox GmbH
|
21 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
22 |
+
* @link http://bonusbox.me
|
23 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
24 |
+
*/
|
25 |
+
-->
|
26 |
+
<layout version="0.1.0">
|
27 |
+
<checkout_onepage_success>
|
28 |
+
<reference name="content">
|
29 |
+
<block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
|
30 |
+
</reference>
|
31 |
+
</checkout_onepage_success>
|
32 |
+
|
33 |
+
<firecheckout_index_success>
|
34 |
+
<reference name="content">
|
35 |
+
<block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
|
36 |
+
</reference>
|
37 |
+
</firecheckout_index_success>
|
38 |
+
</layout>
|
app/design/frontend/base/default/template/bonusbox/checkout/success.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category design
|
16 |
+
* @package default_default
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
* @link https://github.com/symmetrics/bonusbox_magento
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* 'bonusbox/checkout/success.phtml'
|
28 |
+
*/
|
29 |
+
?>
|
30 |
+
|
31 |
+
<iframe style="overflow: hidden; border: 0; width: 100%;" src="<?php echo $this->getSuccessPageUrl() ?>" />
|
app/design/frontend/default/default/layout/bonusbox.xml
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<checkout_onepage_success>
|
4 |
-
<reference name="content">
|
5 |
-
<block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
|
6 |
-
</reference>
|
7 |
-
</checkout_onepage_success>
|
8 |
-
|
9 |
-
<firecheckout_index_success>
|
10 |
-
<reference name="content">
|
11 |
-
<block type="bonusbox/checkout_success" name="bonusbox.checkout_success" />
|
12 |
-
</reference>
|
13 |
-
</firecheckout_index_success>
|
14 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/default/default/template/bonusbox/checkout/success.phtml
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<iframe style="overflow: hidden; border: 0; width: 100%;" src="<?php echo $this->getSuccessPageUrl() ?>" />
|
|
app/etc/modules/Bonusbox_Bonusbox.xml
CHANGED
@@ -1,9 +1,36 @@
|
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
9 |
</config>
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Bonusbox
|
17 |
+
* @package Bonusbox_Bonusbox
|
18 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
19 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
20 |
+
* @copyright 2011-2012 BonusBox GmbH
|
21 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
22 |
+
* @link http://bonusbox.me
|
23 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
24 |
+
*/
|
25 |
+
-->
|
26 |
<config>
|
27 |
+
<modules>
|
28 |
+
<Bonusbox_Bonusbox>
|
29 |
+
<active>true</active>
|
30 |
+
<codePool>community</codePool>
|
31 |
+
<depends>
|
32 |
+
<Mage_SalesRule />
|
33 |
+
</depends>
|
34 |
+
</Bonusbox_Bonusbox>
|
35 |
+
</modules>
|
36 |
</config>
|
app/locale/de_DE/bonusbox_admin.csv
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
"Enabled","Enabled"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bonusbox_Bonusbox1</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT License</license>
|
7 |
<channel>community</channel>
|
@@ -10,11 +10,26 @@
|
|
10 |
<description>Bonusbox enables merchants to win and retain customers in Facebook. Reward customers with bonusbox credits for referrals, comments and for repeat purchases!
|
11 |
|
12 |
For further information, check out our homepage www.bonusbox.me.</description>
|
13 |
-
<notes
|
14 |
-
|
15 |
-
|
16 |
-
<
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<compatible/>
|
19 |
-
<dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bonusbox_Bonusbox1</name>
|
4 |
+
<version>1.1.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT License</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Bonusbox enables merchants to win and retain customers in Facebook. Reward customers with bonusbox credits for referrals, comments and for repeat purchases!
|
11 |
|
12 |
For further information, check out our homepage www.bonusbox.me.</description>
|
13 |
+
<notes>* PHPCS and PHPMD checks
|
14 |
+
* Compatibility of Magento CE 1.7
|
15 |
+
* Compatibility of Magento EE 1.12</notes>
|
16 |
+
<authors>
|
17 |
+
<author>
|
18 |
+
<name>Jan Riethmayer</name>
|
19 |
+
<user>jan_bonusbox</user>
|
20 |
+
<email>jan@bonusbox.me</email>
|
21 |
+
</author>
|
22 |
+
</authors>
|
23 |
+
<date>2012-07-04</date>
|
24 |
+
<time>14:02:27</time>
|
25 |
+
<contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="bonusbox.css"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bonusbox.xml"/></dir><dir name="template"><dir name="bonusbox"><dir name="checkout"><file name="success.phtml"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bonusbox_Bonusbox.xml"/></dir></target><target name="magecommunity"><dir name="Bonusbox"><dir name="Bonusbox"><dir name="controllers"><file name="TestController.php"/></dir><dir name="etc"><file name="system.xml"/><file name="config.xml"/><file name="adminhtml.xml"/></dir><dir name="Model"><dir name="Client"><file name="Badges.php"/><file name="Coupons.php"/><file name="Successpages.php"/></dir><dir name="SalesRule"><dir name="Rule"><dir name="Condition"><file name="Combine.php"/></dir></dir><dir name="Condition"><file name="Bonusbox.php"/></dir><file name="Validator.php"/></dir><dir name="Sales"><file name="Observer.php"/></dir><file name="Client.php"/><file name="Session.php"/></dir><dir name="Helper"><file name="Data.php"/><file name="Successpage.php"/></dir><dir name="Block"><dir name="Checkout"><file name="Success.php"/></dir></dir><file name="Exception.php"/></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="bonusbox_admin.csv"/></dir></target></contents>
|
26 |
<compatible/>
|
27 |
+
<dependencies>
|
28 |
+
<required>
|
29 |
+
<php>
|
30 |
+
<min>5.2.0</min>
|
31 |
+
<max>6.0.0</max>
|
32 |
+
</php>
|
33 |
+
</required>
|
34 |
+
</dependencies>
|
35 |
</package>
|
skin/frontend/default/default/css/bonusbox.css
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@charset 'UTF-8';
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category skin
|
16 |
+
* @package default_default
|
17 |
+
* @author symmetrics - a CGI Group brand <info@symmetrics.de>
|
18 |
+
* @author Ngoc Anh Doan <ngoc-anh.doan@cgi.com>
|
19 |
+
* @copyright 2011-2012 BonusBox GmbH
|
20 |
+
* @license http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
|
21 |
+
* @link http://bonusbox.me
|
22 |
+
* @link http://github.com/symmetrics/bonusbox_magento
|
23 |
+
* @link https://github.com/symmetrics/bonusbox_magento
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* minimal styles for default skin
|
28 |
+
*
|
29 |
+
* 'css/bonusbox.css'
|
30 |
+
*/
|
31 |
+
|
32 |
+
body {
|
33 |
+
color: #2F2F2F;
|
34 |
+
font: 12px/1.55 Arial,Helvetica,sans-serif;
|
35 |
+
}
|