Version Notes
- repackaging
Download this release
Release Info
Developer | ORBA |
Extension | Orba_Multipunkty |
Version | 0.2.1 |
Comparing to | |
See all releases |
Version 0.2.1
- app/code/community/Orba/Multipunkty/Block/Account.php +96 -0
- app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Button/Register.php +60 -0
- app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Select/Disabled.php +14 -0
- app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Service/Launch.php +18 -0
- app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Service/Status.php +46 -0
- app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Text/Points.php +22 -0
- app/code/community/Orba/Multipunkty/Block/Cart.php +25 -0
- app/code/community/Orba/Multipunkty/Block/Checkout.php +27 -0
- app/code/community/Orba/Multipunkty/Block/Checkout/Transaction.php +25 -0
- app/code/community/Orba/Multipunkty/Block/Home.php +25 -0
- app/code/community/Orba/Multipunkty/Block/Product.php +25 -0
- app/code/community/Orba/Multipunkty/Helper/Data.php +135 -0
- app/code/community/Orba/Multipunkty/Model/Api/Abstract.php +20 -0
- app/code/community/Orba/Multipunkty/Model/Api/Client.php +255 -0
- app/code/community/Orba/Multipunkty/Model/Api/Server.php +175 -0
- app/code/community/Orba/Multipunkty/Model/Config.php +27 -0
- app/code/community/Orba/Multipunkty/Model/Eav/Abstract.php +70 -0
- app/code/community/Orba/Multipunkty/Model/Eav/Customer.php +30 -0
- app/code/community/Orba/Multipunkty/Model/Eav/Product.php +15 -0
- app/code/community/Orba/Multipunkty/Model/Mysql4/Nonce.php +9 -0
- app/code/community/Orba/Multipunkty/Model/Mysql4/Nonce/Collection.php +11 -0
- app/code/community/Orba/Multipunkty/Model/Mysql4/Setup.php +5 -0
- app/code/community/Orba/Multipunkty/Model/Mysql4/Transaction.php +9 -0
- app/code/community/Orba/Multipunkty/Model/Mysql4/Transaction/Collection.php +11 -0
- app/code/community/Orba/Multipunkty/Model/Nonce.php +8 -0
- app/code/community/Orba/Multipunkty/Model/Observer.php +135 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Backend/Points.php +27 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Backend/Service/Launch.php +16 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Backend/Service/Status.php +33 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Source/Enabledisable.php +12 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Source/Payment/Methods.php +15 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Source/Points/Ttl.php +18 -0
- app/code/community/Orba/Multipunkty/Model/System/Config/Source/Rewardscatalog/Options.php +16 -0
- app/code/community/Orba/Multipunkty/Model/Transaction.php +8 -0
- app/code/community/Orba/Multipunkty/controllers/CustomerController.php +172 -0
- app/code/community/Orba/Multipunkty/controllers/IndexController.php +145 -0
- app/code/community/Orba/Multipunkty/etc/adminhtml.xml +14 -0
- app/code/community/Orba/Multipunkty/etc/config.xml +180 -0
- app/code/community/Orba/Multipunkty/etc/system.xml +262 -0
- app/code/community/Orba/Multipunkty/sql/multipunkty_setup/mysql4-install-0.1.0.php +32 -0
- app/code/community/Orba/Multipunkty/sql/multipunkty_setup/mysql4-upgrade-0.1.0-0.2.0.php +22 -0
- app/code/community/Orba/Multipunkty/sql/multipunkty_setup/mysql4-upgrade-0.2.0-0.2.1.php +25 -0
- app/design/adminhtml/default/default/layout/multipunkty.xml +13 -0
- app/design/adminhtml/default/default/template/multipunkty/rewardscatalog.phtml +13 -0
- app/design/frontend/base/default/template/multipunkty/account.phtml +88 -0
- app/design/frontend/base/default/template/multipunkty/cart.phtml +13 -0
- app/design/frontend/base/default/template/multipunkty/checkout.phtml +19 -0
- app/design/frontend/base/default/template/multipunkty/checkout.transaction.phtml +46 -0
- app/design/frontend/base/default/template/multipunkty/checkout/onepage/payment/methods.phtml +115 -0
- app/design/frontend/base/default/template/multipunkty/email/order_new.phtml +50 -0
- app/design/frontend/base/default/template/multipunkty/home.phtml +11 -0
- app/design/frontend/base/default/template/multipunkty/product.phtml +11 -0
- app/etc/modules/Orba_Multipunkty.xml +9 -0
- app/locale/en_US/template/email/multipunkty/order_new.html +26 -0
- app/locale/pl_PL/Orba_Multipunkty.csv +73 -0
- js/multipunkty/api.js +1 -0
- js/multipunkty/registerHandler.js +27 -0
- package.xml +20 -0
- skin/frontend/base/default/css/multipunkty/multipunkty.css +60 -0
app/code/community/Orba/Multipunkty/Block/Account.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Account extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
protected $_subscription = null;
|
6 |
+
|
7 |
+
public function getCustomer()
|
8 |
+
{
|
9 |
+
return Mage::getSingleton('customer/session')->getCustomer();
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getAccountUrl()
|
13 |
+
{
|
14 |
+
return Mage::getUrl('customer/account/edit', array('_secure'=>true));
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getAddressesUrl()
|
18 |
+
{
|
19 |
+
return Mage::getUrl('customer/address/index', array('_secure'=>true));
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getAddressEditUrl($address)
|
23 |
+
{
|
24 |
+
return Mage::getUrl('customer/address/edit', array('_secure'=>true, 'id'=>$address->getId()));
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getOrdersUrl()
|
28 |
+
{
|
29 |
+
return Mage::getUrl('customer/order/index', array('_secure'=>true));
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getReviewsUrl()
|
33 |
+
{
|
34 |
+
return Mage::getUrl('review/customer/index', array('_secure'=>true));
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getWishlistUrl()
|
38 |
+
{
|
39 |
+
return Mage::getUrl('customer/wishlist/index', array('_secure'=>true));
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getTagsUrl()
|
43 |
+
{
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getSubscriptionObject()
|
48 |
+
{
|
49 |
+
if(is_null($this->_subscription)) {
|
50 |
+
$this->_subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer($this->getCustomer());
|
51 |
+
}
|
52 |
+
|
53 |
+
return $this->_subscription;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function getManageNewsletterUrl()
|
57 |
+
{
|
58 |
+
return $this->getUrl('*/newsletter/manage');
|
59 |
+
}
|
60 |
+
|
61 |
+
public function getSubscriptionText()
|
62 |
+
{
|
63 |
+
if($this->getSubscriptionObject()->isSubscribed()) {
|
64 |
+
return Mage::helper('customer')->__('You are currently subscribed to our newsletter.');
|
65 |
+
}
|
66 |
+
|
67 |
+
return Mage::helper('customer')->__('You are currently not subscribed to our newsletter.');
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getPrimaryAddresses()
|
71 |
+
{
|
72 |
+
$addresses = $this->getCustomer()->getPrimaryAddresses();
|
73 |
+
if (empty($addresses)) {
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
return $addresses;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Get back url in account dashboard
|
81 |
+
*
|
82 |
+
* This method is copypasted in:
|
83 |
+
* Mage_Wishlist_Block_Customer_Wishlist - because of strange inheritance
|
84 |
+
* Mage_Customer_Block_Address_Book - because of secure url
|
85 |
+
*
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function getBackUrl()
|
89 |
+
{
|
90 |
+
// the RefererUrl must be set in appropriate controller
|
91 |
+
if ($this->getRefererUrl()) {
|
92 |
+
return $this->getRefererUrl();
|
93 |
+
}
|
94 |
+
return $this->getUrl('customer/account/');
|
95 |
+
}
|
96 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Button/Register.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Adminhtml_System_Button_Register extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$this->setElement($element);
|
8 |
+
|
9 |
+
$helper = Mage::helper('multipunkty');
|
10 |
+
|
11 |
+
if($helper->isStoreRegistered())
|
12 |
+
{
|
13 |
+
$btnTxt = 'Account Registered';
|
14 |
+
$commentHtml = '';
|
15 |
+
$element->setReadOnly(true,true);
|
16 |
+
|
17 |
+
$onClickUrl = false;
|
18 |
+
}else{
|
19 |
+
$btnTxt = 'Register Account';
|
20 |
+
|
21 |
+
$onClickUrl = 'regStore()';
|
22 |
+
|
23 |
+
$commentHtml = '<p class="note"><span>'.$helper->__('Click here to activate your account in MultiPunkty.pl service').'</span></p>';
|
24 |
+
}
|
25 |
+
|
26 |
+
//Build button
|
27 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
+
->setType('button')
|
29 |
+
->setClass('scalable')
|
30 |
+
->setLabel($helper->__($btnTxt))
|
31 |
+
->setOnClick($onClickUrl);
|
32 |
+
|
33 |
+
$html = $button->toHtml();
|
34 |
+
|
35 |
+
/*
|
36 |
+
* Create JS to handle register button
|
37 |
+
*/
|
38 |
+
$jsHtml = '<script type="text/javascript">
|
39 |
+
function regStore()
|
40 |
+
{
|
41 |
+
new Ajax.Request("'.$this->getUrl('multipunkty/index/fetchdata').'", {
|
42 |
+
onSuccess: function(response) {
|
43 |
+
var data = response.responseText.evalJSON();
|
44 |
+
$MP.api.connectPartner(data.appId, data.partnerFK, data.secret, data.eventUrl, data.returnUrl, {
|
45 |
+
name: data.storeName,
|
46 |
+
categories: "[ " +data.categories+" ]",
|
47 |
+
url: data.storeUrl,
|
48 |
+
email: data.email,
|
49 |
+
phone: data.phone,
|
50 |
+
firstname: data.firstName
|
51 |
+
});
|
52 |
+
}
|
53 |
+
});
|
54 |
+
}
|
55 |
+
</script>';
|
56 |
+
|
57 |
+
return $html . $commentHtml . $jsHtml;
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Select/Disabled.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Adminhtml_System_Select_Disabled extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$this->setElement($element);
|
8 |
+
|
9 |
+
$element->setReadonly(true, true);
|
10 |
+
|
11 |
+
return $element->getElementHtml();
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Service/Launch.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Adminhtml_System_Service_Launch extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$this->setElement($element);
|
8 |
+
|
9 |
+
if(!Mage::helper('multipunkty')->isStoreRegistered())
|
10 |
+
{
|
11 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/launch_service', "0");
|
12 |
+
$element->setReadOnly(true,true);
|
13 |
+
}
|
14 |
+
|
15 |
+
return $element->getElementHtml();
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Service/Status.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Adminhtml_System_Service_Status extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$_helper = Mage::helper('multipunkty');
|
8 |
+
$descrHtml = '';
|
9 |
+
|
10 |
+
$this->setElement($element);
|
11 |
+
|
12 |
+
$element->setReadOnly(true,true);
|
13 |
+
|
14 |
+
if(!($_helper->isActive() && $_helper->isStoreRegistered() && Mage::getStoreConfig('multipunkty/start_settings/points_amount') != 0)){
|
15 |
+
if(!$_helper->isStoreRegistered())
|
16 |
+
{
|
17 |
+
$msg = $_helper->__('No account - create one or complete registration process');
|
18 |
+
}else if(Mage::getStoreConfig('multipunkty/start_settings/points_amount') == 0) {
|
19 |
+
$msg = $_helper->__('No Multipoints - buy credits');
|
20 |
+
}else {
|
21 |
+
|
22 |
+
$apiClient = Mage::getModel('multipunkty/api_client');
|
23 |
+
$data = $apiClient->getPartnerStatus();
|
24 |
+
|
25 |
+
if($data->isEnabled)
|
26 |
+
{
|
27 |
+
$msg = '';
|
28 |
+
}else{
|
29 |
+
$msg = $_helper->__('After activating your account using activation link sent by email, please launch service in module and save changes');
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
if(!empty($msg))
|
35 |
+
{
|
36 |
+
$descrHtml = '<p class="note"><span style="color: #ea7601;">'.$msg.'</span></p>';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
$html = $element->getElementHtml();
|
41 |
+
$html .= $descrHtml;
|
42 |
+
|
43 |
+
return $html;
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Adminhtml/System/Text/Points.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Adminhtml_System_Text_Points extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$helper = Mage::helper('multipunkty');
|
8 |
+
$txtMore = $helper->__('You get 1000 MP$ at the beginning, which you can reward your customers for the purchase');
|
9 |
+
$url = $helper->getBuyCreditsUrl();
|
10 |
+
$element->setReadOnly(true, true);
|
11 |
+
$element->setTitle($txtMore);
|
12 |
+
$this->setElement($element);
|
13 |
+
|
14 |
+
$html = $element->getElementHtml();
|
15 |
+
$html .= '<p class="note"><span><a href="'.$url.'" target="_blank" title="';
|
16 |
+
$html .= $txtMore;
|
17 |
+
$html .= '">'.$helper->__('Buy credits').'</a></span></p>';
|
18 |
+
|
19 |
+
return $html;
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Cart.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Cart extends Mage_Core_Block_Template {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function isVisible()
|
10 |
+
{
|
11 |
+
if (Mage::helper('multipunkty')->isActiveCart() AND Mage::helper('multipunkty')->serviceActive())
|
12 |
+
{
|
13 |
+
return true;
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getPurchaseReward()
|
22 |
+
{
|
23 |
+
return Mage::helper('multipunkty')->getPurchaseReward();
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Checkout.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Checkout extends Mage_Core_Block_Template {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function isVisible()
|
10 |
+
{
|
11 |
+
$helper = Mage::helper('multipunkty');
|
12 |
+
|
13 |
+
if ($helper->isActiveCheckout() AND $helper->serviceActive() AND $helper->isCashOnDeliveryAccepted())
|
14 |
+
{
|
15 |
+
return true;
|
16 |
+
}
|
17 |
+
else
|
18 |
+
{
|
19 |
+
return false;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getPurchaseReward()
|
24 |
+
{
|
25 |
+
return Mage::helper('multipunkty')->getPurchaseReward();
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Checkout/Transaction.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Checkout_Transaction extends Mage_Core_Block_Template {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function isVisible()
|
10 |
+
{
|
11 |
+
if (Mage::helper('multipunkty')->isActive())
|
12 |
+
{
|
13 |
+
return true;
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getPurchaseReward()
|
22 |
+
{
|
23 |
+
return Mage::helper('multipunkty')->getPurchaseReward();
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Home.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Home extends Mage_Core_Block_Template {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function isVisible()
|
10 |
+
{
|
11 |
+
if (Mage::helper('multipunkty')->isActiveHome() AND Mage::helper('multipunkty')->serviceActive())
|
12 |
+
{
|
13 |
+
return true;
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getPurchaseReward()
|
22 |
+
{
|
23 |
+
return Mage::helper('multipunkty')->getPurchaseReward();
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Orba/Multipunkty/Block/Product.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Block_Product extends Mage_Core_Block_Template {
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function isVisible()
|
10 |
+
{
|
11 |
+
if (Mage::helper('multipunkty')->isActiveProduct() AND Mage::helper('multipunkty')->serviceActive())
|
12 |
+
{
|
13 |
+
return true;
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getPurchaseReward()
|
22 |
+
{
|
23 |
+
return Mage::helper('multipunkty')->getPurchaseReward();
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Orba/Multipunkty/Helper/Data.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Basic helper class
|
4 |
+
*
|
5 |
+
* @author
|
6 |
+
*
|
7 |
+
* @created
|
8 |
+
* @lastModified 22-01-2014
|
9 |
+
* @lastModifiedBy Michał Zabielski <michal.zabielski@orba.pl>
|
10 |
+
*/
|
11 |
+
class Orba_Multipunkty_Helper_Data extends Mage_Core_Helper_Abstract {
|
12 |
+
//list of important URL's
|
13 |
+
const URL_BUY_CREDITS = 'http://partner.multipunkty.pl/stan-konta-doladuj';
|
14 |
+
const URL_ABOUT_MP_SITE = 'czym-sa-multipunkty';
|
15 |
+
const URL_HOME_PAGE = 'http://multipunkty.pl';
|
16 |
+
const URL_REGISTER_ACCOUNT_PAGE = 'http://multipunkty.pl/rejestracja';
|
17 |
+
const MAIL_SENDER_EMAIL = 'cafenews@cafenews.pl'; //deprecated
|
18 |
+
const MAIL_SENDER_NAME = 'MultiPunkty.pl'; //deprecated
|
19 |
+
|
20 |
+
public function isActive() {
|
21 |
+
return Mage::getStoreConfig('multipunkty/start_settings/launch_service');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function serviceActive()
|
25 |
+
{
|
26 |
+
return Mage::getStoreConfig('multipunkty/start_settings/service_status') && $this->getPointsAmount() != 0;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function isActiveProduct() {
|
30 |
+
return Mage::getStoreConfig('multipunkty/presenting_information/show_near_product');
|
31 |
+
}
|
32 |
+
|
33 |
+
public function isActiveCart() {
|
34 |
+
return Mage::getStoreConfig('multipunkty/presenting_information/show_near_shopping_cart');
|
35 |
+
}
|
36 |
+
|
37 |
+
public function isActiveHome() {
|
38 |
+
return Mage::getStoreConfig('multipunkty/presenting_information/show_on_homepage');
|
39 |
+
}
|
40 |
+
|
41 |
+
public function isActiveCheckout() {
|
42 |
+
return Mage::getStoreConfig('multipunkty/presenting_information/show_on_summary');
|
43 |
+
}
|
44 |
+
|
45 |
+
public function isStoreRegistered()
|
46 |
+
{
|
47 |
+
$isApiKey = (is_null(Mage::getStoreConfig('multipunkty/basic_config/api_key')) || Mage::getStoreConfig('multipunkty/basic_config/api_key') === '') ? false : true;
|
48 |
+
$isPrivKey = (is_null(Mage::getStoreConfig('multipunkty/basic_config/private_key')) || Mage::getStoreConfig('multipunkty/basic_config/private_key') === '') ? false : true;
|
49 |
+
$isPartnerId = (is_null(Mage::getStoreConfig('multipunkty/basic_config/partner_id'))|| Mage::getStoreConfig('multipunkty/basic_config/partner_id') === '') ? false : true;
|
50 |
+
|
51 |
+
return $isApiKey && $isPrivKey && $isPartnerId;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function isCashOnDeliveryAccepted()
|
55 |
+
{
|
56 |
+
return Mage::getStoreConfig('multipunkty/rewarding_settings/apply_cash_on_delivery');
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getPurchaseReward() {
|
60 |
+
return Mage::getStoreConfig('multipunkty/rewarding_settings/reward_purchase');
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getBuyCreditsUrl()
|
64 |
+
{
|
65 |
+
return self::URL_BUY_CREDITS;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getAboutMPSiteUrl()
|
69 |
+
{
|
70 |
+
return self::URL_HOME_PAGE . '/' . self::URL_ABOUT_MP_SITE;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getHomePageUrl()
|
74 |
+
{
|
75 |
+
return self::URL_HOME_PAGE;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getRegisterAccountUrl()
|
79 |
+
{
|
80 |
+
return self::URL_REGISTER_ACCOUNT_PAGE;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getApiKey()
|
84 |
+
{
|
85 |
+
return Mage::getStoreConfig('multipunkty/basic_config/api_key');
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getPartnerId()
|
89 |
+
{
|
90 |
+
return Mage::getStoreConfig('multipunkty/basic_config/partner_id');
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getPrivateKey()
|
94 |
+
{
|
95 |
+
return Mage::getStoreConfig('multipunkty/basic_config/private_key');
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getTimeToActivateTransaction()
|
99 |
+
{
|
100 |
+
return Mage::getStoreConfig('multipunkty/rewarding_settings/days_after_trans_act');
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getTransactionStatus($status)
|
104 |
+
{
|
105 |
+
switch($status)
|
106 |
+
{
|
107 |
+
case 'Accept':
|
108 |
+
return 'Accept';
|
109 |
+
|
110 |
+
case 'Reject':
|
111 |
+
default:
|
112 |
+
return 'Reject';
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
public function getPointsAmount()
|
117 |
+
{
|
118 |
+
return Mage::getStoreConfig('multipunkty/start_settings/points_amount');
|
119 |
+
}
|
120 |
+
|
121 |
+
public function isDebugMode()
|
122 |
+
{
|
123 |
+
return Mage::getStoreConfig('multipunkty/basic_config/debug_mode');
|
124 |
+
}
|
125 |
+
|
126 |
+
public function getMailSenderEmail()
|
127 |
+
{
|
128 |
+
return self::MAIL_SENDER_EMAIL;
|
129 |
+
}
|
130 |
+
|
131 |
+
public function getMailSenderName()
|
132 |
+
{
|
133 |
+
return self::MAIL_SENDER_NAME;
|
134 |
+
}
|
135 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Api/Abstract.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Api_Abstract extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
const API_URL = 'http://backend.multipunkty.pl/';
|
6 |
+
const API_NONCE_MAX_LEN = 32;
|
7 |
+
const API_APP_ID_LEN = 32;
|
8 |
+
const API_PARTNER_TOKEN_LEN = 128;
|
9 |
+
const API_PARTNER_ID_LEN = 32;
|
10 |
+
const API_TIME_LEN = 15;
|
11 |
+
const API_TIME_MAX_TOLERANTION_SEC = 1800;
|
12 |
+
const API_QUERY_REGISTER_TRANSACTION = 'api/1/transactions/register';
|
13 |
+
const API_QUERY_GET_STATUS = 'api/1/status';
|
14 |
+
const API_QUERY_GET_PARTNER_STATUS = 'api/1/partners/{partnerId}/status';
|
15 |
+
const API_QUERY_ASSIGN_TRANSACTION_TO_USER = 'api/1/transactions/assign';
|
16 |
+
const API_QUERY_CHANGE_TRANSACTION_STATUS = 'api/1/transactions/status';
|
17 |
+
const API_TRANSACTION_STATUS_ACCEPT = 'Accept';
|
18 |
+
const API_TRANSACTION_STATUS_REJECT = 'Reject';
|
19 |
+
|
20 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Api/Client.php
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* MultiPunkty.pl API Client, compatible with API version 5
|
5 |
+
*
|
6 |
+
* @author Michał Zabielski <michal.zabielski@orba.pl>
|
7 |
+
* @created 15-07-2013
|
8 |
+
* @lastModified 26-11-2013
|
9 |
+
*/
|
10 |
+
class Orba_Multipunkty_Model_Api_Client extends Orba_Multipunkty_Model_Api_Abstract {
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Checking if debug mode is active
|
14 |
+
*/
|
15 |
+
protected function isDebugMode()
|
16 |
+
{
|
17 |
+
return Mage::helper('multipunkty')->isDebugMode();
|
18 |
+
}
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Signing queries to MultiPunkty.pl API server
|
22 |
+
* Time format: yyyyMMddTHHmmSS UTC
|
23 |
+
*
|
24 |
+
* @doc Section 4.1, 4.2 from API Specification
|
25 |
+
*/
|
26 |
+
protected function signQuery()
|
27 |
+
{
|
28 |
+
//API requirement
|
29 |
+
date_default_timezone_set('UTC');
|
30 |
+
|
31 |
+
$privatekey = Mage::helper('multipunkty')->getPrivateKey();
|
32 |
+
if(is_null($privatekey) || $privatekey === '')
|
33 |
+
{
|
34 |
+
$privatekey = Mage::getStoreConfig('multipunkty/basic_config/platform_private_key');
|
35 |
+
}
|
36 |
+
$appId = Mage::helper('multipunkty')->getApiKey();
|
37 |
+
if(is_null($appId) || $appId === '')
|
38 |
+
{
|
39 |
+
$appId = Mage::getStoreConfig('multipunkty/basic_config/platform_api_key');
|
40 |
+
}
|
41 |
+
$time = date("Ymd").'T'.date("His");
|
42 |
+
$nonce = substr( md5(time()+rand(0,time())), 0, self::API_NONCE_MAX_LEN );
|
43 |
+
|
44 |
+
//save nonce in database
|
45 |
+
/* $nonceData = Mage::getModel('multipunkty/nonce');
|
46 |
+
$nonceData->setSecretPhrase($nonce);
|
47 |
+
$nonceData->setQueryTime($time);
|
48 |
+
$nonceData->save(); */
|
49 |
+
|
50 |
+
$codingString = $appId.'&'.$time.'&'.$nonce;
|
51 |
+
|
52 |
+
return base64_encode($codingString.'&'.base64_encode(hash_hmac('sha256', $codingString.'&'.$privatekey, $privatekey, true)));
|
53 |
+
}
|
54 |
+
|
55 |
+
/*
|
56 |
+
* Sending query to MultiPunkty.pl
|
57 |
+
* $sufix - const API_QUERY available in configuration (Model/Api/Abstract.php)
|
58 |
+
*
|
59 |
+
* @doc Section 4.2 from API specification
|
60 |
+
*/
|
61 |
+
protected function sendQuery($sufix, $query = NULL, $method = "POST", array $options = array())
|
62 |
+
{
|
63 |
+
if(strtoupper($method) == "GET")
|
64 |
+
{
|
65 |
+
$connMethod = 0;
|
66 |
+
}else{
|
67 |
+
$connMethod = 1;
|
68 |
+
}
|
69 |
+
|
70 |
+
$query_body = json_encode($query);
|
71 |
+
|
72 |
+
$url = self::API_URL.$sufix;
|
73 |
+
|
74 |
+
$sign = $this->signQuery();
|
75 |
+
|
76 |
+
//$f = fopen('request.txt', 'w');
|
77 |
+
$defaults = array(
|
78 |
+
CURLOPT_HTTPHEADER => array('Authorization: MultiPunktyApp '.$sign),
|
79 |
+
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)',
|
80 |
+
CURLOPT_AUTOREFERER => true,
|
81 |
+
CURLOPT_FOLLOWLOCATION => true,
|
82 |
+
CURLOPT_POST => $connMethod,
|
83 |
+
CURLOPT_HEADER => 0,
|
84 |
+
CURLOPT_URL => $url,
|
85 |
+
CURLOPT_VERBOSE => 1,
|
86 |
+
//CURLOPT_STDERR => $f,
|
87 |
+
CURLOPT_RETURNTRANSFER => 1,
|
88 |
+
CURLOPT_TIMEOUT => 300,
|
89 |
+
CURLOPT_COOKIEFILE => 'cookie2.txt',
|
90 |
+
CURLOPT_COOKIEJAR => 'cookie2.txt',
|
91 |
+
CURLOPT_SSL_VERIFYPEER => false
|
92 |
+
);
|
93 |
+
|
94 |
+
// If method POST, then JSON body is sending
|
95 |
+
if($connMethod)
|
96 |
+
{
|
97 |
+
$defaults[CURLOPT_POSTFIELDS] = $query_body;
|
98 |
+
}
|
99 |
+
|
100 |
+
$ch = curl_init();
|
101 |
+
curl_setopt_array($ch, ($options + $defaults));
|
102 |
+
if( ! $result_raw = curl_exec($ch))
|
103 |
+
{
|
104 |
+
trigger_error(curl_error($ch));
|
105 |
+
}
|
106 |
+
//fclose($f);
|
107 |
+
curl_close($ch);
|
108 |
+
|
109 |
+
$result = json_decode($result_raw);
|
110 |
+
|
111 |
+
return $result;
|
112 |
+
}
|
113 |
+
|
114 |
+
/*
|
115 |
+
* Checking API status in MultiPunkty.pl
|
116 |
+
* Tip: Good method for API testing
|
117 |
+
*
|
118 |
+
* @doc Section 5.1 from API specification
|
119 |
+
*
|
120 |
+
* @return boolean { isAuthorized }
|
121 |
+
*/
|
122 |
+
public function getApiStatus()
|
123 |
+
{
|
124 |
+
$result = $this->sendQuery(self::API_QUERY_GET_STATUS, null, "GET");
|
125 |
+
|
126 |
+
if($result->statusCode == 200)
|
127 |
+
{
|
128 |
+
$status = $result->data->isAuthorized;
|
129 |
+
}else {
|
130 |
+
$status = $result->error;
|
131 |
+
}
|
132 |
+
|
133 |
+
if($this->isDebugMode())
|
134 |
+
{
|
135 |
+
Mage::log('getApiStatus() -> '.$status, null, 'multipunkty.log');
|
136 |
+
}
|
137 |
+
|
138 |
+
return $status;
|
139 |
+
}
|
140 |
+
|
141 |
+
/*
|
142 |
+
* Checking partner status in MultiPunkty.pl (is active in service?)
|
143 |
+
* Tip: Good method for API testing
|
144 |
+
*
|
145 |
+
* @doc Section 5.2 from API specification
|
146 |
+
*
|
147 |
+
* @return Object { isEnabled, paymentModel, pointsAvailable }
|
148 |
+
*/
|
149 |
+
public function getPartnerStatus()
|
150 |
+
{
|
151 |
+
$partnerId = Mage::helper('multipunkty')->getPartnerId();
|
152 |
+
Mage::log($partnerId,null,'mp_points.log');
|
153 |
+
$result = $this->sendQuery('api/1/partners/'.$partnerId.'/status', null, "GET");
|
154 |
+
Mage::log($result,null,'mp_points.log');
|
155 |
+
if($result->statusCode == 200)
|
156 |
+
{
|
157 |
+
$status = $result->data;
|
158 |
+
}else {
|
159 |
+
$status = $result->error;
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
if($this->isDebugMode())
|
164 |
+
{
|
165 |
+
Mage::log('getPartnerStatus() -> '.$status, null, 'multipunkty.log');
|
166 |
+
}
|
167 |
+
|
168 |
+
return $status;
|
169 |
+
}
|
170 |
+
|
171 |
+
/*
|
172 |
+
* Register transaction in MultiPunkty service
|
173 |
+
*
|
174 |
+
* @doc Section 5.3 for API specification
|
175 |
+
*
|
176 |
+
* @return Object { transactionId, assignUrl }
|
177 |
+
*/
|
178 |
+
public function registerTransaction($partnerID, $transactionFK, $points, $value = 0, $title = '', $autoStatusTime = null, $autoStatus = null)
|
179 |
+
{
|
180 |
+
if(is_null($autoStatusTime))
|
181 |
+
{
|
182 |
+
$daysToactivate = Mage::helper('multipunkty')->getTimeToActivateTransaction();
|
183 |
+
//must be in minutes
|
184 |
+
$autoStatusTime = $daysToactivate * 24 * 60;
|
185 |
+
}
|
186 |
+
|
187 |
+
if(is_null($autoStatus))
|
188 |
+
{
|
189 |
+
$autoStatus = self::API_TRANSACTION_STATUS_ACCEPT;
|
190 |
+
}
|
191 |
+
|
192 |
+
$query_body = array("partnerId" => $partnerID,
|
193 |
+
"transactionFK" => $transactionFK,
|
194 |
+
"points" => $points,
|
195 |
+
"value" => $value,
|
196 |
+
"title" => $title,
|
197 |
+
"autoStatusTime" => $autoStatusTime,
|
198 |
+
"autoStatus" => $autoStatus);
|
199 |
+
$result = $this->sendQuery(self::API_QUERY_REGISTER_TRANSACTION, $query_body);
|
200 |
+
|
201 |
+
if($result->statusCode == 200)
|
202 |
+
{
|
203 |
+
$data = $result->data;
|
204 |
+
}else {
|
205 |
+
$data = $result->error;
|
206 |
+
}
|
207 |
+
|
208 |
+
if($this->isDebugMode())
|
209 |
+
{
|
210 |
+
Mage::log('registerTransaction() -> '.$result->statusCode.' '.$data, null, 'multipunkty.log');
|
211 |
+
}
|
212 |
+
|
213 |
+
return $data;
|
214 |
+
}
|
215 |
+
|
216 |
+
/*
|
217 |
+
* Assigning transaction to approprate user in MultiPunkty service
|
218 |
+
*
|
219 |
+
* @doc Section 5.4 from API specification
|
220 |
+
*
|
221 |
+
* @return boolean { success }
|
222 |
+
*/
|
223 |
+
public function assignTransactionToUser($transactionId, $mpid, $status = '', $description = '')
|
224 |
+
{
|
225 |
+
$query_body = array("mpid" => $mpid, "status" => $status, "description" => $description);
|
226 |
+
$result = $this->sendQuery('api/1/transactions/'.$transactionId.'/assign', $query_body);
|
227 |
+
|
228 |
+
if($this->isDebugMode())
|
229 |
+
{
|
230 |
+
Mage::log('assignTransactionToUser() -> '.$result->statusCode, null, 'multipunkty.log');
|
231 |
+
}
|
232 |
+
|
233 |
+
return ($result->statusCode == 200) ? true : false;
|
234 |
+
}
|
235 |
+
|
236 |
+
/*
|
237 |
+
* Change transaction status (eg. from accepted to rejected)
|
238 |
+
*
|
239 |
+
* @doc Section 5.5 from API specification
|
240 |
+
*
|
241 |
+
* @return boolean { success }
|
242 |
+
*/
|
243 |
+
public function changeTransactionStatus($transactionId, $status, $description = '')
|
244 |
+
{
|
245 |
+
$query_body = array("status" => $status, "description" => $description);
|
246 |
+
$result = $this->sendQuery('api/1/transactions/'.$transactionId.'/status', $query_body);
|
247 |
+
|
248 |
+
if($this->isDebugMode())
|
249 |
+
{
|
250 |
+
Mage::log('changeTransactionStatus() -> '.$result->statusCode, null, 'multipunkty.log');
|
251 |
+
}
|
252 |
+
|
253 |
+
return ($result->statusCode == 200) ? true : false;
|
254 |
+
}
|
255 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Api/Server.php
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* MultiPunkty.pl API Server, compatible with API version 5
|
5 |
+
*
|
6 |
+
* @author Michał Zabielski <michal.zabielski@orba.pl>
|
7 |
+
* @created 25-11-2013
|
8 |
+
* @lastModified 26-11-2013
|
9 |
+
*/
|
10 |
+
class Orba_Multipunkty_Model_Api_Server extends Orba_Multipunkty_Model_Api_Abstract {
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Validates if time of response fits in tolerantion time of response,
|
14 |
+
* which equals to 1800 seconds (30 minutes)
|
15 |
+
*
|
16 |
+
* @doc Section 4.1 from API specification
|
17 |
+
*
|
18 |
+
* @return boolean { fitToTolerantionLevel }
|
19 |
+
*/
|
20 |
+
private function validateTimeTolerance($qTime)
|
21 |
+
{
|
22 |
+
$time = time();
|
23 |
+
$qTimestamp = strtotime($qTime);
|
24 |
+
$timeDiff = abs($qTimestamp-$time);
|
25 |
+
|
26 |
+
if($timeDiff > self::API_TIME_MAX_TOLERANTION_SEC)
|
27 |
+
{
|
28 |
+
return 0;
|
29 |
+
}else{
|
30 |
+
return 1;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/*
|
35 |
+
* Validates AppID of received response
|
36 |
+
*
|
37 |
+
* @doc Section 4.1 from API specification
|
38 |
+
*
|
39 |
+
* @return boolean { accept }
|
40 |
+
*/
|
41 |
+
private function validateAppId($qAppId)
|
42 |
+
{
|
43 |
+
$appId = Mage::helper('multipunkty')->getApiKey();
|
44 |
+
if(is_null($appId) || $appId === '')
|
45 |
+
{
|
46 |
+
$appId = Mage::getStoreConfig('multipunkty/basic_config/platform_api_key');
|
47 |
+
}
|
48 |
+
|
49 |
+
//for test purposes only
|
50 |
+
//$appId = 'fb62897b90ad4d1d8af1adeb5a0a7b66';
|
51 |
+
|
52 |
+
if(strcmp($appId, $qAppId))
|
53 |
+
{
|
54 |
+
return 0;
|
55 |
+
}else{
|
56 |
+
return 1;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/*
|
61 |
+
* Validates private key of received response
|
62 |
+
*
|
63 |
+
* @doc Section 4.1 from API specification
|
64 |
+
*
|
65 |
+
* @return boolean { accept }
|
66 |
+
*/
|
67 |
+
private function validatePrivateKey($qAppId, $qTime, $qNonce, $qHash)
|
68 |
+
{
|
69 |
+
$hashDecode = base64_decode($qHash);
|
70 |
+
|
71 |
+
$privatekey = Mage::helper('multipunkty')->getPrivateKey();
|
72 |
+
if(is_null($privatekey) || $privatekey === '')
|
73 |
+
{
|
74 |
+
$privatekey = Mage::getStoreConfig('multipunkty/basic_config/platform_private_key');
|
75 |
+
}
|
76 |
+
|
77 |
+
//For test purposes only
|
78 |
+
//$privatekey = 'f1e1e13b0de2ea9e1ce072a0a83a49832c5a59ad33c7b6c07f7b94aa0f90322f';
|
79 |
+
|
80 |
+
$hashNew = hash_hmac('sha256', $qAppId.'&'.$qTime.'&'.$qNonce.'&'.$privatekey, $privatekey, true);
|
81 |
+
|
82 |
+
if(strcmp($hashNew, $hashDecode))
|
83 |
+
{
|
84 |
+
return 0;
|
85 |
+
}else{
|
86 |
+
return 1;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/*
|
91 |
+
* Validating queries received from MultiPunkty.pl
|
92 |
+
*
|
93 |
+
* @doc Section 4.1, 4.3 and 6 from API specification
|
94 |
+
*
|
95 |
+
* @return boolean { isValid }
|
96 |
+
*/
|
97 |
+
public function validateQuery($query)
|
98 |
+
{
|
99 |
+
if(strpos($query,'MultiPunktyApp') !== false)
|
100 |
+
{
|
101 |
+
$query = str_replace('MultiPunktyApp ', '', $query);
|
102 |
+
$isValid = false;
|
103 |
+
$result = base64_decode($query);
|
104 |
+
$queryData = explode('&', $result);
|
105 |
+
|
106 |
+
$valAppId = $this->validateAppId($queryData[0]);
|
107 |
+
$valTime = $this->validateTimeTolerance($queryData[1]);
|
108 |
+
$valPK = $this->validatePrivateKey($queryData[0], $queryData[1], $queryData[2], $queryData[3]);
|
109 |
+
|
110 |
+
//verifyData
|
111 |
+
if($valAppId && $valTime && $valPK)
|
112 |
+
{
|
113 |
+
$isValid = true;
|
114 |
+
}
|
115 |
+
|
116 |
+
return $isValid;
|
117 |
+
}else{
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
/*
|
123 |
+
* Receive data about registered account - function to complete registration process
|
124 |
+
*
|
125 |
+
* @doc Section 6.1 from API specification
|
126 |
+
*
|
127 |
+
* @return boolean { success }
|
128 |
+
*/
|
129 |
+
public function getRegisteredData($auth, $data)
|
130 |
+
{
|
131 |
+
if($this->validateQuery($auth))
|
132 |
+
{
|
133 |
+
$nonce = Mage::getModel('multipunkty/nonce')->load($data->secret, 'secret_phrase');
|
134 |
+
|
135 |
+
if($nonce->getId())
|
136 |
+
{
|
137 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/api_key', $data->appId);
|
138 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/private_key', $data->key);
|
139 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/partner_id', $data->partnerId);
|
140 |
+
|
141 |
+
//delete used secret phrase
|
142 |
+
$nonce->delete();
|
143 |
+
|
144 |
+
return '{ statusCode: 200 }';
|
145 |
+
}else{
|
146 |
+
return '{ statusCode: 403, error: "Forbidden: Your access data are invalid" }';
|
147 |
+
}
|
148 |
+
}else{
|
149 |
+
return '{ statusCode: 403, error: "Error: Query validation failed" }';
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
/*
|
154 |
+
* Receive data about changing partner status
|
155 |
+
*
|
156 |
+
* @doc Section 6.2 from API specification
|
157 |
+
*/
|
158 |
+
public function getPartnerStatus($auth, $data)
|
159 |
+
{
|
160 |
+
if($this->validateQuery($auth))
|
161 |
+
{
|
162 |
+
if(Mage::getStoreConfig('multipunkty/basic_config/partner_id') == $data->partnerId)
|
163 |
+
{
|
164 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/service_status', $data->isEnabled);
|
165 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/points_amount', $data->pointsAvailable);
|
166 |
+
|
167 |
+
return '{ statusCode: 200 }';
|
168 |
+
}else{
|
169 |
+
return '{ statusCode: 403, error: "Error: PartnerID is incorrect" }';
|
170 |
+
}
|
171 |
+
}else{
|
172 |
+
return '{ statusCode: 403, error: "Error: Query validation failed" }';
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Config.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Config extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
/*
|
6 |
+
* Stale do obslugi API
|
7 |
+
*/
|
8 |
+
const API_URL = 'http://backend.multipunkty.pl/';
|
9 |
+
const API_NONCE_MAX_LEN = 32;
|
10 |
+
const API_APP_ID_LEN = 32;
|
11 |
+
const API_PARTNER_TOKEN_LEN = 128;
|
12 |
+
const API_PARTNER_ID_LEN = 32;
|
13 |
+
const API_TIME_LEN = 15;
|
14 |
+
//adresy do zapytan API
|
15 |
+
const API_QUERY_REGISTER_TRANSACTION = 'api/1/transactions/register';
|
16 |
+
const API_QUERY_GET_PARTNER_STATUS = 'api/1/partners/status';
|
17 |
+
const API_QUERY_ASSIGN_TRANSACTION_TO_USER = 'api/1/transactions/assign';
|
18 |
+
const API_QUERY_CHANGE_TRANSACTION_STATUS = 'api/1/transactions/status';
|
19 |
+
//list of important URL's
|
20 |
+
const URL_BUY_CREDITS = 'http://backend.multipunkty.pl/';
|
21 |
+
|
22 |
+
public function _construct() {
|
23 |
+
$this->_init('multipunkty/config');
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
|
app/code/community/Orba/Multipunkty/Model/Eav/Abstract.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Eav_Abstract extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
protected function _construct() {
|
6 |
+
$this->_init('multipunkty/eavattribute');
|
7 |
+
}
|
8 |
+
|
9 |
+
public function createAttribute($code, $label, $attribute_type, $product_type, $attribute_data, $attribute_set_name, $group_name, $entity_type_id = 'catalog_product') {
|
10 |
+
$default_attribute_data = array(
|
11 |
+
'attribute_code' => $code,
|
12 |
+
'is_global' => 0,
|
13 |
+
'frontend_input' => $attribute_type,
|
14 |
+
'frontend_class' => '',
|
15 |
+
'default_value_text' => '',
|
16 |
+
'default_value_yesno' => 0,
|
17 |
+
'default_value_date' => '',
|
18 |
+
'default_value_textarea' => '',
|
19 |
+
'is_unique' => 0,
|
20 |
+
'is_required' => 0,
|
21 |
+
'apply_to' => array($product_type),
|
22 |
+
'is_configurable' => 0,
|
23 |
+
'is_filterable' => 0,
|
24 |
+
'is_filterable_in_search' => 0,
|
25 |
+
'is_searchable' => 0,
|
26 |
+
'is_visible_in_advanced_search' => 0,
|
27 |
+
'is_comparable' => 0,
|
28 |
+
'is_used_for_price_rules' => 0,
|
29 |
+
'is_wysiwyg_enabled' => 0,
|
30 |
+
'is_html_allowed_on_front' => 1,
|
31 |
+
'is_visible_on_front' => 0,
|
32 |
+
'used_in_product_listing' => 0,
|
33 |
+
'used_for_sort_by' => 0,
|
34 |
+
'frontend_label' => array($label),
|
35 |
+
'sort_order' => 0,
|
36 |
+
'is_user_defined' => 0
|
37 |
+
);
|
38 |
+
$attribute_data = array_merge($default_attribute_data, $attribute_data);
|
39 |
+
$model = Mage::getModel('catalog/resource_eav_attribute');
|
40 |
+
if (!isset($attribute_data['backend_type'])) {
|
41 |
+
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
|
42 |
+
$attribute_data['backend_type'] = $model->getBackendTypeByInput($attribute_data['frontend_input']);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$model->addData($attribute_data);
|
46 |
+
$model->setEntityTypeId(Mage::getModel('eav/entity')->setType($entity_type_id)->getTypeId());
|
47 |
+
try {
|
48 |
+
$model->save();
|
49 |
+
if (isset($attribute_data['source_model'])) {
|
50 |
+
$model->setSourceModel($attribute_data['source_model'])->save();
|
51 |
+
}
|
52 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
53 |
+
$attribute_code = $code;
|
54 |
+
$attribute_set_ids = array();
|
55 |
+
if ($attribute_set_name) {
|
56 |
+
$attribute_set_ids[] = $setup->getAttributeSetId($entity_type_id, $attribute_set_name);
|
57 |
+
} else {
|
58 |
+
$attribute_set_ids = $setup->getAllAttributeSetIds($entity_type_id);
|
59 |
+
}
|
60 |
+
$attribute_id = $setup->getAttributeId($entity_type_id, $attribute_code);
|
61 |
+
foreach ($attribute_set_ids as $attribute_set_id) {
|
62 |
+
$attribute_group_id = $setup->getAttributeGroupId($entity_type_id, $attribute_set_id, $group_name);
|
63 |
+
$setup->addAttributeToSet($entity_type_id, $attribute_set_id, $attribute_group_id, $attribute_id, $attribute_data['sort_order']);
|
64 |
+
}
|
65 |
+
} catch (Exception $e) {
|
66 |
+
Mage::log("Couldn't create attribute $code. Exception: ".$e->getMessage(), null, 'multipunkty.log');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Eav/Customer.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Eav_Customer extends Orba_Multipunkty_Model_Eav_Abstract {
|
4 |
+
|
5 |
+
public function addMultipunktyAttributesToCustomer() {
|
6 |
+
$entity_type = 'customer';
|
7 |
+
|
8 |
+
$this->createAttribute('multipunkty_userid', 'User ID in MultiPunkty.pl service', 'text', null, array(
|
9 |
+
'backend_type' => 'varchar',
|
10 |
+
'sort_order' => 200,
|
11 |
+
'is_global' => 1,
|
12 |
+
'is_required' => 1,
|
13 |
+
), false, 'Account Information', $entity_type);
|
14 |
+
|
15 |
+
$this->createAttribute('multipunkty_active', 'Is user active in MultiPunkty service', 'select', null, array(
|
16 |
+
'backend_type' => 'int',
|
17 |
+
'source_model' => 'eav/entity_attribute_source_boolean',
|
18 |
+
'sort_order' => 210,
|
19 |
+
'is_global' => 1
|
20 |
+
), false, 'Account Information', $entity_type);
|
21 |
+
|
22 |
+
$this->createAttribute('multipunkty_userlogin', 'User login in MultiPunkty.pl service', 'text', null, array(
|
23 |
+
'backend_type' => 'varchar',
|
24 |
+
'sort_order' => 220,
|
25 |
+
'is_global' => 1,
|
26 |
+
'is_required' => 1,
|
27 |
+
), false, 'Account Information', $entity_type);
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Eav/Product.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Eav_Product extends Orba_Multipunkty_Model_Eav_Abstract {
|
4 |
+
|
5 |
+
public function addMultipunktyAttributesToProduct() {
|
6 |
+
$this->createAttribute('multipunkty_is_in_catalog', 'MultiPunkty Is in products catalog', 'select', null, array(
|
7 |
+
'backend_type' => 'int',
|
8 |
+
'source_model' => 'eav/entity_attribute_source_boolean',
|
9 |
+
'sort_order' => 320,
|
10 |
+
'is_global' => 1,
|
11 |
+
'used_in_product_listing' => 1
|
12 |
+
), false, 'General');
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Mysql4/Nonce.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Mysql4_Nonce extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('multipunkty/nonce', 'id');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Mysql4/Nonce/Collection.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Mysql4_Nonce_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->init('multipunkty/nonce');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Mysql4/Setup.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
|
4 |
+
{
|
5 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Mysql4/Transaction.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Mysql4_Transaction extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('multipunkty/transaction', 'id');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Mysql4/Transaction/Collection.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Mysql4_Transaction_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->init('multipunkty/transaction');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Nonce.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Nonce extends Mage_Core_Model_Abstract {
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('multipunkty/nonce');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Observer.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Observer that handles operation after order is placed.
|
4 |
+
*
|
5 |
+
* Description of status numbers in transaction DB:
|
6 |
+
* 1 - User have account in MultiPunkty service, it's registered in store and
|
7 |
+
* API request was completed with success. Then MP$ are automatically added to him,
|
8 |
+
* without clicking on assign URL.
|
9 |
+
* 2 - User have account in MultiPunkty, but assigning transaction to user went false.
|
10 |
+
* MP$ were not added and user will obtain assign URL
|
11 |
+
* 3 - User is not logged in store - he received assign URL and none attempt to
|
12 |
+
* register MP$ was started
|
13 |
+
*
|
14 |
+
* This class is created based on deleted Transaction/Observer.php file
|
15 |
+
*
|
16 |
+
* @author
|
17 |
+
*
|
18 |
+
* @created
|
19 |
+
* @lastModified 6-12-2013
|
20 |
+
* @lastModifiedBy Michał Zabielski <michal.zabielski@orba.pl>
|
21 |
+
*/
|
22 |
+
class Orba_Multipunkty_Model_Observer extends Mage_Core_Model_Abstract {
|
23 |
+
|
24 |
+
/*
|
25 |
+
* Method that handles transaction
|
26 |
+
*/
|
27 |
+
protected function _handleTransaction($observer)
|
28 |
+
{
|
29 |
+
$event = $observer->getEvent();
|
30 |
+
$order = $event->getOrder();
|
31 |
+
|
32 |
+
$helper = Mage::helper('multipunkty');
|
33 |
+
|
34 |
+
$total = $order->getSubtotal();
|
35 |
+
$reward = $helper->getPurchaseReward();
|
36 |
+
|
37 |
+
$paymentCode = $order->getPayment()->getMethodInstance()->getCode();
|
38 |
+
$cashOnDelivery = (!$helper->isCashOnDeliveryAccepted() && $paymentCode == 'cashondelivery') ? false : true;
|
39 |
+
$points = ($helper->getPointsAmount() == 0) ? false : true;
|
40 |
+
|
41 |
+
if ($helper->isActive() AND $helper->getPurchaseReward() > 0 AND $helper->serviceActive() AND $cashOnDelivery AND $points)
|
42 |
+
{
|
43 |
+
$points = ceil($total*$reward);
|
44 |
+
|
45 |
+
$api = Mage::getModel('multipunkty/api_client');
|
46 |
+
|
47 |
+
$partner_id = $helper->getPartnerId();
|
48 |
+
|
49 |
+
$value = $total * 100;
|
50 |
+
|
51 |
+
//registering transaction in MultiPunkty service
|
52 |
+
$data = (array) $api->registerTransaction($partner_id, $order->getId(), (int)$points, $value);
|
53 |
+
|
54 |
+
if (is_array($data))
|
55 |
+
{
|
56 |
+
|
57 |
+
//save transaction in database for future use
|
58 |
+
$newMultipunkty = Mage::getModel('multipunkty/transaction');
|
59 |
+
$newMultipunkty->setOrderId($order->getId());
|
60 |
+
$newMultipunkty->setPoints($points);
|
61 |
+
$newMultipunkty->setValue($value);
|
62 |
+
$newMultipunkty->setTransactionHash($data['transactionId']);
|
63 |
+
$newMultipunkty->setAssignUrl($data['assignUrl']);
|
64 |
+
//accept transaction
|
65 |
+
$api->changeTransactionStatus($data['transactionId'], $helper->getTransactionStatus('Accept'));
|
66 |
+
|
67 |
+
//check if user is logged in
|
68 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn())
|
69 |
+
{
|
70 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
71 |
+
|
72 |
+
//if MPID exist
|
73 |
+
if ($customerData->multipunkty_userid)
|
74 |
+
{
|
75 |
+
if ($api->assignTransactionToUser($data['transactionId'], $customerData->getMultipunktyUserId()))
|
76 |
+
{
|
77 |
+
$newMultipunkty->setStatus(1);
|
78 |
+
}
|
79 |
+
else
|
80 |
+
{
|
81 |
+
$newMultipunkty->setStatus(2);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
else
|
86 |
+
{
|
87 |
+
$newMultipunkty->setStatus(3);
|
88 |
+
}
|
89 |
+
|
90 |
+
$newMultipunkty->save();
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/*
|
98 |
+
* Method that sends an email after order is placed
|
99 |
+
*/
|
100 |
+
protected function _handleEmailSending($observer)
|
101 |
+
{
|
102 |
+
$helper = Mage::helper('multipunkty');
|
103 |
+
$order = $observer->getEvent()->getOrder();
|
104 |
+
$receiveEmail = $order->getCustomerEmail();
|
105 |
+
$receiveName = $order->getCustomerName();
|
106 |
+
$storeId = Mage::app()->getStore()->getId();
|
107 |
+
$vars = Array('order' => $order);
|
108 |
+
$mailSubject = $helper->__('%s: You received MultiPoints for an order #%d', Mage::app()->getStore()->getFrontendName(), $order->getIncrementId());
|
109 |
+
|
110 |
+
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('multipunkty_email_template');
|
111 |
+
$emailTemplate->setSenderName(Mage::getStoreConfig('general/store_information/name', $storeId));
|
112 |
+
$emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
|
113 |
+
$emailTemplate->setTemplateSubject($mailSubject, $storeId);
|
114 |
+
|
115 |
+
$emailTemplate->send($receiveEmail,$receiveName, $vars);
|
116 |
+
}
|
117 |
+
|
118 |
+
public function placeOrder($observer)
|
119 |
+
{
|
120 |
+
$helper = Mage::helper('multipunkty');
|
121 |
+
|
122 |
+
if($helper->isActive() && $helper->serviceActive())
|
123 |
+
{
|
124 |
+
$this->_handleTransaction($observer);
|
125 |
+
|
126 |
+
$order = $observer->getEvent()->getOrder();
|
127 |
+
$payment_code = $order->getPayment()->getMethodInstance()->getCode();
|
128 |
+
|
129 |
+
if(($payment_code != 'cashondelivery') OR ($payment_code == 'cashondelivery' AND $helper->isCashOnDeliveryAccepted()))
|
130 |
+
{
|
131 |
+
$this->_handleEmailSending($observer);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
app/code/community/Orba/Multipunkty/Model/System/Config/Backend/Points.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Backend_Points extends Mage_Core_Model_Config_Data {
|
4 |
+
|
5 |
+
public function _afterLoad()
|
6 |
+
{
|
7 |
+
//take points number from API
|
8 |
+
$points = Mage::getModel('multipunkty/api_client')->getPartnerStatus()->pointsAvailable;
|
9 |
+
|
10 |
+
if(is_null($points))
|
11 |
+
{
|
12 |
+
$points = Mage::getStoreConfig('multipunkty/start_settings/points_amount');
|
13 |
+
if(is_null($points))
|
14 |
+
{
|
15 |
+
$points = 0;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/points_amount', $points);
|
20 |
+
$this->setValue($points);
|
21 |
+
|
22 |
+
return parent::_afterLoad();
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
|
app/code/community/Orba/Multipunkty/Model/System/Config/Backend/Service/Launch.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Backend_Service_Launch extends Mage_Core_Model_Config_Data {
|
4 |
+
|
5 |
+
protected function _afterLoad()
|
6 |
+
{
|
7 |
+
if(!Mage::helper('multipunkty')->isStoreRegistered())
|
8 |
+
{
|
9 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/launch_service', "0");
|
10 |
+
$this->setValue(0);
|
11 |
+
}
|
12 |
+
|
13 |
+
parent::_afterLoad();
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Orba/Multipunkty/Model/System/Config/Backend/Service/Status.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Backend_Service_Status extends Mage_Core_Model_Config_Data {
|
4 |
+
|
5 |
+
protected function checkActivation()
|
6 |
+
{
|
7 |
+
$_helper = Mage::helper('multipunkty');
|
8 |
+
|
9 |
+
if($_helper->isActive() && $_helper->isStoreRegistered() && Mage::getStoreConfig('multipunkty/start_settings/points_amount') != 0)
|
10 |
+
{
|
11 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/service_status', "1");
|
12 |
+
$this->setValue(1);
|
13 |
+
}else{
|
14 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/start_settings/service_status', "0");
|
15 |
+
$this->setValue(0);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
protected function _afterLoad()
|
21 |
+
{
|
22 |
+
$this->checkActivation();
|
23 |
+
parent::_afterLoad();
|
24 |
+
}
|
25 |
+
|
26 |
+
/* protected function _beforeSave()
|
27 |
+
{
|
28 |
+
$this->checkActivation();
|
29 |
+
parent::_beforeSave();
|
30 |
+
} */
|
31 |
+
|
32 |
+
}
|
33 |
+
|
app/code/community/Orba/Multipunkty/Model/System/Config/Source/Enabledisable.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Source_Enabledisable
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value'=>1, 'label'=>Mage::helper('multipunkty')->__('Enabled')),
|
9 |
+
array('value'=>0, 'label'=>Mage::helper('multipunkty')->__('Disabled')),
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Orba/Multipunkty/Model/System/Config/Source/Payment/Methods.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Source_Payment_Methods extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$options = array(
|
8 |
+
array('value' => false, 'label' => Mage::helper('multipunkty')->__('Payment in advance')),
|
9 |
+
array('value' => true, 'label' => Mage::helper('multipunkty')->__('Payment in advance & Cash on delivery')),
|
10 |
+
);
|
11 |
+
|
12 |
+
return $options;
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Orba/Multipunkty/Model/System/Config/Source/Points/Ttl.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Source_Points_Ttl extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$helper = Mage::helper('multipunkty');
|
8 |
+
|
9 |
+
$options = array(
|
10 |
+
array('value' => 14, 'label' => '14 ' . $helper->__("days")),
|
11 |
+
array('value' => 30, 'label' => '30 ' . $helper->__("days")),
|
12 |
+
array('value' => 60, 'label' => '60 ' . $helper->__("days")),
|
13 |
+
);
|
14 |
+
|
15 |
+
return $options;
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/Orba/Multipunkty/Model/System/Config/Source/Rewardscatalog/Options.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_System_Config_Source_Rewardscatalog_Options extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$options = array(
|
8 |
+
array('value' => 'none', 'label' => Mage::helper('multipunkty')->__('None')),
|
9 |
+
array('value' => 'all', 'label' => Mage::helper('multipunkty')->__('All')),
|
10 |
+
array('value' => 'category', 'label' => Mage::helper('multipunkty')->__('From Category')),
|
11 |
+
);
|
12 |
+
|
13 |
+
return $options;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Orba/Multipunkty/Model/Transaction.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Orba_Multipunkty_Model_Transaction extends Mage_Core_Model_Abstract {
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('multipunkty/transaction');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Orba/Multipunkty/controllers/CustomerController.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Controller that handles action from My Account -> Multipunkty section
|
4 |
+
*
|
5 |
+
* @author
|
6 |
+
* @created
|
7 |
+
*
|
8 |
+
* @lastModified 30-11-2013
|
9 |
+
* @lastModifiedBy Michał Zabielski <michal.zabielski@orba.pl>
|
10 |
+
*/
|
11 |
+
class Orba_Multipunkty_CustomerController extends Mage_Core_Controller_Front_Action {
|
12 |
+
public function preDispatch()
|
13 |
+
{
|
14 |
+
parent::preDispatch();
|
15 |
+
$action = $this->getRequest()->getActionName();
|
16 |
+
$loginUrl = Mage::helper('customer')->getLoginUrl();
|
17 |
+
|
18 |
+
if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl))
|
19 |
+
{
|
20 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Retrieve customer session model object
|
26 |
+
*
|
27 |
+
* @return Mage_Customer_Model_Session
|
28 |
+
*/
|
29 |
+
protected function _getSession()
|
30 |
+
{
|
31 |
+
return Mage::getSingleton('customer/session');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function indexAction()
|
35 |
+
{
|
36 |
+
$this->loadLayout();
|
37 |
+
$this->_initLayoutMessages('customer/session');
|
38 |
+
$this->_initLayoutMessages('catalog/session');
|
39 |
+
|
40 |
+
$block = $this->getLayout()->getBlock('multipunkty_account_content');
|
41 |
+
if ($block) {
|
42 |
+
$block->setRefererUrl($this->_getRefererUrl());
|
43 |
+
}
|
44 |
+
$data = $this->_getSession()->getCustomerFormData(true);
|
45 |
+
$customer = $this->_getSession()->getCustomer();
|
46 |
+
|
47 |
+
if (!empty($data)) {
|
48 |
+
$customer->addData($data);
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('MultiPunkty'));
|
52 |
+
$this->getLayout()->getBlock('messages')->setEscapeMessageFlag(true);
|
53 |
+
$this->renderLayout();
|
54 |
+
}
|
55 |
+
|
56 |
+
public function editPostAction()
|
57 |
+
{
|
58 |
+
if (!$this->_validateFormKey()) {
|
59 |
+
return $this->_redirect('multipunkty/customer');
|
60 |
+
}
|
61 |
+
|
62 |
+
if ($this->getRequest()->isPost()) {
|
63 |
+
/** @var $customer Mage_Customer_Model_Customer */
|
64 |
+
$customer = $this->_getSession()->getCustomer();
|
65 |
+
|
66 |
+
/** @var $customerForm Mage_Customer_Model_Form */
|
67 |
+
$customerForm = Mage::getModel('customer/form');
|
68 |
+
$customerForm->setFormCode('customer_account_edit')
|
69 |
+
->setEntity($customer);
|
70 |
+
|
71 |
+
$customerData = $customerForm->extractData($this->getRequest());
|
72 |
+
|
73 |
+
$errors = array();
|
74 |
+
$customerErrors = $customerForm->validateData($customerData);
|
75 |
+
if ($customerErrors !== true) {
|
76 |
+
$errors = array_merge($customerErrors, $errors);
|
77 |
+
} else {
|
78 |
+
$customerForm->compactData($customerData);
|
79 |
+
$errors = array();
|
80 |
+
|
81 |
+
// Validate account and compose list of errors if any
|
82 |
+
$customerErrors = $customer->validate();
|
83 |
+
if (is_array($customerErrors)) {
|
84 |
+
$errors = array_merge($errors, $customerErrors);
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if (!empty($errors)) {
|
89 |
+
$this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
|
90 |
+
foreach ($errors as $message) {
|
91 |
+
$this->_getSession()->addError($message);
|
92 |
+
}
|
93 |
+
$this->_redirect('multipunkty/customer');
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
|
97 |
+
try {
|
98 |
+
$customer->setConfirmation(null);
|
99 |
+
$customer->save();
|
100 |
+
$this->_getSession()->setCustomer($customer)
|
101 |
+
->addSuccess($this->__('Edycja przebiegła pomyślnie.'));
|
102 |
+
|
103 |
+
$this->_redirect('multipunkty/customer');
|
104 |
+
return;
|
105 |
+
} catch (Mage_Core_Exception $e) {
|
106 |
+
$this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
|
107 |
+
->addError($e->getMessage());
|
108 |
+
} catch (Exception $e) {
|
109 |
+
$this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
|
110 |
+
->addException($e, $this->__('Wystąpił błąd podczas zapisu danych.'));
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->_redirect('multipunkty/customer');
|
115 |
+
}
|
116 |
+
|
117 |
+
/*
|
118 |
+
* Handles register request from Multipunkty Javascript API
|
119 |
+
*/
|
120 |
+
public function registerAction()
|
121 |
+
{
|
122 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
123 |
+
$helper = Mage::helper('multipunkty');
|
124 |
+
|
125 |
+
try {
|
126 |
+
$postData = $this->getRequest()->getPost();
|
127 |
+
|
128 |
+
$customer->setMultipunktyUserid($postData['mpid']);
|
129 |
+
$customer->setMultipunktyUserlogin($postData['login']);
|
130 |
+
$customer->setMultipunktyActive(1);
|
131 |
+
$customer->save();
|
132 |
+
|
133 |
+
$this->_getSession()->setCustomer($customer)
|
134 |
+
->addSuccess($helper->__('User was successfully registered.'));
|
135 |
+
}catch (Exception $e) {
|
136 |
+
$this->_getSession()->setCustomer($customer)
|
137 |
+
->addException($e, $helper->__('There was an error when processing your request, try again.'));
|
138 |
+
}
|
139 |
+
|
140 |
+
$this->_redirect('multipunkty/customer');
|
141 |
+
}
|
142 |
+
|
143 |
+
/*
|
144 |
+
* Handles unregister request from My account -> Multipunkty section
|
145 |
+
*/
|
146 |
+
public function unregisterAction()
|
147 |
+
{
|
148 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
149 |
+
$helper = Mage::helper('multipunkty');
|
150 |
+
|
151 |
+
try {
|
152 |
+
if(is_null($customer->getMultipunktyUserid()))
|
153 |
+
{
|
154 |
+
$this->_getSession()->setCustomer($customer)
|
155 |
+
->addException($helper->__('User already unregistered.'));
|
156 |
+
}else{
|
157 |
+
$customer->setMultipunktyUserid(null);
|
158 |
+
$customer->setMultipunktyUserlogin(null);
|
159 |
+
$customer->setMultipunktyActive(0);
|
160 |
+
$customer->save();
|
161 |
+
|
162 |
+
$this->_getSession()->setCustomer($customer)
|
163 |
+
->addSuccess($helper->__('User was successfully unregistered.'));
|
164 |
+
}
|
165 |
+
}catch (Exception $e) {
|
166 |
+
$this->_getSession()->setCustomer($customer)
|
167 |
+
->addError($e, $helper->__('There was an error when processing your request, try again.'));
|
168 |
+
}
|
169 |
+
|
170 |
+
$this->_redirect('multipunkty/customer');
|
171 |
+
}
|
172 |
+
}
|
app/code/community/Orba/Multipunkty/controllers/IndexController.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Controller to handle Multipunkty API v6 and test it
|
4 |
+
*
|
5 |
+
* @author Michał Zabielski <michal.zabielski@orba.pl>
|
6 |
+
*
|
7 |
+
* @created 25-11-2013
|
8 |
+
* @lastModified 3-12-2013
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Orba_Multipunkty_IndexController extends Mage_Core_Controller_Front_Action {
|
12 |
+
|
13 |
+
/*
|
14 |
+
* Get HTTP headers to get Authorization header
|
15 |
+
*/
|
16 |
+
protected function _getAllHeaders()
|
17 |
+
{
|
18 |
+
$headers = '';
|
19 |
+
foreach ($_SERVER as $name => $value)
|
20 |
+
{
|
21 |
+
if (substr($name, 0, 5) == 'HTTP_')
|
22 |
+
{
|
23 |
+
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
return $headers;
|
27 |
+
}
|
28 |
+
|
29 |
+
/*
|
30 |
+
* For test purposes
|
31 |
+
*/
|
32 |
+
public function indexAction()
|
33 |
+
{
|
34 |
+
$params = Mage::app()->getRequest()->getParams();
|
35 |
+
echo Mage::helper('core/url')->getCurrentUrl();
|
36 |
+
print_r($params);
|
37 |
+
}
|
38 |
+
|
39 |
+
/*
|
40 |
+
* Action that handles registration in Multipunkty.pl service
|
41 |
+
*
|
42 |
+
* @doc Section 6.1 from API specification
|
43 |
+
*/
|
44 |
+
public function connectedAction()
|
45 |
+
{
|
46 |
+
$headers = $this->_getAllHeaders();
|
47 |
+
$auth = $headers['Authorization'];
|
48 |
+
|
49 |
+
if(empty($auth))
|
50 |
+
{
|
51 |
+
echo '{ statusCode: 403, error: "Error: Authorization failed" }';
|
52 |
+
}else{
|
53 |
+
$postData = file_get_contents('php://input');
|
54 |
+
$data = json_decode($postData);
|
55 |
+
|
56 |
+
if(is_null($data))
|
57 |
+
{
|
58 |
+
echo '{ statusCode: 403, error: "Error: Query validation failed" }';
|
59 |
+
}else{
|
60 |
+
$server = Mage::getModel('multipunkty/api_server');
|
61 |
+
$result = $server->getRegisteredData($auth, $data);
|
62 |
+
|
63 |
+
echo $result;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/*
|
69 |
+
* Action that handles parter status change
|
70 |
+
*
|
71 |
+
* @doc Section 6.2 from API specification
|
72 |
+
*/
|
73 |
+
public function statusAction()
|
74 |
+
{
|
75 |
+
$headers = $this->_getAllHeaders();
|
76 |
+
$auth = $headers['Authorization'];
|
77 |
+
|
78 |
+
if(is_null($auth))
|
79 |
+
{
|
80 |
+
echo '{ statusCode: 403, error: "Error: Authorization failed" }';
|
81 |
+
}else{
|
82 |
+
$postData = file_get_contents('php://input');
|
83 |
+
$data = json_decode($postData);
|
84 |
+
|
85 |
+
if(is_null($data))
|
86 |
+
{
|
87 |
+
echo '{ statusCode: 403, error: "Error: Query validation failed" }';
|
88 |
+
}else{
|
89 |
+
$server = Mage::getModel('multipunkty/api_server');
|
90 |
+
$result = $server->getPartnerStatus($auth, $data);
|
91 |
+
|
92 |
+
echo $result;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/*
|
98 |
+
* Method to fetch data for register button
|
99 |
+
*/
|
100 |
+
public function fetchdataAction()
|
101 |
+
{
|
102 |
+
$appId = Mage::getStoreConfig('multipunkty/basic_config/platform_api_key');
|
103 |
+
$secret = (string)rand(0, 99999);
|
104 |
+
$partnerFK = Mage::getStoreConfig('multipunkty/basic_config/platform_partner_id');
|
105 |
+
|
106 |
+
$nonce = Mage::getModel('multipunkty/nonce');
|
107 |
+
$nonce->setSecretPhrase($secret);
|
108 |
+
$nonce->setQueryTime(date("Ymd").'T'.date("His"));
|
109 |
+
$nonce->save();
|
110 |
+
|
111 |
+
$storeUrl = htmlentities(Mage::helper('core/url')->getHomeUrl());
|
112 |
+
//$returnUrl = Mage::helper('core/url')->getCurrentUrl();
|
113 |
+
$returnUrl = $this->getRequest()->getServer('HTTP_REFERER');
|
114 |
+
$eventUrl = str_replace('/index.php', '', $storeUrl) . 'multipunkty';
|
115 |
+
$storeName = Mage::app()->getStore()->getFrontendName();
|
116 |
+
$categories = 'Sklep';
|
117 |
+
$email = Mage::getStoreConfig('trans_email/ident_general/email');
|
118 |
+
$phone = Mage::getStoreConfig('general/store_information/phone');
|
119 |
+
$firstName = Mage::getStoreConfig('trans_email/ident_general/name');
|
120 |
+
|
121 |
+
$data = array(
|
122 |
+
"appId" => $appId,
|
123 |
+
"secret" => $secret,
|
124 |
+
"partnerFK" => $partnerFK,
|
125 |
+
"storeUrl" => $storeUrl,
|
126 |
+
"returnUrl" => $returnUrl,
|
127 |
+
"eventUrl" => $eventUrl,
|
128 |
+
"storeName" => $storeName,
|
129 |
+
"categories" => $categories,
|
130 |
+
"email" => $email,
|
131 |
+
"phone" => $phone,
|
132 |
+
"firstName" => $firstName,
|
133 |
+
);
|
134 |
+
|
135 |
+
echo json_encode($data);
|
136 |
+
}
|
137 |
+
|
138 |
+
public function testapiAction()
|
139 |
+
{
|
140 |
+
$result = Mage::getModel('multipunkty/api_client')->getPartnerStatus();
|
141 |
+
|
142 |
+
var_dump($result);
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
app/code/community/Orba/Multipunkty/etc/adminhtml.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<sales>
|
5 |
+
<children>
|
6 |
+
<multipunkty translate="title" module="multipunkty">
|
7 |
+
<title>Loyalty program</title>
|
8 |
+
<sort_order>290</sort_order>
|
9 |
+
<action>adminhtml/system_config/edit/section/multipunkty</action>
|
10 |
+
</multipunkty>
|
11 |
+
</children>
|
12 |
+
</sales>
|
13 |
+
</menu>
|
14 |
+
</config>
|
app/code/community/Orba/Multipunkty/etc/config.xml
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Orba_Multipunkty>
|
5 |
+
<version>0.2.1</version>
|
6 |
+
</Orba_Multipunkty>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<multipunkty>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Orba_Multipunkty</module>
|
14 |
+
<frontName>multipunkty</frontName>
|
15 |
+
</args>
|
16 |
+
</multipunkty>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<multipunkty>
|
21 |
+
<file>multipunkty.xml</file>
|
22 |
+
</multipunkty>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
<translate>
|
26 |
+
<modules>
|
27 |
+
<Orba_Multipunkty>
|
28 |
+
<files>
|
29 |
+
<default>Orba_Multipunkty.csv</default>
|
30 |
+
</files>
|
31 |
+
</Orba_Multipunkty>
|
32 |
+
</modules>
|
33 |
+
</translate>
|
34 |
+
</frontend>
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<multipunkty>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<module>Orba_Multipunkty</module>
|
41 |
+
<frontName>multipunkty</frontName>
|
42 |
+
</args>
|
43 |
+
</multipunkty>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
<adminhtml>
|
47 |
+
<translate>
|
48 |
+
<modules>
|
49 |
+
<Orba_Multipunkty>
|
50 |
+
<files>
|
51 |
+
<default>Orba_Multipunkty.csv</default>
|
52 |
+
</files>
|
53 |
+
</Orba_Multipunkty>
|
54 |
+
</modules>
|
55 |
+
</translate>
|
56 |
+
<acl>
|
57 |
+
<resources>
|
58 |
+
<admin>
|
59 |
+
<children>
|
60 |
+
<system>
|
61 |
+
<children>
|
62 |
+
<config>
|
63 |
+
<children>
|
64 |
+
<multipunkty>
|
65 |
+
<title>ORBA | MultiPunkty</title>
|
66 |
+
</multipunkty>
|
67 |
+
</children>
|
68 |
+
</config>
|
69 |
+
</children>
|
70 |
+
</system>
|
71 |
+
</children>
|
72 |
+
</admin>
|
73 |
+
</resources>
|
74 |
+
</acl>
|
75 |
+
<layout>
|
76 |
+
<updates>
|
77 |
+
<multipunkty>
|
78 |
+
<file>multipunkty.xml</file>
|
79 |
+
</multipunkty>
|
80 |
+
</updates>
|
81 |
+
</layout>
|
82 |
+
</adminhtml>
|
83 |
+
<global>
|
84 |
+
<blocks>
|
85 |
+
<multipunkty>
|
86 |
+
<class>Orba_Multipunkty_Block</class>
|
87 |
+
</multipunkty>
|
88 |
+
</blocks>
|
89 |
+
<models>
|
90 |
+
<multipunkty>
|
91 |
+
<class>Orba_Multipunkty_Model</class>
|
92 |
+
<resourceModel>multipunkty_mysql4</resourceModel>
|
93 |
+
</multipunkty>
|
94 |
+
<multipunkty_mysql4>
|
95 |
+
<class>Orba_Multipunkty_Model_Mysql4</class>
|
96 |
+
<entities>
|
97 |
+
<transaction>
|
98 |
+
<table>orba_multipunkty_transaction</table>
|
99 |
+
</transaction>
|
100 |
+
<nonce>
|
101 |
+
<table>orba_multipunkty_nonce</table>
|
102 |
+
</nonce>
|
103 |
+
</entities>
|
104 |
+
</multipunkty_mysql4>
|
105 |
+
</models>
|
106 |
+
<resources>
|
107 |
+
<multipunkty_setup>
|
108 |
+
<setup>
|
109 |
+
<module>Orba_Multipunkty</module>
|
110 |
+
</setup>
|
111 |
+
<connection>
|
112 |
+
<use>core_setup</use>
|
113 |
+
</connection>
|
114 |
+
</multipunkty_setup>
|
115 |
+
<multipunkty_write>
|
116 |
+
<connection>
|
117 |
+
<use>core_write</use>
|
118 |
+
</connection>
|
119 |
+
</multipunkty_write>
|
120 |
+
<multipunkty_read>
|
121 |
+
<connection>
|
122 |
+
<use>core_read</use>
|
123 |
+
</connection>
|
124 |
+
</multipunkty_read>
|
125 |
+
</resources>
|
126 |
+
<helpers>
|
127 |
+
<multipunkty>
|
128 |
+
<class>Orba_Multipunkty_Helper</class>
|
129 |
+
</multipunkty>
|
130 |
+
</helpers>
|
131 |
+
<events>
|
132 |
+
<sales_order_place_after>
|
133 |
+
<observers>
|
134 |
+
<orba_multipunkty>
|
135 |
+
<class>Orba_Multipunkty_Model_Observer</class>
|
136 |
+
<method>placeOrder</method>
|
137 |
+
</orba_multipunkty>
|
138 |
+
</observers>
|
139 |
+
</sales_order_place_after>
|
140 |
+
</events>
|
141 |
+
<rewrite>
|
142 |
+
<orba_multipunkty_index>
|
143 |
+
<from><![CDATA[#multipunkty/api/1/events/partner/(.*)#]]></from>
|
144 |
+
<to><![CDATA[/multipunkty/index/$1]]></to>
|
145 |
+
</orba_multipunkty_index>
|
146 |
+
</rewrite>
|
147 |
+
<template>
|
148 |
+
<email>
|
149 |
+
<multipunkty_email_template translate="label" module="multipunkty">
|
150 |
+
<label>Multipunkty Email Template</label>
|
151 |
+
<file>multipunkty/order_new.html</file>
|
152 |
+
<type>html</type>
|
153 |
+
</multipunkty_email_template>
|
154 |
+
</email>
|
155 |
+
</template>
|
156 |
+
</global>
|
157 |
+
<default>
|
158 |
+
<multipunkty>
|
159 |
+
<start_settings>
|
160 |
+
<points_amount>1000</points_amount>
|
161 |
+
</start_settings>
|
162 |
+
<rewarding_settings>
|
163 |
+
<reward_purchase>1</reward_purchase>
|
164 |
+
<apply_cash_on_delivery>false</apply_cash_on_delivery>
|
165 |
+
</rewarding_settings>
|
166 |
+
<recommending_settings>
|
167 |
+
<reward_comment>1</reward_comment>
|
168 |
+
<reward_recommend_store>1</reward_recommend_store>
|
169 |
+
<reward_recommend_product>1</reward_recommend_product>
|
170 |
+
</recommending_settings>
|
171 |
+
<presenting_information>
|
172 |
+
<show_on_homepage>1</show_on_homepage>
|
173 |
+
<show_near_product>1</show_near_product>
|
174 |
+
<show_near_shopping_cart>1</show_near_shopping_cart>
|
175 |
+
<show_on_summary>1</show_on_summary>
|
176 |
+
<show_by_mail>1</show_by_mail>
|
177 |
+
</presenting_information>
|
178 |
+
</multipunkty>
|
179 |
+
</default>
|
180 |
+
</config>
|
app/code/community/Orba/Multipunkty/etc/system.xml
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<multipunkty translate="label" module="multipunkty">
|
5 |
+
<label>ORBA | MultiPunkty.pl</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>1000</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<start_settings traslate="label">
|
14 |
+
<label>MultiPunkty.pl loyalty program start</label>
|
15 |
+
<sort_order>10</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<account_register_btn translate="label,comment">
|
21 |
+
<label>MultiPunkty.pl Account</label>
|
22 |
+
<frontend_type>button</frontend_type>
|
23 |
+
<frontend_model>multipunkty/adminhtml_system_button_register</frontend_model>
|
24 |
+
<sort_order>10</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
</account_register_btn>
|
29 |
+
<points_amount translate="label">
|
30 |
+
<label>Number of points</label>
|
31 |
+
<frontend_model>multipunkty/adminhtml_system_text_points</frontend_model>
|
32 |
+
<backend_model>multipunkty/system_config_backend_points</backend_model>
|
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 |
+
</points_amount>
|
38 |
+
<launch_service translate="label,comment">
|
39 |
+
<label>Launch Service</label>
|
40 |
+
<frontend_type>select</frontend_type>
|
41 |
+
<frontend_model>multipunkty/adminhtml_system_service_launch</frontend_model>
|
42 |
+
<backend_model>multipunkty/system_config_backend_service_launch</backend_model>
|
43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
+
<sort_order>30</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
</launch_service>
|
49 |
+
<service_status translate="label">
|
50 |
+
<label>Service status</label>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<frontend_model>multipunkty/adminhtml_system_service_status</frontend_model>
|
53 |
+
<backend_model>multipunkty/system_config_backend_service_status</backend_model>
|
54 |
+
<source_model>multipunkty/system_config_source_enabledisable</source_model>
|
55 |
+
<sort_order>40</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</service_status>
|
60 |
+
</fields>
|
61 |
+
</start_settings>
|
62 |
+
<basic_config translate="label">
|
63 |
+
<label>API Configuration</label>
|
64 |
+
<sort_order>100</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 |
+
<fields>
|
69 |
+
<api_key translate="label,comment">
|
70 |
+
<label>Store API Key</label>
|
71 |
+
<frontend_type>text</frontend_type>
|
72 |
+
<frontend_model>multipunkty/adminhtml_system_select_disabled</frontend_model>
|
73 |
+
<comment>This value is used for store identification with MultiPunkty.pl service</comment>
|
74 |
+
<sort_order>10</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>1</show_in_store>
|
78 |
+
</api_key>
|
79 |
+
<private_key translate="label">
|
80 |
+
<label>Private Key</label>
|
81 |
+
<frontend_type>text</frontend_type>
|
82 |
+
<frontend_model>multipunkty/adminhtml_system_select_disabled</frontend_model>
|
83 |
+
<sort_order>11</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>1</show_in_website>
|
86 |
+
<show_in_store>1</show_in_store>
|
87 |
+
</private_key>
|
88 |
+
<partner_id translate="label">
|
89 |
+
<label>Partner ID</label>
|
90 |
+
<frontend_type>text</frontend_type>
|
91 |
+
<frontend_model>multipunkty/adminhtml_system_select_disabled</frontend_model>
|
92 |
+
<sort_order>12</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
</partner_id>
|
97 |
+
</fields>
|
98 |
+
</basic_config>
|
99 |
+
<rewarding_settings translate="label">
|
100 |
+
<label>Rewarding settings</label>
|
101 |
+
<sort_order>20</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>1</show_in_website>
|
104 |
+
<show_in_store>1</show_in_store>
|
105 |
+
<fields>
|
106 |
+
<reward_purchase translate="label,comment">
|
107 |
+
<label>Reward for purchase</label>
|
108 |
+
<frontend_type>text</frontend_type>
|
109 |
+
<comment>Amount of MP$ for 1PLN. Minimal value: 1</comment>
|
110 |
+
<sort_order>10</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>1</show_in_store>
|
114 |
+
</reward_purchase>
|
115 |
+
<apply_cash_on_delivery translate="label,comment">
|
116 |
+
<label>Payment type accepted by MultiPunkty module</label>
|
117 |
+
<frontend_type>select</frontend_type>
|
118 |
+
<source_model>multipunkty/system_config_source_payment_methods</source_model>
|
119 |
+
<comment>W przypadku wybrania opcji "płatność z góry"- MultiPunkty są naliczane po dokonaniu płatności on line za towar. Ma to zachęcić Klientów do wybrania opcji zapłaty przed dostarczeniem towaru. Sklep może podjąć decyzję o przyznawaniu MultiPunktów również w przypadku, gdy Klient wybierze opcję "za pobraniem"</comment>
|
120 |
+
<sort_order>20</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
+
</apply_cash_on_delivery>
|
125 |
+
<days_after_trans_act translate="label,comment">
|
126 |
+
<label>Points activation time</label>
|
127 |
+
<comment>Klient po dokonaniu zakupu w sklepie otrzymuje MultiPunkty. Przez określony czas (związany z możliwością zwrócenie towaru) punkty mają status nieaktywnych (nie można za nie odebrać nagrody). Po tym zdefiniowanym czasie MultiPunkty stają się aktywne. W przypadku zwrotu towaru przez Klienta w zdefiniowanym okresie MultiPunkty wracają na konto sklepu. Status poszczególnych transakcji jest dostępny z poziomu programu MultiPunkty.pl</comment>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<source_model>multipunkty/system_config_source_points_ttl</source_model>
|
130 |
+
<sort_order>30</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>1</show_in_store>
|
134 |
+
</days_after_trans_act>
|
135 |
+
</fields>
|
136 |
+
</rewarding_settings>
|
137 |
+
<!-- Will be use in 2nd stage of implementation
|
138 |
+
<recommending_settings>
|
139 |
+
<label>Recommending</label>
|
140 |
+
<sort_order>30</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
<fields>
|
145 |
+
<reward_comment translate="label,comment">
|
146 |
+
<label>Reward for comment</label>
|
147 |
+
<frontend_type>text</frontend_type>
|
148 |
+
<comment>Amount of MP$. Minimal value: 1</comment>
|
149 |
+
<sort_order>20</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
</reward_comment>
|
154 |
+
<reward_recommend_store translate="label,comment">
|
155 |
+
<label>Reward for store recommendation</label>
|
156 |
+
<frontend_type>text</frontend_type>
|
157 |
+
<comment>Amount of MP$. Minimal value: 1</comment>
|
158 |
+
<sort_order>30</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
</reward_recommend_store>
|
163 |
+
<reward_recommend_product translate="label,comment">
|
164 |
+
<label>Reward for product recommendation</label>
|
165 |
+
<frontend_type>text</frontend_type>
|
166 |
+
<comment>Amount of MP$. Minimal value: 1</comment>
|
167 |
+
<sort_order>40</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>1</show_in_store>
|
171 |
+
</reward_recommend_product>
|
172 |
+
</fields>
|
173 |
+
</recommending_settings>
|
174 |
+
-->
|
175 |
+
<presenting_information translate="label">
|
176 |
+
<label>Presenting information about MultiPunkty.pl service settings</label>
|
177 |
+
<sort_order>40</sort_order>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
<fields>
|
182 |
+
<show_on_homepage translate="label">
|
183 |
+
<label>Show information on homepage</label>
|
184 |
+
<frontend_type>select</frontend_type>
|
185 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
186 |
+
<sort_order>10</sort_order>
|
187 |
+
<show_in_default>1</show_in_default>
|
188 |
+
<show_in_website>1</show_in_website>
|
189 |
+
<show_in_store>1</show_in_store>
|
190 |
+
</show_on_homepage>
|
191 |
+
<show_near_product translate="label">
|
192 |
+
<label>Show information near product</label>
|
193 |
+
<frontend_type>select</frontend_type>
|
194 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
195 |
+
<sort_order>20</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>1</show_in_store>
|
199 |
+
</show_near_product>
|
200 |
+
<show_near_shopping_cart translate="label">
|
201 |
+
<label>Show information near shopping cart</label>
|
202 |
+
<frontend_type>select</frontend_type>
|
203 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
204 |
+
<sort_order>30</sort_order>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<show_in_store>1</show_in_store>
|
208 |
+
</show_near_shopping_cart>
|
209 |
+
<show_on_summary translate="label">
|
210 |
+
<label>Show information after purchase (in summary)</label>
|
211 |
+
<frontend_type>select</frontend_type>
|
212 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
213 |
+
<sort_order>40</sort_order>
|
214 |
+
<show_in_default>1</show_in_default>
|
215 |
+
<show_in_website>1</show_in_website>
|
216 |
+
<show_in_store>1</show_in_store>
|
217 |
+
</show_on_summary>
|
218 |
+
<show_by_mail translate="label">
|
219 |
+
<label>Show information in mail after purchase</label>
|
220 |
+
<frontend_type>select</frontend_type>
|
221 |
+
<frontend_model>multipunkty/adminhtml_system_select_disabled</frontend_model>
|
222 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
223 |
+
<sort_order>50</sort_order>
|
224 |
+
<show_in_default>1</show_in_default>
|
225 |
+
<show_in_website>1</show_in_website>
|
226 |
+
<show_in_store>1</show_in_store>
|
227 |
+
</show_by_mail>
|
228 |
+
</fields>
|
229 |
+
</presenting_information>
|
230 |
+
<!-- Will be use in 2nd stage of implementation
|
231 |
+
<promote_action_settings>
|
232 |
+
<label>Promotional campaigns settings</label>
|
233 |
+
<sort_order>50</sort_order>
|
234 |
+
<show_in_default>1</show_in_default>
|
235 |
+
<show_in_website>1</show_in_website>
|
236 |
+
<show_in_store>1</show_in_store>
|
237 |
+
</promote_action_settings>
|
238 |
+
-->
|
239 |
+
<!-- Will be use in 2nd stage of implementation
|
240 |
+
<rewards_catalog>
|
241 |
+
<label>Rewards Catalog</label>
|
242 |
+
<sort_order>60</sort_order>
|
243 |
+
<show_in_default>1</show_in_default>
|
244 |
+
<show_in_website>1</show_in_website>
|
245 |
+
<show_in_store>1</show_in_store>
|
246 |
+
<fields>
|
247 |
+
<include_products_in_catalog>
|
248 |
+
<label>Add products to Rewards Catalog</label>
|
249 |
+
<frontend_type>select</frontend_type>
|
250 |
+
<source_model>multipunkty/system_config_source_rewardscatalog_options</source_model>
|
251 |
+
<sort_order>10</sort_order>
|
252 |
+
<show_in_default>1</show_in_default>
|
253 |
+
<show_in_website>1</show_in_website>
|
254 |
+
<show_in_store>1</show_in_store>
|
255 |
+
</include_products_in_catalog>
|
256 |
+
</fields>
|
257 |
+
</rewards_catalog>
|
258 |
+
-->
|
259 |
+
</groups>
|
260 |
+
</multipunkty>
|
261 |
+
</sections>
|
262 |
+
</config>
|
app/code/community/Orba/Multipunkty/sql/multipunkty_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Installation script for Multipunkty module database
|
4 |
+
*/
|
5 |
+
|
6 |
+
$installer = $this;
|
7 |
+
|
8 |
+
$installer->startSetup();
|
9 |
+
|
10 |
+
//add additional attributes to product and customer by EAV
|
11 |
+
//Will be used in future releases...
|
12 |
+
//Mage::getModel('multipunkty/eav_product')->addMultipunktyAttributesToProduct();
|
13 |
+
Mage::getModel('multipunkty/eav_customer')->addMultipunktyAttributesToCustomer();
|
14 |
+
|
15 |
+
$installer->run("
|
16 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('orba_multipunkty_transaction')} (
|
17 |
+
`id` int(11) NULL AUTO_INCREMENT ,
|
18 |
+
`order_id` int(11) NULL ,
|
19 |
+
`points` int(11) NULL ,
|
20 |
+
`value` int(11) NULL ,
|
21 |
+
`transaction_hash` varchar(250) NULL ,
|
22 |
+
`assign_url` varchar(250) NULL,
|
23 |
+
`status` INT(11) NULL,
|
24 |
+
PRIMARY KEY (`id`)
|
25 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
26 |
+
");
|
27 |
+
|
28 |
+
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'multipunkty_userid');
|
29 |
+
$oAttribute->setData('used_in_forms', array('customer_account_edit'));
|
30 |
+
$oAttribute->save();
|
31 |
+
|
32 |
+
$installer->endSetup();
|
app/code/community/Orba/Multipunkty/sql/multipunkty_setup/mysql4-upgrade-0.1.0-0.2.0.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Installation script for Multipunkty module database
|
5 |
+
*
|
6 |
+
* Change: Added platform key set
|
7 |
+
*
|
8 |
+
* @author Michał Zabielski <michal.zabielski@orba.pl>
|
9 |
+
*/
|
10 |
+
|
11 |
+
$installer = $this;
|
12 |
+
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
//add key set to module system config
|
16 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/platform_api_key', "ab9687d7d975420298325df02c610760");
|
17 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/platform_private_key', "ed18e87476eef6fb7f55c56cafa35ac95cef03d8a319fa7aad5af6b895463614");
|
18 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/platform_partner_id', "160");
|
19 |
+
//adding variable to detect debug mode
|
20 |
+
Mage::getModel('core/config')->saveConfig('multipunkty/basic_config/debug_mode', "0");
|
21 |
+
|
22 |
+
$installer->endSetup();
|
app/code/community/Orba/Multipunkty/sql/multipunkty_setup/mysql4-upgrade-0.2.0-0.2.1.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Installation script for Multipunkty module database
|
5 |
+
*
|
6 |
+
* Change: Add database table to store nonces for API queries
|
7 |
+
*
|
8 |
+
* @author Michał Zabielski <michal.zabielski@orba.pl>
|
9 |
+
*/
|
10 |
+
|
11 |
+
$installer = $this;
|
12 |
+
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
//datetime format compatible with API: yyyyMMddTHHmmss
|
16 |
+
$installer->run("
|
17 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('orba_multipunkty_nonce')} (
|
18 |
+
`id` int(11) NOT NULL AUTO_INCREMENT ,
|
19 |
+
`secret_phrase` varchar(32) NOT NULL ,
|
20 |
+
`query_time` char(15) NOT NULL ,
|
21 |
+
PRIMARY KEY (`id`)
|
22 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
23 |
+
");
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/multipunkty.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs">
|
6 |
+
<script>multipunkty/api.js</script>
|
7 |
+
</action>
|
8 |
+
<action method="addJs">
|
9 |
+
<script>multipunkty/registerHandler.js</script>
|
10 |
+
</action>
|
11 |
+
</reference>
|
12 |
+
</default>
|
13 |
+
</layout>
|
app/design/adminhtml/default/default/template/multipunkty/rewardscatalog.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<table cellspacing="0">
|
3 |
+
<tr>
|
4 |
+
<td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('multipunkty')->__('Products in MultiPunkty.pl Rewards Catalog') ?></h3></td>
|
5 |
+
</tr>
|
6 |
+
</table>
|
7 |
+
</div>
|
8 |
+
<?php if( !$this->isSingleStoreMode() ): ?>
|
9 |
+
<?php echo $this->getChildHtml('store_switcher');?>
|
10 |
+
<?php endif;?>
|
11 |
+
<div>
|
12 |
+
<?php echo $this->getGridHtml() ?>
|
13 |
+
</div>
|
app/design/frontend/base/default/template/multipunkty/account.phtml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$helper = Mage::helper('multipunkty');
|
3 |
+
$isActive = false;
|
4 |
+
|
5 |
+
if($this->getCustomer()->getMultipunktyUserid())
|
6 |
+
{
|
7 |
+
$isActive = true;
|
8 |
+
}
|
9 |
+
?>
|
10 |
+
<div class="page-title">
|
11 |
+
<h1><?php echo $this->__('MultiPunkty') ?></h1>
|
12 |
+
</div>
|
13 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
14 |
+
<form action="<?php echo $this->getUrl('multipunkty/customer/editPost') ?>" method="post" id="form-validate">
|
15 |
+
<div class="fieldset">
|
16 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
17 |
+
<h2 class="legend"><?php echo $helper->__('Account information') ?></h2>
|
18 |
+
<ul class="form-list mp-customer-stats">
|
19 |
+
<li>
|
20 |
+
<?php echo $helper->__('User status: '); ?>
|
21 |
+
<span class="mp-user-status<?php if($isActive) echo ' active'; ?>">
|
22 |
+
<?php
|
23 |
+
if($isActive)
|
24 |
+
{
|
25 |
+
echo $helper->__('Active');
|
26 |
+
}else{
|
27 |
+
echo $helper->__('Inactive');
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
</span>
|
31 |
+
</li>
|
32 |
+
<li>
|
33 |
+
<?php echo $helper->__('User login: '); ?>
|
34 |
+
<span class="mp-user-login">
|
35 |
+
<?php
|
36 |
+
if($this->getCustomer()->getMultipunktyUserlogin())
|
37 |
+
{
|
38 |
+
echo $this->getCustomer()->getMultipunktyUserlogin();
|
39 |
+
}else{
|
40 |
+
echo $helper->__('Not able ');
|
41 |
+
}
|
42 |
+
?>
|
43 |
+
</span>
|
44 |
+
</li>
|
45 |
+
<li></li>
|
46 |
+
<li>
|
47 |
+
<a style="color: #ea7900;" href="<?php echo $helper->getHomePageUrl(); ?>" target="_blank">
|
48 |
+
<?php echo $helper->__('Click here to check your MultiPoints status and get to your account panel in MultiPunkty.pl service'); ?>
|
49 |
+
</a>
|
50 |
+
</li>
|
51 |
+
</ul>
|
52 |
+
<div class="buttons-set">
|
53 |
+
<?php if($isActive): ?>
|
54 |
+
<button type="button" title="<?php echo $helper->__('Unregister account') ?>" class="button" onclick="unregisterAcc()"><span><span><?php echo $helper->__('Unregister account') ?></span></span></button>
|
55 |
+
<?php else: ?>
|
56 |
+
<button type="button" title="<?php echo $helper->__('Register account') ?>" class="button" onclick="registerAcc()"><span><span><?php echo $helper->__('Register account') ?></span></span></button>
|
57 |
+
<?php endif; ?>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<div class="buttons-set">
|
61 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $helper->__('Back') ?></a></p>
|
62 |
+
</div>
|
63 |
+
</form>
|
64 |
+
<form id="register-form" action="<?php echo $this->getUrl('multipunkty/customer/register') ?>" method="post">
|
65 |
+
<input id="register-mpid" type="hidden" name="mpid" value="" />
|
66 |
+
<input id="register-login" type="hidden" name="login" value="" />
|
67 |
+
</form>
|
68 |
+
<script type="text/javascript">
|
69 |
+
//<![CDATA[
|
70 |
+
function registerAcc()
|
71 |
+
{
|
72 |
+
$MP.api.getCurrentUser(function(user) {
|
73 |
+
if (!user) {
|
74 |
+
alert('<?php echo $helper->__('There was an error when logging into MultiPunkty service - try again.'); ?>');
|
75 |
+
} else {
|
76 |
+
$('register-mpid').setAttribute('value', user.mpid);
|
77 |
+
$('register-login').setAttribute('value', user.login);
|
78 |
+
$('register-form').submit();
|
79 |
+
}
|
80 |
+
});
|
81 |
+
}
|
82 |
+
|
83 |
+
function unregisterAcc()
|
84 |
+
{
|
85 |
+
setLocation('/multipunkty/customer/unregister');
|
86 |
+
}
|
87 |
+
//]]>
|
88 |
+
</script>
|
app/design/frontend/base/default/template/multipunkty/cart.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_coreHelper = $this->helper('core');
|
3 |
+
$_cartHelper = $this->helper('checkout/cart');
|
4 |
+
|
5 |
+
$totalItemsInCart = $_cartHelper->getItemsCount();
|
6 |
+
$aboutUrl = Mage::helper('multipunkty')->getAboutMPSiteUrl();
|
7 |
+
?>
|
8 |
+
<?php if ($this->isVisible() AND $this->getPurchaseReward() > 0 AND $totalItemsInCart > 0): ?>
|
9 |
+
<div class="price-box">
|
10 |
+
<?php echo $this->__('Za zakupione towary otrzymasz łącznie'); ?> <span class="regular-price"><span class="price"><?php echo ceil($_coreHelper->currency($_cartHelper->getQuote()->getGrandTotal()*$this->getPurchaseReward(), false, false)); ?> MP$</span></span>
|
11 |
+
<br /><a href="<?php echo $aboutUrl; ?>" target="_blank"> <?php echo $this->__('Czym są MultiPunkty.pl?'); ?></a>
|
12 |
+
</div>
|
13 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/multipunkty/checkout.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_coreHelper = $this->helper('core');
|
3 |
+
|
4 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
5 |
+
$oOrder = Mage::getModel('sales/order')->load($sOrderId);
|
6 |
+
|
7 |
+
$total = $oOrder->getSubtotal();
|
8 |
+
$aboutUrl = Mage::helper('multipunkty')->getAboutMPSiteUrl();
|
9 |
+
?>
|
10 |
+
<?php if ($this->isVisible() AND $this->getPurchaseReward() > 0): ?>
|
11 |
+
<ul class="messages">
|
12 |
+
<li class="notice-msg">
|
13 |
+
<ul>
|
14 |
+
<li><?php echo $this->__('Za zakupione towary otrzymałeś łącznie').' '.ceil($_coreHelper->currency($total*$this->getPurchaseReward(), false, false)); ?> MP$</li>
|
15 |
+
<li><a href="<?php echo $aboutUrl; ?>" target="_blank"> <?php echo $this->__('Zobacz czym są MultiPunkty.pl'); ?></a></li>
|
16 |
+
</ul>
|
17 |
+
</li>
|
18 |
+
</ul>
|
19 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/multipunkty/checkout.transaction.phtml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//$_coreHelper = $this->helper('core');
|
3 |
+
|
4 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
5 |
+
//$oOrder = Mage::getModel('sales/order')->load($sOrderId);
|
6 |
+
|
7 |
+
$mp = Mage::getModel('multipunkty/transaction');
|
8 |
+
$mp->load($sOrderId, 'order_id');
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php if ($this->isVisible()): ?>
|
12 |
+
<?php if ($this->getPurchaseReward() > 0): ?>
|
13 |
+
<?php if ($mp->getStatus() == 1): ?>
|
14 |
+
<ul class="messages">
|
15 |
+
<li class="notice-msg">
|
16 |
+
<ul>
|
17 |
+
<li><?php echo $this->__('Punkty zostały przyznane pomyślnie. Pod poniższym linkiem będziesz miał(a) możliwość sprawdzenia statusu punktów') ?></li>
|
18 |
+
<li><a href="<?php echo $mp->getAssignUrl(); ?>" target="_blank"><?php echo $mp->getAssignUrl(); ?></a></li>
|
19 |
+
</ul>
|
20 |
+
</li>
|
21 |
+
</ul>
|
22 |
+
<?php endif; ?>
|
23 |
+
|
24 |
+
<?php if ($mp->getStatus() == 2): ?>
|
25 |
+
<ul class="messages">
|
26 |
+
<li class="notice-msg">
|
27 |
+
<ul>
|
28 |
+
<li><?php echo $this->__('Identyfikator konta MultiPunkty podany w profilu jest prawdopodobnie błędny lub nie został wprowadzony. Aby odebrać punkty kliknij w poniższy link') ?></li>
|
29 |
+
<li><a href="<?php echo $mp->getAssignUrl(); ?>" target="_blank"><?php echo $mp->getAssignUrl(); ?></a></li>
|
30 |
+
</ul>
|
31 |
+
</li>
|
32 |
+
</ul>
|
33 |
+
<?php endif; ?>
|
34 |
+
|
35 |
+
<?php if ($mp->getStatus() == 3): ?>
|
36 |
+
<ul class="messages">
|
37 |
+
<li class="notice-msg">
|
38 |
+
<ul>
|
39 |
+
<li><?php echo $this->__('Aby odebrać punkty kliknij w poniższy link') ?></li>
|
40 |
+
<li><a href="<?php echo $mp->getAssignUrl(); ?>" target="_blank"><?php echo $mp->getAssignUrl(); ?></a></li>
|
41 |
+
</ul>
|
42 |
+
</li>
|
43 |
+
</ul>
|
44 |
+
<?php endif; ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/multipunkty/checkout/onepage/payment/methods.phtml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* One page checkout payment methods
|
30 |
+
*
|
31 |
+
* @see Mage_Checkout_Block_Onepage_Payment_Methods
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<dl class="sp-methods" id="checkout-payment-method-load">
|
35 |
+
<?php
|
36 |
+
$methods = $this->getMethods();
|
37 |
+
$oneMethod = count($methods) <= 1;
|
38 |
+
?>
|
39 |
+
<?php
|
40 |
+
foreach ($methods as $_method):
|
41 |
+
$_code = $_method->getCode();
|
42 |
+
?>
|
43 |
+
<dt>
|
44 |
+
<?php if(!$oneMethod): ?>
|
45 |
+
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>');"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> class="radio" />
|
46 |
+
<?php else: ?>
|
47 |
+
<span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
|
48 |
+
<?php $oneMethod = $_code; ?>
|
49 |
+
<?php endif; ?>
|
50 |
+
<label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
|
51 |
+
</dt>
|
52 |
+
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
|
53 |
+
<dd>
|
54 |
+
<?php echo $html; ?>
|
55 |
+
</dd>
|
56 |
+
<?php endif; ?>
|
57 |
+
<?php endforeach; ?>
|
58 |
+
</dl>
|
59 |
+
|
60 |
+
<?php
|
61 |
+
$_coreHelper = $this->helper('core');
|
62 |
+
//$_aboutUrl = Mage::helper('multipunkty')->getAboutMPSiteUrl();
|
63 |
+
|
64 |
+
$total = Mage::getModel('checkout/cart')->getQuote()->getData("subtotal");
|
65 |
+
|
66 |
+
$_helper = Mage::helper('multipunkty');
|
67 |
+
$mpNumber = ceil($_coreHelper->currency($total*$_helper->getPurchaseReward(), false, false));
|
68 |
+
$useSpecialBlock = !$_helper->isCashOnDeliveryAccepted() && $_helper->isActive();
|
69 |
+
|
70 |
+
if($useSpecialBlock && $mpNumber > 0):
|
71 |
+
?>
|
72 |
+
<div id="mp-info-msg" style="display: none;">
|
73 |
+
<div class="close" title="<?php echo $_helper->__("Close message window"); ?>">X</div>
|
74 |
+
<div class="txt">
|
75 |
+
<span class="title"><?php echo $_helper->__('%d Multipoints (MP$) will not be given to user',$mpNumber); ?></span><br />
|
76 |
+
<span class="descr"><?php echo $_helper->__('You will receive your MP$ if you will pay on purchase'); ?></span>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
<?php endif; ?>
|
80 |
+
|
81 |
+
|
82 |
+
<?php echo $this->getChildChildHtml('additional'); ?>
|
83 |
+
<script type="text/javascript">
|
84 |
+
//<![CDATA[
|
85 |
+
<?php echo $this->getChildChildHtml('scripts'); ?>
|
86 |
+
payment.init();
|
87 |
+
<?php if (is_string($oneMethod)): ?>
|
88 |
+
payment.switchMethod('<?php echo $oneMethod ?>');
|
89 |
+
<?php endif; ?>
|
90 |
+
<?php if($useSpecialBlock): ?>
|
91 |
+
if($('p_method_cashondelivery').checked === true)
|
92 |
+
{
|
93 |
+
$('mp-info-msg').show();
|
94 |
+
}
|
95 |
+
Event.observe($('mp-info-msg'),'click',function(event) {
|
96 |
+
var elem = event.element();
|
97 |
+
|
98 |
+
if(elem.hasClassName('close'))
|
99 |
+
{
|
100 |
+
$('mp-info-msg').hide();
|
101 |
+
}
|
102 |
+
});
|
103 |
+
Event.observe($('checkout-payment-method-load'),'click',function(event) {
|
104 |
+
var elem = event.element();
|
105 |
+
|
106 |
+
if(elem.id === 'p_method_cashondelivery')
|
107 |
+
{
|
108 |
+
$('mp-info-msg').show();
|
109 |
+
}else{
|
110 |
+
$('mp-info-msg').hide();
|
111 |
+
}
|
112 |
+
});
|
113 |
+
<?php endif; ?>
|
114 |
+
//]]>
|
115 |
+
</script>
|
app/design/frontend/base/default/template/multipunkty/email/order_new.phtml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$helper = Mage::helper('multipunkty');
|
3 |
+
$order = $this->getData('order');
|
4 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
5 |
+
$pointsScaler = Mage::helper('multipunkty')->getPurchaseReward();
|
6 |
+
$total = $order->getSubtotal();
|
7 |
+
$points = ceil(Mage::helper('core')->currency($total*$pointsScaler, false, false));
|
8 |
+
|
9 |
+
$mp = Mage::getModel('multipunkty/transaction');
|
10 |
+
$mp->load($order->getId(), 'order_id');
|
11 |
+
?>
|
12 |
+
<br />
|
13 |
+
<p style="font-weight: bold;">
|
14 |
+
<?php echo $helper->__('Thank you for shopping!'); ?>
|
15 |
+
</p>
|
16 |
+
|
17 |
+
<?php if($customer->getMultipunktyUserid() && $mp->getStatus() == 1): ?>
|
18 |
+
<p style="color: orange; font-weight: bold; margin-bottom: 12px;">
|
19 |
+
<?php echo $helper->__('You received %d MultiPoints',$points); ?> (<?php echo $points; ?> MP$)
|
20 |
+
</p>
|
21 |
+
<p>
|
22 |
+
<?php echo $helper->__('Check your MP$ status and rewards that you can receive!'); ?> <a href="<?php echo $helper->getHomePageUrl(); ?>" target="_blank" style="font-weight: bold; color: black; text-decoration: underline;">(MultiPunkty.pl)</a>
|
23 |
+
</p>
|
24 |
+
<?php else: ?>
|
25 |
+
<?php
|
26 |
+
$transaction = Mage::getModel('multipunkty/transaction')->load($order->getId(), 'order_id');
|
27 |
+
|
28 |
+
if($transaction->getId())
|
29 |
+
{
|
30 |
+
$assignUrl = $transaction->getAssignUrl();
|
31 |
+
}else{
|
32 |
+
$assignUrl = null;
|
33 |
+
}
|
34 |
+
?>
|
35 |
+
<p style="font-weight: bold; margin-bottom: 12px;">
|
36 |
+
<?php echo $helper->__('You received %d MultiPoints',$points); ?> (<?php echo $points; ?> MP$)
|
37 |
+
</p>
|
38 |
+
<p style="color: orange; font-weight: bold;">
|
39 |
+
<?php echo $helper->__('Receive your MultiPoints and exchange them into rewards (over 1 000 rewards to choose)'); ?>
|
40 |
+
</p>
|
41 |
+
<p>
|
42 |
+
<?php echo $helper->__('More than 250 000 people gather MP$'); ?>
|
43 |
+
</p>
|
44 |
+
<?php endif; ?>
|
45 |
+
<?php if(!is_null($assignUrl)): ?>
|
46 |
+
<p>
|
47 |
+
<?php echo $helper->__('Click on the link above to register your MultiPoints'); ?><br />
|
48 |
+
<a href="<?php echo $assignUrl; ?>" target="_blank"><?php echo $assignUrl; ?></a>
|
49 |
+
</p>
|
50 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/multipunkty/home.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $aboutUrl = Mage::helper('multipunkty')->getAboutMPSiteUrl(); ?>
|
2 |
+
<?php if ($this->isVisible() AND $this->getPurchaseReward() > 0): ?>
|
3 |
+
<ul class="messages">
|
4 |
+
<li class="notice-msg">
|
5 |
+
<ul>
|
6 |
+
<li><?php echo $this->__('Przy zakupach w naszym sklepie za każdą wydaną złotówkę otrzymujesz').' '.$this->getPurchaseReward(); ?> MP$</li>
|
7 |
+
<li><a href="<?php echo $aboutUrl; ?>" target="_blank"> <?php echo $this->__('Zobacz czym są MultiPunkty.pl'); ?></a></li>
|
8 |
+
</ul>
|
9 |
+
</li>
|
10 |
+
</ul>
|
11 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/multipunkty/product.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_coreHelper = $this->helper('core');
|
3 |
+
$_product = Mage::registry('current_product');
|
4 |
+
$aboutUrl = Mage::helper('multipunkty')->getAboutMPSiteUrl();
|
5 |
+
?>
|
6 |
+
<?php if ($this->isVisible() AND $this->getPurchaseReward() > 0): ?>
|
7 |
+
<div class="price-box">
|
8 |
+
<?php echo $this->__('Przy zakupie tego towaru otrzymasz'); ?> <span class="regular-price"><span class="price"><?php echo ceil($_coreHelper->currency($_product->getFinalPrice()*$this->getPurchaseReward(), false, false)); ?> MP$</span></span>
|
9 |
+
<br /><a href="<?php echo $aboutUrl; ?>" target="_blank"> <?php echo $this->__('Czym są MultiPunkty.pl?'); ?></a>
|
10 |
+
</div>
|
11 |
+
<?php endif; ?>
|
app/etc/modules/Orba_Multipunkty.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Orba_Multipunkty>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Orba_Multipunkty>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/multipunkty/order_new.html
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var store.getFrontendName()}}: You received MultiPoints for an order #{{var order.increment_id}} @-->
|
2 |
+
<!--@vars
|
3 |
+
{"store url=\"\"":"Store Url",
|
4 |
+
"var logo_url":"Email Logo Image Url",
|
5 |
+
"var logo_alt":"Email Logo Image Alt",
|
6 |
+
"htmlescape var=$order.getCustomerName()":"Customer Name",
|
7 |
+
"var store.getFrontendName()":"Store Name",
|
8 |
+
"store url=\"customer/account/\"":"Customer Account Url",
|
9 |
+
"var order.increment_id":"Order Id",
|
10 |
+
"var order.getCreatedAtFormated('long')":"Order Created At (datetime)",
|
11 |
+
"var order.getBillingAddress().format('html')":"Billing Address",
|
12 |
+
"var payment_html":"Payment Details",
|
13 |
+
"var order.getShippingAddress().format('html')":"Shipping Address",
|
14 |
+
"var order.getShippingDescription()":"Shipping Description",
|
15 |
+
"layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid",
|
16 |
+
"var order.getEmailCustomerNote()":"Email Order Note"}
|
17 |
+
@-->
|
18 |
+
<!--@styles
|
19 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
20 |
+
@-->
|
21 |
+
|
22 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
23 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
24 |
+
{{block type='core/template' area='frontend' template='multipunkty/email/order_new.phtml' order=$order}}
|
25 |
+
</div>
|
26 |
+
</body>
|
app/locale/pl_PL/Orba_Multipunkty.csv
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"API Configuration","Konfiguracja API"
|
2 |
+
"Store API Key","Klucz API sklepu"
|
3 |
+
"This value is used for store identification with MultiPunkty.pl service","Wartość ta jest wykorzystywana do identyfikacji sklepu w serwisie MultiPunkty.pl"
|
4 |
+
"Payment type","Typ płatności"
|
5 |
+
"Launch Service","Uruchom usługę"
|
6 |
+
"Yes","Tak"
|
7 |
+
"No","Nie"
|
8 |
+
"Rewarding settings","Ustawienia premiowania"
|
9 |
+
"Reward for purchase","Liczba punktów za zakupy"
|
10 |
+
"Reward for comment","Liczba punktów za wystawiony komentarz"
|
11 |
+
"Reward for store recommendation","Liczba punktów za polecenie sklepu"
|
12 |
+
"Reward for product recommendation","Liczba punktów za polecenie produktu"
|
13 |
+
"Amount of MP$ for 1PLN. Minimal value: 1","Liczba multipunktów otrzymywana za każdą wydaną złotówkę. Minimalna wartość: 1"
|
14 |
+
"Amount of MP$. Minimal value: 1","Liczba multipunktów. Minimalna wartość: 1"
|
15 |
+
"Presenting information about MultiPunkty.pl service settings","Prezentacja informacji o usłudze MultiPunkty.pl"
|
16 |
+
"Show information on homepage","Pokazuj informację na stronie głównej"
|
17 |
+
"Show information near product","Pokazuj informację przy opisie produktu"
|
18 |
+
"Show information near shopping cart","Pokazuj informację przy koszyku sklepowym"
|
19 |
+
"Show information after purchase (in summary)","Pokazuj informację po zakupie (w podsumowaniu)"
|
20 |
+
"Show information in mail after purchase","Pokazuj informację w mailu po zakupie"
|
21 |
+
"Rewards Catalog","Katalog nagród"
|
22 |
+
"Add products to Rewards Catalog","Dodaj produkty do Katalogu nagród"
|
23 |
+
"None","Żadne"
|
24 |
+
"All","Wszystkie"
|
25 |
+
"From Category","Z kategorii"
|
26 |
+
"Loyalty program","Program lojalnościowy"
|
27 |
+
"Recommending","Polecanie"
|
28 |
+
"Promotional campaigns settings","Ustawienia akcji promocyjnych"
|
29 |
+
"MultiPunkty.pl loyalty program start","Start usługi programu lojalnościowego MultiPunkty.pl"
|
30 |
+
"Payment in advance","Płatność z góry"
|
31 |
+
"Payment in advance & Cash on delivery","Płatność z góry lub za pobraniem"
|
32 |
+
"Private Key","Klucz prywatny sklepu"
|
33 |
+
"Partner ID","Identyfikator partnera"
|
34 |
+
"MultiPunkty.pl Account","Konto MultiPunkty.pl"
|
35 |
+
"Number of points","Liczba punktów"
|
36 |
+
"Buy credits","Doładuj"
|
37 |
+
"Service status","Status usługi"
|
38 |
+
"Points activation time","Czas aktywowania punktów"
|
39 |
+
"Payment type accepted by MultiPunkty module","Typ płatności za zakup a przyznawanie MultiPunktów"
|
40 |
+
"Enabled","Aktywna"
|
41 |
+
"Disabled","Nieaktywna"
|
42 |
+
"Register Account","Załóż konto"
|
43 |
+
"Account Registered","Konto założone"
|
44 |
+
"No account - create one or complete registration process","Brak konta - założ konto lub dokończ proces rejestracji"
|
45 |
+
"No MultiPoints - buy credits","Brak MultiPunktów - doładuj konto"
|
46 |
+
"Click here to activate your account in MultiPunkty.pl service","Kliknij tutaj, aby założyć konto i aktywować je w usłudze MultiPunkty.pl"
|
47 |
+
"%d MultiPoints (MP$) will not be given to user","Uwaga! %d MultiPunktów (MP$)"
|
48 |
+
"You will receive your MP$ if you will pay on purchase","Możesz otrzymać dokonując płatności przy zakupie (z góry). Sprawdź wybrany typ zapłaty."
|
49 |
+
"Account information","Informacje o koncie"
|
50 |
+
"User status: ","Status użytkownika: "
|
51 |
+
"Active","Aktywny"
|
52 |
+
"Inactive","Nieaktywny"
|
53 |
+
"User login: ","Login użytkownika: "
|
54 |
+
"Not able ","Niedostępny "
|
55 |
+
"Unregister account","Wyrejestruj konto"
|
56 |
+
"Register account","Zarejestruj konto"
|
57 |
+
"Back","Powrót"
|
58 |
+
"There was an error when logging into MultiPunkty service - try again.","Wystąpił błąd podczas logowania do serwisu MultiPunkty.pl - spróbuj ponownie"
|
59 |
+
"User was successfully registered.","Użytkownik został zarejestrowany pomyślnie"
|
60 |
+
"There was an error when processing your request, try again.","Wystąpił błąd podczas obsługi Twojego żądania, spróbuj ponownie"
|
61 |
+
"User already unregistered.","Użytkownik został wyrejestrowany wcześniej"
|
62 |
+
"User was successfully unregistered.","Użytkownik został wyrejestrowany pomyślnie"
|
63 |
+
"You received %d MultiPoints","Otrzymałeś %d MultiPunktów"
|
64 |
+
"Check your MP$ status and rewards that you can receive!","Sprawdź swój stan MP$ i nagrody, jakie możesz odebrać !"
|
65 |
+
"Receive your MultiPoints and exchange them into rewards (over 1000 rewards to choose)","Odbierz swoje MultiPunkty i wymień je na nagrody (ponad 1000 nagród do wyboru)"
|
66 |
+
"Click on the link above to register your MultiPoints","Kliknij w poniższy link, aby zarejestrować swoje MultiPunkty:"
|
67 |
+
"More than 250 000 people gather MP$","Już ponad 250 000 osób zbiera MP$"
|
68 |
+
"Thank you for shopping!","Dziękujemy za zakupy!"
|
69 |
+
"Click here to check your MultiPoints status and get to your account panel in MultiPunkty.pl service","Kliknij tutaj, aby sprawdzić status swoich punktów i dostać się do panelu konta w serwisie MultiPunkty.pl"
|
70 |
+
"After activating your account using activation link sent by email, please launch service in module and save changes","Po aktywowaniu konta za pomocą linku aktywacyjnego, proszę o uruchomienie usługi oraz zapisanie zmian"
|
71 |
+
"You get 1000 MP$ at the beginning, which you can reward your customers for the purchase","Otrzymujesz 1000 MP$ na Start, którymi możesz premiować swoich Klientów za zakup"
|
72 |
+
"'%s: You received MultiPoints for an order #%d'","%s: Otrzymałeś MultiPunkty za zamówienie nr %d"
|
73 |
+
"days","dni"
|
js/multipunkty/api.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
window.$MP=window.$MP||{};$MP.base=$MP.base||{};$MP.callbacks=$MP.callbacks||{};$MP.cookie=$MP.cookie||{};$MP.utils=$MP.utils||{};Function.prototype.bind=function(context){var method=this;return function(){return method.apply(context,arguments);};};$MP.base.callback=function(identifier,args){var fn=$MP.callbacks[identifier];if(fn){delete $MP.callbacks[identifier];setTimeout(function(){fn.apply(this,args);},1);}};$MP.base.getContainer=function(id,isNewContainerBlocked){id=id||'mp-container';var c=document.getElementById(id);if(!c&&!isNewContainerBlocked){c=document.createElement('div');c.id=id;document.body.appendChild(c);}return c;};$MP.base.request=function(url,callback,options){options=$MP.utils.defaults(options,{delay:4,allowCache:false});if(callback){var identifier;do identifier='_'+$MP.utils.generateIdentifier(16);while($MP.callbacks[identifier]);$MP.callbacks[identifier]=callback;url=$MP.utils.appendQueryString(url,'cb='+encodeURIComponent(identifier));}if(!options.allowCache){url=$MP.utils.appendQueryString(url,'d='+new Date().getTime());}setTimeout(function(){var c=$MP.base.getContainer();c.innerHTML='';var s=document.createElement('script');s.setAttribute('type','text/javascript');s.src=document.location.protocol.match(/https/i)?url.replace(/http:/i,'https:'):url;c.appendChild(s);},options.delay);};$MP.cookie.get=function(name,cookieFormat){cookieFormat=cookieFormat||1;var ca=document.cookie.split(';');for(var i=0,c;c=ca[i++];){while(c.charAt(0)==' ')c=c.substring(1);if(c.indexOf(name+'=')==0){var content=c.substring(name.length+1),result={};switch(cookieFormat){case 0:try{while(content.length>0){var nameLength=parseInt(content.substr(0,2),16),name=content.substr(2,nameLength),valueLength=parseInt(content.substr(2+nameLength,2),16),value=content.substr(2+nameLength+2,valueLength);content=content.substr(2+nameLength+2+valueLength);result[name]=value;}}catch(e){return null;}return result;case 1:return $MP.utils.parseQueryString(content);}}}return null;};$MP.cookie.remove=function(name,options){options=$MP.utils.defaults(options,{domain:null});var date=new Date();date.setTime(date.getTime()+(-365*24*60*60*1000));document.cookie=name+'=; expires='+date.toGMTString()+'; path=/'+(options.domain?'; domain='+options.domain:'');};$MP.cookie.set=function(name,object,options){options=$MP.utils.defaults(options,{cookieFormat:1,domain:null});var output='';switch(options.cookieFormat){case 0:for(var name in object){var value=object[name].toString();if(value)output+=$MP.utils.toHex(name.length,2)+name+$MP.utils.toHex(value.length,2)+value;}break;case 1:output=$MP.utils.toQueryString(object);break;}var date=new Date();date.setTime(date.getTime()+(365*24*60*60*1000));document.cookie=name+'='+output+'; expires='+date.toGMTString()+'; path=/'+(options.domain?'; domain='+options.domain:'');};$MP.utils.appendQueryString=function(url,queryString){return url+(url.indexOf('?')==-1?'?':'&')+queryString;};$MP.utils.asBool=function(value){if(!value||(value.length==0))return false;var type=typeof(value);if((type=='number')||(type=='boolean'))return true;value=value.toLowerCase();if((value=='1')||(value=='true'))return true;return false;};$MP.utils.defaults=function(object,defaults){if(!object){object=defaults;}else{for(var name in defaults){if(object[name]==undefined){object[name]=defaults[name];}}}return object;};$MP.utils.format=function(str){var params=arguments;return str.replace(/\{(\d+)\}/g,function(match,group){var idx=parseInt(group);if((idx>=0)&&(idx<params.length-1))return params[idx+1].toString();else throw'Argument of index '+idx+' not found!';});};$MP.utils.generateIdentifier=function(length){length=length||16;var result='';for(var i=0;i<8;i++){var r=Math.floor(Math.random()*36);if(r<10){result+=String.fromCharCode('0'.charCodeAt(0)+r);}else{result+=String.fromCharCode('a'.charCodeAt(0)+r-10);}}return result;};$MP.utils.isEmpty=function(object){if(!object)return true;var cnt=0;for(var x in object)cnt++;return cnt==0;};$MP.utils.jsonSerialize=function(json){if(JSON.stringify!==undefined){return JSON.stringify(json);}else{}};$MP.utils.parseQueryString=function(qs){if(!qs&&window.location.search)qs=window.location.search.substring(1);var result={};if(qs){var qsAry=qs.split('&');for(var i=0,component;component=qsAry[i++];){if(component.length>0){var pair=component.split('='),key=pair[0],value=pair[1];if(key.length>0){if(value&&(value.length>0)){try{value=decodeURIComponent(value).toString();}catch(e){value=unescape(value).toString();}}else{value=new String();}result[key]=value;}}}}return result;};$MP.utils.toHex=function(value,digits){var max=1<<(digits*4);if((value<0)||(value>=max))throw'Invalid hex conversion';var result=value.toString(16);while(result.length<digits){result='0'+result;}return result;};$MP.utils.toQueryString=function(object){var result='',i=0;for(var name in object){result+=(i++?'&':'')+name+'='+(object[name]||'');}return result;};$MP.utils.toStringSeparated=function(value){var output='';var m=value.toString().match(/(-)?(\d+)([,.]\d+)?/);if(m&&m[2]){var sep='';var i=m[2].length;while(i>0){var x=i-3;if(x<0)x=0;output=m[2].substr(x,i-x)+(sep.length?sep:'')+output;sep=' ';i-=3;}if(m[1]){output=m[1]+output;}if(m[3]){output+=m[3];}}return output;};$MP.utils.trim=function(str){return $MP.utils.trimRight($MP.utils.trimLeft(str));};$MP.utils.trimLeft=function(str){return str.replace(/^\s+/,'');};$MP.utils.trimRight=function(str){return str.replace(/\s+$/,'');};$MP.api=$MP.api||{};$MP.api.connectAccount=function(appId,ufk,secret,args,options){if(!appId||!ufk||!secret)return;options=options||{};var to=encodeURIComponent(options.to||'polaczenie-kont');$MP.api.post('http://multipunkty.pl/referrer?to='+to,'ConnectAccounts',$MP.utils.defaults({appId:appId,ufk:ufk,secret:secret},args),options);};$MP.api.connectPartner=function(appId,partnerFK,secret,eventUrl,returnUrl,args,options){if(!appId||!partnerFK||!eventUrl||!returnUrl)return;options=options||{};var to=encodeURIComponent(options.to||'landing');$MP.api.post('http://partner.multipunkty.pl/referrer?to='+to,'ConnectPartner',$MP.utils.defaults({appId:appId,partnerFK:partnerFK,secret:secret,eventUrl:eventUrl,returnUrl:returnUrl},args),options);};$MP.api.getCurrentUser=function(callback,options){if(!callback)return;$MP.api.query('GET','api/1/users/context/current',null,options,function(response){if(response&&(response.statusCode==200)){callback(response.data);return;}callback(null);});};$MP.api.query=function(method,path,args,options,onResponse){args=args||{};options=$MP.utils.defaults(options,{showLoginWindow:true});var requestArgs={method:method,path:encodeURIComponent(path),args:encodeURIComponent($MP.utils.toQueryString(args)),r:encodeURIComponent(document.referrer)};$MP.base.request('http://multipunkty.pl/api-query?'+$MP.utils.toQueryString(requestArgs),function(response){if(response){if(response.statusCode==200){onResponse(response);return;}if(options.showLoginWindow&&(response.statusCode==401)){options.showLoginWindow=false;$MP.api.showLoginWindow({onWindowClosed:function(){$MP.api.query(method,path,args,options,onResponse);}});return;}}onResponse(response);});};$MP.api.post=function(url,action,args,options){if(!url||!action)return;args=args||{};options=options||{};var form=document.createElement('form');form.action=url;form.method='POST';form.target=!options.isTargetSelf?'_blank':'_self';function addParam(name,value){var input=document.createElement('input');input.type='hidden';input.id=name;input.name=name;input.value=value;form.appendChild(input);}addParam('action',action);addParam('args',$MP.utils.jsonSerialize(args));document.body.appendChild(form);form.submit();document.body.removeChild(form);};$MP.api.showLoginWindow=function(options){options=$MP.utils.defaults(options,{title:'Authorization',width:250,height:150,onWindowClosed:null});var url='http://multipunkty.pl/zaloguj-multipunkty';var wnd=window.open(url,options.title,$MP.utils.format('width={0},height={1}',options.width,options.height));if(wnd){var intervalID=setInterval(function(){if(wnd.closed){clearInterval(intervalID);if(options.onWindowClosed){options.onWindowClosed();}}},100);if(window.focus){wnd.focus();}}};(function(){var queue=document.$MP$queue;document.$MP$queue=[];if(queue){for(var i=0,item;item=queue[i++];){item();}}})();
|
js/multipunkty/registerHandler.js
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Function to handle fetching data for register button
|
3 |
+
*
|
4 |
+
* @author Michał Zabielski <michal.zabielski@orba.pl>
|
5 |
+
*
|
6 |
+
* @created 3-12-2013
|
7 |
+
*/
|
8 |
+
|
9 |
+
function registerStore()
|
10 |
+
{
|
11 |
+
new Ajax.Request('/your/url', {
|
12 |
+
onSuccess: function(response) {
|
13 |
+
var data = Object.toJSON(response);
|
14 |
+
|
15 |
+
$MP.api.connectPartner(data.appId, data.partnerFK, data.secret, data.eventUrl, data.returnUrl, {
|
16 |
+
name: data.storeName,
|
17 |
+
categories: '[ ' +data.categories+' ]',
|
18 |
+
url: data.storeUrl,
|
19 |
+
email: data.email,
|
20 |
+
phone: data.phone,
|
21 |
+
firstName: data.firstName
|
22 |
+
});
|
23 |
+
}
|
24 |
+
});
|
25 |
+
}
|
26 |
+
|
27 |
+
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Orba_Multipunkty</name>
|
4 |
+
<version>0.2.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>MultiPunkty.pl service integration / Integracja z serwisem MultiPunkty.pl</summary>
|
10 |
+
<description>This extension allows to use MultiPunkty.pl service on your store
|
11 |
+
--
|
12 |
+
Rozszerzenie pozwala na korzystanie z usług serwisu MultiPunkty.pl w swoim sklepie internetowym</description>
|
13 |
+
<notes>- repackaging</notes>
|
14 |
+
<authors><author><name>ORBA</name><user>orba</user><email>magento@orba.pl</email></author></authors>
|
15 |
+
<date>2014-02-05</date>
|
16 |
+
<time>12:21:45</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Orba_Multipunkty.xml" hash="201cc879b3a099e99f6741419bdbb77c"/></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="multipunkty.xml" hash=""/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Orba"><dir name="Multipunkty"><dir name="Block"><file name="Account.php" hash="ecc57983a7c1936f72a86dd1a4adaf28"/><dir name="Adminhtml"><dir name="System"><dir name="Button"><file name="Register.php" hash="3856302f44e6382583bfd98ba8fd6c29"/></dir><dir name="Select"><file name="Disabled.php" hash="f54a33bbc6e70c19c1edd2547034aeda"/></dir><dir name="Service"><file name="Launch.php" hash="a94af4513fcce6185018dba605f0e4d6"/><file name="Status.php" hash="cd7bba66c14f7fd0f32fc06ea3cb3ea9"/></dir><dir name="Text"><file name="Points.php" hash="5c469f266ba958a5eb05b19d0d1aec4b"/></dir></dir></dir><file name="Cart.php" hash="d99b896364e8328de8c6003d17f75658"/><dir name="Checkout"><file name="Transaction.php" hash="baca23355100c9797f05a8ef7bf52275"/></dir><file name="Checkout.php" hash="df3df0672842721807702e45c5401862"/><file name="Home.php" hash="c93f71caf584e8ea9a904aea1e00a714"/><file name="Product.php" hash="405c4d96d90a892de781091cde81a0ff"/></dir><dir name="Helper"><file name="Data.php" hash="ba5215a46ae78c6289e312e8d5100226"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="00df1f2c2225729ac2f399ce13e5df65"/><file name="Client.php" hash="6a786b10dddf02e5383a9c54ba3d140f"/><file name="Server.php" hash="35b3c8ca35b1f779cf37c69f620ca6e4"/></dir><file name="Config.php" hash="cb5fedbb442bd58233ab0a5ceeed23d0"/><dir name="Eav"><file name="Abstract.php" hash="bf1c290f9bd0ad19f13ce623ffa768e9"/><file name="Customer.php" hash="7837094b565c11deb5c63506d1272f99"/><file name="Product.php" hash="4f4f14aae3a6a93e4e6abd9f6f6d30ba"/></dir><dir name="Mysql4"><dir name="Nonce"><file name="Collection.php" hash="3f3d87074f9c4f7676942f041f3b7948"/></dir><file name="Nonce.php" hash="66cc76003631d38b0776d6365d99f080"/><file name="Setup.php" hash="8fc42135809ff87e49d0ae63581e5b43"/><dir name="Transaction"><file name="Collection.php" hash="9c97830785e9729252bb04a84ab33e2b"/></dir><file name="Transaction.php" hash="a67b77ee42b2a53601c4e87b938ca20e"/></dir><file name="Nonce.php" hash="ebc12c09c90c84cb65cff82d420588ff"/><file name="Observer.php" hash="c3ba70a868356b841d89d8dd577bc2be"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Points.php" hash="d9ef56f07dcd35be03d4a6289e8f962e"/><dir name="Service"><file name="Launch.php" hash="04003013dcea68e0b21936944964910b"/><file name="Status.php" hash="922ec47f767ad22d2c4da52687210667"/></dir></dir><dir name="Source"><file name="Enabledisable.php" hash="010aa1c31aefd7d282745dd171e76197"/><dir name="Payment"><file name="Methods.php" hash="716943fcdbccebfa93dac7192ec2e932"/></dir><dir name="Points"><file name="Ttl.php" hash="0e4f1b92c99ea9941e091eb8ca619785"/></dir><dir name="Rewardscatalog"><file name="Options.php" hash="2da68a611eb99e2f0d161db3a302879e"/></dir></dir></dir></dir><file name="Transaction.php" hash="203d3864388870adc3abeb0f6892e6fd"/></dir><dir name="controllers"><file name="CustomerController.php" hash="a7460d54148ca6cd040a70cc4c647ee1"/><file name="IndexController.php" hash="16e885879e96e55023eaa8f36738f266"/></dir><dir name="etc"><file name="adminhtml.xml" hash="065d951763c62a85a1faba3e5bd5dee5"/><file name="config.xml" hash="e98d489a6778bd9f63f4a01c382ecae8"/><file name="system.xml" hash="a5e0ea94e8d4f0d235a65403dac35607"/></dir><dir name="sql"><dir name="multipunkty_setup"><file name="mysql4-install-0.1.0.php" hash="2eaf38ae8d025481ba23a0636be485e2"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="26e9d7985a75c02e91b81282e5d50b74"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="57b1e428bceface1a22f99b6a3f522cd"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Orba_Multipunkty.csv" hash="6b330aa3f8df211a9545b2bf09874881"/><dir name="template"><dir name="email"><dir name="multipunkty"><file name="order_new.html" hash=""/></dir></dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><dir name="multipunkty"><file name="order_new.html" hash="93ca0b009021d3e2534faf25f3c44c84"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="multipunkty"><file name="rewardscatalog.phtml" hash="f7930c37f13aea92216cec0c0ab92ce4"/></dir></dir><dir name="layout"><file name="multipunkty.xml" hash="d11dec921d58c6d9e64f21a3686eda3c"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="multipunkty"><file name="account.phtml" hash="04b36303308435129969e1d07c8b48a4"/><file name="cart.phtml" hash="ab889f4a9a71416504c0154f3635cfba"/><dir name="checkout"><dir name="onepage"><dir name="payment"><file name="methods.phtml" hash="d0081450d54067b5c3ae5ecdd7cbec40"/></dir></dir></dir><file name="checkout.phtml" hash="45f16a06333a75fb07a3ac9e087d82c1"/><file name="checkout.transaction.phtml" hash="dfb2e178f17f2ebc1f4ef9b9e5387e36"/><dir name="email"><file name="order_new.phtml" hash="edec4611297325869003f98521513785"/></dir><file name="home.phtml" hash="d66907619ab26a064ae7c84f12bec68f"/><file name="product.phtml" hash="2250e3ccf310492ffd060a5261aef454"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="multipunkty"><file name="multipunkty.css" hash="f57d296e815db173d8a81d382af5056c"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="multipunkty"><file name="api.js" hash="c3e2ff739b1c8f1ef1184da738844f67"/><file name="registerHandler.js" hash="981de0b7defe64819088304d659dcf96"/></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|
skin/frontend/base/default/css/multipunkty/multipunkty.css
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Document : multipunkty
|
3 |
+
Created on : 2013-11-29, 13:20:04
|
4 |
+
Author : sil3ntboy
|
5 |
+
Description:
|
6 |
+
Purpose of the stylesheet follows.
|
7 |
+
*/
|
8 |
+
|
9 |
+
/*----- code for message box in checkout --- */
|
10 |
+
#mp-info-msg {
|
11 |
+
position: relative;
|
12 |
+
border: 2px solid #777;
|
13 |
+
background-color: #fff;
|
14 |
+
padding: 10px;
|
15 |
+
width: 300px;
|
16 |
+
height: 120px;
|
17 |
+
float: left;
|
18 |
+
margin-left: 75px;
|
19 |
+
margin-bottom: 25px;
|
20 |
+
}
|
21 |
+
|
22 |
+
#mp-info-msg .close {
|
23 |
+
position: absolute;
|
24 |
+
right: 10px;
|
25 |
+
top: 10px;
|
26 |
+
cursor: pointer;
|
27 |
+
}
|
28 |
+
|
29 |
+
#mp-info-msg .txt {
|
30 |
+
margin-top: 20px;
|
31 |
+
}
|
32 |
+
|
33 |
+
#mp-info-msg .close:hover {
|
34 |
+
text-decoration: underline;
|
35 |
+
}
|
36 |
+
|
37 |
+
#mp-info-msg .title {
|
38 |
+
display: inline-block;
|
39 |
+
text-align: center;
|
40 |
+
font-weight: bold;
|
41 |
+
margin-bottom: 10px;
|
42 |
+
}
|
43 |
+
|
44 |
+
#checkout-payment-method-load {
|
45 |
+
float: left;
|
46 |
+
}
|
47 |
+
|
48 |
+
/*----- code for information form in My Account -> MultiPunkty --- */
|
49 |
+
.mp-user-status {
|
50 |
+
font-weight: bold;
|
51 |
+
color: #d9534f;
|
52 |
+
}
|
53 |
+
|
54 |
+
.mp-user-status.active {
|
55 |
+
color: green;
|
56 |
+
}
|
57 |
+
|
58 |
+
.mp-user-login {
|
59 |
+
font-weight: bold;
|
60 |
+
}
|