Version Notes
Loyalty programme for success pages
Download this release
Release Info
Developer | Magento Core Team |
Extension | Bonusbox_Bonusbox1 |
Version | 1.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.1.4
- app/code/community/Bonusbox/Bonusbox/Helper/Data.php +1 -0
- app/code/community/Bonusbox/Bonusbox/Model/Client.php +1 -1
- app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Condition/Bonusbox.php +8 -0
- app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Validator.php +16 -9
- app/code/community/Bonusbox/Bonusbox/etc/config.xml +1 -1
- package.xml +4 -4
app/code/community/Bonusbox/Bonusbox/Helper/Data.php
CHANGED
@@ -73,6 +73,7 @@ class Bonusbox_Bonusbox_Helper_Data extends Mage_Core_Helper_Data
|
|
73 |
}
|
74 |
}
|
75 |
else {
|
|
|
76 |
if ($message instanceof Exception)
|
77 |
{
|
78 |
throw $message;
|
73 |
}
|
74 |
}
|
75 |
else {
|
76 |
+
Mage::log('TEST ' . (string)$message);
|
77 |
if ($message instanceof Exception)
|
78 |
{
|
79 |
throw $message;
|
app/code/community/Bonusbox/Bonusbox/Model/Client.php
CHANGED
@@ -51,7 +51,7 @@ class Bonusbox_Bonusbox_Model_Client extends Zend_Http_Client
|
|
51 |
->setUri($helper->getConfig('url') . $this->_resourceName)
|
52 |
->setHeaders('Accept', $helper->getConfig('accept_header'))
|
53 |
->setHeaders('Content-Type', self::CONTENT_TYPE)
|
54 |
-
->setAuth($helper->getKey($useSecretKey, $this->getStoreId())) // to collect all badges with multiple shops, request has ti be executed with different store context
|
55 |
->setRawData(null)
|
56 |
;
|
57 |
return $this;
|
51 |
->setUri($helper->getConfig('url') . $this->_resourceName)
|
52 |
->setHeaders('Accept', $helper->getConfig('accept_header'))
|
53 |
->setHeaders('Content-Type', self::CONTENT_TYPE)
|
54 |
+
->setAuth(trim($helper->getKey($useSecretKey, $this->getStoreId()))) // to collect all badges with multiple shops, request has ti be executed with different store context
|
55 |
->setRawData(null)
|
56 |
;
|
57 |
return $this;
|
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Condition/Bonusbox.php
CHANGED
@@ -3,6 +3,10 @@ class Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox extends Mage_Rule_Mod
|
|
3 |
{
|
4 |
public function addConditions(Varien_Event_Observer $observer)
|
5 |
{
|
|
|
|
|
|
|
|
|
6 |
$class = 'bonusbox/salesRule_condition_bonusbox';
|
7 |
$condition = Mage::getModel($class);
|
8 |
$condition->loadAttributeOptions();
|
@@ -73,6 +77,10 @@ class Bonusbox_Bonusbox_Model_SalesRule_Condition_Bonusbox extends Mage_Rule_Mod
|
|
73 |
*/
|
74 |
public function validate(Varien_Object $object)
|
75 |
{
|
|
|
|
|
|
|
|
|
76 |
$bonusbox = new Varien_Object();
|
77 |
$bonusbox->setBadge(Mage::helper('bonusbox')->getCustomerBadge($object->getQuote()));
|
78 |
return parent::validate($bonusbox);
|
3 |
{
|
4 |
public function addConditions(Varien_Event_Observer $observer)
|
5 |
{
|
6 |
+
if (!Mage::helper('bonusbox')->isEnabled())
|
7 |
+
{
|
8 |
+
return;
|
9 |
+
}
|
10 |
$class = 'bonusbox/salesRule_condition_bonusbox';
|
11 |
$condition = Mage::getModel($class);
|
12 |
$condition->loadAttributeOptions();
|
77 |
*/
|
78 |
public function validate(Varien_Object $object)
|
79 |
{
|
80 |
+
if (!Mage::helper('bonusbox')->isEnabled())
|
81 |
+
{
|
82 |
+
return;
|
83 |
+
}
|
84 |
$bonusbox = new Varien_Object();
|
85 |
$bonusbox->setBadge(Mage::helper('bonusbox')->getCustomerBadge($object->getQuote()));
|
86 |
return parent::validate($bonusbox);
|
app/code/community/Bonusbox/Bonusbox/Model/SalesRule/Validator.php
CHANGED
@@ -10,13 +10,16 @@ class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_V
|
|
10 |
*/
|
11 |
public function init($websiteId, $customerGroupId, $couponCode)
|
12 |
{
|
13 |
-
if (Mage::helper('bonusbox')->
|
14 |
{
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
}
|
21 |
return parent::init($websiteId, $customerGroupId, $couponCode);
|
22 |
}
|
@@ -26,7 +29,7 @@ class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_V
|
|
26 |
* @param Mage_SalesRule_Model_Rule $rule
|
27 |
* @return boolean
|
28 |
*/
|
29 |
-
|
30 |
{
|
31 |
if ($this->getBonusboxCode() && !$rule->getCouponCode())
|
32 |
{
|
@@ -38,7 +41,7 @@ class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_V
|
|
38 |
* Check if $conditions contains a bonusbox condition and searches recursively if a combine condition is contained.
|
39 |
* @param array $conditions
|
40 |
*/
|
41 |
-
|
42 |
{
|
43 |
foreach ($conditions as $condition)
|
44 |
{
|
@@ -57,6 +60,10 @@ class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_V
|
|
57 |
public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
|
58 |
{
|
59 |
parent::process($item);
|
|
|
|
|
|
|
|
|
60 |
$appliedRuleIds = explode(',', $item->getQuote()->getAppliedRuleIds());
|
61 |
foreach ($this->_getRules() as $rule)
|
62 |
{
|
@@ -74,7 +81,7 @@ class Bonusbox_Bonusbox_Model_SalesRule_Validator extends Mage_SalesRule_Model_V
|
|
74 |
* @param Mage_Sales_Model_Quote_Item_Abstract $item
|
75 |
* @param Mage_SalesRule_Model_Rule $rule
|
76 |
*/
|
77 |
-
|
78 |
{
|
79 |
$address = $this->_getAddress($item);
|
80 |
$address->setCouponCode($this->getBonusboxCode());
|
10 |
*/
|
11 |
public function init($websiteId, $customerGroupId, $couponCode)
|
12 |
{
|
13 |
+
if (Mage::helper('bonusbox')->isEnabled() && $couponCode)
|
14 |
{
|
15 |
+
if (Mage::helper('bonusbox')->isValidBonusboxCouponCode($couponCode))
|
16 |
+
{
|
17 |
+
$this->setBonusboxCode($couponCode);
|
18 |
+
$couponCode = null;
|
19 |
+
}
|
20 |
+
else {
|
21 |
+
$this->setBonusboxCode(null);
|
22 |
+
}
|
23 |
}
|
24 |
return parent::init($websiteId, $customerGroupId, $couponCode);
|
25 |
}
|
29 |
* @param Mage_SalesRule_Model_Rule $rule
|
30 |
* @return boolean
|
31 |
*/
|
32 |
+
private function isBonusboxRule($rule)
|
33 |
{
|
34 |
if ($this->getBonusboxCode() && !$rule->getCouponCode())
|
35 |
{
|
41 |
* Check if $conditions contains a bonusbox condition and searches recursively if a combine condition is contained.
|
42 |
* @param array $conditions
|
43 |
*/
|
44 |
+
private function hasBonusboxConditions($conditions)
|
45 |
{
|
46 |
foreach ($conditions as $condition)
|
47 |
{
|
60 |
public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
|
61 |
{
|
62 |
parent::process($item);
|
63 |
+
if (!Mage::helper('bonusbox')->isEnabled() || !$this->getBonusboxCode())
|
64 |
+
{
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
$appliedRuleIds = explode(',', $item->getQuote()->getAppliedRuleIds());
|
68 |
foreach ($this->_getRules() as $rule)
|
69 |
{
|
81 |
* @param Mage_Sales_Model_Quote_Item_Abstract $item
|
82 |
* @param Mage_SalesRule_Model_Rule $rule
|
83 |
*/
|
84 |
+
private function _setCouponDataToAddress($item, $rule)
|
85 |
{
|
86 |
$address = $this->_getAddress($item);
|
87 |
$address->setCouponCode($this->getBonusboxCode());
|
app/code/community/Bonusbox/Bonusbox/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<bonusbox_bonusbox>
|
5 |
-
<version>1.1.
|
6 |
</bonusbox_bonusbox>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<bonusbox_bonusbox>
|
5 |
+
<version>1.1.4</version>
|
6 |
</bonusbox_bonusbox>
|
7 |
</modules>
|
8 |
<global>
|
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>
|
@@ -12,9 +12,9 @@
|
|
12 |
For further information, check out our homepage www.bonusbox.me.</description>
|
13 |
<notes>Loyalty programme for success pages</notes>
|
14 |
<authors><author><name>Jan Riethmayer</name><user>auto-converted</user><email>jan@bonusbox.me</email></author></authors>
|
15 |
-
<date>2012-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magecommunity"><dir name="Bonusbox"><dir name="Bonusbox"><dir name="Block"><dir name="Checkout"><file name="Success.php" hash="d54f41cb4ef4e7fa3586cbd5525bf697"/></dir></dir><dir name="controllers"><file name="TestController.php" hash="c0b4a8bc94e61ad974cb2639a9f31d2e"/></dir><dir name="etc"><file name="config.xml" hash="
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bonusbox_Bonusbox1</name>
|
4 |
+
<version>1.1.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/MIT">MIT License</license>
|
7 |
<channel>community</channel>
|
12 |
For further information, check out our homepage www.bonusbox.me.</description>
|
13 |
<notes>Loyalty programme for success pages</notes>
|
14 |
<authors><author><name>Jan Riethmayer</name><user>auto-converted</user><email>jan@bonusbox.me</email></author></authors>
|
15 |
+
<date>2012-03-13</date>
|
16 |
+
<time>21:33:35</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Bonusbox"><dir name="Bonusbox"><dir name="Block"><dir name="Checkout"><file name="Success.php" hash="d54f41cb4ef4e7fa3586cbd5525bf697"/></dir></dir><dir name="controllers"><file name="TestController.php" hash="c0b4a8bc94e61ad974cb2639a9f31d2e"/></dir><dir name="etc"><file name="config.xml" hash="a384c405c94182c031638dda32914be1"/><file name="system.xml" hash="34c55484b3db6b7df74078ff9259831a"/></dir><dir name="Helper"><file name="Data.php" hash="ac73d44d017c8cc71812e4c6c2a1c89a"/><file name="Successpage.php" hash="bc389365d75932a6054df02f3359597d"/></dir><dir name="Model"><dir name="Client"><file name="Badges.php" hash="ef1b25b841ab24db961a9007de26d3a2"/><file name="Coupons.php" hash="d194a60a18c8ef5d50885de48edd5f58"/><file name="Successpages.php" hash="f90e95b81a385aa6e11ca7ece3ade63b"/></dir><dir name="Sales"><file name="Observer.php" hash="ca70bb57f270691743c9683438cda6c0"/></dir><dir name="SalesRule"><dir name="Condition"><file name="Bonusbox.php" hash="9eeaf056104a8dcd55d7ba37e7d00184"/></dir><file name="Validator.php" hash="db2446fb3b40d660bc5a413e3ca9e5ec"/></dir><file name="Client.php" hash="4ba2bf781bbf3ad5125fdae40170f03f"/><file name="Session.php" hash="afd1b944ef8a37533fbe725c750b5c10"/></dir><file name="Exception.php" hash="3816ef60762bc800941bfb975525d581"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="bonusbox.xml" hash="8a0f839c7be99208bd860cd788fb37fe"/></dir><dir name="template"><dir name="bonusbox"><dir name="checkout"><file name="success.phtml" hash="2db7c3f9ba5bc1ba70332550c9def603"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bonusbox_Bonusbox.xml" hash="924b6d17825c821f6d4e5846eba164c5"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|