Version Notes
Klarna Checkout module
Download this release
Release Info
Developer | Avenla Oy |
Extension | Avenla_KlarnaCheckout |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
- app/code/community/Avenla/KlarnaCheckout/Block/Catalog/Product/Ppwidget.php +58 -0
- app/code/community/Avenla/KlarnaCheckout/Helper/Api.php +1 -1
- app/code/community/Avenla/KlarnaCheckout/Helper/Data.php +17 -0
- app/code/community/Avenla/KlarnaCheckout/Model/Api.php +1 -1
- app/code/community/Avenla/KlarnaCheckout/Model/Config.php +30 -0
- app/code/community/Avenla/KlarnaCheckout/Model/Observer.php +13 -0
- app/code/community/Avenla/KlarnaCheckout/Model/Order.php +19 -13
- app/code/community/Avenla/KlarnaCheckout/Model/Source/Pplayout.php +45 -0
- app/code/community/Avenla/KlarnaCheckout/Model/Validator.php +73 -0
- app/code/community/Avenla/KlarnaCheckout/controllers/CartController.php +113 -0
- app/code/community/Avenla/KlarnaCheckout/controllers/KCOController.php +92 -69
- app/code/community/Avenla/KlarnaCheckout/etc/config.xml +14 -9
- app/code/community/Avenla/KlarnaCheckout/etc/system.xml +29 -1
- app/design/adminhtml/default/default/template/KCO/info.phtml +7 -3
- app/design/frontend/base/default/layout/KCO.xml +30 -9
- app/design/frontend/base/default/template/KCO/KCO.phtml +2 -1
- app/design/frontend/base/default/template/KCO/cart.phtml +14 -12
- app/design/frontend/base/default/template/KCO/cart/shipping.phtml +66 -1
- app/design/frontend/base/default/template/KCO/catalog/product/ppwidget.phtml +31 -0
- app/design/frontend/base/default/template/KCO/onepage/link.phtml +4 -1
- app/locale/fi_FI/Avenla_KlarnaCheckout.csv +6 -1
- lib/KlarnaCheckout/Checkout/UserAgent.php +1 -1
- package.xml +4 -4
- skin/frontend/base/default/KCO/kco.css +31 -64
- skin/frontend/base/default/KCO/loader.gif +0 -0
app/code/community/Avenla/KlarnaCheckout/Block/Catalog/Product/Ppwidget.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Avenla_KlarnaCheckout_Block_Catalog_Product_Ppwidget extends Mage_Core_Block_Template
|
23 |
+
{
|
24 |
+
protected $_product = null;
|
25 |
+
private $config;
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
$this->getProduct();
|
30 |
+
$this->config = Mage::getSingleton('klarnaCheckout/KCO')->getConfig();
|
31 |
+
|
32 |
+
return parent::_construct();
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getWidgetParams()
|
36 |
+
{
|
37 |
+
return array(
|
38 |
+
'width' => 210,
|
39 |
+
'height' => 70,
|
40 |
+
'eid' => $this->config->getKlarnaEid(),
|
41 |
+
'locale' => Mage::app()->getLocale()->getLocaleCode(),
|
42 |
+
'price' => $this->getPrice(),
|
43 |
+
'layout' => $this->config->getPpWidgetLayout()
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getProduct()
|
48 |
+
{
|
49 |
+
if (!$this->_product) {
|
50 |
+
$this->_product = Mage::registry('product');
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
private function getPrice()
|
55 |
+
{
|
56 |
+
return $this->_product->getFinalPrice();
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/Helper/Api.php
CHANGED
@@ -83,7 +83,7 @@ class Avenla_KlarnaCheckout_Helper_Api extends Mage_Core_Helper_Abstract
|
|
83 |
{
|
84 |
$mo->addStatusHistoryComment(
|
85 |
$this->__('Failed to activate reservation %s', $rno) ."(" . $e->getMessage() . ")"
|
86 |
-
|
87 |
$mo->save();
|
88 |
Mage::unregister('kco_save');
|
89 |
Mage::logException($e);
|
83 |
{
|
84 |
$mo->addStatusHistoryComment(
|
85 |
$this->__('Failed to activate reservation %s', $rno) ."(" . $e->getMessage() . ")"
|
86 |
+
);
|
87 |
$mo->save();
|
88 |
Mage::unregister('kco_save');
|
89 |
Mage::logException($e);
|
app/code/community/Avenla/KlarnaCheckout/Helper/Data.php
CHANGED
@@ -41,6 +41,22 @@ class Avenla_KlarnaCheckout_Helper_Data extends Mage_Core_Helper_Data
|
|
41 |
$storeId = Mage::app()->getStore()->getStoreId();
|
42 |
return rtrim(Mage::getUrl('klarnaCheckout/KCO/push?storeid='.$storeId.'&klarna_order={checkout.order.uri}'), "/");
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
/**
|
46 |
* Get url of checkout page
|
@@ -134,6 +150,7 @@ class Avenla_KlarnaCheckout_Helper_Data extends Mage_Core_Helper_Data
|
|
134 |
|
135 |
/**
|
136 |
* Get order shipping tax rate
|
|
|
137 |
* @return float $taxRate
|
138 |
*/
|
139 |
public function getShippingVatRate()
|
41 |
$storeId = Mage::app()->getStore()->getStoreId();
|
42 |
return rtrim(Mage::getUrl('klarnaCheckout/KCO/push?storeid='.$storeId.'&klarna_order={checkout.order.uri}'), "/");
|
43 |
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get validation url
|
47 |
+
*
|
48 |
+
* @return string | false
|
49 |
+
*/
|
50 |
+
public function getValidationUri()
|
51 |
+
{
|
52 |
+
$uri = rtrim(Mage::getUrl('klarnaCheckout/KCO/validation?sid='.Mage::getSingleton('core/session')
|
53 |
+
->getSessionId(), array('_forced_secure' => true)), "/");
|
54 |
+
|
55 |
+
if(parse_url($uri, PHP_URL_SCHEME) == "https")
|
56 |
+
return $uri;
|
57 |
+
|
58 |
+
return false;
|
59 |
+
}
|
60 |
|
61 |
/**
|
62 |
* Get url of checkout page
|
150 |
|
151 |
/**
|
152 |
* Get order shipping tax rate
|
153 |
+
*
|
154 |
* @return float $taxRate
|
155 |
*/
|
156 |
public function getShippingVatRate()
|
app/code/community/Avenla/KlarnaCheckout/Model/Api.php
CHANGED
@@ -86,7 +86,7 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
86 |
$qtys = array();
|
87 |
$partial = false;
|
88 |
|
89 |
-
foreach ($mo->
|
90 |
{
|
91 |
if($item->getQtyShipped() > $item->getQtyInvoiced()){
|
92 |
$qtys[$item->getId()] = $item->getQtyShipped() - $item->getQtyInvoiced();
|
86 |
$qtys = array();
|
87 |
$partial = false;
|
88 |
|
89 |
+
foreach ($mo->getAllVisibleItems() as $item)
|
90 |
{
|
91 |
if($item->getQtyShipped() > $item->getQtyInvoiced()){
|
92 |
$qtys[$item->getId()] = $item->getQtyShipped() - $item->getQtyInvoiced();
|
app/code/community/Avenla/KlarnaCheckout/Model/Config.php
CHANGED
@@ -193,4 +193,34 @@ class Avenla_KlarnaCheckout_Model_Config extends Varien_Object
|
|
193 |
|
194 |
return $methods;
|
195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
193 |
|
194 |
return $methods;
|
195 |
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Check if Part payment is enabled
|
199 |
+
*
|
200 |
+
* @return bool
|
201 |
+
*/
|
202 |
+
public function isPpwidgetActive()
|
203 |
+
{
|
204 |
+
return $this->getConfigData('pp_widget');
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Get part payment widget layout
|
209 |
+
*
|
210 |
+
* @return string
|
211 |
+
*/
|
212 |
+
public function getPpWidgetLayout()
|
213 |
+
{
|
214 |
+
return $this->getConfigData('pp_layout');
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Get config for default Checkout
|
219 |
+
*
|
220 |
+
* @return bool
|
221 |
+
*/
|
222 |
+
public function hideDefaultCheckout()
|
223 |
+
{
|
224 |
+
return $this->getConfigData('default_checkout');
|
225 |
+
}
|
226 |
}
|
app/code/community/Avenla/KlarnaCheckout/Model/Observer.php
CHANGED
@@ -152,4 +152,17 @@ class Avenla_KlarnaCheckout_Model_Observer
|
|
152 |
}
|
153 |
}
|
154 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
152 |
}
|
153 |
}
|
154 |
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Add new layout handle if needed
|
158 |
+
*
|
159 |
+
* @param Varien_Event_Observer $observer
|
160 |
+
*/
|
161 |
+
public function layoutLoadBefore($observer)
|
162 |
+
{
|
163 |
+
if (Mage::getModel('klarnaCheckout/config')->hideDefaultCheckout()){
|
164 |
+
$observer->getEvent()->getLayout()->getUpdate()
|
165 |
+
->addHandle('kco_only');
|
166 |
+
}
|
167 |
+
}
|
168 |
}
|
app/code/community/Avenla/KlarnaCheckout/Model/Order.php
CHANGED
@@ -36,7 +36,7 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
36 |
{
|
37 |
$this->helper = Mage::helper("klarnaCheckout");
|
38 |
$this->config = Mage::getSingleton('klarnaCheckout/KCO')->getConfig();
|
39 |
-
$url = $this->config->isLive()
|
40 |
? Avenla_KlarnaCheckout_Model_Config::KCO_LIVE_URL
|
41 |
: Avenla_KlarnaCheckout_Model_Config::KCO_DEMO_URL;
|
42 |
|
@@ -83,13 +83,18 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
83 |
$create['merchant']['id'] = $this->config->getKlarnaEid();
|
84 |
$create['merchant']['terms_uri'] = $this->config->getTermsUri();
|
85 |
$create['merchant']['checkout_uri'] = $this->helper->getCheckoutUri();
|
86 |
-
$create['merchant']['confirmation_uri'] = $this->helper->getConfirmationUri();
|
87 |
$create['merchant']['push_uri'] = $this->helper->getPushUri();
|
|
|
|
|
|
|
|
|
88 |
$create['merchant_reference']['orderid1'] = $this->quote ? $this->quote->getId() : '12345';
|
89 |
$create['gui']['options'] = array('disable_autofocus');
|
90 |
$create['gui']['layout'] = $this->mobile ? 'mobile' : 'desktop';
|
91 |
|
92 |
$info = $this->getCustomerInfo();
|
|
|
93 |
if(!empty($info))
|
94 |
$create['shipping_address'] = $info;
|
95 |
|
@@ -117,7 +122,6 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
117 |
$this->order->fetch();
|
118 |
if(!$this->helper->isOrderFromCurrentStore($this->order) ||
|
119 |
strtoupper($this->order['purchase_country']) != $this->getPurchaseCountry()){
|
120 |
-
|
121 |
$this->createOrder();
|
122 |
return;
|
123 |
}
|
@@ -189,7 +193,7 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
189 |
'name' => $i->getName(),
|
190 |
'uri' => $i->getUrlPath(),
|
191 |
'quantity' => (int)$i->getQty(),
|
192 |
-
'unit_price' => round($i->
|
193 |
'discount_rate' => round($i->getDiscountPercent(), 2) * 100,
|
194 |
'tax_rate' => round($i->getTaxPercent(), 2) * 100
|
195 |
);
|
@@ -204,15 +208,17 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
204 |
private function processDiscount()
|
205 |
{
|
206 |
$totals = $this->quote->getTotals();
|
207 |
-
|
208 |
-
|
|
|
209 |
$discount = $totals['discount'];
|
|
|
210 |
$this->cart[] = array(
|
211 |
'type' => 'discount',
|
212 |
'reference' => $discount->getcode(),
|
213 |
'name' => $discount->getTitle(),
|
214 |
'quantity' => 1,
|
215 |
-
'unit_price' => round($
|
216 |
'tax_rate' => 0
|
217 |
);
|
218 |
}
|
@@ -238,7 +244,7 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
238 |
'reference' => 'shipping_fee',
|
239 |
'name' => $this->quote->getShippingAddress()->getShippingDescription(),
|
240 |
'quantity' => 1,
|
241 |
-
'unit_price' => round($this->quote->getShippingAddress()->
|
242 |
'tax_rate' => (int)($taxRate * 100)
|
243 |
);
|
244 |
|
@@ -261,11 +267,11 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
261 |
|
262 |
$this->cart = array(
|
263 |
array(
|
264 |
-
'reference'
|
265 |
-
'name'
|
266 |
-
'quantity'
|
267 |
-
'unit_price'
|
268 |
-
'tax_rate'
|
269 |
));
|
270 |
$this->createOrder();
|
271 |
|
36 |
{
|
37 |
$this->helper = Mage::helper("klarnaCheckout");
|
38 |
$this->config = Mage::getSingleton('klarnaCheckout/KCO')->getConfig();
|
39 |
+
$url = $this->config->isLive()
|
40 |
? Avenla_KlarnaCheckout_Model_Config::KCO_LIVE_URL
|
41 |
: Avenla_KlarnaCheckout_Model_Config::KCO_DEMO_URL;
|
42 |
|
83 |
$create['merchant']['id'] = $this->config->getKlarnaEid();
|
84 |
$create['merchant']['terms_uri'] = $this->config->getTermsUri();
|
85 |
$create['merchant']['checkout_uri'] = $this->helper->getCheckoutUri();
|
86 |
+
$create['merchant']['confirmation_uri'] = $this->helper->getConfirmationUri();
|
87 |
$create['merchant']['push_uri'] = $this->helper->getPushUri();
|
88 |
+
|
89 |
+
if($this->helper->getValidationUri())
|
90 |
+
$create['merchant']['validation_uri'] = $this->helper->getValidationUri();
|
91 |
+
|
92 |
$create['merchant_reference']['orderid1'] = $this->quote ? $this->quote->getId() : '12345';
|
93 |
$create['gui']['options'] = array('disable_autofocus');
|
94 |
$create['gui']['layout'] = $this->mobile ? 'mobile' : 'desktop';
|
95 |
|
96 |
$info = $this->getCustomerInfo();
|
97 |
+
|
98 |
if(!empty($info))
|
99 |
$create['shipping_address'] = $info;
|
100 |
|
122 |
$this->order->fetch();
|
123 |
if(!$this->helper->isOrderFromCurrentStore($this->order) ||
|
124 |
strtoupper($this->order['purchase_country']) != $this->getPurchaseCountry()){
|
|
|
125 |
$this->createOrder();
|
126 |
return;
|
127 |
}
|
193 |
'name' => $i->getName(),
|
194 |
'uri' => $i->getUrlPath(),
|
195 |
'quantity' => (int)$i->getQty(),
|
196 |
+
'unit_price' => round($i->getBasePriceInclTax(), 2) * 100,
|
197 |
'discount_rate' => round($i->getDiscountPercent(), 2) * 100,
|
198 |
'tax_rate' => round($i->getTaxPercent(), 2) * 100
|
199 |
);
|
208 |
private function processDiscount()
|
209 |
{
|
210 |
$totals = $this->quote->getTotals();
|
211 |
+
$baseDiscount = $this->quote->getShippingAddress()->getBaseDiscountAmount();
|
212 |
+
|
213 |
+
if($baseDiscount < 0){
|
214 |
$discount = $totals['discount'];
|
215 |
+
|
216 |
$this->cart[] = array(
|
217 |
'type' => 'discount',
|
218 |
'reference' => $discount->getcode(),
|
219 |
'name' => $discount->getTitle(),
|
220 |
'quantity' => 1,
|
221 |
+
'unit_price' => round($baseDiscount, 2) * 100,
|
222 |
'tax_rate' => 0
|
223 |
);
|
224 |
}
|
244 |
'reference' => 'shipping_fee',
|
245 |
'name' => $this->quote->getShippingAddress()->getShippingDescription(),
|
246 |
'quantity' => 1,
|
247 |
+
'unit_price' => round($this->quote->getShippingAddress()->getBaseShippingInclTax(), 2) * 100,
|
248 |
'tax_rate' => (int)($taxRate * 100)
|
249 |
);
|
250 |
|
267 |
|
268 |
$this->cart = array(
|
269 |
array(
|
270 |
+
'reference' => '123456789',
|
271 |
+
'name' => 'Test product',
|
272 |
+
'quantity' => 1,
|
273 |
+
'unit_price' => 4490,
|
274 |
+
'tax_rate' => 0
|
275 |
));
|
276 |
$this->createOrder();
|
277 |
|
app/code/community/Avenla/KlarnaCheckout/Model/Source/Pplayout.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Avenla_KlarnaCheckout_Model_Source_Pplayout
|
23 |
+
{
|
24 |
+
public function toOptionArray()
|
25 |
+
{
|
26 |
+
$options = array();
|
27 |
+
|
28 |
+
$layouts = array(
|
29 |
+
'Pale',
|
30 |
+
'Dark',
|
31 |
+
'Deep',
|
32 |
+
'Deep-extra'
|
33 |
+
);
|
34 |
+
|
35 |
+
foreach($layouts as $layout){
|
36 |
+
$options[] = array(
|
37 |
+
'label' => $layout,
|
38 |
+
'value' => strtolower($layout)
|
39 |
+
);
|
40 |
+
}
|
41 |
+
|
42 |
+
return $options;
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/Model/Validator.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Avenla_KlarnaCheckout_Model_Validator extends Mage_Core_Model_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Parse Klarna order for validation
|
27 |
+
*
|
28 |
+
* @return object
|
29 |
+
*/
|
30 |
+
public function parseValidationPost()
|
31 |
+
{
|
32 |
+
$rawrequestBody = file_get_contents('php://input');
|
33 |
+
|
34 |
+
if (mb_detect_encoding($rawrequestBody, 'UTF-8', true)){
|
35 |
+
$order = json_decode($rawrequestBody);
|
36 |
+
}
|
37 |
+
else {
|
38 |
+
$rawrequestBody = iconv("ISO-8859-1", "UTF-8", $rawrequestBody);
|
39 |
+
$order = json_decode($rawrequestBody);
|
40 |
+
}
|
41 |
+
|
42 |
+
return $order;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Validate quote
|
47 |
+
*
|
48 |
+
* @param Mage_Sales_Model_Quote
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
public function validateQuote($quote, $ko)
|
52 |
+
{
|
53 |
+
if (!$quote->isVirtual()){
|
54 |
+
$address = $quote->getShippingAddress();
|
55 |
+
$method= $address->getShippingMethod();
|
56 |
+
$rate = $address->getShippingRateByCode($method);
|
57 |
+
|
58 |
+
if (!$quote->isVirtual() && (!$method || !$rate)){
|
59 |
+
$msg = Mage::helper('sales')->__('Please specify a shipping method.');
|
60 |
+
Mage::getSingleton('core/session')->addError($msg);
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
if($quote->getShippingAddress()->getPostcode() != $ko->shipping_address->postal_code){
|
65 |
+
$msg = Mage::helper('klarnaCheckout')->__('Please use the same post code for your quote and Klarna.');
|
66 |
+
Mage::getSingleton('core/session')->addError($msg);
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
return true;
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/controllers/CartController.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
|
22 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
23 |
+
class Avenla_KlarnaCheckout_CartController extends Mage_Checkout_CartController
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Initialize shipping information
|
27 |
+
*/
|
28 |
+
public function estimateAjaxPostAction()
|
29 |
+
{
|
30 |
+
$country = (string) $this->getRequest()->getParam('country_id');
|
31 |
+
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
|
32 |
+
$city = (string) $this->getRequest()->getParam('estimate_city');
|
33 |
+
$regionId = (string) $this->getRequest()->getParam('region_id');
|
34 |
+
$region = (string) $this->getRequest()->getParam('region');
|
35 |
+
|
36 |
+
$this->_getQuote()->getShippingAddress()
|
37 |
+
->setCountryId($country)
|
38 |
+
->setCity($city)
|
39 |
+
->setPostcode($postcode)
|
40 |
+
->setRegionId($regionId)
|
41 |
+
->setRegion($region)
|
42 |
+
->setCollectShippingRates(true);
|
43 |
+
|
44 |
+
$this->_getQuote()->save();
|
45 |
+
$this->_getCart()->save();
|
46 |
+
|
47 |
+
$this->getResponse()->setBody($this->getEncodedResponse());
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Estimate update action
|
53 |
+
*/
|
54 |
+
public function estimateUpdateAjaxPostAction()
|
55 |
+
{
|
56 |
+
$code = (string) $this->getRequest()->getParam('estimate_method');
|
57 |
+
|
58 |
+
if (!empty($code)) {
|
59 |
+
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)->save();
|
60 |
+
}
|
61 |
+
|
62 |
+
$cart = $this->_getCart();
|
63 |
+
$cart->save();
|
64 |
+
|
65 |
+
$this->getResponse()->setBody($this->getEncodedResponse());
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get response array
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
private function getEncodedResponse()
|
74 |
+
{
|
75 |
+
$resp = array(
|
76 |
+
'shipping' => $this->getShippingHtml(),
|
77 |
+
'totals' => $this->getTotalsHtml(),
|
78 |
+
'msg' => ""
|
79 |
+
);
|
80 |
+
|
81 |
+
return Mage::helper('core')->jsonEncode($resp);
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Get shipping html
|
86 |
+
*
|
87 |
+
* @return string
|
88 |
+
*/
|
89 |
+
private function getShippingHtml()
|
90 |
+
{
|
91 |
+
$layout = $this->getLayout();
|
92 |
+
$layout->getMessagesBlock()->setMessages(Mage::getSingleton('checkout/session')
|
93 |
+
->getMessages(true),Mage::getSingleton('catalog/session')->getMessages(true));
|
94 |
+
$block = $this->getLayout()->createBlock('checkout/cart_shipping')->setTemplate('KCO/cart/shipping.phtml');
|
95 |
+
|
96 |
+
return $block->toHtml();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get review html
|
101 |
+
*
|
102 |
+
* @return string
|
103 |
+
*/
|
104 |
+
private function getTotalsHtml()
|
105 |
+
{
|
106 |
+
$layout = $this->getLayout();
|
107 |
+
$layout->getMessagesBlock()->setMessages(Mage::getSingleton('checkout/session')
|
108 |
+
->getMessages(true),Mage::getSingleton('catalog/session')->getMessages(true));
|
109 |
+
$block = $this->getLayout()->createBlock('checkout/cart_totals')->setTemplate('checkout/cart/totals.phtml');
|
110 |
+
|
111 |
+
return $block->toHtml();
|
112 |
+
}
|
113 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/controllers/KCOController.php
CHANGED
@@ -20,33 +20,32 @@
|
|
20 |
*/
|
21 |
class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Action
|
22 |
{
|
23 |
-
|
24 |
* Load Klarna Checkout iframe
|
25 |
*
|
26 |
*/
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
}
|
34 |
|
35 |
-
|
36 |
|
37 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
38 |
$kco = Mage::getModel('klarnaCheckout/KCO');
|
39 |
|
40 |
-
|
41 |
-
|
42 |
->toCurrency(Mage::getStoreConfig('sales/minimum_order/amount'));
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
|
51 |
if(!$kco->isAvailable($quote)){
|
52 |
$result['msg'] = $this->__("Klarna Checkout is not available");
|
@@ -64,11 +63,11 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
64 |
if($ko != null){
|
65 |
$_SESSION['klarna_checkout'] = $sessionId = $ko->getLocation();
|
66 |
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
|
73 |
if (!$quote->isVirtual() && $quote->getShippingAddress()->getShippingMethod() == null)
|
74 |
$result['msg'] = $this->__("Please select shipping method to use Klarna Checkout");
|
@@ -77,24 +76,24 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
77 |
}
|
78 |
}
|
79 |
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
84 |
* Confirmation action for Klarna Checkout
|
85 |
*
|
86 |
*/
|
87 |
-
|
88 |
-
|
89 |
$redirect = false;
|
90 |
@$checkoutId = $_GET['klarna_order'];
|
91 |
$ko = Mage::getModel("klarnaCheckout/order")->getOrder(null, $checkoutId);
|
92 |
-
|
93 |
try{
|
94 |
$ko->fetch();
|
95 |
if ($ko['status'] == "checkout_complete" || $ko['status'] == "created"){
|
96 |
-
|
97 |
-
|
98 |
$this->getLayout()->getBlock('klarnaCheckout.confirmation')->setCheckoutID($checkoutId);
|
99 |
$this->renderLayout();
|
100 |
}
|
@@ -103,25 +102,48 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
103 |
}
|
104 |
}
|
105 |
catch(Exception $e) {
|
106 |
-
|
107 |
$redirect = true;
|
108 |
-
|
109 |
|
110 |
if($redirect){
|
111 |
header('Location: ' . Mage::helper('checkout/url')->getCartUrl());
|
112 |
exit();
|
113 |
}
|
114 |
-
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
/**
|
117 |
* Convert Klarna address to Magento address
|
118 |
-
*
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
* @param string $region_code
|
123 |
*/
|
124 |
-
|
125 |
{
|
126 |
$country_id = strtoupper($address['country']);
|
127 |
|
@@ -168,38 +190,39 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
168 |
}
|
169 |
else{
|
170 |
$this->_getSession()->addError($this->__('No Klarna reservation number found in order'));
|
171 |
-
|
172 |
-
|
|
|
173 |
}
|
174 |
}
|
175 |
}
|
176 |
catch(Exception $e) {
|
177 |
$this->_getSession()->addError($this->__($e->getMessage()));
|
178 |
-
|
179 |
-
|
180 |
$this->_redirectReferer();
|
181 |
}
|
182 |
|
183 |
-
|
184 |
* Push action for Klarna Checkout
|
185 |
*
|
186 |
*/
|
187 |
-
|
188 |
-
|
189 |
@$checkoutId = $_GET['klarna_order'];
|
190 |
-
|
191 |
$ko = Mage::getModel("klarnaCheckout/order")->getOrder(null, $checkoutId);
|
192 |
$ko->fetch();
|
193 |
$quoteID = $ko['merchant_reference']['orderid1'];
|
194 |
|
195 |
if ($ko['status'] == "checkout_complete" && $quoteID){
|
196 |
-
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
|
204 |
$mo = $this->quoteToOrder($quote, $ko);
|
205 |
|
@@ -209,22 +232,22 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
209 |
|
210 |
$mo->getPayment()->setAdditionalInformation("klarna_server", $url);
|
211 |
$mo->getPayment()->setAdditionalInformation("klarna_order_id", $ko['id']);
|
212 |
-
|
213 |
-
|
214 |
$mo->getPayment()->setAdditionalInformation("klarna_order_reservation_expiration", $ko['expires_at']);
|
215 |
$mo->getPayment()->save();
|
216 |
|
217 |
$update['merchant_reference']['orderid1'] = $mo->getIncrementId();
|
218 |
-
|
219 |
-
|
220 |
|
221 |
if($ko['status'] != "created"){
|
222 |
$this->cancelOrder($mo, $this->__('Order canceled: Failed to create order in Klarna.'));
|
223 |
}
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
}
|
229 |
else{
|
230 |
if($ko['status'] != "checkout_complete")
|
@@ -235,7 +258,7 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
235 |
Mage::log("Couldn't find quote id for Klarna reservation " . $ko['reservation']);
|
236 |
}
|
237 |
}
|
238 |
-
|
239 |
|
240 |
/**
|
241 |
* Convert Magento quote to order
|
@@ -247,8 +270,8 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
247 |
private function quoteToOrder($quote, $ko)
|
248 |
{
|
249 |
$quote->setCustomerEmail($ko['billing_address']['email'])->save();
|
250 |
-
|
251 |
-
|
252 |
$quote->getPayment()->setMethod(Mage::getModel("klarnaCheckout/KCO")->getCode());
|
253 |
$quote->collectTotals()->save();
|
254 |
$service = Mage::getModel('sales/service_quote', $quote);
|
@@ -270,14 +293,14 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
270 |
$mo->save();
|
271 |
}
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
{
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
}
|
283 |
}
|
20 |
*/
|
21 |
class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Action
|
22 |
{
|
23 |
+
/**
|
24 |
* Load Klarna Checkout iframe
|
25 |
*
|
26 |
*/
|
27 |
+
public function loadKcoFrameAction()
|
28 |
+
{
|
29 |
+
$mobile = false;
|
30 |
|
31 |
+
if($this->getRequest()->getParam('mobile') == true)
|
32 |
+
$mobile = true;
|
|
|
33 |
|
34 |
+
$result = array();
|
35 |
|
36 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
37 |
$kco = Mage::getModel('klarnaCheckout/KCO');
|
38 |
|
39 |
+
if (!$quote->validateMinimumAmount()){
|
40 |
+
$minimumAmount = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())
|
41 |
->toCurrency(Mage::getStoreConfig('sales/minimum_order/amount'));
|
42 |
|
43 |
+
$warning = Mage::getStoreConfig('sales/minimum_order/description')
|
44 |
+
? Mage::getStoreConfig('sales/minimum_order/description')
|
45 |
+
: Mage::helper('checkout')->__('Minimum order amount is %s', $minimumAmount);
|
46 |
|
47 |
+
$result['msg'] = $warning;
|
48 |
+
}
|
49 |
|
50 |
if(!$kco->isAvailable($quote)){
|
51 |
$result['msg'] = $this->__("Klarna Checkout is not available");
|
63 |
if($ko != null){
|
64 |
$_SESSION['klarna_checkout'] = $sessionId = $ko->getLocation();
|
65 |
|
66 |
+
if($quote->getShippingAddress()->getPostcode() == null)
|
67 |
+
$result['msg'] = $this->__("Please fill in your post code");
|
68 |
|
69 |
+
if($quote->getShippingAddress()->getCountry() == null)
|
70 |
+
$result['msg'] = $this->__("Please select country");
|
71 |
|
72 |
if (!$quote->isVirtual() && $quote->getShippingAddress()->getShippingMethod() == null)
|
73 |
$result['msg'] = $this->__("Please select shipping method to use Klarna Checkout");
|
76 |
}
|
77 |
}
|
78 |
|
79 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
80 |
+
}
|
81 |
|
82 |
+
/**
|
83 |
* Confirmation action for Klarna Checkout
|
84 |
*
|
85 |
*/
|
86 |
+
public function confirmationAction()
|
87 |
+
{
|
88 |
$redirect = false;
|
89 |
@$checkoutId = $_GET['klarna_order'];
|
90 |
$ko = Mage::getModel("klarnaCheckout/order")->getOrder(null, $checkoutId);
|
91 |
+
|
92 |
try{
|
93 |
$ko->fetch();
|
94 |
if ($ko['status'] == "checkout_complete" || $ko['status'] == "created"){
|
95 |
+
$this->emptyCart();
|
96 |
+
$this->loadLayout();
|
97 |
$this->getLayout()->getBlock('klarnaCheckout.confirmation')->setCheckoutID($checkoutId);
|
98 |
$this->renderLayout();
|
99 |
}
|
102 |
}
|
103 |
}
|
104 |
catch(Exception $e) {
|
105 |
+
Mage::logException($e);
|
106 |
$redirect = true;
|
107 |
+
}
|
108 |
|
109 |
if($redirect){
|
110 |
header('Location: ' . Mage::helper('checkout/url')->getCartUrl());
|
111 |
exit();
|
112 |
}
|
113 |
+
}
|
114 |
|
115 |
+
/**
|
116 |
+
* Validation action for Klarna Checkout
|
117 |
+
*
|
118 |
+
*/
|
119 |
+
public function validationAction()
|
120 |
+
{
|
121 |
+
$validator = Mage::getModel('klarnaCheckout/validator');
|
122 |
+
|
123 |
+
$ko = $validator->parseValidationPost();
|
124 |
+
$quote = Mage::getModel("sales/quote")->load($ko->merchant_reference->orderid1);
|
125 |
+
|
126 |
+
if($validator->validateQuote($quote, $ko)){
|
127 |
+
header("HTTP/1.1 200 OK");
|
128 |
+
}
|
129 |
+
else{
|
130 |
+
Mage::getSingleton('core/session')->setSessionId($_GET['sid']);
|
131 |
+
header("HTTP/1.0 303 See Other");
|
132 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect(
|
133 |
+
Mage::helper('checkout/url')->getCartUrl()
|
134 |
+
)->sendResponse();
|
135 |
+
}
|
136 |
+
exit();
|
137 |
+
}
|
138 |
+
|
139 |
/**
|
140 |
* Convert Klarna address to Magento address
|
141 |
+
*
|
142 |
+
* @param array $address
|
143 |
+
* @param string $region
|
144 |
+
* @param string $region_code
|
|
|
145 |
*/
|
146 |
+
private function convertAddress($address, $region = '', $region_code = '')
|
147 |
{
|
148 |
$country_id = strtoupper($address['country']);
|
149 |
|
190 |
}
|
191 |
else{
|
192 |
$this->_getSession()->addError($this->__('No Klarna reservation number found in order'));
|
193 |
+
$this->_redirectReferer();
|
194 |
+
|
195 |
+
return;
|
196 |
}
|
197 |
}
|
198 |
}
|
199 |
catch(Exception $e) {
|
200 |
$this->_getSession()->addError($this->__($e->getMessage()));
|
201 |
+
$this->_redirectReferer();
|
202 |
+
}
|
203 |
$this->_redirectReferer();
|
204 |
}
|
205 |
|
206 |
+
/**
|
207 |
* Push action for Klarna Checkout
|
208 |
*
|
209 |
*/
|
210 |
+
public function pushAction()
|
211 |
+
{
|
212 |
@$checkoutId = $_GET['klarna_order'];
|
213 |
+
Mage::app()->setCurrentStore($_GET['storeid']);
|
214 |
$ko = Mage::getModel("klarnaCheckout/order")->getOrder(null, $checkoutId);
|
215 |
$ko->fetch();
|
216 |
$quoteID = $ko['merchant_reference']['orderid1'];
|
217 |
|
218 |
if ($ko['status'] == "checkout_complete" && $quoteID){
|
219 |
+
$quote = Mage::getModel("sales/quote")->load($quoteID);
|
220 |
|
221 |
+
if(count($quote->getAllItems()) < 1){
|
222 |
+
Mage::log("No valid quote found for Klarna order, reservation canceled.");
|
223 |
+
Mage::getModel('klarnaCheckout/api')->cancelReservation($ko['reservation']);
|
224 |
+
return;
|
225 |
+
}
|
226 |
|
227 |
$mo = $this->quoteToOrder($quote, $ko);
|
228 |
|
232 |
|
233 |
$mo->getPayment()->setAdditionalInformation("klarna_server", $url);
|
234 |
$mo->getPayment()->setAdditionalInformation("klarna_order_id", $ko['id']);
|
235 |
+
$mo->getPayment()->setAdditionalInformation("klarna_order_reference", $ko['reference']);
|
236 |
+
$mo->getPayment()->setAdditionalInformation("klarna_order_reservation", $ko['reservation']);
|
237 |
$mo->getPayment()->setAdditionalInformation("klarna_order_reservation_expiration", $ko['expires_at']);
|
238 |
$mo->getPayment()->save();
|
239 |
|
240 |
$update['merchant_reference']['orderid1'] = $mo->getIncrementId();
|
241 |
+
$update['status'] = 'created';
|
242 |
+
$ko->update($update);
|
243 |
|
244 |
if($ko['status'] != "created"){
|
245 |
$this->cancelOrder($mo, $this->__('Order canceled: Failed to create order in Klarna.'));
|
246 |
}
|
247 |
+
else{
|
248 |
+
$mo->getSendConfirmation(null);
|
249 |
+
$mo->sendNewOrderEmail();
|
250 |
+
}
|
251 |
}
|
252 |
else{
|
253 |
if($ko['status'] != "checkout_complete")
|
258 |
Mage::log("Couldn't find quote id for Klarna reservation " . $ko['reservation']);
|
259 |
}
|
260 |
}
|
261 |
+
}
|
262 |
|
263 |
/**
|
264 |
* Convert Magento quote to order
|
270 |
private function quoteToOrder($quote, $ko)
|
271 |
{
|
272 |
$quote->setCustomerEmail($ko['billing_address']['email'])->save();
|
273 |
+
$quote->getBillingAddress()->addData($this->convertAddress($ko['billing_address']));
|
274 |
+
$quote->getShippingAddress()->addData($this->convertAddress($ko['shipping_address']));
|
275 |
$quote->getPayment()->setMethod(Mage::getModel("klarnaCheckout/KCO")->getCode());
|
276 |
$quote->collectTotals()->save();
|
277 |
$service = Mage::getModel('sales/service_quote', $quote);
|
293 |
$mo->save();
|
294 |
}
|
295 |
|
296 |
+
/**
|
297 |
+
* Clear the checkout session after successful checkout
|
298 |
+
*
|
299 |
+
*/
|
300 |
+
private function emptyCart()
|
301 |
{
|
302 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
303 |
+
$quote->setIsActive(false)->save();
|
304 |
+
Mage::getSingleton('checkout/session')->clear();
|
305 |
}
|
306 |
}
|
app/code/community/Avenla/KlarnaCheckout/etc/config.xml
CHANGED
@@ -21,12 +21,12 @@
|
|
21 |
|
22 |
-->
|
23 |
<config>
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
<blocks>
|
31 |
<klarnaCheckout>
|
32 |
<class>Avenla_KlarnaCheckout_Block</class>
|
@@ -76,7 +76,6 @@
|
|
76 |
</sales_order_invoice_save_after>
|
77 |
</events>
|
78 |
</global>
|
79 |
-
|
80 |
<default>
|
81 |
<payment>
|
82 |
<klarnaCheckout_payment>
|
@@ -85,11 +84,9 @@
|
|
85 |
<payment_action>authorize</payment_action>
|
86 |
<active>1</active>
|
87 |
<title>Klarna Checkout</title>
|
88 |
-
<allowspecific>1</allowspecific>
|
89 |
</klarnaCheckout_payment>
|
90 |
</payment>
|
91 |
</default>
|
92 |
-
|
93 |
<frontend>
|
94 |
<translate>
|
95 |
<modules>
|
@@ -133,6 +130,14 @@
|
|
133 |
</avenla_klarnacheckout_observer>
|
134 |
</observers>
|
135 |
</core_block_abstract_to_html_before>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
</events>
|
137 |
</frontend>
|
138 |
|
21 |
|
22 |
-->
|
23 |
<config>
|
24 |
+
<modules>
|
25 |
+
<Avenla_KlarnaCheckout>
|
26 |
+
<version>1.0.5</version>
|
27 |
+
</Avenla_KlarnaCheckout>
|
28 |
+
</modules>
|
29 |
+
<global>
|
30 |
<blocks>
|
31 |
<klarnaCheckout>
|
32 |
<class>Avenla_KlarnaCheckout_Block</class>
|
76 |
</sales_order_invoice_save_after>
|
77 |
</events>
|
78 |
</global>
|
|
|
79 |
<default>
|
80 |
<payment>
|
81 |
<klarnaCheckout_payment>
|
84 |
<payment_action>authorize</payment_action>
|
85 |
<active>1</active>
|
86 |
<title>Klarna Checkout</title>
|
|
|
87 |
</klarnaCheckout_payment>
|
88 |
</payment>
|
89 |
</default>
|
|
|
90 |
<frontend>
|
91 |
<translate>
|
92 |
<modules>
|
130 |
</avenla_klarnacheckout_observer>
|
131 |
</observers>
|
132 |
</core_block_abstract_to_html_before>
|
133 |
+
<controller_action_layout_load_before>
|
134 |
+
<observers>
|
135 |
+
<avenla_klarnacheckout_layout_load_before>
|
136 |
+
<class>klarnaCheckout/observer</class>
|
137 |
+
<method>layoutLoadBefore</method>
|
138 |
+
</avenla_klarnacheckout_layout_load_before>
|
139 |
+
</observers>
|
140 |
+
</controller_action_layout_load_before>
|
141 |
</events>
|
142 |
</frontend>
|
143 |
|
app/code/community/Avenla/KlarnaCheckout/etc/system.xml
CHANGED
@@ -134,16 +134,44 @@
|
|
134 |
<show_in_website>1</show_in_website>
|
135 |
<show_in_store>1</show_in_store>
|
136 |
</google_analytics>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
<disabled_shipping_methods translate="label">
|
138 |
<label>Disabled shipping methods</label>
|
139 |
<frontend_type>multiselect</frontend_type>
|
140 |
<source_model>klarnaCheckout/source_shippingmethods</source_model>
|
141 |
-
<sort_order>
|
142 |
<show_in_default>1</show_in_default>
|
143 |
<show_in_website>1</show_in_website>
|
144 |
<show_in_store>1</show_in_store>
|
145 |
<can_be_empty>1</can_be_empty>
|
146 |
</disabled_shipping_methods>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
</fields>
|
148 |
</klarnaCheckout_payment>
|
149 |
</groups>
|
134 |
<show_in_website>1</show_in_website>
|
135 |
<show_in_store>1</show_in_store>
|
136 |
</google_analytics>
|
137 |
+
<default_checkout translate="label">
|
138 |
+
<label>Hide links to default Checkout</label>
|
139 |
+
<frontend_type>select</frontend_type>
|
140 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
141 |
+
<sort_order>14</sort_order>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>1</show_in_website>
|
144 |
+
<show_in_store>1</show_in_store>
|
145 |
+
</default_checkout>
|
146 |
<disabled_shipping_methods translate="label">
|
147 |
<label>Disabled shipping methods</label>
|
148 |
<frontend_type>multiselect</frontend_type>
|
149 |
<source_model>klarnaCheckout/source_shippingmethods</source_model>
|
150 |
+
<sort_order>15</sort_order>
|
151 |
<show_in_default>1</show_in_default>
|
152 |
<show_in_website>1</show_in_website>
|
153 |
<show_in_store>1</show_in_store>
|
154 |
<can_be_empty>1</can_be_empty>
|
155 |
</disabled_shipping_methods>
|
156 |
+
<pp_widget translate="label">
|
157 |
+
<label>Show part payment widget on product page</label>
|
158 |
+
<frontend_type>select</frontend_type>
|
159 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
160 |
+
<sort_order>16</sort_order>
|
161 |
+
<show_in_default>1</show_in_default>
|
162 |
+
<show_in_website>1</show_in_website>
|
163 |
+
<show_in_store>1</show_in_store>
|
164 |
+
</pp_widget>
|
165 |
+
<pp_layout translate="label">
|
166 |
+
<depends><pp_widget>1</pp_widget></depends>
|
167 |
+
<label>Part payment widget layout</label>
|
168 |
+
<frontend_type>select</frontend_type>
|
169 |
+
<source_model>klarnaCheckout/source_pplayout</source_model>
|
170 |
+
<sort_order>17</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>1</show_in_store>
|
174 |
+
</pp_layout>
|
175 |
</fields>
|
176 |
</klarnaCheckout_payment>
|
177 |
</groups>
|
app/design/adminhtml/default/default/template/KCO/info.phtml
CHANGED
@@ -20,19 +20,21 @@
|
|
20 |
*/
|
21 |
?>
|
22 |
<?php if ($this->getRequest()->getActionName() == "view"): ?>
|
|
|
23 |
<img src="<?php echo $imgSrc; ?>" alt="Klarna Checkout" />
|
24 |
<a href="<?php echo $guiUrl; ?>" target="_blank" style="float:right"><?php echo $this->__('Klarna online GUI'); ?></a>
|
25 |
|
26 |
<?php if (count($info->getAdditionalInformation("klarna_order_invoice")) > 0): ?>
|
|
|
27 |
<?php foreach($info->getAdditionalInformation("klarna_order_invoice") as $inv): ?>
|
28 |
<p>
|
29 |
<b><?php echo $this->__('Klarna Invoice number: %s', $inv["invoice"]); ?></b>
|
30 |
-
|
31 |
<?php if(isset($pdfUrl)): ?>
|
32 |
<a href="<?php echo $pdfUrl . $inv['invoice'] . ".pdf" ?>" target="_blank"><?php echo $this->__('Packing slip'); ?></a>
|
33 |
<?php endif; ?>
|
34 |
</p>
|
35 |
<?php endforeach; ?>
|
|
|
36 |
<?php endif; ?>
|
37 |
|
38 |
<?php if($this->getInfo()->getOrder()->getState() != Mage_Sales_Model_Order::STATE_COMPLETE): ?>
|
@@ -44,12 +46,13 @@
|
|
44 |
<?php echo $this->__('Klarna reservation expires: %s',
|
45 |
Mage::helper('core')->formatDate($info->getAdditionalInformation("klarna_order_reservation_expiration"), 'medium', false)); ?>
|
46 |
</p>
|
|
|
47 |
<?php
|
|
|
48 |
$expiration = new Zend_Date($info->getAdditionalInformation("klarna_order_reservation_expiration"));
|
49 |
$now = new Zend_Date();
|
50 |
-
|
51 |
-
if($expiration < $now):
|
52 |
?>
|
|
|
53 |
<p class="klarna_alert"><?php echo $this->__('Klarna reservation has expired.'); ?></p>
|
54 |
<?php endif; ?>
|
55 |
<?php endif; ?>
|
@@ -59,6 +62,7 @@
|
|
59 |
<?php if(isset($message)): ?>
|
60 |
<p><b><?php echo $message; ?></b></p>
|
61 |
<?php endif; ?>
|
|
|
62 |
<?php else: ?>
|
63 |
<p>Klarna Checkout</p>
|
64 |
<?php endif; ?>
|
20 |
*/
|
21 |
?>
|
22 |
<?php if ($this->getRequest()->getActionName() == "view"): ?>
|
23 |
+
|
24 |
<img src="<?php echo $imgSrc; ?>" alt="Klarna Checkout" />
|
25 |
<a href="<?php echo $guiUrl; ?>" target="_blank" style="float:right"><?php echo $this->__('Klarna online GUI'); ?></a>
|
26 |
|
27 |
<?php if (count($info->getAdditionalInformation("klarna_order_invoice")) > 0): ?>
|
28 |
+
|
29 |
<?php foreach($info->getAdditionalInformation("klarna_order_invoice") as $inv): ?>
|
30 |
<p>
|
31 |
<b><?php echo $this->__('Klarna Invoice number: %s', $inv["invoice"]); ?></b>
|
|
|
32 |
<?php if(isset($pdfUrl)): ?>
|
33 |
<a href="<?php echo $pdfUrl . $inv['invoice'] . ".pdf" ?>" target="_blank"><?php echo $this->__('Packing slip'); ?></a>
|
34 |
<?php endif; ?>
|
35 |
</p>
|
36 |
<?php endforeach; ?>
|
37 |
+
|
38 |
<?php endif; ?>
|
39 |
|
40 |
<?php if($this->getInfo()->getOrder()->getState() != Mage_Sales_Model_Order::STATE_COMPLETE): ?>
|
46 |
<?php echo $this->__('Klarna reservation expires: %s',
|
47 |
Mage::helper('core')->formatDate($info->getAdditionalInformation("klarna_order_reservation_expiration"), 'medium', false)); ?>
|
48 |
</p>
|
49 |
+
|
50 |
<?php
|
51 |
+
$temp_time = strtotime($info->getAdditionalInformation("klarna_order_reservation_expiration"));
|
52 |
$expiration = new Zend_Date($info->getAdditionalInformation("klarna_order_reservation_expiration"));
|
53 |
$now = new Zend_Date();
|
|
|
|
|
54 |
?>
|
55 |
+
<?php if(strtotime($info->getAdditionalInformation("klarna_order_reservation_expiration")) < $now->get()): ?>
|
56 |
<p class="klarna_alert"><?php echo $this->__('Klarna reservation has expired.'); ?></p>
|
57 |
<?php endif; ?>
|
58 |
<?php endif; ?>
|
62 |
<?php if(isset($message)): ?>
|
63 |
<p><b><?php echo $message; ?></b></p>
|
64 |
<?php endif; ?>
|
65 |
+
|
66 |
<?php else: ?>
|
67 |
<p>Klarna Checkout</p>
|
68 |
<?php endif; ?>
|
app/design/frontend/base/default/layout/KCO.xml
CHANGED
@@ -21,13 +21,19 @@
|
|
21 |
|
22 |
<layout version="0.1.0">
|
23 |
|
24 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<reference name="head">
|
26 |
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
27 |
</reference>
|
28 |
-
</default>
|
29 |
-
|
30 |
-
<klarnacheckout_kco_confirmation>
|
31 |
<reference name="root">
|
32 |
<action method="setTemplate">
|
33 |
<template>page/1column.phtml</template>
|
@@ -39,29 +45,44 @@
|
|
39 |
</klarnacheckout_kco_confirmation>
|
40 |
|
41 |
<checkout_cart_index>
|
|
|
|
|
|
|
42 |
<reference name="checkout.cart.top_methods">
|
43 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active"><name>checkout.cart.methods.onepage.top</name></action>
|
44 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active">"<name>checkout.cart.methods.onepage</name></action>
|
45 |
</reference>
|
46 |
-
|
47 |
<reference name="checkout.cart">
|
48 |
<action method="setCartTemplate" ifconfig="payment/klarnaCheckout_payment/active"><value>KCO/cart.phtml</value></action>
|
49 |
<action method="chooseTemplate"/>
|
50 |
<block type="klarnaCheckout/KCO" name="checkout.cart.klarnacheckout" as="klarnacheckout" template="KCO/KCO.phtml" />
|
51 |
-
</reference>
|
52 |
-
|
53 |
<reference name="checkout.cart.shipping">
|
54 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/cart/shipping.phtml</template></action>
|
55 |
</reference>
|
56 |
-
|
57 |
<reference name="checkout.cart.crosssell">
|
58 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/cart/crosssell.phtml</template></action>
|
59 |
</reference>
|
60 |
-
|
61 |
<reference name="checkout.cart.methods.onepage">
|
62 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/onepage/link.phtml</template></action>
|
63 |
</reference>
|
64 |
</checkout_cart_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
</layout>
|
67 |
|
21 |
|
22 |
<layout version="0.1.0">
|
23 |
|
24 |
+
<kco_only>
|
25 |
+
<reference name="top.links">
|
26 |
+
<remove name="checkout_cart_link"/>
|
27 |
+
<block type="checkout/links" name="checkout_cart_link_kco">
|
28 |
+
<action method="addCartLink"></action>
|
29 |
+
</block>
|
30 |
+
</reference>
|
31 |
+
</kco_only>
|
32 |
+
|
33 |
+
<klarnacheckout_kco_confirmation>
|
34 |
<reference name="head">
|
35 |
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
36 |
</reference>
|
|
|
|
|
|
|
37 |
<reference name="root">
|
38 |
<action method="setTemplate">
|
39 |
<template>page/1column.phtml</template>
|
45 |
</klarnacheckout_kco_confirmation>
|
46 |
|
47 |
<checkout_cart_index>
|
48 |
+
<reference name="head">
|
49 |
+
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
50 |
+
</reference>
|
51 |
<reference name="checkout.cart.top_methods">
|
52 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active"><name>checkout.cart.methods.onepage.top</name></action>
|
53 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active">"<name>checkout.cart.methods.onepage</name></action>
|
54 |
</reference>
|
|
|
55 |
<reference name="checkout.cart">
|
56 |
<action method="setCartTemplate" ifconfig="payment/klarnaCheckout_payment/active"><value>KCO/cart.phtml</value></action>
|
57 |
<action method="chooseTemplate"/>
|
58 |
<block type="klarnaCheckout/KCO" name="checkout.cart.klarnacheckout" as="klarnacheckout" template="KCO/KCO.phtml" />
|
59 |
+
</reference>
|
|
|
60 |
<reference name="checkout.cart.shipping">
|
61 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/cart/shipping.phtml</template></action>
|
62 |
</reference>
|
|
|
63 |
<reference name="checkout.cart.crosssell">
|
64 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/cart/crosssell.phtml</template></action>
|
65 |
</reference>
|
|
|
66 |
<reference name="checkout.cart.methods.onepage">
|
67 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/onepage/link.phtml</template></action>
|
68 |
</reference>
|
69 |
</checkout_cart_index>
|
70 |
+
|
71 |
+
<catalog_product_view>
|
72 |
+
<block type="klarnaCheckout/catalog_product_ppwidget" template="KCO/catalog/product/ppwidget.phtml" name="klarna_pp_widget" />
|
73 |
+
<reference name="head">
|
74 |
+
<block type="core/text" name="klarna_widget_js">
|
75 |
+
<action method="setText" ifconfig="payment/klarnaCheckout_payment/pp_widget">
|
76 |
+
<text><![CDATA[<script async src="https://cdn.klarna.com/1.0/code/client/all.js"></script>]]></text>
|
77 |
+
</action>
|
78 |
+
</block>
|
79 |
+
</reference>
|
80 |
+
<reference name="product.info.extrahint">
|
81 |
+
<action method="append" ifconfig="payment/klarnaCheckout_payment/pp_widget">
|
82 |
+
<block>klarna_pp_widget</block>
|
83 |
+
</action>
|
84 |
+
</reference>
|
85 |
+
</catalog_product_view>
|
86 |
|
87 |
</layout>
|
88 |
|
app/design/frontend/base/default/template/KCO/KCO.phtml
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
<script>
|
31 |
function loadFrame()
|
32 |
{
|
33 |
-
var kcoloadurl = '<?php echo $this->getUrl("klarnaCheckout/KCO/loadKcoFrame/") ?>';
|
34 |
|
35 |
if($$('div.payments')[0]){
|
36 |
if($$('div.payments')[0].getWidth() < 750)
|
@@ -45,6 +45,7 @@
|
|
45 |
$('klarnaMsg').update('<h2>'+ response.msg +'</h2>').show();
|
46 |
}
|
47 |
else{
|
|
|
48 |
$('klarnaOverlay').hide();
|
49 |
}
|
50 |
|
30 |
<script>
|
31 |
function loadFrame()
|
32 |
{
|
33 |
+
var kcoloadurl = '<?php echo $this->getUrl("klarnaCheckout/KCO/loadKcoFrame/", array("_secure" => true)) ?>';
|
34 |
|
35 |
if($$('div.payments')[0]){
|
36 |
if($$('div.payments')[0].getWidth() < 750)
|
45 |
$('klarnaMsg').update('<h2>'+ response.msg +'</h2>').show();
|
46 |
}
|
47 |
else{
|
48 |
+
$('klarnaMsg').update('').hide();
|
49 |
$('klarnaOverlay').hide();
|
50 |
}
|
51 |
|
app/design/frontend/base/default/template/KCO/cart.phtml
CHANGED
@@ -154,18 +154,20 @@
|
|
154 |
<div class="col-1">
|
155 |
<div class="payments">
|
156 |
<?php if(!$this->hasError()): ?>
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
169 |
<div class="payment_container">
|
170 |
<?php echo $this->getChildHtml('klarnacheckout'); ?>
|
171 |
</div>
|
154 |
<div class="col-1">
|
155 |
<div class="payments">
|
156 |
<?php if(!$this->hasError()): ?>
|
157 |
+
<?php if(!Mage::getModel('klarnaCheckout/config')->hideDefaultCheckout()): ?>
|
158 |
+
<div class="paymentMenuContainer">
|
159 |
+
<ul>
|
160 |
+
<li class="active"><a href="#"><?php echo Mage::getSingleton('klarnaCheckout/config')->getTitle(); ?></a></li>
|
161 |
+
<?php foreach ($this->getMethods('methods') as $method): ?>
|
162 |
+
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
163 |
+
<?php if(strlen(preg_replace( "/\r|\n/", "", $methodHtml)) > 0): ?>
|
164 |
+
<li><?php echo $methodHtml; ?></li>
|
165 |
+
<?php endif; ?>
|
166 |
+
<?php endif; ?>
|
167 |
+
<?php endforeach; ?>
|
168 |
+
</ul>
|
169 |
+
</div>
|
170 |
+
<?php endif; ?>
|
171 |
<div class="payment_container">
|
172 |
<?php echo $this->getChildHtml('klarnacheckout'); ?>
|
173 |
</div>
|
app/design/frontend/base/default/template/KCO/cart/shipping.phtml
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
*/
|
21 |
?>
|
22 |
<?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
|
23 |
-
<div class="shipping col2-set">
|
24 |
|
25 |
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
26 |
<div class="shipping-form">
|
@@ -111,7 +111,72 @@
|
|
111 |
</form>
|
112 |
</div>
|
113 |
<?php endif; ?>
|
|
|
114 |
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
//<![CDATA[
|
116 |
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
117 |
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
20 |
*/
|
21 |
?>
|
22 |
<?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
|
23 |
+
<div class="shipping col2-set" id="shipping">
|
24 |
|
25 |
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
26 |
<div class="shipping-form">
|
111 |
</form>
|
112 |
</div>
|
113 |
<?php endif; ?>
|
114 |
+
|
115 |
<script type="text/javascript">
|
116 |
+
|
117 |
+
function addObservers(){
|
118 |
+
$$('input[name="estimate_postcode"]')[0].observe('change', this.estimateAjaxPost.bind(this));
|
119 |
+
|
120 |
+
$$('input[type="radio"][name="estimate_method"]').each(function(el){
|
121 |
+
Event.observe(el, 'click', function(){
|
122 |
+
if (el.checked == true) {
|
123 |
+
setShipLoading(true);
|
124 |
+
|
125 |
+
new Ajax.Request('<?php echo $this->getUrl("klarnaCheckout/cart/estimateUpdateAjaxPost") ?>', {
|
126 |
+
method:'POST',
|
127 |
+
parameters: $('co-shipping-method-form').serialize(true),
|
128 |
+
onSuccess: function(k) {
|
129 |
+
var response = eval("(" + k.responseText + ")");
|
130 |
+
$('shipping').replace(response.shipping);
|
131 |
+
$('shopping-cart-totals-table').replace(response.totals);
|
132 |
+
addObservers();
|
133 |
+
},
|
134 |
+
onComplete:function(k){
|
135 |
+
setShipLoading(false);
|
136 |
+
}
|
137 |
+
});
|
138 |
+
}
|
139 |
+
});
|
140 |
+
});
|
141 |
+
coShippingMethodForm = new VarienForm('shipping-zip-form');
|
142 |
+
}
|
143 |
+
|
144 |
+
function estimateAjaxPost(event) {
|
145 |
+
setShipLoading(true);
|
146 |
+
new Ajax.Request('<?php echo $this->getUrl("klarnaCheckout/cart/estimateAjaxPost") ?>', {
|
147 |
+
method:'POST',
|
148 |
+
parameters: $('shipping-zip-form').serialize(true),
|
149 |
+
onSuccess: function(k) {
|
150 |
+
var response = eval("(" + k.responseText + ")");
|
151 |
+
$('shipping').replace(response.shipping);
|
152 |
+
$('shopping-cart-totals-table').replace(response.totals);
|
153 |
+
addObservers();
|
154 |
+
},
|
155 |
+
onComplete:function(k){
|
156 |
+
setShipLoading(false);
|
157 |
+
}
|
158 |
+
});
|
159 |
+
}
|
160 |
+
|
161 |
+
function setShipLoading(status){
|
162 |
+
if(status){
|
163 |
+
if(window._klarnaCheckout !== undefined){
|
164 |
+
window._klarnaCheckout(function (api) {
|
165 |
+
api.suspend();
|
166 |
+
});
|
167 |
+
}
|
168 |
+
$('shipping').addClassName('loading');
|
169 |
+
$('shopping-cart-totals-table').addClassName('loading');
|
170 |
+
}
|
171 |
+
else{
|
172 |
+
loadFrame();
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
document.observe("dom:loaded", function() {
|
177 |
+
addObservers();
|
178 |
+
});
|
179 |
+
|
180 |
//<![CDATA[
|
181 |
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
182 |
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
app/design/frontend/base/default/template/KCO/catalog/product/ppwidget.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<?php $params = $this->getWidgetParams(); ?>
|
23 |
+
<?php if($params['price']): ?>
|
24 |
+
<div style="width:<?php echo $params['width']; ?>px; height:<?php echo $params['height']; ?>px"
|
25 |
+
class="klarna-widget klarna-part-payment"
|
26 |
+
data-eid="<?php echo $params['eid']; ?>"
|
27 |
+
data-locale="<?php echo $params['locale']; ?>"
|
28 |
+
data-price="<?php echo $params['price']; ?>"
|
29 |
+
data-layout="<?php echo $params['layout']; ?>">
|
30 |
+
</div>
|
31 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/KCO/onepage/link.phtml
CHANGED
@@ -21,5 +21,8 @@
|
|
21 |
?>
|
22 |
|
23 |
<?php if ($this->isPossibleOnepageCheckout()):?>
|
24 |
-
<a href="<?php echo $this->getCheckoutUrl() ?>"
|
|
|
|
|
|
|
25 |
<?php endif?>
|
21 |
?>
|
22 |
|
23 |
<?php if ($this->isPossibleOnepageCheckout()):?>
|
24 |
+
<a href="<?php echo $this->getCheckoutUrl() ?>"
|
25 |
+
<?php if ($this->isDisabled()): ?> class="disabled"<?php endif; ?>>
|
26 |
+
<?php echo $this->__('Proceed to Checkout') ?>
|
27 |
+
</a>
|
28 |
<?php endif?>
|
app/locale/fi_FI/Avenla_KlarnaCheckout.csv
CHANGED
@@ -42,4 +42,9 @@
|
|
42 |
"I accept the terms in the license agreement", "Hyväksyn sopimusehdot"
|
43 |
"License agreement", "Sopimusehdot"
|
44 |
"By accepting the license agreement and filling in your contact information you can use Klarna Checkout module for free.", "Hyväksymällä sopimusehdot ja täyttämällä yhteystietosi voit käyttää Klarna Checkout moduulia ilmaiseksi."
|
45 |
-
"Disabled shipping methods", "Poissuljetut toimitustavat"
|
|
|
|
|
|
|
|
|
|
42 |
"I accept the terms in the license agreement", "Hyväksyn sopimusehdot"
|
43 |
"License agreement", "Sopimusehdot"
|
44 |
"By accepting the license agreement and filling in your contact information you can use Klarna Checkout module for free.", "Hyväksymällä sopimusehdot ja täyttämällä yhteystietosi voit käyttää Klarna Checkout moduulia ilmaiseksi."
|
45 |
+
"Disabled shipping methods", "Poissuljetut toimitustavat"
|
46 |
+
"Show part payment widget on product page", "Näytä osamaksu tiedot tuotesivulla"
|
47 |
+
"Part payment widget layout", "Osamaksu tietojen ulkoasu"
|
48 |
+
"Please use the same post code for your quote and Klarna.", "Toimitustavan valinnassa tulee käyttää samaa postinumeroa kuin Klarnan tilaajan tiedoissa."
|
49 |
+
"Hide links to default Checkout", "Piilota linkit kassasivulle"
|
50 |
+
"Text shown in Klarna link at Magento Checkout", "Kassan linkissä näytettävä teksti"
|
lib/KlarnaCheckout/Checkout/UserAgent.php
CHANGED
@@ -67,7 +67,7 @@ class Klarna_Checkout_UserAgent
|
|
67 |
),
|
68 |
'Module' => array(
|
69 |
'name' => 'KlarnaCheckout.MagentoModule',
|
70 |
-
'version' => '1.0.
|
71 |
)
|
72 |
);
|
73 |
}
|
67 |
),
|
68 |
'Module' => array(
|
69 |
'name' => 'KlarnaCheckout.MagentoModule',
|
70 |
+
'version' => '1.0.5'
|
71 |
)
|
72 |
);
|
73 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Avenla_KlarnaCheckout</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://productdownloads.avenla.com/magento-modules/klarna-checkout/">Custom license by Avenla Oy</license>
|
7 |
<channel>community</channel>
|
@@ -13,9 +13,9 @@ For questions and support - klarna-support@avenla.com
|
|
13 |
</description>
|
14 |
<notes>Klarna Checkout module</notes>
|
15 |
<authors><author><name>Avenla Oy</name><user>Avenla</user><email>info@avenla.fi</email></author></authors>
|
16 |
-
<date>2014-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Avenla"><dir name="KlarnaCheckout"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Info.php" hash="3d0fd774a6116513e4d413a078e80848"/></dir></dir></dir></dir><dir name="KCO"><file name="Confirmation.php" hash="61e58e00070fa76b9f067619e0db5ba5"/><file name="Info.php" hash="2af961abb2eb0609b84f8da5281332ad"/></dir><file name="KCO.php" hash="1abf22f4408a872572c1f8babed730d6"/></dir><dir name="Helper"><file name="Api.php" hash="
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.16</min><max>5.5.0</max></php></required></dependencies>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Avenla_KlarnaCheckout</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://productdownloads.avenla.com/magento-modules/klarna-checkout/">Custom license by Avenla Oy</license>
|
7 |
<channel>community</channel>
|
13 |
</description>
|
14 |
<notes>Klarna Checkout module</notes>
|
15 |
<authors><author><name>Avenla Oy</name><user>Avenla</user><email>info@avenla.fi</email></author></authors>
|
16 |
+
<date>2014-07-17</date>
|
17 |
+
<time>10:39:43</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Avenla"><dir name="KlarnaCheckout"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Info.php" hash="3d0fd774a6116513e4d413a078e80848"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Ppwidget.php" hash="bdf50c2d2fc94994d853f33ff9600117"/></dir></dir><dir name="KCO"><file name="Confirmation.php" hash="61e58e00070fa76b9f067619e0db5ba5"/><file name="Info.php" hash="2af961abb2eb0609b84f8da5281332ad"/></dir><file name="KCO.php" hash="1abf22f4408a872572c1f8babed730d6"/></dir><dir name="Helper"><file name="Api.php" hash="40f14b72afdcf758b97b564ebe27d0c6"/><file name="Data.php" hash="ca36161784169edf2e055088ac14a49d"/></dir><dir name="Model"><file name="Api.php" hash="dad35c50097e6e3aa5e72cbb4bc54ce1"/><file name="Config.php" hash="f0417d1bf67e0f6da2f6e581c763491c"/><file name="KCO.php" hash="48565fcddce1d3cad0192afc67972f0c"/><file name="Observer.php" hash="32a73fb00607a252ddc912f14ae630a2"/><file name="Order.php" hash="21f62928574b36ccfb6d06a0d4f3142e"/><dir name="Source"><file name="Countries.php" hash="0440b3ecc5528cf42dbb937eb7d9c0cb"/><file name="Orderlocale.php" hash="a88769cf211991c70a0f51185bc53fb0"/><file name="Pplayout.php" hash="455484dbea2ff0770aa17e42851b81a6"/><file name="Servermode.php" hash="df4420b3831b1a1e1ec04daa53711a4d"/><file name="Shippingmethods.php" hash="fecb931e29be4ae008c678cc1d760a02"/><file name="Taxclass.php" hash="ff40a1943352031fd7971688b805be05"/></dir><file name="Validator.php" hash="e47ce8ed09e6ba7ed9320385805f6c97"/></dir><dir name="controllers"><file name="CartController.php" hash="891403418045004e6c047c0173dc7c6a"/><file name="KCOController.php" hash="daea867511eca9b03ba7a9c668e52290"/></dir><dir name="etc"><file name="config.xml" hash="575a57697f1f163edc278b2d5782eaab"/><file name="system.xml" hash="697422c0d777501a660ab102411b9ae2"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="KCO"><file name="info.phtml" hash="3fd13b1139150ac3949bc23dd22a63a4"/><dir name="system"><dir name="config"><dir name="fieldset"><file name="info.phtml" hash="36a21983fcc4816b7c8a6b8fe9f2e78c"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="KCO"><file name="KCO.phtml" hash="659a8f322539d18d7e9a068dd5c48b15"/><dir name="cart"><file name="crosssell.phtml" hash="e7f78cb99e14ab680b794524b8666812"/><file name="shipping.phtml" hash="d5526d17ffe083471b02d683147ca2a2"/></dir><file name="cart.phtml" hash="587df7307d1a49d01525e6b6ae6e7a68"/><dir name="catalog"><dir name="product"><file name="ppwidget.phtml" hash="806ac81d9394ef9566daa080eb582832"/></dir></dir><file name="info.phtml" hash="a87d8ee70c92a10445fa864a63d042ba"/><file name="link.phtml" hash="7dadce1567975585dddd51bc904b95fa"/><dir name="onepage"><file name="link.phtml" hash="a05ab2ebf5f0ed225c2f3967e2bceced"/></dir></dir></dir><dir name="layout"><file name="KCO.xml" hash="86b6db0d5c6c777c0d7620cfeed5f6c1"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Klarna"><file name="Country.php" hash="40360c3964fc6193e7fb922845eb419b"/><file name="Currency.php" hash="a709407428d86521cc0775cbeb281523"/><file name="Encoding.php" hash="f8f8e744303ff7ce7f4b226331e7bdcf"/><file name="Exceptions.php" hash="933b2811e910da817743766cdde8ffeb"/><file name="Flags.php" hash="b407a1373adf5f172bef3e3d01e81cdb"/><file name="Klarna.php" hash="dc69f2c10e9b65999057bc04246c3fe8"/><file name="Language.php" hash="8e40aed0dece8f0a3fbe07e37451af16"/><dir name="checkout"><file name="checkouthtml.intf.php" hash="81e0740254585f2af67895df28093d35"/><file name="threatmetrix.class.php" hash="6ce1bfded90b6b3bb329176ff4c7acac"/></dir><dir name="examples"><file name="activate.php" hash="85a84a8eaeec830949551dfd98fe0236"/><file name="activateInvoice.php" hash="cfac2ed57d0c79679fb35ca723eaffab"/><file name="activatePart.php" hash="b46475c2d9f5b326ff2cd65586a1de6e"/><file name="activateReservation.php" hash="bd9b0e5717eaa32ebf6b5d31ad66e5d4"/><file name="addTransaction.php" hash="6426b7965de733bb17ddc7f74ee3949f"/><file name="calc_monthly_cost.php" hash="30e78c4d40db82643396f9289749a898"/><file name="cancelReservation.php" hash="ae8d00e19c671f6cfe8454a5bb590ab1"/><file name="changeReservation.php" hash="43d9486d29326a8c33a4fda466612149"/><file name="checkOrderStatus.php" hash="bef76f120b3e486790d78b50f4101701"/><file name="creditInvoice.php" hash="8edca171c9f7be2a3c15b23ff166048e"/><file name="creditPart.php" hash="5497b9307da7cccadbf4a6c0dc943876"/><file name="deleteInvoice.php" hash="6d2a6e53c64e7a1aacb79c775a46da5b"/><file name="emailInvoice.php" hash="764fbd5fab4f52dacd767a3f7ac17234"/><file name="fetchPClasses.php" hash="aac08dc4d9cfece6ac9e9a9c4e7b20cc"/><file name="getAddresses.php" hash="ebd79224ea702c92e99a407a53d42da0"/><file name="getPClasses.php" hash="8e444c98a7c63b82512af1f4ce35ac65"/><file name="invoiceAddress.php" hash="97475403b1db4264c0add60930380434"/><file name="invoiceAmount.php" hash="2f5dc326549b179cf99c27518b715e88"/><file name="invoicePartAmount.php" hash="87bf68e855bfdd4f6ba3547091104c97"/><file name="reserveAmount.php" hash="1a97ef5c39f5a2c6d97660504cbbfa10"/><file name="reserveOCR.php" hash="9349b5ea9807060cba4b5f3fcd14369f"/><file name="returnAmount.php" hash="02caca4d76b6d055d504023c770961a4"/><file name="sendInvoice.php" hash="9139eef562746840d09f9d9d5a465c21"/><file name="splitReservation.php" hash="0e09421de645d97c3b74485d51edacfd"/><file name="update.php" hash="3e3561165f4c6727731afe451b0f87d6"/><file name="updateChargeAmount.php" hash="34de26a7f6a089bdb18f67eae1f903c7"/><file name="updateGoodsQty.php" hash="e4f9ee36f56b47924ba35cda500cf13e"/><file name="updateOrderNo.php" hash="cdd594a386072f7bffbf05d2ecdcb9b7"/></dir><file name="klarnaaddr.php" hash="b090d4b0a819fdb7cc58815a8643de18"/><file name="klarnacalc.php" hash="3ab728bf3889240b881f282122fd25fd"/><file name="klarnaconfig.php" hash="a3a4011dccda60fcf3567f56254699ff"/><file name="klarnapclass.php" hash="26a8fd1df0806788f6719cb894787f76"/><dir name="pclasses"><file name="jsonstorage.class.php" hash="e59e526d9dcc17d1ca92ded188750672"/><file name="mysqlstorage.class.php" hash="896a5cd4edf461ef517e0bb2e328707b"/><file name="sqlstorage.class.php" hash="bb7ba4359e7e69424c9f0ecdafc0c9ae"/><file name="storage.intf.php" hash="26db57484b6db3d717c0150ffaa87b19"/><file name="xmlstorage.class.php" hash="4f13939bf8d73f2724f858dd17f219de"/></dir><dir name="transport"><dir name="xmlrpc-3.0.0.beta"><dir name="lib"><file name="xmlrpc.inc" hash="5a74ea2a831648febc9b2c8f809b252c"/><file name="xmlrpc_wrappers.inc" hash="5aa00141ead09fc5498d9a3c9fcab888"/><file name="xmlrpcs.inc" hash="158b97bda79333e9b40793d876b6e98f"/></dir></dir></dir></dir><dir name="KlarnaCheckout"><dir name="Checkout"><file name="BasicConnector.php" hash="42afc7257646279bbc9239e5e427a76d"/><file name="ConnectionErrorException.php" hash="352ae3f5bbb18c04f0a9d3ca1be30faf"/><file name="Connector.php" hash="767cd6181abcd144ea8b2d1738f0a617"/><file name="ConnectorException.php" hash="fe4017579c8757798e018fb0755496c0"/><file name="ConnectorInterface.php" hash="0ebfd5610fec6ddce7b7fd0f45f3d1d6"/><file name="Digest.php" hash="d7c2ea4ff1f22c8919685aad7e4e9c8b"/><file name="Exception.php" hash="31a95e8212f01d149265f75e20b31bcb"/><dir name="HTTP"><file name="CURLFactory.php" hash="591493c487797a80fd76f4f80ca598d0"/><file name="CURLHandle.php" hash="2d58ba553ffddafdcc9c80bea0c2c5ee"/><file name="CURLHandleInterface.php" hash="df5e3ddf82deb09164c75249c7235756"/><file name="CURLHeaders.php" hash="2a900efb8591defaf9230368403c975f"/><file name="CURLTransport.php" hash="c35a9910a04007372c2d6673f4657b89"/><file name="Request.php" hash="180f04ffd522b713b4261087a7e60c68"/><file name="Response.php" hash="86993580c2a11b14bab4af6328caa6de"/><file name="Transport.php" hash="4aa96d5086e105d79b0f97593fbe5d9b"/><file name="TransportInterface.php" hash="3d6aab36479741136c9dee1bbcf3914e"/></dir><file name="Order.php" hash="568242a47b838ae9abf8438a4bc7301e"/><file name="ResourceInterface.php" hash="55fc925edc0f69a89f2d79e348152a2c"/><file name="UserAgent.php" hash="32f00a78564158e27ab99c8af4a993f2"/></dir><file name="Checkout.php" hash="6e16bb237ecfc54f086a0d533a8e69e3"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="KCO"><file name="dropdown.png" hash="a408e177ff3130bdb4bb491935700df4"/><file name="kco.css" hash="fb072bb34dde0222d3e66bf076e91178"/><file name="loader.gif" hash="5e51d58f5d9bd09ab814d9ca9347d3b9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Avenla_KlarnaCheckout.xml" hash="22b47fd5cc2c12370457a51ffff752d6"/></dir></target><target name="magelocale"><dir name="fi_FI"><file name="Avenla_KlarnaCheckout.csv" hash="a362ca64aa7802755bfa48a4445fdbfd"/></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.16</min><max>5.5.0</max></php></required></dependencies>
|
21 |
</package>
|
skin/frontend/base/default/KCO/kco.css
CHANGED
@@ -1,35 +1,14 @@
|
|
1 |
-
|
2 |
-
* This file is released under a custom license by Avenla Oy.
|
3 |
-
* All rights reserved
|
4 |
-
*
|
5 |
-
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
6 |
-
* For questions and support - klarna-support@avenla.com
|
7 |
-
*
|
8 |
-
* @category Avenla
|
9 |
-
* @package Avenla_KlarnaCheckout
|
10 |
-
* @copyright Copyright (c) Avenla Oy
|
11 |
-
* @link http://www.avenla.fi
|
12 |
-
*/
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Avenla KlarnaCheckout
|
16 |
-
*
|
17 |
-
* @category Avenla
|
18 |
-
* @package Avenla_KlarnaCheckout
|
19 |
-
*/
|
20 |
-
|
21 |
-
#klarnaWrapper {position: relative;}
|
22 |
.klarnaLink, #klarnaMsg{
|
23 |
background-color:#FFF;
|
24 |
text-align:center;
|
25 |
border:1px solid #1e7ec8;
|
26 |
display:block;
|
27 |
padding:20px 5px;
|
28 |
-
margin-bottom:
|
29 |
border-radius:3px;
|
30 |
-
|
31 |
-
|
32 |
-
#klarnaMsg{margin-bottom:0px;}
|
33 |
.klarna_link_text{margin:10px 0px 0px 0px;font-weight:bold;}
|
34 |
#klarnaMsg h2{
|
35 |
color:#1e7ec8;
|
@@ -37,7 +16,6 @@
|
|
37 |
margin:0px;
|
38 |
}
|
39 |
.klarnaLink:hover{border:1px solid #8CCBFC;}
|
40 |
-
#klarnaWrapper{position:relative;}
|
41 |
.klarna_alert{font-weight:bold; color:red;}
|
42 |
#klarnaOverlay{
|
43 |
background-color:#FFF;
|
@@ -46,30 +24,38 @@
|
|
46 |
width:100%;
|
47 |
opacity:0.5;
|
48 |
}
|
49 |
-
|
|
|
50 |
.cart .payments ul li {
|
51 |
display:block;
|
52 |
float:left;
|
53 |
-
border
|
54 |
-
|
55 |
-
|
56 |
-
border-right:
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
border-bottom:0px;
|
59 |
background: #eeeeee;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
-
|
62 |
-
.cart .payments ul{display:block;margin:0;}
|
63 |
-
.cart .totals_row{margin: 0 0 18px;}
|
64 |
-
.cart .payments ul li a, .responsive-payments ul li a{
|
65 |
display:block;
|
66 |
text-decoration:none;
|
67 |
-
font:
|
68 |
-
|
69 |
-
|
70 |
}
|
71 |
-
.cart .payments ul li.active
|
72 |
-
.cart .payments ul li.active{
|
73 |
position:relative;
|
74 |
z-index:20;
|
75 |
background: rgb(178,225,255);
|
@@ -83,7 +69,6 @@
|
|
83 |
margin-bottom: -1px;
|
84 |
margin-top: 1px;
|
85 |
}
|
86 |
-
|
87 |
.cart .payments ul li:hover{
|
88 |
background: rgb(222,239,255);
|
89 |
background: -moz-linear-gradient(top, rgba(222,239,255,1) 0%, rgba(152,190,222,1) 100%);
|
@@ -94,41 +79,23 @@
|
|
94 |
background: linear-gradient(to bottom, rgba(222,239,255,1) 0%,rgba(152,190,222,1) 100%);
|
95 |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#deefff', endColorstr='#98bede',GradientType=0 );
|
96 |
}
|
97 |
-
|
98 |
.payment_container{
|
99 |
padding:5px;
|
100 |
overflow: hidden;
|
101 |
-
clear:
|
102 |
-
margin-top:
|
103 |
position: relative;
|
104 |
-webkit-border-radius: 2px;
|
105 |
-moz-border-radius: 2px;
|
106 |
border: 1px solid #d0cbc1;
|
107 |
}
|
108 |
-
|
109 |
.sp-methods{
|
110 |
background:none !important;
|
111 |
margin:0px !important;
|
112 |
padding:0px !important;
|
113 |
}
|
114 |
-
.cart .crosssell{margin: 0 0 18px;}
|
115 |
.cart .cart-collaterals .col2-set, .cart .totals{width:auto;float:none;}
|
116 |
.cart .cart-collaterals .col2-set .col-2{width: 48.5%;}
|
117 |
-
.cart .crosssell{overflow:hidden;}
|
118 |
.cart .crosssell li.item{float:left;margin-right:10px;}
|
119 |
-
.
|
120 |
-
.responsive-payments ul{overflow:hidden;border:1px solid #ddd;border-radius:3px 0px 0px 3px;margin-bottom:10px !important;}
|
121 |
-
.responsive-payments .paymentnavi-toggle{display:block;position:absolute;right:0;height:40px;width:40px;background:url('dropdown.png') no-repeat;}
|
122 |
-
.responsive-payments .paymentnavi-toggle:hover{cursor:pointer;}
|
123 |
-
.responsive-payments ul li{
|
124 |
-
padding:8px 40px 8px 0px !important;
|
125 |
-
background:#fff;
|
126 |
-
float:none !important;
|
127 |
-
text-align:center;
|
128 |
-
border-bottom:1px solid #ddd;
|
129 |
-
display:none;
|
130 |
-
transition:0.4s;
|
131 |
-
}
|
132 |
-
.responsive-payments ul li:hover {box-shadow:inset 0px 0px 5px 5px rgba(0,0,0,0.025);}
|
133 |
-
.responsive-payments ul li.active{display:block !important;}
|
134 |
-
.klarna-part-payment{margin-top:10px;}
|
1 |
+
#klarnaWrapper {position: relative;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
.klarnaLink, #klarnaMsg{
|
3 |
background-color:#FFF;
|
4 |
text-align:center;
|
5 |
border:1px solid #1e7ec8;
|
6 |
display:block;
|
7 |
padding:20px 5px;
|
8 |
+
margin-bottom:0px;
|
9 |
border-radius:3px;
|
10 |
+
}
|
11 |
+
.klarnaLink {margin-bottom:10px;}
|
|
|
12 |
.klarna_link_text{margin:10px 0px 0px 0px;font-weight:bold;}
|
13 |
#klarnaMsg h2{
|
14 |
color:#1e7ec8;
|
16 |
margin:0px;
|
17 |
}
|
18 |
.klarnaLink:hover{border:1px solid #8CCBFC;}
|
|
|
19 |
.klarna_alert{font-weight:bold; color:red;}
|
20 |
#klarnaOverlay{
|
21 |
background-color:#FFF;
|
24 |
width:100%;
|
25 |
opacity:0.5;
|
26 |
}
|
27 |
+
.cart .totals_row{margin: 0 0 18px;}
|
28 |
+
.cart .payments ul{display:inline;margin-bottom:-5px;}
|
29 |
.cart .payments ul li {
|
30 |
display:block;
|
31 |
float:left;
|
32 |
+
border: 1px solid #d0cbc1;
|
33 |
+
padding:10px 20px;
|
34 |
+
-webkit-border-top-left-radius: 5px;
|
35 |
+
-webkit-border-top-right-radius: 5px;
|
36 |
+
-moz-border-radius-topleft: 5px;
|
37 |
+
-moz-border-radius-topright: 5px;
|
38 |
+
border-top-left-radius: 5px;
|
39 |
+
border-top-right-radius: 5px;
|
40 |
+
margin-left:5px;
|
41 |
border-bottom:0px;
|
42 |
background: #eeeeee;
|
43 |
+
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
|
44 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc));
|
45 |
+
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
|
46 |
+
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
|
47 |
+
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
|
48 |
+
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%);
|
49 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 );
|
50 |
}
|
51 |
+
.cart .payments ul li a{
|
|
|
|
|
|
|
52 |
display:block;
|
53 |
text-decoration:none;
|
54 |
+
font: bold 13px/16px Arial, Helvetica, sans-serif;
|
55 |
+
color: #000;
|
56 |
+
text-transform: uppercase;
|
57 |
}
|
58 |
+
.cart .payments ul li.active{
|
|
|
59 |
position:relative;
|
60 |
z-index:20;
|
61 |
background: rgb(178,225,255);
|
69 |
margin-bottom: -1px;
|
70 |
margin-top: 1px;
|
71 |
}
|
|
|
72 |
.cart .payments ul li:hover{
|
73 |
background: rgb(222,239,255);
|
74 |
background: -moz-linear-gradient(top, rgba(222,239,255,1) 0%, rgba(152,190,222,1) 100%);
|
79 |
background: linear-gradient(to bottom, rgba(222,239,255,1) 0%,rgba(152,190,222,1) 100%);
|
80 |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#deefff', endColorstr='#98bede',GradientType=0 );
|
81 |
}
|
|
|
82 |
.payment_container{
|
83 |
padding:5px;
|
84 |
overflow: hidden;
|
85 |
+
clear:left;
|
86 |
+
margin-top: -20px;
|
87 |
position: relative;
|
88 |
-webkit-border-radius: 2px;
|
89 |
-moz-border-radius: 2px;
|
90 |
border: 1px solid #d0cbc1;
|
91 |
}
|
|
|
92 |
.sp-methods{
|
93 |
background:none !important;
|
94 |
margin:0px !important;
|
95 |
padding:0px !important;
|
96 |
}
|
97 |
+
.cart .crosssell{margin: 0 0 18px;overflow:hidden;}
|
98 |
.cart .cart-collaterals .col2-set, .cart .totals{width:auto;float:none;}
|
99 |
.cart .cart-collaterals .col2-set .col-2{width: 48.5%;}
|
|
|
100 |
.cart .crosssell li.item{float:left;margin-right:10px;}
|
101 |
+
.loading{ background: url('loader.gif') no-repeat 50% 50% !important; opacity:0.7;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/frontend/base/default/KCO/loader.gif
ADDED
Binary file
|