Version Notes
Loyalty programme for success pages
Download this release
Release Info
Developer | Magento Core Team |
Extension | Bonusbox_Bonusbox1 |
Version | 0.9.0 |
Comparing to | |
See all releases |
Version 0.9.0
- app/code/community/Bonusbox/Bonusbox/Block/Checkout/Success.php +42 -0
- app/code/community/Bonusbox/Bonusbox/Helper/Data.php +70 -0
- app/code/community/Bonusbox/Bonusbox/Helper/Successpage.php +10 -0
- app/code/community/Bonusbox/Bonusbox/Model/Client.php +184 -0
- app/code/community/Bonusbox/Bonusbox/controllers/TestController.php +24 -0
- app/code/community/Bonusbox/Bonusbox/etc/config.xml +119 -0
- app/code/community/Bonusbox/Bonusbox/etc/system.xml +134 -0
- app/design/frontend/default/default/layout/bonusbox.xml +8 -0
- app/design/frontend/default/default/template/bonusbox/checkout/success.phtml +1 -0
- app/etc/modules/Bonusbox_Bonusbox.xml +9 -0
- package.xml +20 -0
app/code/community/Bonusbox/Bonusbox/Block/Checkout/Success.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Bonusbox_Bonusbox_Block_Checkout_Success extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
protected $_template = 'bonusbox/checkout/success.phtml';
|
5 |
+
|
6 |
+
protected function _beforeToHtml()
|
7 |
+
{
|
8 |
+
parent::_beforeToHtml();
|
9 |
+
try {
|
10 |
+
if (Mage::helper('bonusbox/successpage')->isOperational())
|
11 |
+
{
|
12 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
13 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
14 |
+
if ($order->getId())
|
15 |
+
{
|
16 |
+
$response = Mage::getModel('bonusbox/client')->requestSuccessPage($order);
|
17 |
+
$this->setSuccessPageUrl($response['success_page']['url']);
|
18 |
+
}
|
19 |
+
else {
|
20 |
+
throw new Exception('No Order found for success page.');
|
21 |
+
}
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
Mage::log('Bonusbox Success Page is missing config data.');
|
25 |
+
}
|
26 |
+
}
|
27 |
+
catch (Exception $ex)
|
28 |
+
{
|
29 |
+
Mage::helper('bonusbox')->log($ex);
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
protected function _toHtml()
|
36 |
+
{
|
37 |
+
if ($this->getSuccessPageUrl())
|
38 |
+
{
|
39 |
+
return parent::_toHtml();
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Bonusbox/Bonusbox/Helper/Data.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Bonusbox_Bonusbox_Helper_Data extends Mage_Core_Helper_Data
|
3 |
+
{
|
4 |
+
protected $configCode = 'bonusbox';
|
5 |
+
|
6 |
+
protected $configSection = 'general';
|
7 |
+
|
8 |
+
public function getConfig($key)
|
9 |
+
{
|
10 |
+
return Mage::getStoreConfig($this->configCode . '/' . $this->configSection . '/' . $key);
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
public function isEnabled()
|
15 |
+
{
|
16 |
+
return $this->getConfig('enabled');
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
public function isLive()
|
21 |
+
{
|
22 |
+
return $this->getConfig('live');
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
public function isOperational()
|
27 |
+
{
|
28 |
+
return $this->isEnabled() && $this->getKey('public') && $this->getKey('secret');
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
public function getKey($secret)
|
33 |
+
{
|
34 |
+
$mode = $this->isLive() ? 'live' : 'test';
|
35 |
+
$type = $secret ? 'secret' : 'public';
|
36 |
+
return $this->getConfig($mode . '_' . $type . '_key');
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
public function log($message)
|
41 |
+
{
|
42 |
+
if ($this->isLive())
|
43 |
+
{
|
44 |
+
Mage::log((string)$message);
|
45 |
+
try {
|
46 |
+
$mail = new Zend_Mail('utf-8');
|
47 |
+
$mail
|
48 |
+
->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'))
|
49 |
+
->addTo($this->getConfig('debug_email'))
|
50 |
+
->setSubject('Bonusbox Magento Error')
|
51 |
+
->setBodyText((string)$message)
|
52 |
+
->send()
|
53 |
+
;
|
54 |
+
}
|
55 |
+
catch (Exception $ex)
|
56 |
+
{
|
57 |
+
Mage::logException($ex);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
else {
|
61 |
+
if ($message instanceof Exception)
|
62 |
+
{
|
63 |
+
throw $message;
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
throw new Mage_Core_Exception($message);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Bonusbox/Bonusbox/Helper/Successpage.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Bonusbox_Bonusbox_Helper_Successpage extends Bonusbox_Bonusbox_Helper_Data
|
3 |
+
{
|
4 |
+
protected $configSection = 'success_page';
|
5 |
+
|
6 |
+
public function isOperational()
|
7 |
+
{
|
8 |
+
return Mage::helper('bonusbox')->isOperational() && $this->getConfig('coupon_code');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Bonusbox/Bonusbox/Model/Client.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Bonusbox_Bonusbox_Model_Client extends Varien_Http_Client
|
3 |
+
{
|
4 |
+
const CONTENT_TYPE = 'application/json';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* set default config data
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
$this
|
13 |
+
->setHeaders('Accept', Mage::helper('bonusbox')->getConfig('accept_header'))
|
14 |
+
->setHeaders('Content-Type', self::CONTENT_TYPE)
|
15 |
+
;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Encodes data to json format
|
20 |
+
* @param mixed $body
|
21 |
+
*/
|
22 |
+
public function encodeData($body)
|
23 |
+
{
|
24 |
+
return json_encode($body);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Decodes data from json format
|
29 |
+
* @param unknown_type $body
|
30 |
+
*/
|
31 |
+
public function decodeData($body)
|
32 |
+
{
|
33 |
+
return json_decode($body, true);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Request a resource with given data.
|
38 |
+
* @param string $resource
|
39 |
+
* @param bool $secret - Flag for secure/public key
|
40 |
+
* @param mixed $data
|
41 |
+
*/
|
42 |
+
public function requestResource($resource, $secret, $data = null)
|
43 |
+
{
|
44 |
+
try {
|
45 |
+
$this
|
46 |
+
->setAuth(Mage::helper('bonusbox')->getKey($secret))
|
47 |
+
->setUri(Mage::helper('bonusbox')->getConfig('url') . $resource)
|
48 |
+
->setRawData($this->encodeData($data))
|
49 |
+
;
|
50 |
+
$response = $this->request('POST');
|
51 |
+
if (strpos($response->getStatus(), '2') === 0) # codes in the 2xx range indicate success
|
52 |
+
{
|
53 |
+
return $this->decodeData($response->getBody());
|
54 |
+
}
|
55 |
+
else {
|
56 |
+
Mage::helper('bonusbox')->log((string)$this . "\n\n" . (string)$response);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
catch (Exception $ex)
|
60 |
+
{
|
61 |
+
Mage::helper('bonusbox')->log($ex);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Sets required data from address object to array
|
67 |
+
* @param Mage_Sales_Model_Order_Address $address
|
68 |
+
*/
|
69 |
+
protected function getAddressPost(Mage_Sales_Model_Order_Address $address)
|
70 |
+
{
|
71 |
+
return array(
|
72 |
+
'code' => $address->getAddressType(),
|
73 |
+
'city' => $address->getCity(),
|
74 |
+
'company' => $address->getCompany(),
|
75 |
+
'region' => $address->getRegion(),
|
76 |
+
'country' => $address->getCountry(),
|
77 |
+
'firstname' => $address->getFirstname(),
|
78 |
+
'lastname' => $address->getLastname(),
|
79 |
+
'phone' => $address->getTelephone(),
|
80 |
+
'fax' => $address->getFax(),
|
81 |
+
'email' => $address->getEmail(),
|
82 |
+
'street' => $address->getStreetFull(),
|
83 |
+
'zip' => $address->getPostcode()
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Formats decimal values to int by multiplying and rounding
|
89 |
+
* @param decimal $value
|
90 |
+
* @param int $precision
|
91 |
+
* @return int
|
92 |
+
*/
|
93 |
+
protected function encodeDecimal($value, $precision = 2)
|
94 |
+
{
|
95 |
+
return round($value * pow(10, $precision));
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Request resource success_pages with order data
|
100 |
+
* Return url and token, if successful, otherwise detailed error description
|
101 |
+
* @param Mage_Sales_Model_Order $order
|
102 |
+
* @return mixed
|
103 |
+
*/
|
104 |
+
public function requestSuccessPage(Mage_Sales_Model_Order $order)
|
105 |
+
{
|
106 |
+
$payment = $order->getPayment();
|
107 |
+
$helper = Mage::helper('bonusbox/successpage');
|
108 |
+
|
109 |
+
$data = array(
|
110 |
+
'addresses' => array(
|
111 |
+
$this->getAddressPost($order->getBillingAddress()),
|
112 |
+
$this->getAddressPost($order->getShippingAddress())
|
113 |
+
),
|
114 |
+
'discount' => array(
|
115 |
+
'token' => $helper->getConfig('coupon_code'),
|
116 |
+
'expires_at' => $helper->getConfig('coupon_expires_at'),
|
117 |
+
'title' => $helper->getConfig('coupon_title'),
|
118 |
+
'description' => $helper->getConfig('coupon_description')
|
119 |
+
),
|
120 |
+
'discounts_used' => $order->getCouponCode() ? array($order->getCouponCode()) : null,
|
121 |
+
'items' => array(
|
122 |
+
array(
|
123 |
+
'code' => 'shipping',
|
124 |
+
'quantity' => $this->encodeDecimal(1),
|
125 |
+
'sku' => $order->getShippingMethod(),
|
126 |
+
'title' => $order->getShippingDescription(),
|
127 |
+
'price' => $this->encodeDecimal($order->getData('shipping_amount')),
|
128 |
+
'vat_amount' => $this->encodeDecimal($order->getData('shipping_tax_amount')),
|
129 |
+
'vat_rate' => $order->getData('shipping_amount') > 0 ? $this->encodeDecimal($order->getData('shipping_tax_amount') / ($order->getData('shipping_amount'))) : 0
|
130 |
+
),
|
131 |
+
array(
|
132 |
+
'code' => 'payment',
|
133 |
+
'quantity' => $this->encodeDecimal(1),
|
134 |
+
'sku' => $payment->getMethod(),
|
135 |
+
'title' => $payment->getMethodInstance()->getTitle(),
|
136 |
+
'price' => 0,
|
137 |
+
'vat_amount' => 0,
|
138 |
+
'vat_rate' => 0
|
139 |
+
),
|
140 |
+
),
|
141 |
+
'currency' => $order->getData('order_currency_code'),
|
142 |
+
'order_number' => $order->getData('increment_id'),
|
143 |
+
'new_user_text' => $helper->getConfig('new_user_text'),
|
144 |
+
'bonusbox_user_text' => $helper->getConfig('bonusbox_user_text'),
|
145 |
+
'style_url' => Mage::getDesign()->getSkinUrl($helper->getConfig('style_url'), array())
|
146 |
+
);
|
147 |
+
|
148 |
+
foreach ($order->getAllItems() as $item)
|
149 |
+
{
|
150 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
151 |
+
$data['items'][] = array(
|
152 |
+
'code' => 'product',
|
153 |
+
'sku' => $item->getSku(),
|
154 |
+
'quantity' => round($item->getQtyOrdered()),
|
155 |
+
'title' => $item->getName(),
|
156 |
+
'description' => $item->getDescription(),
|
157 |
+
'price' => $this->encodeDecimal($item->getData('price')),
|
158 |
+
'vat_rate' => $this->encodeDecimal($item->getData('tax_percent')),
|
159 |
+
'vat_amount' => $this->encodeDecimal($item->getData('tax_amount')),
|
160 |
+
'landing_page' => $product->getUrlModel()->getUrl($product, array('_ignore_category' => true)),
|
161 |
+
'image_url' => Mage::helper('catalog/image')->init($product, 'image')->__toString()
|
162 |
+
);
|
163 |
+
}
|
164 |
+
return $this->requestResource('success_pages', true, $data);
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Super class does not support __toString
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
public function __toString()
|
172 |
+
{
|
173 |
+
foreach ($this->headers as $header)
|
174 |
+
{
|
175 |
+
$headers[] = $header[0] . ': ' . $header[1];
|
176 |
+
}
|
177 |
+
return implode("\n", array(
|
178 |
+
(string)$this->getUri(),
|
179 |
+
implode("\n", $headers),
|
180 |
+
'Authorization: ' . $this->auth['type'] . ' ' . $this->auth['user'] . ':' . $this->auth['password'],
|
181 |
+
$this->raw_post_data
|
182 |
+
));
|
183 |
+
}
|
184 |
+
}
|
app/code/community/Bonusbox/Bonusbox/controllers/TestController.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
3 |
+
class Bonusbox_Bonusbox_TestController extends Mage_Checkout_OnepageController
|
4 |
+
{
|
5 |
+
protected function getOrder()
|
6 |
+
{
|
7 |
+
return Mage::getModel('sales/order')->getResourceCollection()
|
8 |
+
->setPageSize(1)
|
9 |
+
->getFirstItem()
|
10 |
+
;
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
public function successAction()
|
15 |
+
{
|
16 |
+
$order = $this->getOrder();
|
17 |
+
$session = $this->getOnepage()->getCheckout();
|
18 |
+
$session->setLastOrderId($order->getId());
|
19 |
+
|
20 |
+
$this->loadLayout();
|
21 |
+
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('bonusbox/checkout_success'));
|
22 |
+
$this->renderLayout();
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Bonusbox/Bonusbox/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<bonusbox_bonusbox>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</bonusbox_bonusbox>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<bonusbox>
|
11 |
+
<class>Bonusbox_Bonusbox_Model</class>
|
12 |
+
</bonusbox>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<bonusbox>
|
16 |
+
<class>Bonusbox_Bonusbox_Helper</class>
|
17 |
+
</bonusbox>
|
18 |
+
</helpers>
|
19 |
+
<blocks>
|
20 |
+
<bonusbox>
|
21 |
+
<class>Bonusbox_Bonusbox_Block</class>
|
22 |
+
</bonusbox>
|
23 |
+
</blocks>
|
24 |
+
|
25 |
+
<resources>
|
26 |
+
<bonusbox_setup>
|
27 |
+
<setup><module>Bonusbox_Bonusbox</module></setup>
|
28 |
+
<connection><use>core_setup</use></connection>
|
29 |
+
</bonusbox_setup>
|
30 |
+
<bonusbox_write>
|
31 |
+
<connection><use>core_write</use></connection>
|
32 |
+
</bonusbox_write>
|
33 |
+
<bonusbox_read>
|
34 |
+
<connection><use>core_read</use></connection>
|
35 |
+
</bonusbox_read>
|
36 |
+
</resources>
|
37 |
+
</global>
|
38 |
+
|
39 |
+
<frontend>
|
40 |
+
<routers>
|
41 |
+
<bonusbox_test>
|
42 |
+
<use>standard</use>
|
43 |
+
<args>
|
44 |
+
<module>Bonusbox_Bonusbox</module>
|
45 |
+
<frontName>bonusbox</frontName>
|
46 |
+
</args>
|
47 |
+
</bonusbox_test>
|
48 |
+
</routers>
|
49 |
+
|
50 |
+
<layout>
|
51 |
+
<updates>
|
52 |
+
<bonusbox>
|
53 |
+
<file>bonusbox.xml</file>
|
54 |
+
</bonusbox>
|
55 |
+
</updates>
|
56 |
+
</layout>
|
57 |
+
</frontend>
|
58 |
+
|
59 |
+
<adminhtml>
|
60 |
+
<acl>
|
61 |
+
<resources>
|
62 |
+
<admin>
|
63 |
+
<children>
|
64 |
+
<system>
|
65 |
+
<children>
|
66 |
+
<config>
|
67 |
+
<children>
|
68 |
+
<bonusbox translate="title" module="bonusbox">
|
69 |
+
<title>Bonusbox</title>
|
70 |
+
</bonusbox>
|
71 |
+
</children>
|
72 |
+
</config>
|
73 |
+
</children>
|
74 |
+
</system>
|
75 |
+
<bonusbox>
|
76 |
+
<title>Bonusbox</title>
|
77 |
+
<sort_order>71</sort_order>
|
78 |
+
<children>
|
79 |
+
<bonusbox translate="title" module="bonusbox">
|
80 |
+
<title>Config</title>
|
81 |
+
<sort_order>0</sort_order>
|
82 |
+
</bonusbox>
|
83 |
+
</children>
|
84 |
+
</bonusbox>
|
85 |
+
</children>
|
86 |
+
</admin>
|
87 |
+
</resources>
|
88 |
+
</acl>
|
89 |
+
<translate>
|
90 |
+
<modules>
|
91 |
+
<bonusbox_bonusbox>
|
92 |
+
<files>
|
93 |
+
<default>bonusbox_admin.csv</default>
|
94 |
+
</files>
|
95 |
+
</bonusbox_bonusbox>
|
96 |
+
</modules>
|
97 |
+
</translate>
|
98 |
+
</adminhtml>
|
99 |
+
|
100 |
+
<default>
|
101 |
+
<bonusbox>
|
102 |
+
<general>
|
103 |
+
<enabled>0</enabled>
|
104 |
+
<live>0</live>
|
105 |
+
<live_public_key />
|
106 |
+
<live_secret_key />
|
107 |
+
<test_public_key />
|
108 |
+
<test_secret_key />
|
109 |
+
<url><![CDATA[https://api.bonusbox.me/]]></url>
|
110 |
+
<accept_header><![CDATA[application/json,application/vnd.api;ver=1]]></accept_header>
|
111 |
+
<debug_email><![CDATA[no-reply@bonusbox.me]]></debug_email>
|
112 |
+
</general>
|
113 |
+
<success_page>
|
114 |
+
<new_user_text>Sichere dir %{CREDITS:ACHIEVED} Bonusbox-Punkte und einen Gutschein für deinen nächsten Einkauf!</new_user_text>
|
115 |
+
<bonusbox_user_text>Du hast für deinen Einkauf %{CREDITS:ACHIEVED} Punkte bekommen. Die fehlen noch %{CREDITS:LEVELUP} um den naechsten %{BADGE:LEVELUP} zu erreichen.</bonusbox_user_text>
|
116 |
+
</success_page>
|
117 |
+
</bonusbox>
|
118 |
+
</default>
|
119 |
+
</config>
|
app/code/community/Bonusbox/Bonusbox/etc/system.xml
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<bonusbox translate="label" module="bonusbox">
|
5 |
+
<label>Bonusbox</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<sort_order>70</sort_order>
|
8 |
+
<show_in_default>1</show_in_default>
|
9 |
+
<show_in_website>1</show_in_website>
|
10 |
+
<show_in_store>1</show_in_store>
|
11 |
+
<groups>
|
12 |
+
<general>
|
13 |
+
<label>General</label>
|
14 |
+
<sort_order>10</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<fields>
|
19 |
+
<enabled translate="label">
|
20 |
+
<label>Enabled</label>
|
21 |
+
<frontend_type>select</frontend_type>
|
22 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
23 |
+
<sort_order>10</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
</enabled>
|
28 |
+
<live>
|
29 |
+
<label>Live Mode</label>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<comment>False equals test mode.</comment>
|
33 |
+
<sort_order>20</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
</live>
|
38 |
+
<live_public_key translate="label">
|
39 |
+
<label>Public Key (Live)</label>
|
40 |
+
<sort_order>30</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</live_public_key>
|
45 |
+
<live_secret_key translate="label">
|
46 |
+
<label>Secret Key (Live)</label>
|
47 |
+
<sort_order>40</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 |
+
</live_secret_key>
|
52 |
+
<test_public_key translate="label">
|
53 |
+
<label>Public Key (Test)</label>
|
54 |
+
<sort_order>50</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
</test_public_key>
|
59 |
+
<test_secret_key translate="label">
|
60 |
+
<label>Secret Key (Test)</label>
|
61 |
+
<sort_order>60</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
</test_secret_key>
|
66 |
+
</fields>
|
67 |
+
</general>
|
68 |
+
<success_page>
|
69 |
+
<label>Checkout Success Page</label>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<fields>
|
75 |
+
<coupon_code translate="label">
|
76 |
+
<label>Coupon Code</label>
|
77 |
+
<comment>A valid shopping cart price rule with this code must exists.</comment>
|
78 |
+
<sort_order>10</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 |
+
</coupon_code>
|
83 |
+
<coupon_title translate="label">
|
84 |
+
<label>Title</label>
|
85 |
+
<sort_order>20</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 |
+
</coupon_title>
|
90 |
+
<coupon_description translate="label">
|
91 |
+
<label>Description</label>
|
92 |
+
<frontend_type>textarea</frontend_type>
|
93 |
+
<sort_order>30</sort_order>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
</coupon_description>
|
98 |
+
<coupon_expires_at translate="label">
|
99 |
+
<label>Coupon Expires At</label>
|
100 |
+
<sort_order>40</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</coupon_expires_at>
|
105 |
+
<new_user_text translate="label">
|
106 |
+
<label>New User Text</label>
|
107 |
+
<frontend_type>textarea</frontend_type>
|
108 |
+
<sort_order>50</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</new_user_text>
|
113 |
+
<bonusbox_user_text translate="label">
|
114 |
+
<label>Bonusbox User Text</label>
|
115 |
+
<frontend_type>textarea</frontend_type>
|
116 |
+
<sort_order>60</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
</bonusbox_user_text>
|
121 |
+
<style_url translate="label">
|
122 |
+
<label>Stylesheet</label>
|
123 |
+
<comment>Provide the path relative to your skin path (e.g. "css/bonusbox.css").</comment>
|
124 |
+
<sort_order>70</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>1</show_in_store>
|
128 |
+
</style_url>
|
129 |
+
</fields>
|
130 |
+
</success_page>
|
131 |
+
</groups>
|
132 |
+
</bonusbox>
|
133 |
+
</sections>
|
134 |
+
</config>
|
app/design/frontend/default/default/layout/bonusbox.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
</layout>
|
app/design/frontend/default/default/template/bonusbox/checkout/success.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<iframe style="overflow: hidden; border: 0; width: 100%;" src="<?php echo $this->getSuccessPageUrl() ?>" />
|
app/etc/modules/Bonusbox_Bonusbox.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Bonusbox_Bonusbox>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Bonusbox_Bonusbox>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Bonusbox_Bonusbox1</name>
|
4 |
+
<version>0.9.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/MIT">MIT License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Set up your loyalty program in Facebook, reward referrals and win new customers!</summary>
|
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>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>2011-11-22</date>
|
16 |
+
<time>01:49:53</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Bonusbox"><dir name="Bonusbox"><dir name="Block"><dir name="Checkout"><file name="Success.php" hash="d7612dcbdd975b6bca3c5cc1454ae161"/></dir></dir><dir name="controllers"><file name="TestController.php" hash="76ab46446b6f9755a31d5a808ae0d0d7"/></dir><dir name="etc"><file name="config.xml" hash="93d25c0bdce345f6ddcd2bd3cda4f1e2"/><file name="system.xml" hash="8d2efc676d7937656781001e7002899c"/></dir><dir name="Helper"><file name="Data.php" hash="2b91b32a971fc0a72c37860728b8dc4a"/><file name="Successpage.php" hash="c9713b9155ad608a95ddac2bf5e55b06"/></dir><dir name="Model"><file name="Client.php" hash="eb6e8e450d538cf541fc00f891284671"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="bonusbox.xml" hash="f54448012a1ded76fba3e17626fe36da"/></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>
|