Version Notes
fix for "No payment information necessary" - when cart grandtotal is 0
Download this release
Release Info
Developer | Paweł |
Extension | Mymonki_Ship2pay |
Version | 1.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.7 to 1.0.8
app/code/community/Mymonki/Ship2pay/Block/Onepage/Payment/Methods.php
CHANGED
@@ -36,7 +36,7 @@ class Mymonki_Ship2pay_Block_Onepage_Payment_Methods extends Mage_Checkout_Block
|
|
36 |
//Get ship2pay config
|
37 |
$ship2pay = @unserialize(Mage::getStoreConfig('shipping/ship2pay/ship2pay'));
|
38 |
$ship2pay_is_enabled = Mage::getStoreConfig('shipping/ship2pay/active');
|
39 |
-
|
40 |
if(!$ship2pay_is_enabled)
|
41 |
return parent::getMethods();
|
42 |
|
@@ -46,11 +46,26 @@ class Mymonki_Ship2pay_Block_Onepage_Payment_Methods extends Mage_Checkout_Block
|
|
46 |
if(!array_key_exists('shipping_method', $ship2pay) || !array_key_exists('payment_method', $ship2pay))
|
47 |
return false;
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
//Get selected shipping method
|
50 |
$shippingMethod = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
|
51 |
|
|
|
|
|
52 |
if(!$shippingMethod)
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
$shippingMethod = explode('_', $shippingMethod);
|
56 |
|
@@ -61,14 +76,13 @@ class Mymonki_Ship2pay_Block_Onepage_Payment_Methods extends Mage_Checkout_Block
|
|
61 |
if($smethod == $shippingMethod[0])
|
62 |
$avaiable[$ship2pay['payment_method'][$key]] = true;
|
63 |
}
|
|
|
|
|
64 |
|
65 |
-
$methods = parent::getMethods();
|
66 |
-
|
67 |
//Remove blocked methods
|
68 |
foreach ($methods as $key => $method) {
|
69 |
$code = $method->getCode();
|
70 |
-
|
71 |
-
if(!array_key_exists($code, $avaiable))
|
72 |
unset($methods[$key]);
|
73 |
}
|
74 |
|
36 |
//Get ship2pay config
|
37 |
$ship2pay = @unserialize(Mage::getStoreConfig('shipping/ship2pay/ship2pay'));
|
38 |
$ship2pay_is_enabled = Mage::getStoreConfig('shipping/ship2pay/active');
|
39 |
+
|
40 |
if(!$ship2pay_is_enabled)
|
41 |
return parent::getMethods();
|
42 |
|
46 |
if(!array_key_exists('shipping_method', $ship2pay) || !array_key_exists('payment_method', $ship2pay))
|
47 |
return false;
|
48 |
|
49 |
+
//Mage::log(var_export($ship2pay, true));
|
50 |
+
|
51 |
+
//Get all payment methods
|
52 |
+
$methods = parent::getMethods();
|
53 |
+
$quote = $this->getQuote();
|
54 |
+
$total = $quote->getGrandTotal();
|
55 |
+
//Mage::log(var_export($methods, true));
|
56 |
+
|
57 |
//Get selected shipping method
|
58 |
$shippingMethod = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
|
59 |
|
60 |
+
//Mage::log(var_export($shippingMethod, true));
|
61 |
+
|
62 |
if(!$shippingMethod)
|
63 |
+
{
|
64 |
+
if($total != 0)
|
65 |
+
return array();
|
66 |
+
else
|
67 |
+
$shippingMethod = "free"; //Grand total eq 0 - set shipping method to dump "free"
|
68 |
+
}
|
69 |
|
70 |
$shippingMethod = explode('_', $shippingMethod);
|
71 |
|
76 |
if($smethod == $shippingMethod[0])
|
77 |
$avaiable[$ship2pay['payment_method'][$key]] = true;
|
78 |
}
|
79 |
+
|
80 |
+
//Mage::log(var_export($avaiable, true));
|
81 |
|
|
|
|
|
82 |
//Remove blocked methods
|
83 |
foreach ($methods as $key => $method) {
|
84 |
$code = $method->getCode();
|
85 |
+
if(!array_key_exists($code, $avaiable) && ($total != 0 && $code != "free"))
|
|
|
86 |
unset($methods[$key]);
|
87 |
}
|
88 |
|
app/code/community/Mymonki/Ship2pay/Helper/Data.php
CHANGED
@@ -43,9 +43,6 @@ class Mymonki_Ship2pay_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
43 |
|
44 |
if(!$method_label)
|
45 |
$method_label = $methodInstance->getCode();
|
46 |
-
|
47 |
-
if($methodInstance->getCode() == 'klarna_partpayment')
|
48 |
-
Mage::log(var_export($methodInstance->getConfigData('title'), true));
|
49 |
|
50 |
array_unshift($options, array(
|
51 |
'value' => $methodInstance->getCode(),
|
43 |
|
44 |
if(!$method_label)
|
45 |
$method_label = $methodInstance->getCode();
|
|
|
|
|
|
|
46 |
|
47 |
array_unshift($options, array(
|
48 |
'value' => $methodInstance->getCode(),
|
app/code/community/Mymonki/Ship2pay/Model/Ship2pay.php
CHANGED
@@ -20,110 +20,4 @@
|
|
20 |
class Mymonki_Ship2pay_Model_Ship2pay extends Mage_Payment_Model_Method_Abstract
|
21 |
{
|
22 |
|
23 |
-
}
|
24 |
-
|
25 |
-
/* protected $_code = 'bankpayment';
|
26 |
-
|
27 |
-
protected $_formBlockType = 'bankpayment/form';
|
28 |
-
protected $_infoBlockType = 'bankpayment/info';
|
29 |
-
protected $_accounts;
|
30 |
-
|
31 |
-
|
32 |
-
public function getAccountHolder()
|
33 |
-
{
|
34 |
-
if ($accounts = $this->getAccounts()) {
|
35 |
-
return $accounts[0]->getAccountHolder();
|
36 |
-
}
|
37 |
-
return null;
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getAccountNumber()
|
41 |
-
{
|
42 |
-
if ($accounts = $this->getAccounts()) {
|
43 |
-
return $accounts[0]->getAccountNumber();
|
44 |
-
}
|
45 |
-
return null;
|
46 |
-
}
|
47 |
-
|
48 |
-
public function getSortCode()
|
49 |
-
{
|
50 |
-
if ($accounts = $this->getAccounts()) {
|
51 |
-
return $accounts[0]->getSortCode();
|
52 |
-
}
|
53 |
-
return null;
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
public function getBankName()
|
58 |
-
{
|
59 |
-
if ($accounts = $this->getAccounts()) {
|
60 |
-
return $accounts[0]->getBankName();
|
61 |
-
}
|
62 |
-
return null;
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
public function getIBAN()
|
67 |
-
{
|
68 |
-
if ($accounts = $this->getAccounts()) {
|
69 |
-
return $accounts[0]->getIBAN();
|
70 |
-
}
|
71 |
-
return null;
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
public function getBIC()
|
76 |
-
{
|
77 |
-
if ($accounts = $this->getAccounts()) {
|
78 |
-
return $accounts[0]->getBIC();
|
79 |
-
}
|
80 |
-
return null;
|
81 |
-
}
|
82 |
-
|
83 |
-
public function getPayWithinXDays()
|
84 |
-
{
|
85 |
-
return $this->getConfigData('paywithinxdays');
|
86 |
-
}
|
87 |
-
|
88 |
-
public function getCustomText($addNl2Br = true)
|
89 |
-
{
|
90 |
-
$customText = $this->getConfigData('customtext');
|
91 |
-
if ($addNl2Br) {
|
92 |
-
$customText = nl2br($customText);
|
93 |
-
}
|
94 |
-
return $customText;
|
95 |
-
}
|
96 |
-
|
97 |
-
public function getAccounts()
|
98 |
-
{
|
99 |
-
if (!$this->_accounts) {
|
100 |
-
$paymentInfo = $this->getInfoInstance();
|
101 |
-
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
|
102 |
-
$storeId = $paymentInfo->getOrder()->getStoreId();
|
103 |
-
} else {
|
104 |
-
$storeId = $paymentInfo->getQuote()->getStoreId();
|
105 |
-
}
|
106 |
-
|
107 |
-
$currentOrder = Mage::registry('current_order');
|
108 |
-
$storeId = $currentOrder ? $currentOrder->getStoreId() : null;
|
109 |
-
$accounts = unserialize(Mage::getStoreConfig('payment/bankpayment/bank_accounts',$storeId));
|
110 |
-
|
111 |
-
$this->_accounts = array();
|
112 |
-
$fields = is_array($accounts) ? array_keys($accounts) : null;
|
113 |
-
if (!empty($fields)) {
|
114 |
-
foreach ($accounts[$fields[0]] as $i => $k) {
|
115 |
-
if ($k) {
|
116 |
-
$account = new Varien_Object();
|
117 |
-
foreach ($fields as $field) {
|
118 |
-
$account->setData($field,$accounts[$field][$i]);
|
119 |
-
}
|
120 |
-
$this->_accounts[] = $account;
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
-
return $this->_accounts;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
*/
|
129 |
-
?>
|
20 |
class Mymonki_Ship2pay_Model_Ship2pay extends Mage_Payment_Model_Method_Abstract
|
21 |
{
|
22 |
|
23 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Mymonki/Ship2pay/etc/config.xml
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Mymonki_Ship2pay>
|
13 |
-
<version>1.0.
|
14 |
</Mymonki_Ship2pay>
|
15 |
</modules>
|
16 |
<global>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Mymonki_Ship2pay>
|
13 |
+
<version>1.0.8</version>
|
14 |
</Mymonki_Ship2pay>
|
15 |
</modules>
|
16 |
<global>
|
package.xml
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mymonki_Ship2pay</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Shows payment methods depending on shipping method
|
|
|
10 |
<description>Module that limits the number of payment options depending on the chosen shipping method. For example When my client chooses pickup at store he should not be able to select bank transfer</description>
|
11 |
-
<notes>
|
12 |
-
<authors><author><name>Paweł</name><user>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocale"><dir name="pl_PL"><file name="Mymonki_Ship2pay.csv" hash="7723347de6de6068f8d8b6b9fa227a15"/></dir></target><target name="magecommunity"><dir name="Mymonki"><dir name="Ship2pay"><dir name="Block"><dir name="Adminhtml"><file name="Ship2pay.php" hash="076e6e0840129b8517df6b92d177d352"/></dir><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="
|
16 |
<compatible/>
|
17 |
-
<dependencies
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mymonki_Ship2pay</name>
|
4 |
+
<version>1.0.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Shows payment methods depending on shipping method.
|
10 |
+
- fix for "No payment information necessary" - when cart grandtotal is 0</summary>
|
11 |
<description>Module that limits the number of payment options depending on the chosen shipping method. For example When my client chooses pickup at store he should not be able to select bank transfer</description>
|
12 |
+
<notes>fix for "No payment information necessary" - when cart grandtotal is 0</notes>
|
13 |
+
<authors><author><name>Paweł</name><user>krzaczek</user><email>pawel@freshmind.pl</email></author></authors>
|
14 |
+
<date>2012-01-27</date>
|
15 |
+
<time>12:21:45</time>
|
16 |
+
<contents><target name="magelocale"><dir name="pl_PL"><file name="Mymonki_Ship2pay.csv" hash="7723347de6de6068f8d8b6b9fa227a15"/></dir></target><target name="magecommunity"><dir name="Mymonki"><dir name="Ship2pay"><dir name="Block"><dir name="Adminhtml"><file name="Ship2pay.php" hash="076e6e0840129b8517df6b92d177d352"/></dir><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="d915e85e2de05e6dbdcc7f60ebed8f80"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ca0768ee6a5da7e940fd642e5463093d"/></dir><dir name="Model"><file name="Ship2pay.php" hash="14a17e4d4ef83622e40d81e6b770736d"/></dir><dir name="etc"><file name="config.xml" hash="8262c9a95211ddc89da0e776bdeb6a70"/><file name="system.xml" hash="3f9c3640c298ba4db33a43e80b0a9bba"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mymonki_Ship2pay.xml" hash="7faf6630d1abba5fb960ece11c1c1c12"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.2.0</min><max>5.4.0</max></php></required></dependencies>
|
19 |
</package>
|