Craig_Tco - Version 2.2.1

Version Notes

*Added purchase_step parameter to skip to the payment-method selection at 2Checkout.
*Added support to specify checkout language.
*Added support to customize redirect message.

Download this release

Release Info

Developer Magento Core Team
Extension Craig_Tco
Version 2.2.1
Comparing to
See all releases


Code changes from version 2.2.0 to 2.2.1

app/code/local/Craig/Tco/Block/Redirect.php CHANGED
@@ -39,7 +39,7 @@ class Craig_Tco_Block_Redirect extends Mage_Core_Block_Abstract
39
}
40
41
$html = '<html><body>';
42
- $html.= $this->__('You will be redirected to 2Checkout in a few seconds.');
43
$html.= $form->toHtml();
44
$html.= '<br>';
45
$html.= '<script type="text/javascript">document.getElementById("pay").submit();</script>';
39
}
40
41
$html = '<html><body>';
42
+ $html.= $tco->getRedirectMessage();
43
$html.= $form->toHtml();
44
$html.= '<br>';
45
$html.= '<script type="text/javascript">document.getElementById("pay").submit();</script>';
app/code/local/Craig/Tco/Model/Checkout.php CHANGED
@@ -54,6 +54,18 @@ class Craig_Tco_Model_Checkout extends Mage_Payment_Model_Method_Abstract {
54
return $url;
55
}
56
57
//get order
58
public function getQuote() {
59
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
@@ -210,6 +222,8 @@ class Craig_Tco_Model_Checkout extends Mage_Payment_Model_Method_Abstract {
210
211
$tcoFields = array();
212
$tcoFields['sid'] = $this->getSid();
213
$tcoFields['merchant_order_id'] = $order_id;
214
$tcoFields['email'] = $order->getData('customer_email');
215
$tcoFields['first_name'] = $b->getFirstname();
@@ -229,34 +243,35 @@ class Craig_Tco_Model_Checkout extends Mage_Payment_Model_Method_Abstract {
229
$tcoFields['zip'] = $b->getPostcode();
230
231
if ($a) {
232
- $tcoFields['ship_name'] = $a->getFirstname() . ' ' . $a->getLastname();
233
- $tcoFields['ship_country'] = $a->getCountry();
234
- $tcoFields['ship_street_address'] = $a->getStreet1();
235
- $tcoFields['ship_street_address2'] = $a->getStreet2();
236
- $tcoFields['ship_city'] = $a->getCity();
237
- $tcoFields['ship_state'] = $a->getRegion();
238
- $tcoFields['ship_zip'] = $a->getPostcode();
239
- $tcoFields['sh_cost'] = $shipping;
240
- $tcoFields['sh_weight'] = $weight;
241
- $tcoFields['ship_method'] = $ship_method;
242
- }
243
$tcoFields['2co_tax'] = $tax;
244
$tcoFields['2co_cart_type'] = 'magento';
245
- $tcoFields['x_Receipt_Link_URL'] = Mage::getUrl('tco/redirect/success', array('_secure' => true));
246
$tcoFields['demo'] = $this->getDemo();
247
- $tcoFields['currency_code'] = $currency_code;
248
249
//Check Integration mode
250
- $lineitem_total = $this->checkTotal();
251
if ($lineitem_total != $amount) {
252
- $tcoFields['id_type'] = '1';
253
- $tcoFields['total'] = $amount;
254
- $tcoFields['cart_order_id'] = $order_id;
255
- $result = $productData + $taxData + $tcoFields;
256
} else {
257
$tcoFields['mode'] = '2CO';
258
$result = $tcoFields + $lineitemData;
259
}
260
return $result;
261
}
262
54
return $url;
55
}
56
57
+ //get checkout language
58
+ public function getLanguage() {
59
+ $lang = $this->getConfigData('checkout_language');
60
+ return $lang;
61
+ }
62
+
63
+ //get custom checkout message
64
+ public function getRedirectMessage() {
65
+ $redirect_message = $this->getConfigData('redirect_message');
66
+ return $redirect_message;
67
+ }
68
+
69
//get order
70
public function getQuote() {
71
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
222
223
$tcoFields = array();
224
$tcoFields['sid'] = $this->getSid();
225
+ $tcoFields['lang'] = $this->getLanguage();
226
+ $tcoFields['purchase_step'] = 'payment-method';
227
$tcoFields['merchant_order_id'] = $order_id;
228
$tcoFields['email'] = $order->getData('customer_email');
229
$tcoFields['first_name'] = $b->getFirstname();
243
$tcoFields['zip'] = $b->getPostcode();
244
245
if ($a) {
246
+ $tcoFields['ship_name'] = $a->getFirstname() . ' ' . $a->getLastname();
247
+ $tcoFields['ship_country'] = $a->getCountry();
248
+ $tcoFields['ship_street_address'] = $a->getStreet1();
249
+ $tcoFields['ship_street_address2'] = $a->getStreet2();
250
+ $tcoFields['ship_city'] = $a->getCity();
251
+ $tcoFields['ship_state'] = $a->getRegion();
252
+ $tcoFields['ship_zip'] = $a->getPostcode();
253
+ $tcoFields['sh_cost'] = $shipping;
254
+ $tcoFields['sh_weight'] = $weight;
255
+ $tcoFields['ship_method'] = $ship_method;
256
+ }
257
$tcoFields['2co_tax'] = $tax;
258
$tcoFields['2co_cart_type'] = 'magento';
259
+ $tcoFields['x_Receipt_Link_URL'] = Mage::getUrl('tco/redirect/success', array('_secure' => true));
260
$tcoFields['demo'] = $this->getDemo();
261
+ $tcoFields['currency_code'] = $currency_code;
262
263
//Check Integration mode
264
+ $lineitem_total = $this->checkTotal();
265
if ($lineitem_total != $amount) {
266
+ $tcoFields['id_type'] = '1';
267
+ $tcoFields['total'] = $amount;
268
+ $tcoFields['cart_order_id'] = $order_id;
269
+ $result = $productData + $taxData + $tcoFields;
270
} else {
271
$tcoFields['mode'] = '2CO';
272
$result = $tcoFields + $lineitemData;
273
}
274
+
275
return $result;
276
}
277
app/code/local/Craig/Tco/etc/config.xml CHANGED
@@ -24,7 +24,7 @@
24
<config>
25
<modules>
26
<Craig_Tco>
27
- <version>2.2.0</version>
28
</Craig_Tco>
29
</modules>
30
<global>
@@ -99,8 +99,8 @@
99
<title>2Checkout (Visa, MasterCard, Amex, Discover, JCB, Diners Club, Debit Card, PayPal)</title>
100
<sid>Enter 2Checkout Account Number</sid>
101
<secret_word>Enter your Secret Word</secret_word>
102
- <submit_url>1</submit_url>
103
- <demo>0</demo>
104
<sort_order>1</sort_order>
105
</tco>
106
</payment>
24
<config>
25
<modules>
26
<Craig_Tco>
27
+ <version>2.2.1</version>
28
</Craig_Tco>
29
</modules>
30
<global>
99
<title>2Checkout (Visa, MasterCard, Amex, Discover, JCB, Diners Club, Debit Card, PayPal)</title>
100
<sid>Enter 2Checkout Account Number</sid>
101
<secret_word>Enter your Secret Word</secret_word>
102
+ <submit_url>1</submit_url>
103
+ <demo>0</demo>
104
<sort_order>1</sort_order>
105
</tco>
106
</payment>
app/code/local/Craig/Tco/etc/system.xml CHANGED
@@ -151,10 +151,30 @@
151
<show_in_website>1</show_in_website>
152
<show_in_store>0</show_in_store>
153
</specificcountry>
154
<sort_order translate="label">
155
<label>Sort order</label>
156
<frontend_type>text</frontend_type>
157
- <sort_order>15</sort_order>
158
<show_in_default>1</show_in_default>
159
<show_in_website>1</show_in_website>
160
<show_in_store>0</show_in_store>
151
<show_in_website>1</show_in_website>
152
<show_in_store>0</show_in_store>
153
</specificcountry>
154
+ <checkout_language translate="label">
155
+ <label>Checkout Language Code</label>
156
+ <comment>**Defaults to English** Enter your preferred 2Checkout language code to translate the checkout page.
157
+ <![CDATA[<a href="https://www.2checkout.com/blog/knowledge-base/merchants/tech-support/multi-language-options/do-you-offer-any-languages-other-than-english/">2Checkout Language Code Reference</a>]]>
158
+ </comment>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>15</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>0</show_in_store>
164
+ </checkout_language>
165
+ <redirect_message translate="label">
166
+ <label>Redirect Message</label>
167
+ <comment>You will be redirected to 2Checkout in a few seconds.</comment>
168
+ <frontend_type>text</frontend_type>
169
+ <sort_order>15</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>0</show_in_store>
173
+ </redirect_message>
174
<sort_order translate="label">
175
<label>Sort order</label>
176
<frontend_type>text</frontend_type>
177
+ <sort_order>16</sort_order>
178
<show_in_default>1</show_in_default>
179
<show_in_website>1</show_in_website>
180
<show_in_store>0</show_in_store>
package.xml CHANGED
@@ -1,21 +1,20 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Craig_Tco</name>
4
- <version>2.2.0</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>2Checkout Payment Extension</summary>
10
<description>Official 2Checkout Payment Extension</description>
11
- <notes>*Made PTP default for better lineitem listings&#xD;
12
- *Added multi-currency support&#xD;
13
- *Removed shipping address from intangible sales&#xD;
14
- *Removed mark shipping requirement</notes>
15
<authors><author><name>Craig Christenson</name><user>auto-converted</user><email>christensoncraig@gmail.com</email></author></authors>
16
- <date>2012-11-30</date>
17
- <time>15:15:21</time>
18
- <contents><target name="mageetc"><dir name="modules"><file name="Craig_Tco.xml" hash="4a6e92678d9b2a310af880d35a4c355f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="tco"><file name="form.phtml" hash="08ae585e158550d0a5dccbed3d37758d"/><file name="info.phtml" hash="b714a7398773adc71ea086024dfc96b1"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Craig"><dir name="Tco"><dir name="Block"><file name="Form.php" hash="b552018543f57090c42784d939004dd4"/><file name="Info.php" hash="ceb4ec03e4de3e4f1dafaf5d7da9b982"/><file name="Redirect.php" hash="e2809d56d51bdc74367dad8da77ac563"/></dir><dir name="controllers"><file name="NotificationController.php" hash="c978c760f0ee234a371ace1853353ccf"/><file name="RedirectController.php" hash="6dd5e6460c5454da1e37be35de7b4ec7"/></dir><dir name="etc"><file name="config.xml" hash="dbc9281bf0137e3c19647b7d485f129c"/><file name="system.xml" hash="36c109d2906a8aa301aa1e6338988d56"/></dir><dir name="Helper"><file name="Data.php" hash="de7680011db7d6821c1f68d70a8fa684"/></dir><dir name="Model"><file name="Checkout.php" hash="1d94602fe52951ba9e6876359b9cf848"/><file name="Observer.php" hash="1451aacaa9eb8038629b2a48c842c406"/></dir></dir></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Craig_Tco</name>
4
+ <version>2.2.1</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>2Checkout Payment Extension</summary>
10
<description>Official 2Checkout Payment Extension</description>
11
+ <notes>*Added purchase_step parameter to skip to the payment-method selection at 2Checkout.&#xD;
12
+ *Added support to specify checkout language.&#xD;
13
+ *Added support to customize redirect message.</notes>
14
<authors><author><name>Craig Christenson</name><user>auto-converted</user><email>christensoncraig@gmail.com</email></author></authors>
15
+ <date>2012-12-31</date>
16
+ <time>12:31:32</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="Craig_Tco.xml" hash="4a6e92678d9b2a310af880d35a4c355f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="tco"><file name="form.phtml" hash="08ae585e158550d0a5dccbed3d37758d"/><file name="info.phtml" hash="b714a7398773adc71ea086024dfc96b1"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Craig"><dir name="Tco"><dir name="Block"><file name="Form.php" hash="b552018543f57090c42784d939004dd4"/><file name="Info.php" hash="ceb4ec03e4de3e4f1dafaf5d7da9b982"/><file name="Redirect.php" hash="fb6c6d68ff2ede5d7f3b965311e908d3"/></dir><dir name="controllers"><file name="NotificationController.php" hash="c978c760f0ee234a371ace1853353ccf"/><file name="RedirectController.php" hash="6dd5e6460c5454da1e37be35de7b4ec7"/></dir><dir name="etc"><file name="config.xml" hash="ec868c128af27ef62506b78ea885221b"/><file name="system.xml" hash="f5ef53fa2b5befe1567e477b679f8557"/></dir><dir name="Helper"><file name="Data.php" hash="de7680011db7d6821c1f68d70a8fa684"/></dir><dir name="Model"><file name="Checkout.php" hash="e35ff3449234ac38d144576cd2bd6356"/><file name="Observer.php" hash="1451aacaa9eb8038629b2a48c842c406"/></dir></dir></dir></target></contents>
18
<compatible/>
19
<dependencies/>
20
</package>