Version Notes
Skybox Checkout enables a Magento ecommerce site to sell instantly to 180 countries & territories and accept payment in 140 local currencies. SkyBOX Checkout is a combination of technology tools & services to help retailers expand overseas while offering a localized full landed cost calculation to international shoppers. SkyBOX Checkout takes on full risk of fraud screening & international payments while providing competitive international shipping with full tracking via its proprietary logistics network.
Download this release
Release Info
Developer | Emilio Lizarraga |
Extension | SKYBOZ456 |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- app/code/community/Skybox/Catalog/Block/Bundle/Price.php +149 -149
- app/code/community/Skybox/Catalog/Block/Catalog/Category/Tab/Skyboxcheckout.php +125 -125
- app/code/community/Skybox/Catalog/Block/Product/List.php +468 -468
- app/code/community/Skybox/Catalog/Block/Product/Price.php +242 -221
- app/code/community/Skybox/Catalog/Block/Product/Widget/New.php +48 -48
- app/code/community/Skybox/Catalog/Model/Api/Product.php +937 -889
- app/code/community/Skybox/Catalog/Model/Observer.php +270 -249
- app/code/community/Skybox/Catalog/Model/Product/Attribute/Source/Categories.php +38 -38
- app/code/community/Skybox/Catalog/Model/Product/Type/Price.php +64 -64
- app/code/community/Skybox/Catalog/Model/Resource/Setup.php +11 -11
- app/code/community/Skybox/Catalog/etc/config.xml +174 -174
- app/code/community/Skybox/Catalog/sql/skyboxcatalog_setup/mysql4-install-0.1.0.php +70 -70
- app/code/community/Skybox/Checkout/Block/Cart/Item/Renderer.php +11 -11
- app/code/community/Skybox/Checkout/Block/Cart/Sidebar.php +32 -32
- app/code/community/Skybox/Checkout/Block/Cart/Totals.php +157 -171
- app/code/community/Skybox/Checkout/Block/Checkout/Cart.php +45 -45
- app/code/community/Skybox/Checkout/Block/Checkout/Cart/Sidebar.php +16 -16
- app/code/community/Skybox/Checkout/Block/Checkout/Links.php +26 -26
- app/code/community/Skybox/Checkout/Block/Checkout/Onepage/Link.php +43 -43
- app/code/community/Skybox/Checkout/Block/Sales/Order/Total.php +45 -45
- app/code/community/Skybox/Checkout/Helper/Data.php +156 -133
- app/code/community/Skybox/Checkout/Helper/Url.php +58 -58
- app/code/community/Skybox/Checkout/Model/Api/Checkout.php +222 -220
- app/code/community/Skybox/Checkout/Model/Carrier.php +36 -36
- app/code/community/Skybox/Checkout/Model/Cart.php +689 -586
- app/code/community/Skybox/Checkout/Model/Creditmemo/Total.php +17 -17
- app/code/community/Skybox/Checkout/Model/Invoice/Total.php +17 -17
- app/code/community/Skybox/Checkout/Model/Observer.php +292 -292
- app/code/community/Skybox/Checkout/Model/Pay.php +11 -11
- app/code/community/Skybox/Checkout/Model/Quote/Address/Total/Rmt.php +87 -73
- app/code/community/Skybox/Checkout/Model/Quote/Address/Total/Tax.php +5 -5
- app/code/community/Skybox/Checkout/Model/Quote/SubTotal.php +103 -103
- app/code/community/Skybox/Checkout/Model/Quote/Total.php +304 -276
- app/code/community/Skybox/Checkout/Model/Quote/Total2.php +7 -7
- app/code/community/Skybox/Checkout/Model/Quote/Total3.php +6 -6
- app/code/community/Skybox/Checkout/Model/Quote/Total4.php +6 -6
- app/code/community/Skybox/Checkout/Model/Quote/Total5.php +6 -6
- app/code/community/Skybox/Checkout/Model/Quote/Total6.php +6 -6
- app/code/community/Skybox/Checkout/Model/Quote/Total7.php +6 -6
- app/code/community/Skybox/Checkout/Model/Quote/Total8.php +7 -7
- app/code/community/Skybox/Checkout/controllers/CalculateController.php +127 -127
- app/code/community/Skybox/Checkout/controllers/InternationalController.php +66 -65
- app/code/community/Skybox/Checkout/controllers/ProcessController.php +335 -300
- app/code/community/Skybox/Checkout/etc/config.xml +467 -467
- app/code/community/Skybox/Checkout/etc/system.xml +127 -127
- app/code/community/Skybox/Checkout/sql/skyboxcheckout_setup/mysql4-install-0.1.0.php +132 -132
- app/code/community/Skybox/Checkout/sql/skyboxcheckout_setup/mysql4-upgrade-0.1.0-0.1.1.php +71 -71
- app/code/community/Skybox/Checkout/sql/skyboxcheckout_setup/mysql4-upgrade-0.1.0-0.1.2.php +18 -18
- app/code/community/Skybox/Core/Exception.php +19 -19
- app/code/community/Skybox/Core/Helper/Allow.php +236 -0
- app/code/community/Skybox/Core/Helper/Data.php +11 -11
- app/code/community/Skybox/Core/Helper/Email.php +52 -52
- app/code/community/Skybox/Core/Model/Api/Abstract.php +440 -369
- app/code/community/Skybox/Core/Model/Api/Restful.php +362 -345
- app/code/community/Skybox/Core/Model/Config.php +249 -247
- app/code/community/Skybox/Core/Model/Logservice.php +16 -16
- app/code/community/Skybox/Core/Model/Mysql4.php +16 -16
- app/code/community/Skybox/Core/Model/Mysql4/Logservice.php +22 -22
- app/code/community/Skybox/Core/Model/Mysql4/Logservice/Collection.php +17 -17
- app/code/community/Skybox/Core/Model/Session.php +29 -29
- app/code/community/Skybox/Core/Model/Standard.php +292 -287
- app/code/community/Skybox/Core/etc/config.xml +59 -59
- app/code/community/Skybox/Core/sql/skyboxcore_setup/mysql4-install-0.1.0.php +69 -69
- app/code/community/Skybox/International/Helper/Data.php +77 -72
- app/code/community/Skybox/International/Model/Config.php +15 -15
- app/code/community/Skybox/International/etc/adminhtml.xml +39 -39
- app/code/community/Skybox/International/etc/config.xml +60 -60
- app/code/community/Skybox/International/etc/system.xml +133 -133
- app/code/community/Skybox/Services/Model/Api.php +309 -309
- app/code/community/Skybox/Services/Model/Api/V2.php +11 -11
- app/code/community/Skybox/Services/etc/api.xml +37 -37
- app/code/community/Skybox/Services/etc/config.xml +25 -25
- app/code/community/Skybox/Services/etc/wsdl.xml +141 -141
- app/code/community/Skybox/Services/etc/wsi.xml +159 -159
- app/design/adminhtml/default/default/layout/skyboxcatalog.xml +7 -7
- app/design/adminhtml/default/default/layout/skyboxinternational.xml +14 -14
- app/design/frontend/base/default/layout/skyboxcheckout.xml +155 -155
- app/design/frontend/base/default/template/skybox/checkout/cart.phtml +291 -356
- app/design/frontend/base/default/template/skybox/checkout/cart/item/default.phtml +294 -294
- app/design/frontend/base/default/template/skybox/checkout/cart/shipping.phtml +160 -160
- app/design/frontend/base/default/template/skybox/checkout/cart/sidebar.phtml +80 -80
- app/design/frontend/base/default/template/skybox/checkout/cart/sidebar/default.phtml +146 -146
- app/design/frontend/base/default/template/skybox/checkout/cart_list.phtml +195 -195
- app/design/frontend/base/default/template/skybox/checkout/onepage.phtml +3 -3
- app/design/frontend/base/default/template/skybox/checkout/onepage/link.phtml +41 -41
- app/design/frontend/base/default/template/skybox/checkout/pagecheckout.phtml +31 -31
- app/design/frontend/base/default/template/skybox/checkout/skyboxcheckout.phtml +399 -437
- app/design/frontend/base/default/template/skybox/checkout/skyboxsuccess.phtml +28 -28
- app/etc/modules/Skybox_All.xml +35 -35
- js/skybox/adminhtml.category.js +10 -10
- js/skybox/jquery.ba-resize.min.js +8 -8
- js/skybox/jquery.fancybox.js +2020 -0
- js/skybox/jquery.min.js +0 -3
app/code/community/Skybox/Catalog/Block/Bundle/Price.php
CHANGED
@@ -1,150 +1,150 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox Checkout
|
4 |
-
*
|
5 |
-
* @category Mage
|
6 |
-
* @package Skybox_Catalog
|
7 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Bundle product price block
|
12 |
-
*
|
13 |
-
* @category Skybox
|
14 |
-
* @package Skybox_Catalog
|
15 |
-
*/
|
16 |
-
class Skybox_Catalog_Block_Bundle_Price extends Mage_Bundle_Block_Catalog_Product_Price
|
17 |
-
{
|
18 |
-
/*
|
19 |
-
* @var string $_cache_code
|
20 |
-
*/
|
21 |
-
public $_cache_code = null;
|
22 |
-
|
23 |
-
public function getCacheCode()
|
24 |
-
{
|
25 |
-
if ($this->_cache_code == null) {
|
26 |
-
/* @var $config Skybox_Core_Model_Config */
|
27 |
-
$config = Mage::getModel("skyboxcore/config");
|
28 |
-
$skyboxUser = $config->getSession()->getSkyboxUser();
|
29 |
-
$cache_code = $skyboxUser->CartCountryISOCode . $skyboxUser->CartCityId . $skyboxUser->CartCurrencyISOCode;
|
30 |
-
$this->_cache_code = $cache_code;
|
31 |
-
}
|
32 |
-
Mage::log("[bundle/price] Cache Code: " . $cache_code, null, 'cache.log', true);
|
33 |
-
return $this->_cache_code;
|
34 |
-
}
|
35 |
-
|
36 |
-
/*
|
37 |
-
protected function _construct()
|
38 |
-
{
|
39 |
-
//parent::__construct();
|
40 |
-
$this->addData(array(
|
41 |
-
'cache_lifetime' => 120 //seconds
|
42 |
-
));
|
43 |
-
}
|
44 |
-
*/
|
45 |
-
|
46 |
-
public function getCacheKey()
|
47 |
-
{
|
48 |
-
$cache_key = "B_PRODUCT_" . $this->getProduct()->getId() . "_" . $this->getCacheCode();
|
49 |
-
return $cache_key;
|
50 |
-
}
|
51 |
-
|
52 |
-
public function getCacheTags()
|
53 |
-
{
|
54 |
-
$cache_tag = $this->getProduct()->getId() . "_B_" . $this->getCacheCode();
|
55 |
-
return array(Mage_Catalog_Model_Product::CACHE_TAG . $cache_tag);
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Retrieve API Product
|
60 |
-
*
|
61 |
-
* @return Skybox_Catalog_Model_Api_Product
|
62 |
-
*/
|
63 |
-
protected function _getApi()
|
64 |
-
{
|
65 |
-
if (null === $this->_api) {
|
66 |
-
$this->_api = Mage::getModel('skyboxcatalog/api_product');
|
67 |
-
}
|
68 |
-
return $this->_api;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Convert block to html string
|
73 |
-
*
|
74 |
-
* @return string
|
75 |
-
*/
|
76 |
-
public function _toHtml()
|
77 |
-
{
|
78 |
-
//return parent::_toHtml();
|
79 |
-
Mage::log("CatalogBlockPrice__toHtmlbundle ", null, 'orden.log', true);
|
80 |
-
if ($this->_getApi()->getErrorAuthenticate() && !$this->_getApi()->getLocationAllow() && $this->_getApi()->HasError()) {
|
81 |
-
return '';
|
82 |
-
} elseif ($this->_getApi()->HasError()) {
|
83 |
-
//$error_code = $this->_getApi()->getStatusCode();
|
84 |
-
$message = $this->_getApi()->getStatusMessage();
|
85 |
-
//return '<div style="color:#FF0000;">' . $message . '</div>';
|
86 |
-
Mage::log("[bundle/price] Some parameter doesn't given to Calculate Price: " . $this->_getApi()->getStatusMessage(), null, 'skyboxcheckout.log', true);
|
87 |
-
}
|
88 |
-
|
89 |
-
/* @var $product Mage_Catalog_Model_Product */
|
90 |
-
$product = $this->getProduct();
|
91 |
-
$type = $product->getTypeId();
|
92 |
-
$route_name = Mage::app()->getRequest()->getRouteName();
|
93 |
-
//Mage::log("ROUTER; ". $route_name, null, 'cart.log', true);
|
94 |
-
|
95 |
-
if ($type == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $this->getTemplate() == 'bundle/catalog/product/price.phtml') {
|
96 |
-
if ($route_name == 'catalog') {
|
97 |
-
return $this->calculatePrice($product);
|
98 |
-
}
|
99 |
-
|
100 |
-
// Note: we can't get the "Final Price".
|
101 |
-
// Moreover, we show "From XXX to XXX" price Block.
|
102 |
-
//return parent::_toHtml();
|
103 |
-
|
104 |
-
// Note: We make a product type: 'bundle_fixed' to calculate Price and Weight dynamically
|
105 |
-
return $this->calculatePrice($product, 'bundle_fixed');
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Calculate Price HTML output
|
111 |
-
*
|
112 |
-
* @param Mage_Catalog_Model_Product $product
|
113 |
-
* @return string
|
114 |
-
*/
|
115 |
-
protected function calculatePrice($product, $bundleType = 'bundle')
|
116 |
-
{
|
117 |
-
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter calculatePrice', null, 'tracer.log', true);
|
118 |
-
$stockItem = $product->getStockItem();
|
119 |
-
if (!$stockItem->getIsInStock()) {
|
120 |
-
return ''; // Out of Stock
|
121 |
-
}
|
122 |
-
|
123 |
-
$finalPrice = $product->getFinalPrice();
|
124 |
-
$finalPrice = ($finalPrice > 0) ? $finalPrice : null;
|
125 |
-
|
126 |
-
/*
|
127 |
-
//$weight = $product->getWeight();
|
128 |
-
$weight = $product->getTypeInstance(true)->getWeight($product);
|
129 |
-
Mage::log("[Bundle] " . $product->getName() . " : " . $finalPrice . " - [weight] " . $weight, null, 'cart.log', true);
|
130 |
-
*/
|
131 |
-
|
132 |
-
//$template = $this->_getApi()->CalculatePrice($product, null, null, 'bundle')
|
133 |
-
//$template = $this->_getApi()->CalculatePrice($product, null, $finalPrice, 'bundle')
|
134 |
-
$template = $this->_getApi()->CalculatePrice($product, null, $finalPrice, $bundleType)
|
135 |
-
->GetTemplateProduct();
|
136 |
-
|
137 |
-
$extraHtml = '<p class="label" id="skybox-configurable-price-from-'
|
138 |
-
. $product->getId()
|
139 |
-
. $this->getIdSuffix()
|
140 |
-
. '">'
|
141 |
-
. $template
|
142 |
-
. '</p>'
|
143 |
-
. '<div style="clear:both"></div>';
|
144 |
-
//$priceHtml = parent::_toHtml();
|
145 |
-
#manually insert extra html needed by the extension into the normal price html
|
146 |
-
|
147 |
-
//substr_replace($priceHtml, $extraHtml, strpos($priceHtml, $htmlToInsertAfter)+strlen($htmlToInsertAfter),0);
|
148 |
-
return $extraHtml;
|
149 |
-
}
|
150 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox Checkout
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Skybox_Catalog
|
7 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Bundle product price block
|
12 |
+
*
|
13 |
+
* @category Skybox
|
14 |
+
* @package Skybox_Catalog
|
15 |
+
*/
|
16 |
+
class Skybox_Catalog_Block_Bundle_Price extends Mage_Bundle_Block_Catalog_Product_Price
|
17 |
+
{
|
18 |
+
/*
|
19 |
+
* @var string $_cache_code
|
20 |
+
*/
|
21 |
+
public $_cache_code = null;
|
22 |
+
|
23 |
+
public function getCacheCode()
|
24 |
+
{
|
25 |
+
if ($this->_cache_code == null) {
|
26 |
+
/* @var $config Skybox_Core_Model_Config */
|
27 |
+
$config = Mage::getModel("skyboxcore/config");
|
28 |
+
$skyboxUser = $config->getSession()->getSkyboxUser();
|
29 |
+
$cache_code = $skyboxUser->CartCountryISOCode . $skyboxUser->CartCityId . $skyboxUser->CartCurrencyISOCode;
|
30 |
+
$this->_cache_code = $cache_code;
|
31 |
+
}
|
32 |
+
Mage::log("[bundle/price] Cache Code: " . $cache_code, null, 'cache.log', true);
|
33 |
+
return $this->_cache_code;
|
34 |
+
}
|
35 |
+
|
36 |
+
/*
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
//parent::__construct();
|
40 |
+
$this->addData(array(
|
41 |
+
'cache_lifetime' => 120 //seconds
|
42 |
+
));
|
43 |
+
}
|
44 |
+
*/
|
45 |
+
|
46 |
+
public function getCacheKey()
|
47 |
+
{
|
48 |
+
$cache_key = "B_PRODUCT_" . $this->getProduct()->getId() . "_" . $this->getCacheCode();
|
49 |
+
return $cache_key;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getCacheTags()
|
53 |
+
{
|
54 |
+
$cache_tag = $this->getProduct()->getId() . "_B_" . $this->getCacheCode();
|
55 |
+
return array(Mage_Catalog_Model_Product::CACHE_TAG . $cache_tag);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Retrieve API Product
|
60 |
+
*
|
61 |
+
* @return Skybox_Catalog_Model_Api_Product
|
62 |
+
*/
|
63 |
+
protected function _getApi()
|
64 |
+
{
|
65 |
+
if (null === $this->_api) {
|
66 |
+
$this->_api = Mage::getModel('skyboxcatalog/api_product');
|
67 |
+
}
|
68 |
+
return $this->_api;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Convert block to html string
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function _toHtml()
|
77 |
+
{
|
78 |
+
//return parent::_toHtml();
|
79 |
+
Mage::log("CatalogBlockPrice__toHtmlbundle ", null, 'orden.log', true);
|
80 |
+
if ($this->_getApi()->getErrorAuthenticate() && !$this->_getApi()->getLocationAllow() && $this->_getApi()->HasError()) {
|
81 |
+
return '';
|
82 |
+
} elseif ($this->_getApi()->HasError()) {
|
83 |
+
//$error_code = $this->_getApi()->getStatusCode();
|
84 |
+
$message = $this->_getApi()->getStatusMessage();
|
85 |
+
//return '<div style="color:#FF0000;">' . $message . '</div>';
|
86 |
+
Mage::log("[bundle/price] Some parameter doesn't given to Calculate Price: " . $this->_getApi()->getStatusMessage(), null, 'skyboxcheckout.log', true);
|
87 |
+
}
|
88 |
+
|
89 |
+
/* @var $product Mage_Catalog_Model_Product */
|
90 |
+
$product = $this->getProduct();
|
91 |
+
$type = $product->getTypeId();
|
92 |
+
$route_name = Mage::app()->getRequest()->getRouteName();
|
93 |
+
//Mage::log("ROUTER; ". $route_name, null, 'cart.log', true);
|
94 |
+
|
95 |
+
if ($type == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $this->getTemplate() == 'bundle/catalog/product/price.phtml') {
|
96 |
+
if ($route_name == 'catalog') {
|
97 |
+
return $this->calculatePrice($product);
|
98 |
+
}
|
99 |
+
|
100 |
+
// Note: we can't get the "Final Price".
|
101 |
+
// Moreover, we show "From XXX to XXX" price Block.
|
102 |
+
//return parent::_toHtml();
|
103 |
+
|
104 |
+
// Note: We make a product type: 'bundle_fixed' to calculate Price and Weight dynamically
|
105 |
+
return $this->calculatePrice($product, 'bundle_fixed');
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Calculate Price HTML output
|
111 |
+
*
|
112 |
+
* @param Mage_Catalog_Model_Product $product
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
protected function calculatePrice($product, $bundleType = 'bundle')
|
116 |
+
{
|
117 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter calculatePrice', null, 'tracer.log', true);
|
118 |
+
$stockItem = $product->getStockItem();
|
119 |
+
if (!$stockItem->getIsInStock()) {
|
120 |
+
return ''; // Out of Stock
|
121 |
+
}
|
122 |
+
|
123 |
+
$finalPrice = $product->getFinalPrice();
|
124 |
+
$finalPrice = ($finalPrice > 0) ? $finalPrice : null;
|
125 |
+
|
126 |
+
/*
|
127 |
+
//$weight = $product->getWeight();
|
128 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
129 |
+
Mage::log("[Bundle] " . $product->getName() . " : " . $finalPrice . " - [weight] " . $weight, null, 'cart.log', true);
|
130 |
+
*/
|
131 |
+
|
132 |
+
//$template = $this->_getApi()->CalculatePrice($product, null, null, 'bundle')
|
133 |
+
//$template = $this->_getApi()->CalculatePrice($product, null, $finalPrice, 'bundle')
|
134 |
+
$template = $this->_getApi()->CalculatePrice($product, null, $finalPrice, $bundleType)
|
135 |
+
->GetTemplateProduct();
|
136 |
+
|
137 |
+
$extraHtml = '<p class="label" id="skybox-configurable-price-from-'
|
138 |
+
. $product->getId()
|
139 |
+
. $this->getIdSuffix()
|
140 |
+
. '">'
|
141 |
+
. $template
|
142 |
+
. '</p>'
|
143 |
+
. '<div style="clear:both"></div>';
|
144 |
+
//$priceHtml = parent::_toHtml();
|
145 |
+
#manually insert extra html needed by the extension into the normal price html
|
146 |
+
|
147 |
+
//substr_replace($priceHtml, $extraHtml, strpos($priceHtml, $htmlToInsertAfter)+strlen($htmlToInsertAfter),0);
|
148 |
+
return $extraHtml;
|
149 |
+
}
|
150 |
}
|
app/code/community/Skybox/Catalog/Block/Catalog/Category/Tab/Skyboxcheckout.php
CHANGED
@@ -1,126 +1,126 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox Catalog
|
4 |
-
*
|
5 |
-
* @category Skybox
|
6 |
-
* @package Skybox_Catalog
|
7 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Admin form widget
|
12 |
-
*
|
13 |
-
* @category Skybox
|
14 |
-
* @package Skybox_Catalog
|
15 |
-
*/
|
16 |
-
class Skybox_Catalog_Block_Catalog_Category_Tab_Skyboxcheckout extends Mage_Adminhtml_Block_Widget_Form
|
17 |
-
{
|
18 |
-
public $_commodities = null;
|
19 |
-
|
20 |
-
private function _getCommoditiesData()
|
21 |
-
{
|
22 |
-
if ($this->_commodities == null) {
|
23 |
-
|
24 |
-
/* var @api_checkout Skybox_Checkout_Model_Api_Checkout*/
|
25 |
-
$api_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
26 |
-
$categories = $api_checkout->GetCategories();
|
27 |
-
|
28 |
-
$options = array('' => '');
|
29 |
-
|
30 |
-
foreach ($categories as $obj) {
|
31 |
-
$item = array(
|
32 |
-
$obj->IdCommoditie => $obj->Description,
|
33 |
-
);
|
34 |
-
//$options = array_merge($options, $item);
|
35 |
-
$options = array_replace($options, $item);
|
36 |
-
}
|
37 |
-
$this->_commodities = $options;
|
38 |
-
}
|
39 |
-
return $this->_commodities;
|
40 |
-
}
|
41 |
-
|
42 |
-
protected function _prepareForm()
|
43 |
-
{
|
44 |
-
$model = Mage::registry('category');
|
45 |
-
|
46 |
-
$form = new Varien_Data_Form(array(
|
47 |
-
'id' => 'edit_form',
|
48 |
-
'action' => $this->getData('action'),
|
49 |
-
'method' => 'post',
|
50 |
-
'enctype' => 'multipart/form-data'
|
51 |
-
));
|
52 |
-
|
53 |
-
// Form 1
|
54 |
-
// -----------------------------------------------------------------
|
55 |
-
|
56 |
-
$fieldset = $form->addFieldset('form1_fieldset',
|
57 |
-
array('legend' => Mage::helper('catalog')->__('For New Products'))
|
58 |
-
);
|
59 |
-
|
60 |
-
if ($model->getId()) {
|
61 |
-
$fieldset->addField('attribute_id', 'hidden', array(
|
62 |
-
'name' => 'attribute_id',
|
63 |
-
));
|
64 |
-
}
|
65 |
-
|
66 |
-
$options = $this->_getCommoditiesData();
|
67 |
-
|
68 |
-
$fieldset->addField('skybox_category_id', 'select', array(
|
69 |
-
'name' => 'skybox_category_id',
|
70 |
-
'label' => Mage::helper('catalog')->__('Default commodity'),
|
71 |
-
'title' => Mage::helper('catalog')->__('Default commodity'),
|
72 |
-
//'note' => Mage::helper('catalog')->__('Custom Attribute note'),
|
73 |
-
'values' => $options
|
74 |
-
));
|
75 |
-
|
76 |
-
// Form 2
|
77 |
-
// -----------------------------------------------------------------
|
78 |
-
|
79 |
-
$fieldset = $form->addFieldset('form2_fieldset',
|
80 |
-
array('legend' => Mage::helper('catalog')->__('For Existing Products in Category')));
|
81 |
-
|
82 |
-
// Buttons
|
83 |
-
$buttons = ' <br/>';
|
84 |
-
$buttons .= '<br/><button type="button" onclick = "categorySubmit2(\'' . $this->getSaveUrl() . '\', true)" > Apply All Products </button>';
|
85 |
-
$buttons .= '<br/><br/><button type="button" onclick = "categorySubmit3(\'' . $this->getSaveUrl() . '\', true)" > Apply All Products without Commodities </button>';
|
86 |
-
|
87 |
-
$fieldset->addField('skybox_category_id_select', 'select', array(
|
88 |
-
'name' => 'skybox_category_id_select',
|
89 |
-
'label' => Mage::helper('catalog')->__('Select commodity'),
|
90 |
-
'title' => Mage::helper('catalog')->__('Select commodity'),
|
91 |
-
'values' => $options,
|
92 |
-
'after_element_html' => $buttons
|
93 |
-
));
|
94 |
-
|
95 |
-
$fieldset->addField('apply_button', 'hidden', array(
|
96 |
-
'name' => 'apply_button',
|
97 |
-
));
|
98 |
-
|
99 |
-
//Mage::log("category->getData()", null, 'skyboxcheckout.log', false);
|
100 |
-
//Mage::log(print_r($model->getData(), true), null, 'skyboxcheckout.log', false);
|
101 |
-
|
102 |
-
// Set Values
|
103 |
-
$values = Mage::registry('category')->getData();
|
104 |
-
$values['apply_button'] = 'nothing';
|
105 |
-
|
106 |
-
$form->setValues($values);
|
107 |
-
$this->setForm($form);
|
108 |
-
return parent::_prepareForm();
|
109 |
-
}
|
110 |
-
|
111 |
-
protected function _getAdditionalElementTypes()
|
112 |
-
{
|
113 |
-
return array(
|
114 |
-
'apply' => Mage::getConfig()->getBlockClassName('adminhtml / catalog_product_helper_form_apply')
|
115 |
-
);
|
116 |
-
}
|
117 |
-
|
118 |
-
public function getSaveUrl(array $args = array())
|
119 |
-
{
|
120 |
-
//$params = array('_current' => true);
|
121 |
-
//$params = array_merge($params, $args);
|
122 |
-
$params = array();
|
123 |
-
return $this->getUrl('*/*/save', $params);
|
124 |
-
}
|
125 |
-
|
126 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox Catalog
|
4 |
+
*
|
5 |
+
* @category Skybox
|
6 |
+
* @package Skybox_Catalog
|
7 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Admin form widget
|
12 |
+
*
|
13 |
+
* @category Skybox
|
14 |
+
* @package Skybox_Catalog
|
15 |
+
*/
|
16 |
+
class Skybox_Catalog_Block_Catalog_Category_Tab_Skyboxcheckout extends Mage_Adminhtml_Block_Widget_Form
|
17 |
+
{
|
18 |
+
public $_commodities = null;
|
19 |
+
|
20 |
+
private function _getCommoditiesData()
|
21 |
+
{
|
22 |
+
if ($this->_commodities == null) {
|
23 |
+
|
24 |
+
/* var @api_checkout Skybox_Checkout_Model_Api_Checkout*/
|
25 |
+
$api_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
26 |
+
$categories = $api_checkout->GetCategories();
|
27 |
+
|
28 |
+
$options = array('' => '');
|
29 |
+
|
30 |
+
foreach ($categories as $obj) {
|
31 |
+
$item = array(
|
32 |
+
$obj->IdCommoditie => $obj->Description,
|
33 |
+
);
|
34 |
+
//$options = array_merge($options, $item);
|
35 |
+
$options = array_replace($options, $item);
|
36 |
+
}
|
37 |
+
$this->_commodities = $options;
|
38 |
+
}
|
39 |
+
return $this->_commodities;
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function _prepareForm()
|
43 |
+
{
|
44 |
+
$model = Mage::registry('category');
|
45 |
+
|
46 |
+
$form = new Varien_Data_Form(array(
|
47 |
+
'id' => 'edit_form',
|
48 |
+
'action' => $this->getData('action'),
|
49 |
+
'method' => 'post',
|
50 |
+
'enctype' => 'multipart/form-data'
|
51 |
+
));
|
52 |
+
|
53 |
+
// Form 1
|
54 |
+
// -----------------------------------------------------------------
|
55 |
+
|
56 |
+
$fieldset = $form->addFieldset('form1_fieldset',
|
57 |
+
array('legend' => Mage::helper('catalog')->__('For New Products'))
|
58 |
+
);
|
59 |
+
|
60 |
+
if ($model->getId()) {
|
61 |
+
$fieldset->addField('attribute_id', 'hidden', array(
|
62 |
+
'name' => 'attribute_id',
|
63 |
+
));
|
64 |
+
}
|
65 |
+
|
66 |
+
$options = $this->_getCommoditiesData();
|
67 |
+
|
68 |
+
$fieldset->addField('skybox_category_id', 'select', array(
|
69 |
+
'name' => 'skybox_category_id',
|
70 |
+
'label' => Mage::helper('catalog')->__('Default commodity'),
|
71 |
+
'title' => Mage::helper('catalog')->__('Default commodity'),
|
72 |
+
//'note' => Mage::helper('catalog')->__('Custom Attribute note'),
|
73 |
+
'values' => $options
|
74 |
+
));
|
75 |
+
|
76 |
+
// Form 2
|
77 |
+
// -----------------------------------------------------------------
|
78 |
+
|
79 |
+
$fieldset = $form->addFieldset('form2_fieldset',
|
80 |
+
array('legend' => Mage::helper('catalog')->__('For Existing Products in Category')));
|
81 |
+
|
82 |
+
// Buttons
|
83 |
+
$buttons = ' <br/>';
|
84 |
+
$buttons .= '<br/><button type="button" onclick = "categorySubmit2(\'' . $this->getSaveUrl() . '\', true)" > Apply All Products </button>';
|
85 |
+
$buttons .= '<br/><br/><button type="button" onclick = "categorySubmit3(\'' . $this->getSaveUrl() . '\', true)" > Apply All Products without Commodities </button>';
|
86 |
+
|
87 |
+
$fieldset->addField('skybox_category_id_select', 'select', array(
|
88 |
+
'name' => 'skybox_category_id_select',
|
89 |
+
'label' => Mage::helper('catalog')->__('Select commodity'),
|
90 |
+
'title' => Mage::helper('catalog')->__('Select commodity'),
|
91 |
+
'values' => $options,
|
92 |
+
'after_element_html' => $buttons
|
93 |
+
));
|
94 |
+
|
95 |
+
$fieldset->addField('apply_button', 'hidden', array(
|
96 |
+
'name' => 'apply_button',
|
97 |
+
));
|
98 |
+
|
99 |
+
//Mage::log("category->getData()", null, 'skyboxcheckout.log', false);
|
100 |
+
//Mage::log(print_r($model->getData(), true), null, 'skyboxcheckout.log', false);
|
101 |
+
|
102 |
+
// Set Values
|
103 |
+
$values = Mage::registry('category')->getData();
|
104 |
+
$values['apply_button'] = 'nothing';
|
105 |
+
|
106 |
+
$form->setValues($values);
|
107 |
+
$this->setForm($form);
|
108 |
+
return parent::_prepareForm();
|
109 |
+
}
|
110 |
+
|
111 |
+
protected function _getAdditionalElementTypes()
|
112 |
+
{
|
113 |
+
return array(
|
114 |
+
'apply' => Mage::getConfig()->getBlockClassName('adminhtml / catalog_product_helper_form_apply')
|
115 |
+
);
|
116 |
+
}
|
117 |
+
|
118 |
+
public function getSaveUrl(array $args = array())
|
119 |
+
{
|
120 |
+
//$params = array('_current' => true);
|
121 |
+
//$params = array_merge($params, $args);
|
122 |
+
$params = array();
|
123 |
+
return $this->getUrl('*/*/save', $params);
|
124 |
+
}
|
125 |
+
|
126 |
}
|
app/code/community/Skybox/Catalog/Block/Product/List.php
CHANGED
@@ -1,468 +1,468 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magento.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Catalog
|
23 |
-
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Product list
|
30 |
-
*
|
31 |
-
* @category Mage
|
32 |
-
* @package Mage_Catalog
|
33 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
-
*/
|
35 |
-
class Skybox_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List
|
36 |
-
{
|
37 |
-
/**
|
38 |
-
* Default toolbar block name
|
39 |
-
*
|
40 |
-
* @var string
|
41 |
-
*/
|
42 |
-
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Product Collection
|
46 |
-
*
|
47 |
-
* @var Mage_Eav_Model_Entity_Collection_Abstract
|
48 |
-
*/
|
49 |
-
protected $_productCollection;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Retrieve loaded category collection
|
53 |
-
*
|
54 |
-
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
55 |
-
*/
|
56 |
-
protected function _getProductCollection()
|
57 |
-
{
|
58 |
-
if (is_null($this->_productCollection)) {
|
59 |
-
$layer = $this->getLayer();
|
60 |
-
/* @var $layer Mage_Catalog_Model_Layer */
|
61 |
-
if ($this->getShowRootCategory()) {
|
62 |
-
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
|
63 |
-
}
|
64 |
-
|
65 |
-
// if this is a product view page
|
66 |
-
if (Mage::registry('product')) {
|
67 |
-
// get collection of categories this product is associated with
|
68 |
-
$categories = Mage::registry('product')->getCategoryCollection()
|
69 |
-
->setPage(1, 1)
|
70 |
-
->load();
|
71 |
-
// if the product is associated with any category
|
72 |
-
if ($categories->count()) {
|
73 |
-
// show products from this category
|
74 |
-
$this->setCategoryId(current($categories->getIterator()));
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
$origCategory = null;
|
79 |
-
if ($this->getCategoryId()) {
|
80 |
-
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
|
81 |
-
if ($category->getId()) {
|
82 |
-
$origCategory = $layer->getCurrentCategory();
|
83 |
-
$layer->setCurrentCategory($category);
|
84 |
-
$this->addModelTags($category);
|
85 |
-
}
|
86 |
-
}
|
87 |
-
$this->_productCollection = $layer->getProductCollection();
|
88 |
-
|
89 |
-
$this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
|
90 |
-
|
91 |
-
if ($origCategory) {
|
92 |
-
$layer->setCurrentCategory($origCategory);
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
return $this->_productCollection;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Get catalog layer model
|
101 |
-
*
|
102 |
-
* @return Mage_Catalog_Model_Layer
|
103 |
-
*/
|
104 |
-
public function getLayer()
|
105 |
-
{
|
106 |
-
$layer = Mage::registry('current_layer');
|
107 |
-
if ($layer) {
|
108 |
-
return $layer;
|
109 |
-
}
|
110 |
-
return Mage::getSingleton('catalog/layer');
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Retrieve loaded category collection
|
115 |
-
*
|
116 |
-
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
117 |
-
*/
|
118 |
-
public function getLoadedProductCollection()
|
119 |
-
{
|
120 |
-
return $this->_getProductCollection();
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Retrieve current view mode
|
125 |
-
*
|
126 |
-
* @return string
|
127 |
-
*/
|
128 |
-
public function getMode()
|
129 |
-
{
|
130 |
-
return $this->getChild('toolbar')->getCurrentMode();
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Retrieve API Product
|
135 |
-
*
|
136 |
-
* @return Skybox_Catalog_Model_Api_Product
|
137 |
-
*/
|
138 |
-
protected function _getApi()
|
139 |
-
{
|
140 |
-
if (null === $this->_api) {
|
141 |
-
$this->_api = Mage::getModel('skyboxcatalog/api_product');
|
142 |
-
}
|
143 |
-
return $this->_api;
|
144 |
-
}
|
145 |
-
|
146 |
-
public function getUrlService($product)
|
147 |
-
{
|
148 |
-
|
149 |
-
$type = $product->getTypeId();
|
150 |
-
switch ($type) {
|
151 |
-
case 'simple':
|
152 |
-
$template = $this->_getApi()->getUrl($product->getId(), null, $product->getFinalPrice(), $product->getTypeId());
|
153 |
-
break;
|
154 |
-
case 'configurable':
|
155 |
-
$template = $this->_getApi()->getUrl($product->getId(), null, $product->getFinalPrice(), $product->getTypeId());
|
156 |
-
break;
|
157 |
-
case 'bundle':
|
158 |
-
$template = $this->_getApi()->getUrl($product, null, $product->getFinalPrice(), 'simple');
|
159 |
-
break;
|
160 |
-
}
|
161 |
-
return $template;
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Need use as _prepareLayout - but problem in declaring collection from
|
166 |
-
* another block (was problem with search result)
|
167 |
-
*/
|
168 |
-
protected function _beforeToHtml()
|
169 |
-
{
|
170 |
-
|
171 |
-
/*ini Load all product of catalog*/
|
172 |
-
|
173 |
-
//var_dump($products); exit;
|
174 |
-
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
175 |
-
$sky = $session->getData("skyBox");
|
176 |
-
/*1 step conexion done*/
|
177 |
-
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
178 |
-
$_cartDataURL = "";
|
179 |
-
$_checkout->InitializeBarSkybox();
|
180 |
-
$data = $_checkout->getValueAccessService();
|
181 |
-
|
182 |
-
$skyBoxUrlClient = Mage::helper('skyboxinternational/data')->getSkyBoxUrlAPI();
|
183 |
-
$skyBoxUrlClient = $skyBoxUrlClient . ("multiplecalculate");
|
184 |
-
//var_dump($skyBoxUrlClient); "https://beta.skyboxcheckout.com/testapi/ApiRest/multiplecalculate"
|
185 |
-
$products = $this->_getProductCollection();
|
186 |
-
/*call*/
|
187 |
-
/*Objeto producto catalogo*/
|
188 |
-
foreach($products as $prod) {
|
189 |
-
$product = Mage::getModel('catalog/product')->load($prod->getId());
|
190 |
-
$data['listproducts'][] = $this->getUrlService($product);
|
191 |
-
$dataJson = json_encode($data);
|
192 |
-
}
|
193 |
-
$this->_getApi()->HtmlTemplateButton();
|
194 |
-
$template = $this->_getApi()->getHtmlTemplateButton();
|
195 |
-
|
196 |
-
$start = microtime(true);
|
197 |
-
$resultObjectMultiCurl = $this->file_multi_get_contents_curl($skyBoxUrlClient, $dataJson);
|
198 |
-
|
199 |
-
//var_export($resultObjectMultiCurl);
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Only works to async version start
|
203 |
-
*/
|
204 |
-
/*
|
205 |
-
$time_elapsed_secs = microtime(true) - $start;
|
206 |
-
echo "<div style='position: absolute;
|
207 |
-
background: lightgreen;
|
208 |
-
font-weight: bolder;
|
209 |
-
z-index: 1111;'>Tiempo de respuesta (Multiple): {$time_elapsed_secs}</div>"."<br/>";
|
210 |
-
|
211 |
-
|
212 |
-
$dataMultiCurl = array();
|
213 |
-
$resultObjectMultiCurl = json_decode($resultObjectMultiCurl);
|
214 |
-
$resultObjectMultiCurlArray = json_decode(json_encode($resultObjectMultiCurl), true);
|
215 |
-
|
216 |
-
foreach($resultObjectMultiCurlArray['listCalculateResponse'] as $value) {
|
217 |
-
$dataMultiCurl[$value["HtmlObjectId"]] = $this->getTemplateServicio($value, $template);
|
218 |
-
}
|
219 |
-
|
220 |
-
$dataMultiCurlVal = array();
|
221 |
-
$cont = 0;
|
222 |
-
foreach($products as $key => $prod) {
|
223 |
-
$dataMultiCurlVal[$prod->getId()] = $dataMultiCurl[$cont];
|
224 |
-
$cont++;
|
225 |
-
}
|
226 |
-
$session->setData("skyBox", $dataMultiCurl);
|
227 |
-
*/
|
228 |
-
/**
|
229 |
-
* Only works to async version end
|
230 |
-
*/
|
231 |
-
|
232 |
-
/*end Load all product of catalog*/
|
233 |
-
|
234 |
-
|
235 |
-
$toolbar = $this->getToolbarBlock();
|
236 |
-
|
237 |
-
// called prepare sortable parameters
|
238 |
-
$collection = $this->_getProductCollection();
|
239 |
-
|
240 |
-
// use sortable parameters
|
241 |
-
if ($orders = $this->getAvailableOrders()) {
|
242 |
-
$toolbar->setAvailableOrders($orders);
|
243 |
-
}
|
244 |
-
if ($sort = $this->getSortBy()) {
|
245 |
-
$toolbar->setDefaultOrder($sort);
|
246 |
-
}
|
247 |
-
if ($dir = $this->getDefaultDirection()) {
|
248 |
-
$toolbar->setDefaultDirection($dir);
|
249 |
-
}
|
250 |
-
if ($modes = $this->getModes()) {
|
251 |
-
$toolbar->setModes($modes);
|
252 |
-
}
|
253 |
-
|
254 |
-
// set collection to toolbar and apply sort
|
255 |
-
$toolbar->setCollection($collection);
|
256 |
-
|
257 |
-
$this->setChild('toolbar', $toolbar);
|
258 |
-
Mage::dispatchEvent('catalog_block_product_list_collection', array(
|
259 |
-
'collection' => $this->_getProductCollection()
|
260 |
-
));
|
261 |
-
|
262 |
-
$this->_getProductCollection()->load();
|
263 |
-
|
264 |
-
return parent::_beforeToHtml();
|
265 |
-
}
|
266 |
-
|
267 |
-
public function getTemplateServicio($objectProduct,$template)
|
268 |
-
{
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
/*2step execute get button template*/
|
276 |
-
|
277 |
-
/*var_dump($a->getHtmlTemplateButton());exit;*/
|
278 |
-
|
279 |
-
/*3 step call calculate*/;
|
280 |
-
if (1) {
|
281 |
-
|
282 |
-
/*$objectProduct = json_decode($objectProduct);
|
283 |
-
$objectProduct = json_decode(json_encode($objectProduct), true);*/
|
284 |
-
//var_dump($objectProduct);exit;
|
285 |
-
foreach ($objectProduct as $key => $value) {
|
286 |
-
/*echo "==>".$key."<====";
|
287 |
-
echo "==>".$value."<====";exit;-*/
|
288 |
-
$template = str_replace('{' . $key . '}', $value, $template);
|
289 |
-
}
|
290 |
-
|
291 |
-
// Just for {Block} crap
|
292 |
-
$template = str_replace('{Block}', '', $template);
|
293 |
-
/*echo "<hit>";
|
294 |
-
echo($template); exit;
|
295 |
-
echo "</hit>";*/
|
296 |
-
/*echo $template; exit;*/
|
297 |
-
return $template;
|
298 |
-
}
|
299 |
-
//exit("debug si es que llega");
|
300 |
-
/*var_dump($a); exit;
|
301 |
-
var_dump(Mage::getSingleton('skyboxcore/session')); exit;--*/
|
302 |
-
|
303 |
-
|
304 |
-
}
|
305 |
-
|
306 |
-
function file_multi_get_contents_curl($url, $data)
|
307 |
-
{
|
308 |
-
|
309 |
-
/*var_export($data); exit;*/
|
310 |
-
if (!function_exists("curl_init")) die("cURL extension is not installed");
|
311 |
-
$ch = curl_init();
|
312 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
313 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
314 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
315 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
316 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
317 |
-
$response = curl_exec($ch);
|
318 |
-
|
319 |
-
/*var_export($response); exit;*/
|
320 |
-
// Will dump a beauty json :3
|
321 |
-
//var_dump(json_decode($result, true));
|
322 |
-
return $response;
|
323 |
-
/*
|
324 |
-
$node_count = count($nodes);
|
325 |
-
$curl_arr = array();
|
326 |
-
$master = curl_multi_init();
|
327 |
-
//curl_setopt($master, CURLOPT_SSL_VERIFYPEER, false);
|
328 |
-
// Will return the response, if false it print the response
|
329 |
-
//curl_setopt($master, CURLOPT_RETURNTRANSFER, true);
|
330 |
-
|
331 |
-
for($i = 0; $i < count($nodes); $i++)
|
332 |
-
{
|
333 |
-
$start = microtime(true);
|
334 |
-
$url =$nodes[$i];
|
335 |
-
$curl_arr[$i] = curl_init($url);
|
336 |
-
curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
|
337 |
-
curl_multi_add_handle($master, $curl_arr[$i]);
|
338 |
-
$total_time = round(microtime(true)-$start, 4);
|
339 |
-
echo "Request #".($i+1).": send {$start} ; delay: {$total_time}"."<br/>";
|
340 |
-
}
|
341 |
-
|
342 |
-
$start = microtime(true);
|
343 |
-
do
|
344 |
-
{
|
345 |
-
$startMultiExec = microtime(true);
|
346 |
-
$curl_multi_exec = curl_multi_exec($master,$running);
|
347 |
-
$totalMultiExec = round(microtime(true)-$startMultiExec, 4);
|
348 |
-
//echo "Request MultiExec: send {$startMultiExec} ; delay: {$totalMultiExec}"."<br/>";
|
349 |
-
}
|
350 |
-
while($running > 0);
|
351 |
-
$total_time = round(microtime(true)-$start, 4);
|
352 |
-
echo "Request All: send {$start} ; delay: {$total_time}"."<br/>";
|
353 |
-
|
354 |
-
echo 'results: '."<br/>";
|
355 |
-
$results = array();
|
356 |
-
for($i = 0; $i < $node_count; $i++)
|
357 |
-
{
|
358 |
-
$preresult = curl_multi_getcontent ( $curl_arr[$i] );
|
359 |
-
$results[] = $preresult;
|
360 |
-
echo "<pre>".var_export($results)."</pre>";
|
361 |
-
echo( $i . '\n' . $results . '\n');
|
362 |
-
}
|
363 |
-
echo "<pre>".var_dump($results)."</pre>";
|
364 |
-
|
365 |
-
echo 'done'."<br/>";*/
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Retrieve Toolbar block
|
370 |
-
*
|
371 |
-
* @return Mage_Catalog_Block_Product_List_Toolbar
|
372 |
-
*/
|
373 |
-
public function getToolbarBlock()
|
374 |
-
{
|
375 |
-
if ($blockName = $this->getToolbarBlockName()) {
|
376 |
-
if ($block = $this->getLayout()->getBlock($blockName)) {
|
377 |
-
return $block;
|
378 |
-
}
|
379 |
-
}
|
380 |
-
$block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
|
381 |
-
return $block;
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Retrieve additional blocks html
|
386 |
-
*
|
387 |
-
* @return string
|
388 |
-
*/
|
389 |
-
public function getAdditionalHtml()
|
390 |
-
{
|
391 |
-
return $this->getChildHtml('additional');
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Retrieve list toolbar HTML
|
396 |
-
*
|
397 |
-
* @return string
|
398 |
-
*/
|
399 |
-
public function getToolbarHtml()
|
400 |
-
{
|
401 |
-
return $this->getChildHtml('toolbar');
|
402 |
-
}
|
403 |
-
|
404 |
-
public function setCollection($collection)
|
405 |
-
{
|
406 |
-
$this->_productCollection = $collection;
|
407 |
-
return $this;
|
408 |
-
}
|
409 |
-
|
410 |
-
public function addAttribute($code)
|
411 |
-
{
|
412 |
-
$this->_getProductCollection()->addAttributeToSelect($code);
|
413 |
-
return $this;
|
414 |
-
}
|
415 |
-
|
416 |
-
public function getPriceBlockTemplate()
|
417 |
-
{
|
418 |
-
return $this->_getData('price_block_template');
|
419 |
-
}
|
420 |
-
|
421 |
-
/**
|
422 |
-
* Retrieve Catalog Config object
|
423 |
-
*
|
424 |
-
* @return Mage_Catalog_Model_Config
|
425 |
-
*/
|
426 |
-
protected function _getConfig()
|
427 |
-
{
|
428 |
-
return Mage::getSingleton('catalog/config');
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Prepare Sort By fields from Category Data
|
433 |
-
*
|
434 |
-
* @param Mage_Catalog_Model_Category $category
|
435 |
-
* @return Mage_Catalog_Block_Product_List
|
436 |
-
*/
|
437 |
-
public function prepareSortableFieldsByCategory($category) {
|
438 |
-
if (!$this->getAvailableOrders()) {
|
439 |
-
$this->setAvailableOrders($category->getAvailableSortByOptions());
|
440 |
-
}
|
441 |
-
$availableOrders = $this->getAvailableOrders();
|
442 |
-
if (!$this->getSortBy()) {
|
443 |
-
if ($categorySortBy = $category->getDefaultSortBy()) {
|
444 |
-
if (!$availableOrders) {
|
445 |
-
$availableOrders = $this->_getConfig()->getAttributeUsedForSortByArray();
|
446 |
-
}
|
447 |
-
if (isset($availableOrders[$categorySortBy])) {
|
448 |
-
$this->setSortBy($categorySortBy);
|
449 |
-
}
|
450 |
-
}
|
451 |
-
}
|
452 |
-
|
453 |
-
return $this;
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* Retrieve block cache tags based on product collection
|
458 |
-
*
|
459 |
-
* @return array
|
460 |
-
*/
|
461 |
-
public function getCacheTags()
|
462 |
-
{
|
463 |
-
return array_merge(
|
464 |
-
parent::getCacheTags(),
|
465 |
-
$this->getItemsTags($this->_getProductCollection())
|
466 |
-
);
|
467 |
-
}
|
468 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Catalog
|
23 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Product list
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Catalog
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Skybox_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Default toolbar block name
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Product Collection
|
46 |
+
*
|
47 |
+
* @var Mage_Eav_Model_Entity_Collection_Abstract
|
48 |
+
*/
|
49 |
+
protected $_productCollection;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Retrieve loaded category collection
|
53 |
+
*
|
54 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
55 |
+
*/
|
56 |
+
protected function _getProductCollection()
|
57 |
+
{
|
58 |
+
if (is_null($this->_productCollection)) {
|
59 |
+
$layer = $this->getLayer();
|
60 |
+
/* @var $layer Mage_Catalog_Model_Layer */
|
61 |
+
if ($this->getShowRootCategory()) {
|
62 |
+
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
|
63 |
+
}
|
64 |
+
|
65 |
+
// if this is a product view page
|
66 |
+
if (Mage::registry('product')) {
|
67 |
+
// get collection of categories this product is associated with
|
68 |
+
$categories = Mage::registry('product')->getCategoryCollection()
|
69 |
+
->setPage(1, 1)
|
70 |
+
->load();
|
71 |
+
// if the product is associated with any category
|
72 |
+
if ($categories->count()) {
|
73 |
+
// show products from this category
|
74 |
+
$this->setCategoryId(current($categories->getIterator()));
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
$origCategory = null;
|
79 |
+
if ($this->getCategoryId()) {
|
80 |
+
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
|
81 |
+
if ($category->getId()) {
|
82 |
+
$origCategory = $layer->getCurrentCategory();
|
83 |
+
$layer->setCurrentCategory($category);
|
84 |
+
$this->addModelTags($category);
|
85 |
+
}
|
86 |
+
}
|
87 |
+
$this->_productCollection = $layer->getProductCollection();
|
88 |
+
|
89 |
+
$this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
|
90 |
+
|
91 |
+
if ($origCategory) {
|
92 |
+
$layer->setCurrentCategory($origCategory);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
return $this->_productCollection;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get catalog layer model
|
101 |
+
*
|
102 |
+
* @return Mage_Catalog_Model_Layer
|
103 |
+
*/
|
104 |
+
public function getLayer()
|
105 |
+
{
|
106 |
+
$layer = Mage::registry('current_layer');
|
107 |
+
if ($layer) {
|
108 |
+
return $layer;
|
109 |
+
}
|
110 |
+
return Mage::getSingleton('catalog/layer');
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Retrieve loaded category collection
|
115 |
+
*
|
116 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
117 |
+
*/
|
118 |
+
public function getLoadedProductCollection()
|
119 |
+
{
|
120 |
+
return $this->_getProductCollection();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Retrieve current view mode
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*/
|
128 |
+
public function getMode()
|
129 |
+
{
|
130 |
+
return $this->getChild('toolbar')->getCurrentMode();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Retrieve API Product
|
135 |
+
*
|
136 |
+
* @return Skybox_Catalog_Model_Api_Product
|
137 |
+
*/
|
138 |
+
protected function _getApi()
|
139 |
+
{
|
140 |
+
if (null === $this->_api) {
|
141 |
+
$this->_api = Mage::getModel('skyboxcatalog/api_product');
|
142 |
+
}
|
143 |
+
return $this->_api;
|
144 |
+
}
|
145 |
+
|
146 |
+
public function getUrlService($product)
|
147 |
+
{
|
148 |
+
|
149 |
+
$type = $product->getTypeId();
|
150 |
+
switch ($type) {
|
151 |
+
case 'simple':
|
152 |
+
$template = $this->_getApi()->getUrl($product->getId(), null, $product->getFinalPrice(), $product->getTypeId());
|
153 |
+
break;
|
154 |
+
case 'configurable':
|
155 |
+
$template = $this->_getApi()->getUrl($product->getId(), null, $product->getFinalPrice(), $product->getTypeId());
|
156 |
+
break;
|
157 |
+
case 'bundle':
|
158 |
+
$template = $this->_getApi()->getUrl($product, null, $product->getFinalPrice(), 'simple');
|
159 |
+
break;
|
160 |
+
}
|
161 |
+
return $template;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Need use as _prepareLayout - but problem in declaring collection from
|
166 |
+
* another block (was problem with search result)
|
167 |
+
*/
|
168 |
+
protected function _beforeToHtml()
|
169 |
+
{
|
170 |
+
|
171 |
+
/*ini Load all product of catalog*/
|
172 |
+
|
173 |
+
//var_dump($products); exit;
|
174 |
+
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
175 |
+
$sky = $session->getData("skyBox");
|
176 |
+
/*1 step conexion done*/
|
177 |
+
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
178 |
+
$_cartDataURL = "";
|
179 |
+
$_checkout->InitializeBarSkybox();
|
180 |
+
$data = $_checkout->getValueAccessService();
|
181 |
+
|
182 |
+
$skyBoxUrlClient = Mage::helper('skyboxinternational/data')->getSkyBoxUrlAPI();
|
183 |
+
$skyBoxUrlClient = $skyBoxUrlClient . ("multiplecalculate");
|
184 |
+
//var_dump($skyBoxUrlClient); "https://beta.skyboxcheckout.com/testapi/ApiRest/multiplecalculate"
|
185 |
+
$products = $this->_getProductCollection();
|
186 |
+
/*call*/
|
187 |
+
/*Objeto producto catalogo*/
|
188 |
+
foreach($products as $prod) {
|
189 |
+
$product = Mage::getModel('catalog/product')->load($prod->getId());
|
190 |
+
$data['listproducts'][] = $this->getUrlService($product);
|
191 |
+
$dataJson = json_encode($data);
|
192 |
+
}
|
193 |
+
$this->_getApi()->HtmlTemplateButton();
|
194 |
+
$template = $this->_getApi()->getHtmlTemplateButton();
|
195 |
+
|
196 |
+
$start = microtime(true);
|
197 |
+
$resultObjectMultiCurl = $this->file_multi_get_contents_curl($skyBoxUrlClient, $dataJson);
|
198 |
+
|
199 |
+
//var_export($resultObjectMultiCurl);
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Only works to async version start
|
203 |
+
*/
|
204 |
+
/*
|
205 |
+
$time_elapsed_secs = microtime(true) - $start;
|
206 |
+
echo "<div style='position: absolute;
|
207 |
+
background: lightgreen;
|
208 |
+
font-weight: bolder;
|
209 |
+
z-index: 1111;'>Tiempo de respuesta (Multiple): {$time_elapsed_secs}</div>"."<br/>";
|
210 |
+
|
211 |
+
|
212 |
+
$dataMultiCurl = array();
|
213 |
+
$resultObjectMultiCurl = json_decode($resultObjectMultiCurl);
|
214 |
+
$resultObjectMultiCurlArray = json_decode(json_encode($resultObjectMultiCurl), true);
|
215 |
+
|
216 |
+
foreach($resultObjectMultiCurlArray['listCalculateResponse'] as $value) {
|
217 |
+
$dataMultiCurl[$value["HtmlObjectId"]] = $this->getTemplateServicio($value, $template);
|
218 |
+
}
|
219 |
+
|
220 |
+
$dataMultiCurlVal = array();
|
221 |
+
$cont = 0;
|
222 |
+
foreach($products as $key => $prod) {
|
223 |
+
$dataMultiCurlVal[$prod->getId()] = $dataMultiCurl[$cont];
|
224 |
+
$cont++;
|
225 |
+
}
|
226 |
+
$session->setData("skyBox", $dataMultiCurl);
|
227 |
+
*/
|
228 |
+
/**
|
229 |
+
* Only works to async version end
|
230 |
+
*/
|
231 |
+
|
232 |
+
/*end Load all product of catalog*/
|
233 |
+
|
234 |
+
|
235 |
+
$toolbar = $this->getToolbarBlock();
|
236 |
+
|
237 |
+
// called prepare sortable parameters
|
238 |
+
$collection = $this->_getProductCollection();
|
239 |
+
|
240 |
+
// use sortable parameters
|
241 |
+
if ($orders = $this->getAvailableOrders()) {
|
242 |
+
$toolbar->setAvailableOrders($orders);
|
243 |
+
}
|
244 |
+
if ($sort = $this->getSortBy()) {
|
245 |
+
$toolbar->setDefaultOrder($sort);
|
246 |
+
}
|
247 |
+
if ($dir = $this->getDefaultDirection()) {
|
248 |
+
$toolbar->setDefaultDirection($dir);
|
249 |
+
}
|
250 |
+
if ($modes = $this->getModes()) {
|
251 |
+
$toolbar->setModes($modes);
|
252 |
+
}
|
253 |
+
|
254 |
+
// set collection to toolbar and apply sort
|
255 |
+
$toolbar->setCollection($collection);
|
256 |
+
|
257 |
+
$this->setChild('toolbar', $toolbar);
|
258 |
+
Mage::dispatchEvent('catalog_block_product_list_collection', array(
|
259 |
+
'collection' => $this->_getProductCollection()
|
260 |
+
));
|
261 |
+
|
262 |
+
$this->_getProductCollection()->load();
|
263 |
+
|
264 |
+
return parent::_beforeToHtml();
|
265 |
+
}
|
266 |
+
|
267 |
+
public function getTemplateServicio($objectProduct,$template)
|
268 |
+
{
|
269 |
+
|
270 |
+
|
271 |
+
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
/*2step execute get button template*/
|
276 |
+
|
277 |
+
/*var_dump($a->getHtmlTemplateButton());exit;*/
|
278 |
+
|
279 |
+
/*3 step call calculate*/;
|
280 |
+
if (1) {
|
281 |
+
|
282 |
+
/*$objectProduct = json_decode($objectProduct);
|
283 |
+
$objectProduct = json_decode(json_encode($objectProduct), true);*/
|
284 |
+
//var_dump($objectProduct);exit;
|
285 |
+
foreach ($objectProduct as $key => $value) {
|
286 |
+
/*echo "==>".$key."<====";
|
287 |
+
echo "==>".$value."<====";exit;-*/
|
288 |
+
$template = str_replace('{' . $key . '}', $value, $template);
|
289 |
+
}
|
290 |
+
|
291 |
+
// Just for {Block} crap
|
292 |
+
$template = str_replace('{Block}', '', $template);
|
293 |
+
/*echo "<hit>";
|
294 |
+
echo($template); exit;
|
295 |
+
echo "</hit>";*/
|
296 |
+
/*echo $template; exit;*/
|
297 |
+
return $template;
|
298 |
+
}
|
299 |
+
//exit("debug si es que llega");
|
300 |
+
/*var_dump($a); exit;
|
301 |
+
var_dump(Mage::getSingleton('skyboxcore/session')); exit;--*/
|
302 |
+
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
+
function file_multi_get_contents_curl($url, $data)
|
307 |
+
{
|
308 |
+
|
309 |
+
/*var_export($data); exit;*/
|
310 |
+
if (!function_exists("curl_init")) die("cURL extension is not installed");
|
311 |
+
$ch = curl_init();
|
312 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
313 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
314 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
315 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
316 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
317 |
+
$response = curl_exec($ch);
|
318 |
+
|
319 |
+
/*var_export($response); exit;*/
|
320 |
+
// Will dump a beauty json :3
|
321 |
+
//var_dump(json_decode($result, true));
|
322 |
+
return $response;
|
323 |
+
/*
|
324 |
+
$node_count = count($nodes);
|
325 |
+
$curl_arr = array();
|
326 |
+
$master = curl_multi_init();
|
327 |
+
//curl_setopt($master, CURLOPT_SSL_VERIFYPEER, false);
|
328 |
+
// Will return the response, if false it print the response
|
329 |
+
//curl_setopt($master, CURLOPT_RETURNTRANSFER, true);
|
330 |
+
|
331 |
+
for($i = 0; $i < count($nodes); $i++)
|
332 |
+
{
|
333 |
+
$start = microtime(true);
|
334 |
+
$url =$nodes[$i];
|
335 |
+
$curl_arr[$i] = curl_init($url);
|
336 |
+
curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
|
337 |
+
curl_multi_add_handle($master, $curl_arr[$i]);
|
338 |
+
$total_time = round(microtime(true)-$start, 4);
|
339 |
+
echo "Request #".($i+1).": send {$start} ; delay: {$total_time}"."<br/>";
|
340 |
+
}
|
341 |
+
|
342 |
+
$start = microtime(true);
|
343 |
+
do
|
344 |
+
{
|
345 |
+
$startMultiExec = microtime(true);
|
346 |
+
$curl_multi_exec = curl_multi_exec($master,$running);
|
347 |
+
$totalMultiExec = round(microtime(true)-$startMultiExec, 4);
|
348 |
+
//echo "Request MultiExec: send {$startMultiExec} ; delay: {$totalMultiExec}"."<br/>";
|
349 |
+
}
|
350 |
+
while($running > 0);
|
351 |
+
$total_time = round(microtime(true)-$start, 4);
|
352 |
+
echo "Request All: send {$start} ; delay: {$total_time}"."<br/>";
|
353 |
+
|
354 |
+
echo 'results: '."<br/>";
|
355 |
+
$results = array();
|
356 |
+
for($i = 0; $i < $node_count; $i++)
|
357 |
+
{
|
358 |
+
$preresult = curl_multi_getcontent ( $curl_arr[$i] );
|
359 |
+
$results[] = $preresult;
|
360 |
+
echo "<pre>".var_export($results)."</pre>";
|
361 |
+
echo( $i . '\n' . $results . '\n');
|
362 |
+
}
|
363 |
+
echo "<pre>".var_dump($results)."</pre>";
|
364 |
+
|
365 |
+
echo 'done'."<br/>";*/
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Retrieve Toolbar block
|
370 |
+
*
|
371 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
372 |
+
*/
|
373 |
+
public function getToolbarBlock()
|
374 |
+
{
|
375 |
+
if ($blockName = $this->getToolbarBlockName()) {
|
376 |
+
if ($block = $this->getLayout()->getBlock($blockName)) {
|
377 |
+
return $block;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
$block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
|
381 |
+
return $block;
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Retrieve additional blocks html
|
386 |
+
*
|
387 |
+
* @return string
|
388 |
+
*/
|
389 |
+
public function getAdditionalHtml()
|
390 |
+
{
|
391 |
+
return $this->getChildHtml('additional');
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Retrieve list toolbar HTML
|
396 |
+
*
|
397 |
+
* @return string
|
398 |
+
*/
|
399 |
+
public function getToolbarHtml()
|
400 |
+
{
|
401 |
+
return $this->getChildHtml('toolbar');
|
402 |
+
}
|
403 |
+
|
404 |
+
public function setCollection($collection)
|
405 |
+
{
|
406 |
+
$this->_productCollection = $collection;
|
407 |
+
return $this;
|
408 |
+
}
|
409 |
+
|
410 |
+
public function addAttribute($code)
|
411 |
+
{
|
412 |
+
$this->_getProductCollection()->addAttributeToSelect($code);
|
413 |
+
return $this;
|
414 |
+
}
|
415 |
+
|
416 |
+
public function getPriceBlockTemplate()
|
417 |
+
{
|
418 |
+
return $this->_getData('price_block_template');
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Retrieve Catalog Config object
|
423 |
+
*
|
424 |
+
* @return Mage_Catalog_Model_Config
|
425 |
+
*/
|
426 |
+
protected function _getConfig()
|
427 |
+
{
|
428 |
+
return Mage::getSingleton('catalog/config');
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Prepare Sort By fields from Category Data
|
433 |
+
*
|
434 |
+
* @param Mage_Catalog_Model_Category $category
|
435 |
+
* @return Mage_Catalog_Block_Product_List
|
436 |
+
*/
|
437 |
+
public function prepareSortableFieldsByCategory($category) {
|
438 |
+
if (!$this->getAvailableOrders()) {
|
439 |
+
$this->setAvailableOrders($category->getAvailableSortByOptions());
|
440 |
+
}
|
441 |
+
$availableOrders = $this->getAvailableOrders();
|
442 |
+
if (!$this->getSortBy()) {
|
443 |
+
if ($categorySortBy = $category->getDefaultSortBy()) {
|
444 |
+
if (!$availableOrders) {
|
445 |
+
$availableOrders = $this->_getConfig()->getAttributeUsedForSortByArray();
|
446 |
+
}
|
447 |
+
if (isset($availableOrders[$categorySortBy])) {
|
448 |
+
$this->setSortBy($categorySortBy);
|
449 |
+
}
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
return $this;
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Retrieve block cache tags based on product collection
|
458 |
+
*
|
459 |
+
* @return array
|
460 |
+
*/
|
461 |
+
public function getCacheTags()
|
462 |
+
{
|
463 |
+
return array_merge(
|
464 |
+
parent::getCacheTags(),
|
465 |
+
$this->getItemsTags($this->_getProductCollection())
|
466 |
+
);
|
467 |
+
}
|
468 |
+
}
|
app/code/community/Skybox/Catalog/Block/Product/Price.php
CHANGED
@@ -1,221 +1,242 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox Checkout
|
4 |
-
*
|
5 |
-
* @category Mage
|
6 |
-
* @package Skybox_Catalog
|
7 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
*
|
12 |
-
* Product
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
public
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
*
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
*
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
*
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
//
|
150 |
-
|
151 |
-
//
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
. '<div
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
. '
|
207 |
-
.
|
208 |
-
.
|
209 |
-
.
|
210 |
-
. '">'
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
. '<div
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox Checkout
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Skybox_Catalog
|
7 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
*
|
12 |
+
* Product Price Block
|
13 |
+
*/
|
14 |
+
class Skybox_Catalog_Block_Product_Price extends Mage_Catalog_Block_Product_Price
|
15 |
+
{
|
16 |
+
/*
|
17 |
+
* @var string $_cache_code
|
18 |
+
*/
|
19 |
+
public $_cache_code = null;
|
20 |
+
|
21 |
+
public function getCacheCode()
|
22 |
+
{
|
23 |
+
Mage::log("cache ", null, 'orden.log', true);
|
24 |
+
if ($this->_cache_code == null) {
|
25 |
+
/* @var $config Skybox_Core_Model_Config */
|
26 |
+
$config = Mage::getModel("skyboxcore/config");
|
27 |
+
$skyboxUser = $config->getSession()->getSkyboxUser();
|
28 |
+
$cache_code = $skyboxUser->CartCountryISOCode . $skyboxUser->CartCityId . $skyboxUser->CartCurrencyISOCode;
|
29 |
+
$this->_cache_code = $cache_code;
|
30 |
+
}
|
31 |
+
Mage::log("[product/price] Cache Code: " . $cache_code, null, 'cache.log', true);
|
32 |
+
return $this->_cache_code;
|
33 |
+
}
|
34 |
+
|
35 |
+
/*
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
//parent::__construct();
|
39 |
+
$this->addData(array(
|
40 |
+
'cache_lifetime' => 120 //seconds
|
41 |
+
));
|
42 |
+
}
|
43 |
+
*/
|
44 |
+
|
45 |
+
public function getCacheKey()
|
46 |
+
{
|
47 |
+
$cache_key = "PRODUCT_" . $this->getProduct()->getId() . "_" . $this->getCacheCode();
|
48 |
+
return $cache_key;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function getCacheTags()
|
52 |
+
{
|
53 |
+
$cache_tag = $this->getProduct()->getId() . "_" . $this->getCacheCode();
|
54 |
+
return array(Mage_Catalog_Model_Product::CACHE_TAG . $cache_tag);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Retrieve API Product
|
59 |
+
*
|
60 |
+
* @return Skybox_Catalog_Model_Api_Product
|
61 |
+
*/
|
62 |
+
protected function _getApi()
|
63 |
+
{
|
64 |
+
if (null === $this->_api) {
|
65 |
+
$this->_api = Mage::getModel('skyboxcatalog/api_product');
|
66 |
+
}
|
67 |
+
return $this->_api;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Render block HTML
|
72 |
+
*
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function _toHtml()
|
76 |
+
{
|
77 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
78 |
+
|
79 |
+
if (!$activation) {
|
80 |
+
return '';
|
81 |
+
}
|
82 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
83 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
84 |
+
//Mage::log(print_r('product\Price::_toHtml', true), null, 'tracer.log', true);
|
85 |
+
if ($this->_getApi()->getLocationAllow() && ($typeIntegration != 3)) {
|
86 |
+
if ($this->_getApi()->getErrorAuthenticate() && !$this->_getApi()->getLocationAllow() && $this->_getApi()->HasError()) {
|
87 |
+
return '';
|
88 |
+
} elseif ($this->_getApi()->HasError()) {
|
89 |
+
//$error_code = $this->_getApi()->getStatusCode();
|
90 |
+
$message = $this->_getApi()->getStatusMessage();
|
91 |
+
|
92 |
+
if ($this->_getApi()->_getApi()->ErrorRatesNotFound()) {
|
93 |
+
$message = $this->_getApi()->_getApi()->getErrorRatesNotFoundMessage($this->getLanguageId());
|
94 |
+
return '<div style="color:#FF0000;">' . $message . '</div>';
|
95 |
+
}
|
96 |
+
|
97 |
+
// return '<div style="color:#FF0000;">' . $message . '</div>';
|
98 |
+
return '';
|
99 |
+
}
|
100 |
+
|
101 |
+
/* @var $product Mage_Catalog_Model_Product */
|
102 |
+
$product = $this->getProduct();
|
103 |
+
$type = $product->getTypeId();
|
104 |
+
$route_name = Mage::app()->getRequest()->getRouteName();
|
105 |
+
|
106 |
+
// Mage::log(print_r('$route_name: '. $route_name, true), null, 'tracer.log', true);
|
107 |
+
|
108 |
+
// Simple Product
|
109 |
+
if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $this->getTemplate() == 'catalog/product/price.phtml') {
|
110 |
+
return $this->calculatePrice($product);
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $this->getTemplate() == 'catalog/product/view/price_clone.phtml') {
|
115 |
+
return '';
|
116 |
+
}
|
117 |
+
|
118 |
+
// Configurable Product
|
119 |
+
if ($type == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && $this->getTemplate() == 'catalog/product/price.phtml') {
|
120 |
+
/*if ($route_name == 'catalog') {
|
121 |
+
return '';
|
122 |
+
}*/
|
123 |
+
|
124 |
+
if (Mage::registry('current_product')) {
|
125 |
+
return "";
|
126 |
+
}
|
127 |
+
|
128 |
+
return $this->calculatePrice($product);
|
129 |
+
}
|
130 |
+
|
131 |
+
if ($type == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && $this->getTemplate() == 'catalog/product/view/tierprices.phtml') {
|
132 |
+
if ($route_name == 'catalog') {
|
133 |
+
return $this->calculatePrice($product);
|
134 |
+
}
|
135 |
+
return '';
|
136 |
+
}
|
137 |
+
}
|
138 |
+
return parent::_toHtml();
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Calculate Price HTML output
|
143 |
+
*
|
144 |
+
* @param Mage_Catalog_Model_Product $product
|
145 |
+
* @return string
|
146 |
+
*/
|
147 |
+
protected function calculatePrice($product)
|
148 |
+
{
|
149 |
+
//Mage::log('Entro calcular producto', null, 'tracer.log', true);
|
150 |
+
$stockItem = $product->getStockItem();
|
151 |
+
// if (!$stockItem->getIsInStock()) {
|
152 |
+
// Mage::log('sin stock', null, 'tracer.log', true);
|
153 |
+
// return ''; // Out of Stock
|
154 |
+
// }
|
155 |
+
|
156 |
+
$type = $product->getTypeId();
|
157 |
+
//Mage::log(print_r('product\Price: '.$type, true), null, 'tracer.log', true);
|
158 |
+
|
159 |
+
if (Mage::registry('current_category') and (!(Mage::registry('current_product')))) {
|
160 |
+
/**
|
161 |
+
* Apply multiple calculate start
|
162 |
+
* When: is different to product detail and you are on catalog category
|
163 |
+
*/
|
164 |
+
$template = '<div class="skybox-price-set" product-id="' . $product->getId() . '" id="product-' . $product->getId() . '"></div>';
|
165 |
+
/*
|
166 |
+
if($product->getTypeId() == "simple"){
|
167 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
|
168 |
+
if(!$parentIds)
|
169 |
+
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
170 |
+
if(isset($parentIds[0])){
|
171 |
+
$parent = Mage::getModel('catalog/product')->load($parentIds[0]);
|
172 |
+
// do stuff here
|
173 |
+
}
|
174 |
+
}*/
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Apply multiple calculate end
|
178 |
+
*/
|
179 |
+
} else {
|
180 |
+
switch ($type) {
|
181 |
+
case 'simple':
|
182 |
+
$template = $this->_getApi()->CalculatePrice($product->getId(), null, $product->getFinalPrice(),
|
183 |
+
$product->getTypeId())
|
184 |
+
->GetTemplateProduct();
|
185 |
+
break;
|
186 |
+
case 'configurable':
|
187 |
+
$template = $this->_getApi()->CalculatePrice($product->getId(), null, $product->getFinalPrice(),
|
188 |
+
$product->getTypeId())
|
189 |
+
->GetTemplateProduct();
|
190 |
+
break;
|
191 |
+
case 'bundle':
|
192 |
+
$template = $this->_getApi()->CalculatePrice($product, null, $product->getFinalPrice(), 'simple')
|
193 |
+
->GetTemplateProduct();
|
194 |
+
break;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
// Mage::log(print_r('##Product template##', true), null, 'tracer.log', true);
|
199 |
+
// Mage::log(print_r($template, true), null, 'tracer.log', true);
|
200 |
+
/*
|
201 |
+
$extraHtml = ''
|
202 |
+
. '<div class="price-box">'
|
203 |
+
. '<p class="label" id="skybox-configurable-price-from-'
|
204 |
+
. $product->getId()
|
205 |
+
. $this->getIdSuffix()
|
206 |
+
. '">'
|
207 |
+
. $template
|
208 |
+
. '</p>'
|
209 |
+
. '</div>'
|
210 |
+
. '<div style="clear:both"></div>';
|
211 |
+
|
212 |
+
*/
|
213 |
+
$extraHtml = ''
|
214 |
+
. '<div class="price-box">'
|
215 |
+
. '<p class="label" id="skybox-configurable-price-from-'
|
216 |
+
. $product->getId()
|
217 |
+
. $this->getIdSuffix()
|
218 |
+
. '">'
|
219 |
+
. $template
|
220 |
+
. '</p>'
|
221 |
+
. '</div>'
|
222 |
+
. '<div style="clear:both"></div>';
|
223 |
+
//$priceHtml = parent::_toHtml();
|
224 |
+
#manually insert extra html needed by the extension into the normal price html
|
225 |
+
|
226 |
+
//substr_replace($priceHtml, $extraHtml, strpos($priceHtml, $htmlToInsertAfter)+strlen($htmlToInsertAfter),0);
|
227 |
+
return $extraHtml;
|
228 |
+
}
|
229 |
+
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Return the Language Id
|
233 |
+
* @return int
|
234 |
+
*/
|
235 |
+
private function getLanguageId()
|
236 |
+
{
|
237 |
+
$_config = Mage::getModel('skyboxcore/config');
|
238 |
+
$cart = $_config->getSession()->getCartSkybox();
|
239 |
+
$id = $cart->{'LanguageId'};
|
240 |
+
return intval($id);
|
241 |
+
}
|
242 |
+
}
|
app/code/community/Skybox/Catalog/Block/Product/Widget/New.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox Checkout
|
4 |
-
*
|
5 |
-
* @category Skybox
|
6 |
-
* @package Skybox_Catalog
|
7 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* New products widget
|
12 |
-
*
|
13 |
-
* @category Skybox
|
14 |
-
* @package Skybox_Catalog
|
15 |
-
*/
|
16 |
-
class Skybox_Catalog_Block_Product_Widget_New extends Mage_Catalog_Block_Product_Widget_New
|
17 |
-
{
|
18 |
-
|
19 |
-
/*
|
20 |
-
* @var string $_cache_code
|
21 |
-
*/
|
22 |
-
public $_cache_code = null;
|
23 |
-
|
24 |
-
public function getCacheCode()
|
25 |
-
{
|
26 |
-
if ($this->_cache_code == null) {
|
27 |
-
/* @var $config Skybox_Core_Model_Config */
|
28 |
-
$config = Mage::getModel("skyboxcore/config");
|
29 |
-
$skyboxUser = $config->getSession()->getSkyboxUser();
|
30 |
-
$cache_code = $skyboxUser->CartCountryISOCode . $skyboxUser->CartCityId . $skyboxUser->CartCurrencyISOCode;
|
31 |
-
$this->_cache_code = $cache_code;
|
32 |
-
}
|
33 |
-
Mage::log("[widget/new] Cache Code: " . $cache_code, null, 'cache.log', true);
|
34 |
-
return $this->_cache_code;
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Initialize block's cache and template settings
|
39 |
-
*/
|
40 |
-
protected function _construct()
|
41 |
-
{
|
42 |
-
parent::_construct();
|
43 |
-
$cache_key = Mage_Catalog_Model_Product::CACHE_TAG . "_" . $this->getCacheCode();
|
44 |
-
$this->setAttribute("cache_key", $cache_key);
|
45 |
-
if (Mage::getVersion() == '1.9.1'){
|
46 |
-
$this->addData(array('cache_lifetime' => null)); // Skip cache generation
|
47 |
-
}
|
48 |
-
}
|
49 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox Checkout
|
4 |
+
*
|
5 |
+
* @category Skybox
|
6 |
+
* @package Skybox_Catalog
|
7 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* New products widget
|
12 |
+
*
|
13 |
+
* @category Skybox
|
14 |
+
* @package Skybox_Catalog
|
15 |
+
*/
|
16 |
+
class Skybox_Catalog_Block_Product_Widget_New extends Mage_Catalog_Block_Product_Widget_New
|
17 |
+
{
|
18 |
+
|
19 |
+
/*
|
20 |
+
* @var string $_cache_code
|
21 |
+
*/
|
22 |
+
public $_cache_code = null;
|
23 |
+
|
24 |
+
public function getCacheCode()
|
25 |
+
{
|
26 |
+
if ($this->_cache_code == null) {
|
27 |
+
/* @var $config Skybox_Core_Model_Config */
|
28 |
+
$config = Mage::getModel("skyboxcore/config");
|
29 |
+
$skyboxUser = $config->getSession()->getSkyboxUser();
|
30 |
+
$cache_code = $skyboxUser->CartCountryISOCode . $skyboxUser->CartCityId . $skyboxUser->CartCurrencyISOCode;
|
31 |
+
$this->_cache_code = $cache_code;
|
32 |
+
}
|
33 |
+
Mage::log("[widget/new] Cache Code: " . $cache_code, null, 'cache.log', true);
|
34 |
+
return $this->_cache_code;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Initialize block's cache and template settings
|
39 |
+
*/
|
40 |
+
protected function _construct()
|
41 |
+
{
|
42 |
+
parent::_construct();
|
43 |
+
$cache_key = Mage_Catalog_Model_Product::CACHE_TAG . "_" . $this->getCacheCode();
|
44 |
+
$this->setAttribute("cache_key", $cache_key);
|
45 |
+
if (Mage::getVersion() == '1.9.1'){
|
46 |
+
$this->addData(array('cache_lifetime' => null)); // Skip cache generation
|
47 |
+
}
|
48 |
+
}
|
49 |
}
|
app/code/community/Skybox/Catalog/Model/Api/Product.php
CHANGED
@@ -1,889 +1,937 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Catalog
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Catalog
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
11 |
-
{
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Model instance
|
15 |
-
* @var Skybox_Core_Model_Config
|
16 |
-
*/
|
17 |
-
/*protected $_config = null;
|
18 |
-
|
19 |
-
protected $_typeConfig = "skyboxcore/config";
|
20 |
-
|
21 |
-
protected function getConfig()
|
22 |
-
{
|
23 |
-
if(null === $this->_config)
|
24 |
-
$this->_config = Mage::getModel($this->_typeConfig);
|
25 |
-
}*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Model instance
|
29 |
-
* @var Mage_Core_Catalog_Model_Product
|
30 |
-
*/
|
31 |
-
protected $_product = null;
|
32 |
-
|
33 |
-
protected $_productResult = null;
|
34 |
-
|
35 |
-
protected $_typeProduct = "catalog/product";
|
36 |
-
|
37 |
-
protected $_product_id = null;
|
38 |
-
protected $_product_data = null;
|
39 |
-
|
40 |
-
public function getProductId()
|
41 |
-
{
|
42 |
-
if ($this->_product_id != null) {
|
43 |
-
return $this->_product_id;
|
44 |
-
}
|
45 |
-
return null;
|
46 |
-
}
|
47 |
-
|
48 |
-
public function getProductData()
|
49 |
-
{
|
50 |
-
if ($this->_product_data != null) {
|
51 |
-
return $this->_product_data;
|
52 |
-
}
|
53 |
-
return null;
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Calculate Price
|
59 |
-
*
|
60 |
-
* @param int|Mage_Catalog_Model_Product $product
|
61 |
-
* @param Varien_Object $request
|
62 |
-
* @param float $finalPrice
|
63 |
-
* @param string $type
|
64 |
-
* @param int $objectId
|
65 |
-
* @return Mage_Checkout_Model_Cart
|
66 |
-
*/
|
67 |
-
public function CalculatePrice($product, $request, $finalPrice = null, $type = null, $objectId = 1)
|
68 |
-
{
|
69 |
-
Mage::log("ApiProductCatalog ", null, 'orden.log', true);
|
70 |
-
|
71 |
-
//Mage::log(print_r('Product', true), null, 'tracer.log', true);
|
72 |
-
|
73 |
-
//if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
74 |
-
if (!$this->getLocationAllow()) {
|
75 |
-
return $this;
|
76 |
-
}
|
77 |
-
|
78 |
-
if (!is_object($product)) {
|
79 |
-
$storeId = Mage::app()->getStore()->getStoreId();
|
80 |
-
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($product);
|
81 |
-
}
|
82 |
-
|
83 |
-
$productId = $product->getId();
|
84 |
-
$_data = null;
|
85 |
-
|
86 |
-
if ($type == null) {
|
87 |
-
$type = $product->getTypeId();
|
88 |
-
}
|
89 |
-
|
90 |
-
$defaultSwitch = false;
|
91 |
-
switch ($type) {
|
92 |
-
case 'simple':
|
93 |
-
$finalPrice = isset($finalPrice) ? $finalPrice : $product->getFinalPrice();
|
94 |
-
$category_id = $product->getSkyboxCategoryId();
|
95 |
-
$category_id = isset($category_id) ? $
|
96 |
-
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
97 |
-
|
98 |
-
$_data = array(
|
99 |
-
'object_id' => 1,
|
100 |
-
'name' => $product->getName(),
|
101 |
-
'sku' => $product->getSku(),
|
102 |
-
'category_id' => $category_id,
|
103 |
-
'final_price' => $finalPrice,
|
104 |
-
'weight' => ($product->getWeight()) ? $product->getWeight() : 1,
|
105 |
-
'image_url' => $product->getImageUrl(),
|
106 |
-
'typeProduct' => $type,
|
107 |
-
'VolWeight' => $volWeight,
|
108 |
-
'merchantproductid' => $productId
|
109 |
-
);
|
110 |
-
// $this->_calculatePrice($_data);
|
111 |
-
break;
|
112 |
-
|
113 |
-
case 'configurable':
|
114 |
-
|
115 |
-
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
116 |
-
$weight = $product->getTypeInstance(true)->getWeight($product);
|
117 |
-
$sku = $product->getSku();
|
118 |
-
|
119 |
-
Mage::log("CalculatePrice configurable : " . $finalPrice, null, 'skyboxcheckout.log', false);
|
120 |
-
|
121 |
-
if ($request) {
|
122 |
-
$childProduct = Mage::getModel('catalog/product_type_configurable')
|
123 |
-
->getProductByAttributes($request->getData('super_attribute'), $product);
|
124 |
-
|
125 |
-
$productId = $childProduct->getId();
|
126 |
-
$sku = $childProduct->getSku();
|
127 |
-
|
128 |
-
}
|
129 |
-
|
130 |
-
$parentItem = null;
|
131 |
-
|
132 |
-
if (isset($request) && !$finalPrice) {
|
133 |
-
Mage::log("CalculatePrice candidate INI", null, 'skyboxcheckout.log', false);
|
134 |
-
$_finalPrice = 0;
|
135 |
-
|
136 |
-
$cartCandidates = $product->getTypeInstance(true)
|
137 |
-
->prepareForCartAdvanced($request, $product, 'full');
|
138 |
-
|
139 |
-
foreach ($cartCandidates as $candidate) {
|
140 |
-
// Child items can be sticked together only within their parent
|
141 |
-
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
142 |
-
$candidate->setStickWithinParent($stickWithinParent);
|
143 |
-
|
144 |
-
$candidate_getFinalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(),
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
$
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
$
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
'
|
190 |
-
'
|
191 |
-
'
|
192 |
-
'
|
193 |
-
'
|
194 |
-
'
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
$
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
$
|
239 |
-
}
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
'
|
256 |
-
'
|
257 |
-
'
|
258 |
-
'
|
259 |
-
'
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
$
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
);
|
273 |
-
|
274 |
-
$
|
275 |
-
$
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
$
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
$
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
'
|
401 |
-
|
402 |
-
|
403 |
-
);
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
)
|
415 |
-
|
416 |
-
$this->
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow()
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
//
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
//
|
447 |
-
//
|
448 |
-
//
|
449 |
-
//
|
450 |
-
// }
|
451 |
-
//
|
452 |
-
//
|
453 |
-
//
|
454 |
-
//
|
455 |
-
//
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
}
|
527 |
-
|
528 |
-
public function
|
529 |
-
{
|
530 |
-
return $this->getParameter(Skybox_Core_Model_Config::
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
$
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
$
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
);
|
736 |
-
|
737 |
-
|
738 |
-
$
|
739 |
-
$
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
$finalPrice = isset($finalPrice) ? $finalPrice :
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
$
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
$
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
$
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
$
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
);
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Catalog
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Catalog
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Model instance
|
15 |
+
* @var Skybox_Core_Model_Config
|
16 |
+
*/
|
17 |
+
/*protected $_config = null;
|
18 |
+
|
19 |
+
protected $_typeConfig = "skyboxcore/config";
|
20 |
+
|
21 |
+
protected function getConfig()
|
22 |
+
{
|
23 |
+
if(null === $this->_config)
|
24 |
+
$this->_config = Mage::getModel($this->_typeConfig);
|
25 |
+
}*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Model instance
|
29 |
+
* @var Mage_Core_Catalog_Model_Product
|
30 |
+
*/
|
31 |
+
protected $_product = null;
|
32 |
+
|
33 |
+
protected $_productResult = null;
|
34 |
+
|
35 |
+
protected $_typeProduct = "catalog/product";
|
36 |
+
|
37 |
+
protected $_product_id = null;
|
38 |
+
protected $_product_data = null;
|
39 |
+
|
40 |
+
public function getProductId()
|
41 |
+
{
|
42 |
+
if ($this->_product_id != null) {
|
43 |
+
return $this->_product_id;
|
44 |
+
}
|
45 |
+
return null;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getProductData()
|
49 |
+
{
|
50 |
+
if ($this->_product_data != null) {
|
51 |
+
return $this->_product_data;
|
52 |
+
}
|
53 |
+
return null;
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Calculate Price
|
59 |
+
*
|
60 |
+
* @param int|Mage_Catalog_Model_Product $product
|
61 |
+
* @param Varien_Object $request
|
62 |
+
* @param float $finalPrice
|
63 |
+
* @param string $type
|
64 |
+
* @param int $objectId
|
65 |
+
* @return Mage_Checkout_Model_Cart
|
66 |
+
*/
|
67 |
+
public function CalculatePrice($product, $request, $finalPrice = null, $type = null, $objectId = 1)
|
68 |
+
{
|
69 |
+
Mage::log("ApiProductCatalog ", null, 'orden.log', true);
|
70 |
+
|
71 |
+
//Mage::log(print_r('Product', true), null, 'tracer.log', true);
|
72 |
+
|
73 |
+
//if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
74 |
+
if (!$this->getLocationAllow()) {
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
+
|
78 |
+
if (!is_object($product)) {
|
79 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
80 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($product);
|
81 |
+
}
|
82 |
+
|
83 |
+
$productId = $product->getId();
|
84 |
+
$_data = null;
|
85 |
+
|
86 |
+
if ($type == null) {
|
87 |
+
$type = $product->getTypeId();
|
88 |
+
}
|
89 |
+
|
90 |
+
$defaultSwitch = false;
|
91 |
+
switch ($type) {
|
92 |
+
case 'simple':
|
93 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $product->getFinalPrice();
|
94 |
+
$category_id = $product->getSkyboxCategoryId();
|
95 |
+
$category_id = isset($category_id) ? $category_id : $this->getCommodityFromCategory($product);
|
96 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
97 |
+
|
98 |
+
$_data = array(
|
99 |
+
'object_id' => 1,
|
100 |
+
'name' => $product->getName(),
|
101 |
+
'sku' => $product->getSku(),
|
102 |
+
'category_id' => $category_id,
|
103 |
+
'final_price' => $finalPrice,
|
104 |
+
'weight' => ($product->getWeight()) ? $product->getWeight() : 1,
|
105 |
+
'image_url' => $product->getImageUrl(),
|
106 |
+
'typeProduct' => $type,
|
107 |
+
'VolWeight' => $volWeight,
|
108 |
+
'merchantproductid' => $productId
|
109 |
+
);
|
110 |
+
// $this->_calculatePrice($_data);
|
111 |
+
break;
|
112 |
+
|
113 |
+
case 'configurable':
|
114 |
+
|
115 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
116 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
117 |
+
$sku = $product->getSku();
|
118 |
+
|
119 |
+
Mage::log("CalculatePrice configurable : " . $finalPrice, null, 'skyboxcheckout.log', false);
|
120 |
+
|
121 |
+
if ($request) {
|
122 |
+
$childProduct = Mage::getModel('catalog/product_type_configurable')
|
123 |
+
->getProductByAttributes($request->getData('super_attribute'), $product);
|
124 |
+
|
125 |
+
$productId = $childProduct->getId();
|
126 |
+
$sku = $childProduct->getSku();
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
$parentItem = null;
|
131 |
+
|
132 |
+
if (isset($request) && !$finalPrice) {
|
133 |
+
Mage::log("CalculatePrice candidate INI", null, 'skyboxcheckout.log', false);
|
134 |
+
$_finalPrice = 0;
|
135 |
+
|
136 |
+
$cartCandidates = $product->getTypeInstance(true)
|
137 |
+
->prepareForCartAdvanced($request, $product, 'full');
|
138 |
+
|
139 |
+
foreach ($cartCandidates as $candidate) {
|
140 |
+
// Child items can be sticked together only within their parent
|
141 |
+
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
142 |
+
$candidate->setStickWithinParent($stickWithinParent);
|
143 |
+
|
144 |
+
$candidate_getFinalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(),
|
145 |
+
$product);
|
146 |
+
Mage::log("CalculatePrice candidate getFinalPrice: " . $candidate_getFinalPrice, null,
|
147 |
+
'skyboxcheckout.log', false);
|
148 |
+
|
149 |
+
$_finalPrice = $_finalPrice + $candidate_getFinalPrice;
|
150 |
+
if ($_finalPrice) {
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$finalPrice = $_finalPrice;
|
155 |
+
Mage::log("CalculatePrice candidate FIN", null, 'skyboxcheckout.log', false);
|
156 |
+
}
|
157 |
+
|
158 |
+
/* Weight start*/
|
159 |
+
/*
|
160 |
+
$options = array();
|
161 |
+
// Get any super_attribute settings we need
|
162 |
+
$productAttributesOptions = $product->getTypeInstance(true)->getConfigurableOptions($product);
|
163 |
+
foreach ($productAttributesOptions as $productAttributeOption) {
|
164 |
+
$options[$product->getId()] = array();
|
165 |
+
foreach ($productAttributeOption as $optionValues) {
|
166 |
+
$val = ($optionValues['option_title']);
|
167 |
+
$options[$product->getId()][] = array (
|
168 |
+
$optionValues['sku'] => $optionValues['attribute_code']."=".$val
|
169 |
+
|
170 |
+
) ;
|
171 |
+
}
|
172 |
+
|
173 |
+
}
|
174 |
+
$prod_weight = 1;
|
175 |
+
if(!empty($optionValues)) {
|
176 |
+
$a = Mage::getModel('catalog/product')->loadByAttribute('sku',$optionValues['sku']);
|
177 |
+
//$product->load($product->getIdBySku($optionValues['sku']));
|
178 |
+
$prod_weight = $a->getWeight();
|
179 |
+
echo ":::".$prod_weight."::";
|
180 |
+
}
|
181 |
+
*/
|
182 |
+
/* Weight end*/
|
183 |
+
|
184 |
+
$category_id = $product->getSkyboxCategoryId();
|
185 |
+
$category_id = isset($category_id) ? $category_id : $this->getCommodityFromCategory($product);
|
186 |
+
|
187 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
188 |
+
$_data = array(
|
189 |
+
'object_id' => 1,
|
190 |
+
'name' => $product->getName(),
|
191 |
+
//'sku' => $product->getSku(),
|
192 |
+
'sku' => $sku,
|
193 |
+
'category_id' => $category_id,
|
194 |
+
'final_price' => $finalPrice,
|
195 |
+
'weight' => $weight ? $weight : 1,
|
196 |
+
'image_url' => $product->getImageUrl(),
|
197 |
+
'typeProduct' => $type,
|
198 |
+
'VolWeight' => $volWeight,
|
199 |
+
'merchantproductid' => $productId
|
200 |
+
);
|
201 |
+
|
202 |
+
// $this->_calculatePrice($_data);
|
203 |
+
break;
|
204 |
+
|
205 |
+
case 'bundle':
|
206 |
+
//$_finalPrice = $product->getTotalBundleItemsPrice($product, $request->getQty());
|
207 |
+
//$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
208 |
+
|
209 |
+
//Mage::log(print_r($product, true), null, 'cart.log', true);
|
210 |
+
//Mage::log("Product: [" . $product->getId() . "] - Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
211 |
+
|
212 |
+
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
213 |
+
|
214 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
215 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
216 |
+
$sku = $product->getSku();
|
217 |
+
|
218 |
+
//if (isset($request) && !$finalPrice) {
|
219 |
+
if (isset($request)) {
|
220 |
+
|
221 |
+
$parentItem = null;
|
222 |
+
$_finalPrice = null;
|
223 |
+
$_weight = 0;
|
224 |
+
|
225 |
+
$cartCandidates = $product->getTypeInstance(true)
|
226 |
+
->prepareForCartAdvanced($request, $product, 'full');
|
227 |
+
|
228 |
+
foreach ($cartCandidates as $candidate) {
|
229 |
+
// Child items can be sticked together only within their parent
|
230 |
+
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
231 |
+
$candidate->setStickWithinParent($stickWithinParent);
|
232 |
+
|
233 |
+
if (!$_finalPrice) {
|
234 |
+
$_finalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(), $product);
|
235 |
+
//break;
|
236 |
+
}
|
237 |
+
//$_weight = $_weight + $candidate->getPriceModel()->getWeight();
|
238 |
+
$_weight = $_weight + $candidate->getWeight();
|
239 |
+
}
|
240 |
+
|
241 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
242 |
+
if ($_weight > 0) {
|
243 |
+
$weight = $_weight;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
//Mage::log("weight: " . $weight, null, 'cart.log', true);
|
248 |
+
//Mage::log("sku: " . $sku, null, 'cart.log', true);
|
249 |
+
|
250 |
+
$category_id = $product->getSkyboxCategoryId();
|
251 |
+
$category_id = isset($category_id) ? $category_id : $this->getCommodityFromCategory($product);
|
252 |
+
|
253 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
254 |
+
$_data = array(
|
255 |
+
'object_id' => 1,
|
256 |
+
'name' => $product->getName(),
|
257 |
+
'sku' => $sku,
|
258 |
+
'category_id' => $category_id,
|
259 |
+
'final_price' => $finalPrice,
|
260 |
+
'weight' => ($weight) ? $weight : 1,
|
261 |
+
'image_url' => $product->getImageUrl(),
|
262 |
+
'typeProduct' => $type,
|
263 |
+
'VolWeight' => $volWeight,
|
264 |
+
'merchantproductid' => $productId
|
265 |
+
);
|
266 |
+
// $this->_calculatePrice($_data);
|
267 |
+
break;
|
268 |
+
|
269 |
+
case 'bundle_fixed':
|
270 |
+
|
271 |
+
// @Note: It should be rewrite!!
|
272 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
273 |
+
$skyboxCategoryId = $product->getSkyboxCategoryId();
|
274 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
275 |
+
$sku = $product->getSku();
|
276 |
+
|
277 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
278 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
279 |
+
);
|
280 |
+
|
281 |
+
$_finalPrice = null;
|
282 |
+
$_weight = 0;
|
283 |
+
$_skyboxCategoryId = null;
|
284 |
+
|
285 |
+
foreach ($selectionCollection as $option) {
|
286 |
+
//if ($option->getData('is_default') == 0) continue;
|
287 |
+
|
288 |
+
$product_simple = Mage::getModel('catalog/product')
|
289 |
+
->load($option->getId());
|
290 |
+
|
291 |
+
$_finalPrice = $_finalPrice + $product_simple->getFinalPrice();
|
292 |
+
$_weight = $_weight + $product_simple->getWeight();
|
293 |
+
|
294 |
+
if (!$_skyboxCategoryId) { // Set SkyboxCategory from the first Simple Product
|
295 |
+
// $_skyboxCategoryId = $product_simple->getSkyboxCategoryId();
|
296 |
+
$_skyboxCategoryId = $product->getSkyboxCategoryId();
|
297 |
+
$_skyboxCategoryId = isset($_skyboxCategoryId) ? $_skyboxCategoryId : $this->getCommodityFromCategory($product);
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
302 |
+
|
303 |
+
if (!$weight) {
|
304 |
+
$weight = $_weight;
|
305 |
+
}
|
306 |
+
|
307 |
+
if (!$skyboxCategoryId) {
|
308 |
+
$skyboxCategoryId = $_skyboxCategoryId;
|
309 |
+
}
|
310 |
+
|
311 |
+
/*Mage::log("-------------------------", null, 'cart.log', true);
|
312 |
+
Mage::log("Product: " . $product->getName(), null, 'cart.log', true);
|
313 |
+
Mage::log("Price: " . $finalPrice, null, 'cart.log', true);
|
314 |
+
Mage::log("weight: " . $weight, null, 'cart.log', true);
|
315 |
+
Mage::log("sku: " . $sku, null, 'cart.log', true);*/
|
316 |
+
|
317 |
+
|
318 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
319 |
+
$_data = array(
|
320 |
+
'object_id' => 1,
|
321 |
+
'name' => $product->getName(),
|
322 |
+
'sku' => $sku,
|
323 |
+
'category_id' => $skyboxCategoryId,
|
324 |
+
'final_price' => $finalPrice,
|
325 |
+
'weight' => ($weight) ? $weight : 1,
|
326 |
+
'image_url' => $product->getImageUrl(),
|
327 |
+
'typeProduct' => $type,
|
328 |
+
'VolWeight' => $volWeight,
|
329 |
+
'merchantproductid' => $productId
|
330 |
+
);
|
331 |
+
|
332 |
+
// $this->_calculatePrice($_data);
|
333 |
+
break;
|
334 |
+
|
335 |
+
default:
|
336 |
+
Mage::log("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice",
|
337 |
+
null, 'skyboxcheckout.log', false);
|
338 |
+
trigger_error("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice");
|
339 |
+
$defaultSwitch = true;
|
340 |
+
break;
|
341 |
+
}
|
342 |
+
|
343 |
+
if (!$defaultSwitch) {
|
344 |
+
//Mage::log(print_r('EnableTax: ', true), null, 'tracer.log', true);
|
345 |
+
//Mage::log(print_r($this->getEnabledAddSumTaxToPrice(), true), null, 'tracer.log', true);
|
346 |
+
if ($this->getEnabledAddSumTaxToPrice()) {
|
347 |
+
$store = Mage::app()->getStore('default');
|
348 |
+
$taxCalculation = Mage::getModel('tax/calculation');
|
349 |
+
$request = $taxCalculation->getRateRequest(null, null, null, $store);
|
350 |
+
// $product = Mage::registry('current_product');
|
351 |
+
$taxClassId = $product->getTaxClassId();
|
352 |
+
$percentTax = $taxCalculation->getRate($request->setProductClassId($taxClassId));
|
353 |
+
|
354 |
+
$taxPrice = $_data['final_price'] * ($percentTax / 100);
|
355 |
+
|
356 |
+
//Mage::log(print_r('Id product: ' . $product->getId(), true), null, 'tracer.log', true);
|
357 |
+
//Mage::log(print_r('$taxPrice: ' . $taxPrice, true), null, 'tracer.log', true);
|
358 |
+
//Mage::log(print_r('price: ' . $_data['final_price'], true), null, 'tracer.log', true);
|
359 |
+
//Mage::log(print_r('$taxPrice+price: ' . ($taxPrice + $_data['final_price']), true), null, 'tracer.log', true);
|
360 |
+
$comissionSkybox = $_data['final_price'] * (10 / 100);
|
361 |
+
//Mage::log(print_r('comision skybox: ' . ($comissionSkybox), true), null, 'tracer.log', true);
|
362 |
+
//Mage::log(print_r('price+comision skybox: ' . ($_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
363 |
+
//Mage::log(print_r('$taxPrice+price+comision: ' . ($taxPrice + $_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
364 |
+
//Mage::log(print_r('comision true: ' . (($taxPrice + $_data['final_price']) * (10 / 100)), true), null, 'tracer.log', true);
|
365 |
+
$priceReally = ($taxPrice + $_data['final_price']) + ($taxPrice + $_data['final_price']) * (10 / 100);
|
366 |
+
//Mage::log(print_r('$taxPrice+price+comision true: ' . ($priceReally), true), null, 'tracer.log', true);
|
367 |
+
|
368 |
+
|
369 |
+
$_data['final_price'] = $_data['final_price'] + $taxPrice;
|
370 |
+
}
|
371 |
+
|
372 |
+
//Mage::log(print_r('####################### Data produc params #######################', true), null, 'tracer.log', true);
|
373 |
+
//Mage::log(print_r($_data, true), null, 'tracer.log', true);
|
374 |
+
// $this->_calculatePrice($_data);
|
375 |
+
try {
|
376 |
+
$this->_calculatePrice($_data);
|
377 |
+
} catch (\Exception $e) {
|
378 |
+
Mage::log($e->getMessage(), null, 'skyboxcheckout.log', false);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
Mage::log("Product Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
383 |
+
Mage::log("Product Type: " . $type, null, 'skyboxcheckout.log', false);
|
384 |
+
Mage::log(print_r($_data, true), null, 'skyboxcheckout.log', false);
|
385 |
+
|
386 |
+
$this->_product_data = $_data;
|
387 |
+
$this->_product_id = $productId;
|
388 |
+
return $this;
|
389 |
+
}
|
390 |
+
|
391 |
+
private function _calculatePrice($data)
|
392 |
+
{
|
393 |
+
$msg = sprintf("CalculatePrice: [%s] - [%s] - [%s] - [Category_id: %s] - [Price: %s] - [weight: %s] - [typeProduct: %s]",
|
394 |
+
$data['object_id'],
|
395 |
+
$data['sku'],
|
396 |
+
$data['name'],
|
397 |
+
$data['category_id'],
|
398 |
+
$data['final_price'],
|
399 |
+
$data['weight'],
|
400 |
+
$data['typeProduct']
|
401 |
+
);
|
402 |
+
|
403 |
+
Mage::log($msg, null, 'skyboxcheckout.log', false);
|
404 |
+
|
405 |
+
$params = array(
|
406 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
407 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
408 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
409 |
+
'htmlobjectid' => $data['object_id'],
|
410 |
+
'storeproductcode' => $data['sku'],
|
411 |
+
'storeproductname' => $data['name'],
|
412 |
+
'storeproductcategory' => $data['category_id'],
|
413 |
+
'storeproductprice' => $data['final_price'],
|
414 |
+
//'storeproductprice' => $product->getFinalPrice(),
|
415 |
+
'weight' => ($data['weight']) ? $data['weight'] : 1,
|
416 |
+
'weightunit' => $this->getWeightUnit(),
|
417 |
+
'storeproductimgurl' => $data['image_url'],
|
418 |
+
'merchantproductid' => $data['merchantproductid']
|
419 |
+
);
|
420 |
+
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_CALCULATE, $params);
|
421 |
+
}
|
422 |
+
|
423 |
+
public function HtmlTemplateButton()
|
424 |
+
{
|
425 |
+
if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow()) {
|
426 |
+
$params = array(
|
427 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
428 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
429 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi()
|
430 |
+
);
|
431 |
+
|
432 |
+
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TEMPLATE_BUTTON, $params);
|
433 |
+
}
|
434 |
+
|
435 |
+
return $this;
|
436 |
+
}
|
437 |
+
|
438 |
+
public function GetTemplateProduct()
|
439 |
+
{
|
440 |
+
Mage::log("ApiProduct ", null, 'orden.log', true);
|
441 |
+
if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow() && !$this->_getApi()->ErrorServiceNotController()) {
|
442 |
+
//if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow() && !$this->_getApi()->ErrorService()) {
|
443 |
+
$_productResult = $this->getResponse();
|
444 |
+
$template = $_productResult->TooltipButtonTemplate;
|
445 |
+
return $template;
|
446 |
+
// $templateButton = $this->getHtmlTemplateButton();
|
447 |
+
// if (empty($templateButton))
|
448 |
+
// $this->HtmlTemplateButton();
|
449 |
+
//
|
450 |
+
// /*if($_productResult->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BUTTONERROR})
|
451 |
+
// {*/
|
452 |
+
// //Mage::log("_productResult--->" . json_decode($_productResult));
|
453 |
+
// $templateButton = $this->getHtmlTemplateButton();
|
454 |
+
// if (!empty($templateButton)) {
|
455 |
+
// $template = $this->getHtmlTemplateButton();
|
456 |
+
//// Mage::log(print_r('response template buttom', true), null, 'tracer.log', true);
|
457 |
+
//// Mage::log(print_r($_productResult, true), null, 'tracer.log', true);
|
458 |
+
// foreach ($_productResult as $key => $value) {
|
459 |
+
// $template = str_replace('{' . $key . '}', $value, $template);
|
460 |
+
// }
|
461 |
+
//
|
462 |
+
// // Just for {Block} crap
|
463 |
+
// $template = str_replace('{Block}', '', $template);
|
464 |
+
//
|
465 |
+
// return $template;
|
466 |
+
// }
|
467 |
+
//
|
468 |
+
// $displayUSD = "''"; //CartCountryIso
|
469 |
+
// /*}else{
|
470 |
+
// return "Plantilla de error";
|
471 |
+
// }*/
|
472 |
+
// //Mage::log(get_class($this) . " GetTemplateProduct() ", null, 'cart.log', true);
|
473 |
+
} else {
|
474 |
+
$template = '<div class="skx_content_button"></div>';
|
475 |
+
return $template;
|
476 |
+
}
|
477 |
+
return "";
|
478 |
+
}
|
479 |
+
|
480 |
+
protected $_isUSD = null;
|
481 |
+
|
482 |
+
public function IsUSD()
|
483 |
+
{
|
484 |
+
if (null == $this->_isUSD) {
|
485 |
+
$this->_isUSD = ($this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_CART_CURRENCY_ISO,
|
486 |
+
"") == Skybox_Core_Model_Config::SKYBOX_CURRENCY_USD);
|
487 |
+
}
|
488 |
+
return $this->_isUSD;
|
489 |
+
}
|
490 |
+
|
491 |
+
public function getCustoms()
|
492 |
+
{
|
493 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS, "0");
|
494 |
+
}
|
495 |
+
|
496 |
+
public function getShipping()
|
497 |
+
{
|
498 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING, "0");
|
499 |
+
}
|
500 |
+
|
501 |
+
public function getInsurance()
|
502 |
+
{
|
503 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE, "0");
|
504 |
+
}
|
505 |
+
|
506 |
+
public function getPrice()
|
507 |
+
{
|
508 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_PRICE, "0");
|
509 |
+
}
|
510 |
+
|
511 |
+
public function getTotalPrice()
|
512 |
+
{
|
513 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL, "0");
|
514 |
+
}
|
515 |
+
|
516 |
+
public function getCustomsUSD()
|
517 |
+
{
|
518 |
+
return $this->IsUSD() ? $this->getCustoms() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS_USD,
|
519 |
+
"0");
|
520 |
+
}
|
521 |
+
|
522 |
+
public function getShippingUSD()
|
523 |
+
{
|
524 |
+
return $this->IsUSD() ? $this->getShipping() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING_USD,
|
525 |
+
"0");
|
526 |
+
}
|
527 |
+
|
528 |
+
public function getInsuranceUSD()
|
529 |
+
{
|
530 |
+
return $this->IsUSD() ? $this->getInsurance() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE_USD,
|
531 |
+
"0");
|
532 |
+
}
|
533 |
+
|
534 |
+
public function getPriceUSD()
|
535 |
+
{
|
536 |
+
return $this->IsUSD() ? $this->getPrice() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_PRICE_USD,
|
537 |
+
"0");
|
538 |
+
}
|
539 |
+
|
540 |
+
public function getTotalPriceUSD()
|
541 |
+
{
|
542 |
+
return $this->IsUSD() ? $this->getTotalPrice() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL_USD,
|
543 |
+
"0");
|
544 |
+
}
|
545 |
+
|
546 |
+
public function getGuidSkybox()
|
547 |
+
{
|
548 |
+
return $this->_getApi()->getGuidApi();
|
549 |
+
}
|
550 |
+
|
551 |
+
public function getBasePrice()
|
552 |
+
{
|
553 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_BASE_PRICE, "0");
|
554 |
+
}
|
555 |
+
|
556 |
+
public function getBasePriceUSD()
|
557 |
+
{
|
558 |
+
return $this->IsUSD() ? $this->getBasePrice() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_BASE_PRICE_USD,
|
559 |
+
"0");
|
560 |
+
}
|
561 |
+
|
562 |
+
public function getAdjustPrice()
|
563 |
+
{
|
564 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ADJUST_PRICE, "0");
|
565 |
+
}
|
566 |
+
|
567 |
+
public function getAdjustPriceUSD()
|
568 |
+
{
|
569 |
+
return $this->IsUSD() ? $this->getAdjustPrice() : $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ADJUST_PRICE_USD,
|
570 |
+
"0");
|
571 |
+
}
|
572 |
+
|
573 |
+
public function getAdjustLabel()
|
574 |
+
{
|
575 |
+
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_LABEL_ADJUST, "");
|
576 |
+
}
|
577 |
+
|
578 |
+
/*Async Ini*/
|
579 |
+
|
580 |
+
public function getUrl($product, $request, $finalPrice = null, $type = null, $objectId = 1)
|
581 |
+
{
|
582 |
+
Mage::log("ApiProductCatalog ", null, 'orden.log', true);
|
583 |
+
|
584 |
+
//Mage::log(print_r('Product', true), null, 'tracer.log', true);
|
585 |
+
|
586 |
+
//if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
587 |
+
if (!$this->getLocationAllow()) {
|
588 |
+
return $this;
|
589 |
+
}
|
590 |
+
|
591 |
+
if (!is_object($product)) {
|
592 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
593 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($product);
|
594 |
+
}
|
595 |
+
|
596 |
+
$productId = $product->getId();
|
597 |
+
$_data = null;
|
598 |
+
|
599 |
+
if ($type == null) {
|
600 |
+
$type = $product->getTypeId();
|
601 |
+
}
|
602 |
+
|
603 |
+
$defaultSwitch = true;
|
604 |
+
switch ($type) {
|
605 |
+
case 'simple':
|
606 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $product->getFinalPrice();
|
607 |
+
$category_id = $product->getSkyboxCategoryId();
|
608 |
+
$category_id = isset($category_id) ? $category_id : $this->getCommodityFromCategory($product);
|
609 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
610 |
+
|
611 |
+
$_data = array(
|
612 |
+
'object_id' => $product->getId(),
|
613 |
+
'name' => $product->getName(),
|
614 |
+
'sku' => $product->getSku(),
|
615 |
+
'category_id' => $category_id,
|
616 |
+
'final_price' => $finalPrice,
|
617 |
+
'weight' => ($product->getWeight()) ? $product->getWeight() : 1,
|
618 |
+
'image_url' => $product->getImageUrl(),
|
619 |
+
'typeProduct' => $type,
|
620 |
+
'VolWeight' => $volWeight,
|
621 |
+
'merchantproductid' => $productId
|
622 |
+
);
|
623 |
+
// $this->_calculatePrice($_data);
|
624 |
+
break;
|
625 |
+
|
626 |
+
case 'configurable':
|
627 |
+
|
628 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
629 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
630 |
+
$sku = $product->getSku();
|
631 |
+
|
632 |
+
Mage::log("CalculatePrice configurable : " . $finalPrice, null, 'skyboxcheckout.log', false);
|
633 |
+
|
634 |
+
if ($request) {
|
635 |
+
$childProduct = Mage::getModel('catalog/product_type_configurable')
|
636 |
+
->getProductByAttributes($request->getData('super_attribute'), $product);
|
637 |
+
|
638 |
+
$productId = $childProduct->getId();
|
639 |
+
$sku = $childProduct->getSku();
|
640 |
+
|
641 |
+
}
|
642 |
+
|
643 |
+
$parentItem = null;
|
644 |
+
|
645 |
+
if (isset($request) && !$finalPrice) {
|
646 |
+
Mage::log("CalculatePrice candidate INI", null, 'skyboxcheckout.log', false);
|
647 |
+
$_finalPrice = 0;
|
648 |
+
|
649 |
+
$cartCandidates = $product->getTypeInstance(true)
|
650 |
+
->prepareForCartAdvanced($request, $product, 'full');
|
651 |
+
|
652 |
+
foreach ($cartCandidates as $candidate) {
|
653 |
+
// Child items can be sticked together only within their parent
|
654 |
+
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
655 |
+
$candidate->setStickWithinParent($stickWithinParent);
|
656 |
+
|
657 |
+
$candidate_getFinalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(),
|
658 |
+
$product);
|
659 |
+
Mage::log("CalculatePrice candidate getFinalPrice: " . $candidate_getFinalPrice, null,
|
660 |
+
'skyboxcheckout.log', false);
|
661 |
+
|
662 |
+
$_finalPrice = $_finalPrice + $candidate_getFinalPrice;
|
663 |
+
if ($_finalPrice) {
|
664 |
+
break;
|
665 |
+
}
|
666 |
+
}
|
667 |
+
$finalPrice = $_finalPrice;
|
668 |
+
Mage::log("CalculatePrice candidate FIN", null, 'skyboxcheckout.log', false);
|
669 |
+
}
|
670 |
+
|
671 |
+
$category_id = $product->getSkyboxCategoryId();
|
672 |
+
$category_id = isset($category_id) ? $category_id : $this->getCommodityFromCategory($product);
|
673 |
+
|
674 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
675 |
+
|
676 |
+
$_data = array(
|
677 |
+
'object_id' => $product->getId(),
|
678 |
+
'name' => $product->getName(),
|
679 |
+
//'sku' => $product->getSku(),
|
680 |
+
'sku' => $sku,
|
681 |
+
'category_id' => $category_id,
|
682 |
+
'final_price' => $finalPrice,
|
683 |
+
'weight' => $weight ? $weight : 1,
|
684 |
+
'image_url' => $product->getImageUrl(),
|
685 |
+
'typeProduct' => $type,
|
686 |
+
'VolWeight' => $volWeight,
|
687 |
+
'merchantproductid' => $productId
|
688 |
+
);
|
689 |
+
|
690 |
+
// $this->_calculatePrice($_data);
|
691 |
+
break;
|
692 |
+
|
693 |
+
case 'bundle':
|
694 |
+
//$_finalPrice = $product->getTotalBundleItemsPrice($product, $request->getQty());
|
695 |
+
//$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
696 |
+
|
697 |
+
//Mage::log(print_r($product, true), null, 'cart.log', true);
|
698 |
+
//Mage::log("Product: [" . $product->getId() . "] - Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
699 |
+
|
700 |
+
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
701 |
+
|
702 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
703 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
704 |
+
$sku = $product->getSku();
|
705 |
+
|
706 |
+
//if (isset($request) && !$finalPrice) {
|
707 |
+
if (isset($request)) {
|
708 |
+
|
709 |
+
$parentItem = null;
|
710 |
+
$_finalPrice = null;
|
711 |
+
$_weight = 0;
|
712 |
+
|
713 |
+
$cartCandidates = $product->getTypeInstance(true)
|
714 |
+
->prepareForCartAdvanced($request, $product, 'full');
|
715 |
+
|
716 |
+
foreach ($cartCandidates as $candidate) {
|
717 |
+
// Child items can be sticked together only within their parent
|
718 |
+
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
719 |
+
$candidate->setStickWithinParent($stickWithinParent);
|
720 |
+
|
721 |
+
if (!$_finalPrice) {
|
722 |
+
$_finalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(), $product);
|
723 |
+
//break;
|
724 |
+
}
|
725 |
+
//$_weight = $_weight + $candidate->getPriceModel()->getWeight();
|
726 |
+
$_weight = $_weight + $candidate->getWeight();
|
727 |
+
}
|
728 |
+
|
729 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
730 |
+
if ($_weight > 0) {
|
731 |
+
$weight = $_weight;
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
//Mage::log("weight: " . $weight, null, 'cart.log', true);
|
736 |
+
//Mage::log("sku: " . $sku, null, 'cart.log', true);
|
737 |
+
|
738 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
739 |
+
$_data = array(
|
740 |
+
'object_id' => $product->getId(),
|
741 |
+
'name' => $product->getName(),
|
742 |
+
'sku' => $sku,
|
743 |
+
'category_id' => $product->getSkyboxCategoryId(),
|
744 |
+
'final_price' => $finalPrice,
|
745 |
+
'weight' => ($weight) ? $weight : 1,
|
746 |
+
'image_url' => $product->getImageUrl(),
|
747 |
+
'typeProduct' => $type,
|
748 |
+
'VolWeight' => $volWeight,
|
749 |
+
'merchantproductid' => $productId
|
750 |
+
);
|
751 |
+
// $this->_calculatePrice($_data);
|
752 |
+
break;
|
753 |
+
|
754 |
+
case 'bundle_fixed':
|
755 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
756 |
+
$skyboxCategoryId = $product->getSkyboxCategoryId();
|
757 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
758 |
+
$sku = $product->getSku();
|
759 |
+
|
760 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
761 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
762 |
+
);
|
763 |
+
|
764 |
+
$_finalPrice = null;
|
765 |
+
$_weight = 0;
|
766 |
+
$_skyboxCategoryId = null;
|
767 |
+
|
768 |
+
foreach ($selectionCollection as $option) {
|
769 |
+
//if ($option->getData('is_default') == 0) continue;
|
770 |
+
|
771 |
+
$product_simple = Mage::getModel('catalog/product')
|
772 |
+
->load($option->getId());
|
773 |
+
|
774 |
+
$_finalPrice = $_finalPrice + $product_simple->getFinalPrice();
|
775 |
+
$_weight = $_weight + $product_simple->getWeight();
|
776 |
+
|
777 |
+
if (!$_skyboxCategoryId) { // Set SkyboxCategory from the first Simple Product
|
778 |
+
$_skyboxCategoryId = $product_simple->getSkyboxCategoryId();
|
779 |
+
}
|
780 |
+
}
|
781 |
+
|
782 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
783 |
+
|
784 |
+
if (!$weight) {
|
785 |
+
$weight = $_weight;
|
786 |
+
}
|
787 |
+
|
788 |
+
if (!$skyboxCategoryId) {
|
789 |
+
$skyboxCategoryId = $_skyboxCategoryId;
|
790 |
+
}
|
791 |
+
|
792 |
+
/*Mage::log("-------------------------", null, 'cart.log', true);
|
793 |
+
Mage::log("Product: " . $product->getName(), null, 'cart.log', true);
|
794 |
+
Mage::log("Price: " . $finalPrice, null, 'cart.log', true);
|
795 |
+
Mage::log("weight: " . $weight, null, 'cart.log', true);
|
796 |
+
Mage::log("sku: " . $sku, null, 'cart.log', true);*/
|
797 |
+
|
798 |
+
$volWeight = !empty(trim($product->getDimensionalWeight())) ? $product->getDimensionalWeight() : 0;
|
799 |
+
$_data = array(
|
800 |
+
'object_id' => $product->getId(),
|
801 |
+
'name' => $product->getName(),
|
802 |
+
'sku' => $sku,
|
803 |
+
'category_id' => $skyboxCategoryId,
|
804 |
+
'final_price' => $finalPrice,
|
805 |
+
'weight' => ($weight) ? $weight : 1,
|
806 |
+
'image_url' => $product->getImageUrl(),
|
807 |
+
'typeProduct' => $type,
|
808 |
+
'VolWeight' => $volWeight,
|
809 |
+
'merchantproductid' => $productId
|
810 |
+
);
|
811 |
+
|
812 |
+
// $this->_calculatePrice($_data);
|
813 |
+
break;
|
814 |
+
|
815 |
+
default:
|
816 |
+
Mage::log("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice",
|
817 |
+
null, 'skyboxcheckout.log', false);
|
818 |
+
trigger_error("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice");
|
819 |
+
$defaultSwitch = true;
|
820 |
+
break;
|
821 |
+
}
|
822 |
+
|
823 |
+
if (!$defaultSwitch) {
|
824 |
+
//Mage::log(print_r('EnableTax: ', true), null, 'tracer.log', true);
|
825 |
+
//Mage::log(print_r($this->getEnabledAddSumTaxToPrice(), true), null, 'tracer.log', true);
|
826 |
+
if ($this->getEnabledAddSumTaxToPrice()) {
|
827 |
+
$store = Mage::app()->getStore('default');
|
828 |
+
$taxCalculation = Mage::getModel('tax/calculation');
|
829 |
+
$request = $taxCalculation->getRateRequest(null, null, null, $store);
|
830 |
+
// $product = Mage::registry('current_product');
|
831 |
+
$taxClassId = $product->getTaxClassId();
|
832 |
+
$percentTax = $taxCalculation->getRate($request->setProductClassId($taxClassId));
|
833 |
+
|
834 |
+
$taxPrice = $_data['final_price'] * ($percentTax / 100);
|
835 |
+
|
836 |
+
//Mage::log(print_r('Id product: ' . $product->getId(), true), null, 'tracer.log', true);
|
837 |
+
//Mage::log(print_r('$taxPrice: ' . $taxPrice, true), null, 'tracer.log', true);
|
838 |
+
//Mage::log(print_r('price: ' . $_data['final_price'], true), null, 'tracer.log', true);
|
839 |
+
//Mage::log(print_r('$taxPrice+price: ' . ($taxPrice + $_data['final_price']), true), null, 'tracer.log', true);
|
840 |
+
$comissionSkybox = $_data['final_price'] * (10 / 100);
|
841 |
+
//Mage::log(print_r('comision skybox: ' . ($comissionSkybox), true), null, 'tracer.log', true);
|
842 |
+
//Mage::log(print_r('price+comision skybox: ' . ($_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
843 |
+
//Mage::log(print_r('$taxPrice+price+comision: ' . ($taxPrice + $_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
844 |
+
//Mage::log(print_r('comision true: ' . (($taxPrice + $_data['final_price']) * (10 / 100)), true), null, 'tracer.log', true);
|
845 |
+
$priceReally = ($taxPrice + $_data['final_price']) + ($taxPrice + $_data['final_price']) * (10 / 100);
|
846 |
+
//Mage::log(print_r('$taxPrice+price+comision true: ' . ($priceReally), true), null, 'tracer.log', true);
|
847 |
+
$_data['final_price'] = $_data['final_price'] + $taxPrice;
|
848 |
+
}
|
849 |
+
|
850 |
+
//Mage::log(print_r('####################### Data produc params #######################', true), null, 'tracer.log', true);
|
851 |
+
//Mage::log(print_r($_data, true), null, 'tracer.log', true);
|
852 |
+
try {
|
853 |
+
$this->_calculatePrice($_data);
|
854 |
+
} catch (\Exception $e) {
|
855 |
+
Mage::log($e->getMessage(), null, 'skyboxcheckout.log', false);
|
856 |
+
}
|
857 |
+
|
858 |
+
}
|
859 |
+
|
860 |
+
Mage::log("Product Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
861 |
+
Mage::log("Product Type: " . $type, null, 'skyboxcheckout.log', false);
|
862 |
+
Mage::log(print_r($_data, true), null, 'skyboxcheckout.log', false);
|
863 |
+
|
864 |
+
$data = $this->_callServiceSky($_data);
|
865 |
+
/*var_dump($this); exit;
|
866 |
+
$this->_product_data = $_data;
|
867 |
+
$this->_product_id = $productId;
|
868 |
+
$apiData = $this->_api;
|
869 |
+
var_dump($apiData); exit;*/
|
870 |
+
return $data;
|
871 |
+
}
|
872 |
+
|
873 |
+
/**
|
874 |
+
* Return the Commodity from Category or Root
|
875 |
+
*
|
876 |
+
* @param $product
|
877 |
+
* @return int
|
878 |
+
*/
|
879 |
+
public function getCommodityFromCategory($product)
|
880 |
+
{
|
881 |
+
$result = 0;
|
882 |
+
|
883 |
+
try {
|
884 |
+
$categoryIds = $product->getCategoryIds();
|
885 |
+
|
886 |
+
if (count($categoryIds)) {
|
887 |
+
$categoryId = $categoryIds[0];
|
888 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
889 |
+
$result = $category->getSkyboxCategoryIdSelect();
|
890 |
+
}
|
891 |
+
|
892 |
+
if (empty($result)) {
|
893 |
+
$categoryId = Mage::app()->getStore()->getRootCategoryId();
|
894 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
895 |
+
$result = $category->getSkyboxCategoryIdSelect();
|
896 |
+
}
|
897 |
+
|
898 |
+
$result = isset($result) ? $result : 0;
|
899 |
+
|
900 |
+
} catch (\Exception $e) {
|
901 |
+
\error_log("catch exception product_: " . $product . PHP_EOL, 3, BP . '/var/log/magento19.trace.log');
|
902 |
+
}
|
903 |
+
|
904 |
+
return $result;
|
905 |
+
}
|
906 |
+
|
907 |
+
private function _callServiceSky($data)
|
908 |
+
{
|
909 |
+
$msg = sprintf("CalculatePrice: [%s] - [%s] - [%s] - [Category_id: %s] - [Price: %s] - [weight: %s] - [typeProduct: %s]",
|
910 |
+
$data['object_id'],
|
911 |
+
$data['sku'],
|
912 |
+
$data['name'],
|
913 |
+
$data['category_id'],
|
914 |
+
$data['final_price'],
|
915 |
+
$data['weight'],
|
916 |
+
$data['typeProduct']
|
917 |
+
);
|
918 |
+
|
919 |
+
$params = array(
|
920 |
+
'htmlobjectid' => $data['object_id'],
|
921 |
+
'code' => $data['sku'],
|
922 |
+
'name' => $data['name'],
|
923 |
+
'category' => $data['category_id'],
|
924 |
+
'price' => $data['final_price'],
|
925 |
+
//'storeproductprice' => $product->getFinalPrice(),
|
926 |
+
'weight' => ($data['weight']) ? $data['weight'] : 1,
|
927 |
+
'weightunit' => $this->getWeightUnit(),
|
928 |
+
'imgurl' => $data['image_url'],
|
929 |
+
/*'volweight' => $data['VolWeight'],
|
930 |
+
'merchantproductid' => $data['merchantproductid']*/
|
931 |
+
);
|
932 |
+
//var_dump($params); exit;
|
933 |
+
return $params;
|
934 |
+
}
|
935 |
+
|
936 |
+
/*Async End*/
|
937 |
+
}
|
app/code/community/Skybox/Catalog/Model/Observer.php
CHANGED
@@ -1,250 +1,271 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Mage
|
7 |
-
* @package Skybox_Catalog
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* Catalog Model Observer
|
14 |
-
*
|
15 |
-
* Note: For Magento 1.8.x issues with Block Caching
|
16 |
-
*/
|
17 |
-
class Skybox_Catalog_Model_Observer
|
18 |
-
{
|
19 |
-
private function getActive()
|
20 |
-
|
21 |
-
$value = Mage::
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
if (
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
if (
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
$
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
$
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
$
|
195 |
-
|
196 |
-
if ($
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Mage
|
7 |
+
* @package Skybox_Catalog
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Catalog Model Observer
|
14 |
+
*
|
15 |
+
* Note: For Magento 1.8.x issues with Block Caching
|
16 |
+
*/
|
17 |
+
class Skybox_Catalog_Model_Observer
|
18 |
+
{
|
19 |
+
private function getActive()
|
20 |
+
{
|
21 |
+
// $value = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
22 |
+
$value = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
23 |
+
return $value;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function hookToControllerActionPreDispatch($observer)
|
27 |
+
{
|
28 |
+
$active = $this->getActive();
|
29 |
+
if (!$active) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
//Mage::log('router tivoli: '.$observer->getEvent()->getControllerAction()->getFullActionName(), null, 'tracer.log', true);
|
34 |
+
if (($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add')) {
|
35 |
+
|
36 |
+
//Mage::log('hookToControllerActionPreDispatch '.$observer->getEvent()->getControllerAction()->getFullActionName(),null, 'tracer.log', true);
|
37 |
+
Mage::dispatchEvent("add_to_cart_before", array('request' => $observer->getControllerAction()->getRequest()));
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
public function hookToControllerActionPostDispatch($observer)
|
42 |
+
{
|
43 |
+
$active = $this->getActive();
|
44 |
+
if (!$active) {
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
|
48 |
+
//Mage::log('router tivoli: '.$observer->getEvent()->getControllerAction()->getFullActionName(), null, 'tracer.log', true);
|
49 |
+
if (($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add')) {
|
50 |
+
|
51 |
+
//Mage::log('hookToControllerActionPostDispatch: '.$observer->getEvent()->getControllerAction()->getFullActionName(),null, 'tracer.log', true);
|
52 |
+
Mage::dispatchEvent("add_to_cart_after", array('request' => $observer->getControllerAction()->getRequest()));
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
public function hookToAddToCartBefore($observer)
|
57 |
+
{
|
58 |
+
$active = $this->getActive();
|
59 |
+
if (!$active) {
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
//Mage::log('function hookToAddToCartBefore: ',null, 'tracer.log', true);
|
64 |
+
$key = Mage::getSingleton('core/session')->getFormKey();
|
65 |
+
$observer->getEvent()->getRequest()->setParam('form_key', $key);
|
66 |
+
$request = $observer->getEvent()->getRequest()->getParams();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function hookToAddToCartAfter($observer)
|
70 |
+
{
|
71 |
+
$active = $this->getActive();
|
72 |
+
if (!$active) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
$request = $observer->getEvent()->getRequest()->getParams();
|
77 |
+
Mage::log("hookToAddToCartAfter " . print_r($request, true) . " is added to cart.", null, 'cart.log', true);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function injectTab(Varien_Event_Observer $observer)
|
81 |
+
{
|
82 |
+
// $active = $this->getActive();
|
83 |
+
// if (!$active) { return; }
|
84 |
+
|
85 |
+
// core_block_abstract_prepare_layout_after
|
86 |
+
|
87 |
+
/* $block Mage_Adminhtml_Block_Catalog_Category_Tabs */
|
88 |
+
$block = $observer->getEvent()->getBlock();
|
89 |
+
|
90 |
+
if ($block instanceof Mage_Adminhtml_Block_Catalog_Category_Tabs) {
|
91 |
+
|
92 |
+
if ($this->_getRequest()->getActionName() == 'edit' || $this->_getRequest()->getParam('type')) {
|
93 |
+
|
94 |
+
$tab_ids = $block->getTabsIds();
|
95 |
+
$tab_name = $tab_ids[3]; // SkyboxCheckout position
|
96 |
+
|
97 |
+
if ($tab_name) {
|
98 |
+
$block->removeTab($tab_name);
|
99 |
+
}
|
100 |
+
|
101 |
+
// SkyboxCheckout Tab
|
102 |
+
$block->addTab('custom_tab', array(
|
103 |
+
'label' => 'SkyboxCheckout',
|
104 |
+
'content' => $block->getLayout()
|
105 |
+
->createBlock('skyboxcatalog/catalog_category_tab_skyboxcheckout')
|
106 |
+
->toHtml()
|
107 |
+
));
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
public function saveCategory(Varien_Event_Observer $observer)
|
113 |
+
{
|
114 |
+
// catalog_category_prepare_save
|
115 |
+
|
116 |
+
// Note: Already know. this is a piece of crap
|
117 |
+
|
118 |
+
/* $category Mage_Catalog_Model_Category */
|
119 |
+
$category = $observer->getEvent()->getCategory();
|
120 |
+
|
121 |
+
$skybox_category_id = $this->_getRequest()->getPost('skybox_category_id');
|
122 |
+
$skybox_category_id_select = $this->_getRequest()->getPost('skybox_category_id_select');
|
123 |
+
$apply_button = $this->_getRequest()->getPost('apply_button');
|
124 |
+
|
125 |
+
if ($skybox_category_id != $category->getData('skybox_category_id')) {
|
126 |
+
//$category->setData('skybox_category_id', $skybox_category_id);
|
127 |
+
$category->setSkyboxCategoryId($skybox_category_id);
|
128 |
+
$msg = "[" . $category->getId() . "] saving skybox_category_id [" . $skybox_category_id . "]";
|
129 |
+
Mage::log($msg, null, 'skyboxcheckout.log', true);
|
130 |
+
}
|
131 |
+
|
132 |
+
if ($skybox_category_id_select != $category->getData('skybox_category_id_select')) {
|
133 |
+
//$category->setData('skybox_category_id_select', $skybox_category_id_select);
|
134 |
+
$category->setSkyboxCategoryIdSelect($skybox_category_id_select);
|
135 |
+
$msg = "[" . $category->getId() . "] saving skybox_category_id_select [" . $skybox_category_id_select . "]";
|
136 |
+
Mage::log($msg, null, 'skyboxcheckout.log', true);
|
137 |
+
}
|
138 |
+
|
139 |
+
if ($skybox_category_id || $skybox_category_id_select) {
|
140 |
+
Mage::log("Commodities saved!", null, 'skyboxcheckout.log', true);
|
141 |
+
try {
|
142 |
+
$category->getResource()->save($category);
|
143 |
+
} catch (Exception $ex) {
|
144 |
+
Mage::log("saveCategory() Exception: " . $ex->getMessage(), null, 'skyboxcheckout.log', true);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
if (isset($apply_button) && $apply_button != 'nothing') {
|
149 |
+
|
150 |
+
$skybox_category_id_select = $this->_getRequest()->getPost('skybox_category_id_select');
|
151 |
+
$skybox_category_id_select = ($skybox_category_id_select) ?
|
152 |
+
$skybox_category_id_select :
|
153 |
+
$category->getData('skybox_category_id_select');
|
154 |
+
|
155 |
+
Mage::log("Apply Button: " . $apply_button, null, 'skyboxcheckout.log', true);
|
156 |
+
switch ($apply_button) {
|
157 |
+
case 'all_products':
|
158 |
+
$categoryIds = array($category->getId());
|
159 |
+
$this->_bulk_commodities($categoryIds, $skybox_category_id_select, true);
|
160 |
+
break;
|
161 |
+
|
162 |
+
case 'all_products_without_commoditites':
|
163 |
+
$categoryIds = array($category->getId());
|
164 |
+
$this->_bulk_commodities($categoryIds, $skybox_category_id_select, false);
|
165 |
+
break;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
return $this;
|
169 |
+
}
|
170 |
+
|
171 |
+
public function setCommodityInForm(Varien_Event_Observer $observer)
|
172 |
+
{
|
173 |
+
// catalog_product_prepare_save
|
174 |
+
|
175 |
+
Mage::log('catalog_product_prepare_save', null, 'skyboxcheckout.log', true);
|
176 |
+
|
177 |
+
$product = $observer->getEvent()->getProduct();
|
178 |
+
$skybox_category_id = $this->_getRequest()->getPost('skybox_category_id');
|
179 |
+
$commodity = $product->getData('skybox_category_id');
|
180 |
+
|
181 |
+
// If the user change commodity manually
|
182 |
+
if ($skybox_category_id && ($skybox_category_id != $product->getData('skybox_category_id'))) {
|
183 |
+
$product->setData('skybox_category_id', $skybox_category_id);
|
184 |
+
$product->getResource()->save($product);
|
185 |
+
return $this;
|
186 |
+
}
|
187 |
+
|
188 |
+
// If commodity already set
|
189 |
+
if ($commodity) {
|
190 |
+
Mage::log('commodity_exist_true', null, 'skyboxcheckout.log', true);
|
191 |
+
return $this;
|
192 |
+
} else {
|
193 |
+
Mage::log('commodity_exist_false', null, 'skyboxcheckout.log', true);
|
194 |
+
$categoryIds = $product->getCategoryIds();
|
195 |
+
|
196 |
+
if (empty($categoryIds)) {
|
197 |
+
return $this;
|
198 |
+
}
|
199 |
+
|
200 |
+
$categoryId = reset($categoryIds); // current
|
201 |
+
|
202 |
+
/* $category Mage_Catalog_Model_Category */
|
203 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
204 |
+
|
205 |
+
$value = $category->getData('skybox_category_id');
|
206 |
+
|
207 |
+
if ($value) {
|
208 |
+
$product->setData('skybox_category_id', $value);
|
209 |
+
$product->getResource()->save($product);
|
210 |
+
} else {
|
211 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
212 |
+
sprintf("The category %s doesn't have any associated commodity.", $category->getData('title'))
|
213 |
+
);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
return $this;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Shortcut to getRequest
|
221 |
+
*/
|
222 |
+
protected function _getRequest()
|
223 |
+
{
|
224 |
+
return Mage::app()->getRequest();
|
225 |
+
}
|
226 |
+
|
227 |
+
private function _bulk_commodities($categoryIds, $value, $allProducts = true)
|
228 |
+
{
|
229 |
+
/* @var $collection Mage_Catalog_Model_Product */
|
230 |
+
$collection = Mage::getModel('catalog/product')
|
231 |
+
->getCollection()
|
232 |
+
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left')
|
233 |
+
->addAttributeToSelect('*')
|
234 |
+
->addAttributeToFilter('category_id', array('in' => $categoryIds));
|
235 |
+
|
236 |
+
if (!$allProducts) {
|
237 |
+
$collection->addAttributeToFilter('skybox_category_id', array('null' => true));
|
238 |
+
}
|
239 |
+
|
240 |
+
$count = count($collection);
|
241 |
+
|
242 |
+
foreach ($collection as $product) {
|
243 |
+
try {
|
244 |
+
/** @var Mage_Catalog_Model_Product $product */
|
245 |
+
$product = $product;
|
246 |
+
|
247 |
+
if ($product->getTypeId() == 'configurable') {
|
248 |
+
/** @var Mage_Catalog_Model_Product $productChild */
|
249 |
+
// $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
|
250 |
+
$childProducts = $product->getTypeInstance()->getUsedProductIds();
|
251 |
+
foreach ($childProducts as $key => $child) {
|
252 |
+
$productChild = Mage::getModel('catalog/product')->load($child);
|
253 |
+
$productChild->setData('skybox_category_id', $value);
|
254 |
+
$productChild->getResource()->save($productChild);
|
255 |
+
}
|
256 |
+
} else {
|
257 |
+
// Only setData if product->getTypeId() is 'simple'
|
258 |
+
$product->setData('skybox_category_id', $value);
|
259 |
+
$product->getResource()->save($product);
|
260 |
+
}
|
261 |
+
} catch (\Exception $ex) {
|
262 |
+
Mage::log("saveCategory() Exception: " . $ex->getMessage(), null, 'skyboxcheckout.log', true);
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
267 |
+
sprintf('%s products have been updated correctly.', $count)
|
268 |
+
);
|
269 |
+
}
|
270 |
+
|
271 |
}
|
app/code/community/Skybox/Catalog/Model/Product/Attribute/Source/Categories.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Catalog
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Catalog
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Catalog_Model_Product_Attribute_Source_Categories extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
|
11 |
-
{
|
12 |
-
public $_options = null;
|
13 |
-
|
14 |
-
public function getAllOptions()
|
15 |
-
{
|
16 |
-
if ($this->_options === null) {
|
17 |
-
/* var @api_checkout Skybox_Checkout_Model_Api_Checkout */
|
18 |
-
$api_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
19 |
-
$categories = $api_checkout->GetCategories();
|
20 |
-
|
21 |
-
$item = array(
|
22 |
-
'value' => '',
|
23 |
-
'label' => '',
|
24 |
-
);
|
25 |
-
|
26 |
-
$data[] = $item;
|
27 |
-
|
28 |
-
foreach ($categories as $obj) {
|
29 |
-
$item = array(
|
30 |
-
'value' => $obj->IdCommoditie,
|
31 |
-
'label' => $obj->Description,
|
32 |
-
);
|
33 |
-
$data[] = $item;
|
34 |
-
}
|
35 |
-
$this->_options = $data;
|
36 |
-
}
|
37 |
-
return $this->_options;
|
38 |
-
}
|
39 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Catalog
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Catalog
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Catalog_Model_Product_Attribute_Source_Categories extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
|
11 |
+
{
|
12 |
+
public $_options = null;
|
13 |
+
|
14 |
+
public function getAllOptions()
|
15 |
+
{
|
16 |
+
if ($this->_options === null) {
|
17 |
+
/* var @api_checkout Skybox_Checkout_Model_Api_Checkout */
|
18 |
+
$api_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
19 |
+
$categories = $api_checkout->GetCategories();
|
20 |
+
|
21 |
+
$item = array(
|
22 |
+
'value' => '',
|
23 |
+
'label' => '',
|
24 |
+
);
|
25 |
+
|
26 |
+
$data[] = $item;
|
27 |
+
|
28 |
+
foreach ($categories as $obj) {
|
29 |
+
$item = array(
|
30 |
+
'value' => $obj->IdCommoditie,
|
31 |
+
'label' => $obj->Description,
|
32 |
+
);
|
33 |
+
$data[] = $item;
|
34 |
+
}
|
35 |
+
$this->_options = $data;
|
36 |
+
}
|
37 |
+
return $this->_options;
|
38 |
+
}
|
39 |
}
|
app/code/community/Skybox/Catalog/Model/Product/Type/Price.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox Checkout
|
4 |
-
*
|
5 |
-
* @category Skybox
|
6 |
-
* @package Skybox_Catalog
|
7 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
*
|
12 |
-
* Skybox overriding product type price
|
13 |
-
*
|
14 |
-
* @author César Tapia M. <ctapia@skyworldint.com>
|
15 |
-
*/
|
16 |
-
class Skybox_Catalog_Model_Product_Type_Price extends Mage_Catalog_Model_Product_Type_Price
|
17 |
-
{
|
18 |
-
protected $_typeApi = 'skyboxcatalog/api_product';
|
19 |
-
protected $_api = null;
|
20 |
-
|
21 |
-
protected function _getApi()
|
22 |
-
{
|
23 |
-
if(null === $this->_api)
|
24 |
-
{
|
25 |
-
$this->_api = Mage::getModel($this->_typeApi);
|
26 |
-
}
|
27 |
-
|
28 |
-
return $this->_api;
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Recupera el precio final del producto
|
33 |
-
*
|
34 |
-
* @param float|null $qty
|
35 |
-
* @param Mage_Catalog_Model_Product $product
|
36 |
-
* @return float
|
37 |
-
*/
|
38 |
-
public function getFinalPrice($qty = null, $product)
|
39 |
-
{
|
40 |
-
/*if(!$this->_getApi()->getErrorAuthenticate() && $this->_getApi()->getLocationAllow())
|
41 |
-
{
|
42 |
-
if(is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
|
43 |
-
return $product->getCalculatedFinalPrice();
|
44 |
-
}
|
45 |
-
|
46 |
-
$finalPrice= $this->getBasePrice($product, $qty);
|
47 |
-
$product->setFinalPrice($finalPrice);
|
48 |
-
|
49 |
-
Mage::dispatchEvent('catalog_product_get_final_price', array('product'=> $product, 'qty'=> $qty));
|
50 |
-
|
51 |
-
$finalPrice = $product->getData('final_price');
|
52 |
-
$finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
|
53 |
-
$finalPrice = max(0, $finalPrice);
|
54 |
-
//Call Calculate
|
55 |
-
$this->_getApi()->CalculatePrice($product->getId(), $finalPrice);
|
56 |
-
//Set final price for product
|
57 |
-
$finalPrice = $this->_getApi()->getResponse()->TotalProduct;
|
58 |
-
$product->setFinalPrice($finalPrice);
|
59 |
-
|
60 |
-
return $finalPrice;
|
61 |
-
}*/
|
62 |
-
return parent::getFinalPrice($qty, $product);
|
63 |
-
}
|
64 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox Checkout
|
4 |
+
*
|
5 |
+
* @category Skybox
|
6 |
+
* @package Skybox_Catalog
|
7 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
*
|
12 |
+
* Skybox overriding product type price
|
13 |
+
*
|
14 |
+
* @author César Tapia M. <ctapia@skyworldint.com>
|
15 |
+
*/
|
16 |
+
class Skybox_Catalog_Model_Product_Type_Price extends Mage_Catalog_Model_Product_Type_Price
|
17 |
+
{
|
18 |
+
protected $_typeApi = 'skyboxcatalog/api_product';
|
19 |
+
protected $_api = null;
|
20 |
+
|
21 |
+
protected function _getApi()
|
22 |
+
{
|
23 |
+
if(null === $this->_api)
|
24 |
+
{
|
25 |
+
$this->_api = Mage::getModel($this->_typeApi);
|
26 |
+
}
|
27 |
+
|
28 |
+
return $this->_api;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Recupera el precio final del producto
|
33 |
+
*
|
34 |
+
* @param float|null $qty
|
35 |
+
* @param Mage_Catalog_Model_Product $product
|
36 |
+
* @return float
|
37 |
+
*/
|
38 |
+
public function getFinalPrice($qty = null, $product)
|
39 |
+
{
|
40 |
+
/*if(!$this->_getApi()->getErrorAuthenticate() && $this->_getApi()->getLocationAllow())
|
41 |
+
{
|
42 |
+
if(is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
|
43 |
+
return $product->getCalculatedFinalPrice();
|
44 |
+
}
|
45 |
+
|
46 |
+
$finalPrice= $this->getBasePrice($product, $qty);
|
47 |
+
$product->setFinalPrice($finalPrice);
|
48 |
+
|
49 |
+
Mage::dispatchEvent('catalog_product_get_final_price', array('product'=> $product, 'qty'=> $qty));
|
50 |
+
|
51 |
+
$finalPrice = $product->getData('final_price');
|
52 |
+
$finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
|
53 |
+
$finalPrice = max(0, $finalPrice);
|
54 |
+
//Call Calculate
|
55 |
+
$this->_getApi()->CalculatePrice($product->getId(), $finalPrice);
|
56 |
+
//Set final price for product
|
57 |
+
$finalPrice = $this->_getApi()->getResponse()->TotalProduct;
|
58 |
+
$product->setFinalPrice($finalPrice);
|
59 |
+
|
60 |
+
return $finalPrice;
|
61 |
+
}*/
|
62 |
+
return parent::getFinalPrice($qty, $product);
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Skybox/Catalog/Model/Resource/Setup.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Catalog
|
5 |
-
*
|
6 |
-
* @category Mage
|
7 |
-
* @package Skybox_Catalog
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Catalog_Model_Resource_Setup extends Mage_Sales_Model_Mysql4_Setup
|
11 |
-
{
|
12 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Catalog
|
5 |
+
*
|
6 |
+
* @category Mage
|
7 |
+
* @package Skybox_Catalog
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Catalog_Model_Resource_Setup extends Mage_Sales_Model_Mysql4_Setup
|
11 |
+
{
|
12 |
}
|
app/code/community/Skybox/Catalog/etc/config.xml
CHANGED
@@ -1,175 +1,175 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<config>
|
3 |
-
<default>
|
4 |
-
<settings>
|
5 |
-
<typeIntegration>1</typeIntegration>
|
6 |
-
<codeShop>00248</codeShop>
|
7 |
-
</settings>
|
8 |
-
</default>
|
9 |
-
<modules>
|
10 |
-
<Skybox_Catalog>
|
11 |
-
<version>0.1.0</version>
|
12 |
-
<codePool>community</codePool>
|
13 |
-
</Skybox_Catalog>
|
14 |
-
</modules>
|
15 |
-
<global>
|
16 |
-
|
17 |
-
<blocks>
|
18 |
-
<skyboxcatalog>
|
19 |
-
<class>Skybox_Catalog_Block</class>
|
20 |
-
</skyboxcatalog>
|
21 |
-
<catalog>
|
22 |
-
<rewrite>
|
23 |
-
<product_price>Skybox_Catalog_Block_Product_Price</product_price>
|
24 |
-
<product_widget_new>Skybox_Catalog_Block_Product_Widget_New</product_widget_new>
|
25 |
-
<product_list>Skybox_Catalog_Block_Product_List</product_list>
|
26 |
-
</rewrite>
|
27 |
-
</catalog>
|
28 |
-
<bundle>
|
29 |
-
<rewrite>
|
30 |
-
<catalog_product_price>Skybox_Catalog_Block_Bundle_Price</catalog_product_price>
|
31 |
-
</rewrite>
|
32 |
-
</bundle>
|
33 |
-
<!--
|
34 |
-
<adminhtml>
|
35 |
-
<rewrite>
|
36 |
-
<catalog_category_tabs>Skybox_Catalog_Block_Catalog_Category_Tabs</catalog_category_tabs>
|
37 |
-
</rewrite>
|
38 |
-
</adminhtml>
|
39 |
-
-->
|
40 |
-
</blocks>
|
41 |
-
|
42 |
-
<models>
|
43 |
-
<skyboxcatalog>
|
44 |
-
<class>Skybox_Catalog_Model</class>
|
45 |
-
</skyboxcatalog>
|
46 |
-
<!--
|
47 |
-
<catalog>
|
48 |
-
<rewrite>
|
49 |
-
<product_type_price>Skybox_Catalog_Model_Product_Type_Price</product_type_price>
|
50 |
-
</rewrite>
|
51 |
-
</catalog>
|
52 |
-
-->
|
53 |
-
</models>
|
54 |
-
|
55 |
-
<resources>
|
56 |
-
<skyboxcatalog_setup>
|
57 |
-
<setup>
|
58 |
-
<module>Skybox_Catalog</module>
|
59 |
-
<class>Skybox_Catalog_Model_Resource_Setup</class>
|
60 |
-
</setup>
|
61 |
-
<connection>
|
62 |
-
<use>core_setup</use>
|
63 |
-
</connection>
|
64 |
-
</skyboxcatalog_setup>
|
65 |
-
</resources>
|
66 |
-
|
67 |
-
<events>
|
68 |
-
<!-- Observers for Magento 1.8.x issues with Block Caching -->
|
69 |
-
<controller_action_predispatch>
|
70 |
-
<observers>
|
71 |
-
<controller_action_before>
|
72 |
-
<class>skyboxcatalog/observer</class>
|
73 |
-
<method>hookToControllerActionPreDispatch</method>
|
74 |
-
</controller_action_before>
|
75 |
-
</observers>
|
76 |
-
</controller_action_predispatch>
|
77 |
-
<controller_action_postdispatch>
|
78 |
-
<observers>
|
79 |
-
<controller_action_after>
|
80 |
-
<class>skyboxcatalog/observer</class>
|
81 |
-
<method>hookToControllerActionPostDispatch</method>
|
82 |
-
</controller_action_after>
|
83 |
-
</observers>
|
84 |
-
</controller_action_postdispatch>
|
85 |
-
<add_to_cart_before>
|
86 |
-
<observers>
|
87 |
-
<add_to_cart_before>
|
88 |
-
<class>skyboxcatalog/observer</class>
|
89 |
-
<method>hookToAddToCartBefore</method>
|
90 |
-
</add_to_cart_before>
|
91 |
-
</observers>
|
92 |
-
</add_to_cart_before>
|
93 |
-
<add_to_cart_after>
|
94 |
-
<observers>
|
95 |
-
<add_to_cart_after>
|
96 |
-
<class>skyboxcatalog/observer</class>
|
97 |
-
<method>hookToAddToCartAfter</method>
|
98 |
-
</add_to_cart_after>
|
99 |
-
</observers>
|
100 |
-
</add_to_cart_after>
|
101 |
-
<!-- /Observers -->
|
102 |
-
|
103 |
-
<!--
|
104 |
-
<adminhtml_catalog_category_tabs>
|
105 |
-
<observers>
|
106 |
-
<skyboxcatalog_customtab_observer>
|
107 |
-
<class>skyboxcatalog/observer</class>
|
108 |
-
<method>hookToAddTabToCategory</method>
|
109 |
-
</skyboxcatalog_customtab_observer>
|
110 |
-
</observers>
|
111 |
-
</adminhtml_catalog_category_tabs>
|
112 |
-
-->
|
113 |
-
|
114 |
-
<catalog_category_prepare_save>
|
115 |
-
<observers>
|
116 |
-
<skyboxcatalog_category_prepare_save>
|
117 |
-
<class>skyboxcatalog/observer</class>
|
118 |
-
<method>saveCategory</method>
|
119 |
-
</skyboxcatalog_category_prepare_save>
|
120 |
-
</observers>
|
121 |
-
</catalog_category_prepare_save>
|
122 |
-
|
123 |
-
</events>
|
124 |
-
</global>
|
125 |
-
|
126 |
-
|
127 |
-
<adminhtml>
|
128 |
-
<events>
|
129 |
-
|
130 |
-
<!--
|
131 |
-
|
132 |
-
<adminhtml_catalog_category_edit_prepare_form>
|
133 |
-
<observers>
|
134 |
-
<bueyada_catalog_observer>
|
135 |
-
<type>singleton</type>
|
136 |
-
<class>bueyada_catalog/observer</class>
|
137 |
-
<method>addCategoryTab</method>
|
138 |
-
</bueyada_catalog_observer>
|
139 |
-
</observers>
|
140 |
-
</adminhtml_catalog_category_edit_prepare_form>
|
141 |
-
|
142 |
-
-->
|
143 |
-
|
144 |
-
<core_block_abstract_prepare_layout_after>
|
145 |
-
<observers>
|
146 |
-
<skybox_catalog_observer>
|
147 |
-
<type>singleton</type>
|
148 |
-
<class>skyboxcatalog/observer</class>
|
149 |
-
<method>injectTab</method>
|
150 |
-
</skybox_catalog_observer>
|
151 |
-
</observers>
|
152 |
-
</core_block_abstract_prepare_layout_after>
|
153 |
-
|
154 |
-
<catalog_product_prepare_save>
|
155 |
-
<observers>
|
156 |
-
<skybox_catalog_observer>
|
157 |
-
<type>singleton</type>
|
158 |
-
<class>skyboxcatalog/observer</class>
|
159 |
-
<method>setCommodityInForm</method>
|
160 |
-
</skybox_catalog_observer>
|
161 |
-
</observers>
|
162 |
-
</catalog_product_prepare_save>
|
163 |
-
|
164 |
-
</events>
|
165 |
-
|
166 |
-
<layout>
|
167 |
-
<updates>
|
168 |
-
<skyboxcatalog>
|
169 |
-
<file>skyboxcatalog.xml</file>
|
170 |
-
</skyboxcatalog>
|
171 |
-
</updates>
|
172 |
-
</layout>
|
173 |
-
</adminhtml>
|
174 |
-
|
175 |
</config>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<config>
|
3 |
+
<default>
|
4 |
+
<settings>
|
5 |
+
<typeIntegration>1</typeIntegration>
|
6 |
+
<codeShop>00248</codeShop>
|
7 |
+
</settings>
|
8 |
+
</default>
|
9 |
+
<modules>
|
10 |
+
<Skybox_Catalog>
|
11 |
+
<version>0.1.0</version>
|
12 |
+
<codePool>community</codePool>
|
13 |
+
</Skybox_Catalog>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
|
17 |
+
<blocks>
|
18 |
+
<skyboxcatalog>
|
19 |
+
<class>Skybox_Catalog_Block</class>
|
20 |
+
</skyboxcatalog>
|
21 |
+
<catalog>
|
22 |
+
<rewrite>
|
23 |
+
<product_price>Skybox_Catalog_Block_Product_Price</product_price>
|
24 |
+
<product_widget_new>Skybox_Catalog_Block_Product_Widget_New</product_widget_new>
|
25 |
+
<product_list>Skybox_Catalog_Block_Product_List</product_list>
|
26 |
+
</rewrite>
|
27 |
+
</catalog>
|
28 |
+
<bundle>
|
29 |
+
<rewrite>
|
30 |
+
<catalog_product_price>Skybox_Catalog_Block_Bundle_Price</catalog_product_price>
|
31 |
+
</rewrite>
|
32 |
+
</bundle>
|
33 |
+
<!--
|
34 |
+
<adminhtml>
|
35 |
+
<rewrite>
|
36 |
+
<catalog_category_tabs>Skybox_Catalog_Block_Catalog_Category_Tabs</catalog_category_tabs>
|
37 |
+
</rewrite>
|
38 |
+
</adminhtml>
|
39 |
+
-->
|
40 |
+
</blocks>
|
41 |
+
|
42 |
+
<models>
|
43 |
+
<skyboxcatalog>
|
44 |
+
<class>Skybox_Catalog_Model</class>
|
45 |
+
</skyboxcatalog>
|
46 |
+
<!--
|
47 |
+
<catalog>
|
48 |
+
<rewrite>
|
49 |
+
<product_type_price>Skybox_Catalog_Model_Product_Type_Price</product_type_price>
|
50 |
+
</rewrite>
|
51 |
+
</catalog>
|
52 |
+
-->
|
53 |
+
</models>
|
54 |
+
|
55 |
+
<resources>
|
56 |
+
<skyboxcatalog_setup>
|
57 |
+
<setup>
|
58 |
+
<module>Skybox_Catalog</module>
|
59 |
+
<class>Skybox_Catalog_Model_Resource_Setup</class>
|
60 |
+
</setup>
|
61 |
+
<connection>
|
62 |
+
<use>core_setup</use>
|
63 |
+
</connection>
|
64 |
+
</skyboxcatalog_setup>
|
65 |
+
</resources>
|
66 |
+
|
67 |
+
<events>
|
68 |
+
<!-- Observers for Magento 1.8.x issues with Block Caching -->
|
69 |
+
<controller_action_predispatch>
|
70 |
+
<observers>
|
71 |
+
<controller_action_before>
|
72 |
+
<class>skyboxcatalog/observer</class>
|
73 |
+
<method>hookToControllerActionPreDispatch</method>
|
74 |
+
</controller_action_before>
|
75 |
+
</observers>
|
76 |
+
</controller_action_predispatch>
|
77 |
+
<controller_action_postdispatch>
|
78 |
+
<observers>
|
79 |
+
<controller_action_after>
|
80 |
+
<class>skyboxcatalog/observer</class>
|
81 |
+
<method>hookToControllerActionPostDispatch</method>
|
82 |
+
</controller_action_after>
|
83 |
+
</observers>
|
84 |
+
</controller_action_postdispatch>
|
85 |
+
<add_to_cart_before>
|
86 |
+
<observers>
|
87 |
+
<add_to_cart_before>
|
88 |
+
<class>skyboxcatalog/observer</class>
|
89 |
+
<method>hookToAddToCartBefore</method>
|
90 |
+
</add_to_cart_before>
|
91 |
+
</observers>
|
92 |
+
</add_to_cart_before>
|
93 |
+
<add_to_cart_after>
|
94 |
+
<observers>
|
95 |
+
<add_to_cart_after>
|
96 |
+
<class>skyboxcatalog/observer</class>
|
97 |
+
<method>hookToAddToCartAfter</method>
|
98 |
+
</add_to_cart_after>
|
99 |
+
</observers>
|
100 |
+
</add_to_cart_after>
|
101 |
+
<!-- /Observers -->
|
102 |
+
|
103 |
+
<!--
|
104 |
+
<adminhtml_catalog_category_tabs>
|
105 |
+
<observers>
|
106 |
+
<skyboxcatalog_customtab_observer>
|
107 |
+
<class>skyboxcatalog/observer</class>
|
108 |
+
<method>hookToAddTabToCategory</method>
|
109 |
+
</skyboxcatalog_customtab_observer>
|
110 |
+
</observers>
|
111 |
+
</adminhtml_catalog_category_tabs>
|
112 |
+
-->
|
113 |
+
|
114 |
+
<catalog_category_prepare_save>
|
115 |
+
<observers>
|
116 |
+
<skyboxcatalog_category_prepare_save>
|
117 |
+
<class>skyboxcatalog/observer</class>
|
118 |
+
<method>saveCategory</method>
|
119 |
+
</skyboxcatalog_category_prepare_save>
|
120 |
+
</observers>
|
121 |
+
</catalog_category_prepare_save>
|
122 |
+
|
123 |
+
</events>
|
124 |
+
</global>
|
125 |
+
|
126 |
+
|
127 |
+
<adminhtml>
|
128 |
+
<events>
|
129 |
+
|
130 |
+
<!--
|
131 |
+
|
132 |
+
<adminhtml_catalog_category_edit_prepare_form>
|
133 |
+
<observers>
|
134 |
+
<bueyada_catalog_observer>
|
135 |
+
<type>singleton</type>
|
136 |
+
<class>bueyada_catalog/observer</class>
|
137 |
+
<method>addCategoryTab</method>
|
138 |
+
</bueyada_catalog_observer>
|
139 |
+
</observers>
|
140 |
+
</adminhtml_catalog_category_edit_prepare_form>
|
141 |
+
|
142 |
+
-->
|
143 |
+
|
144 |
+
<core_block_abstract_prepare_layout_after>
|
145 |
+
<observers>
|
146 |
+
<skybox_catalog_observer>
|
147 |
+
<type>singleton</type>
|
148 |
+
<class>skyboxcatalog/observer</class>
|
149 |
+
<method>injectTab</method>
|
150 |
+
</skybox_catalog_observer>
|
151 |
+
</observers>
|
152 |
+
</core_block_abstract_prepare_layout_after>
|
153 |
+
|
154 |
+
<catalog_product_prepare_save>
|
155 |
+
<observers>
|
156 |
+
<skybox_catalog_observer>
|
157 |
+
<type>singleton</type>
|
158 |
+
<class>skyboxcatalog/observer</class>
|
159 |
+
<method>setCommodityInForm</method>
|
160 |
+
</skybox_catalog_observer>
|
161 |
+
</observers>
|
162 |
+
</catalog_product_prepare_save>
|
163 |
+
|
164 |
+
</events>
|
165 |
+
|
166 |
+
<layout>
|
167 |
+
<updates>
|
168 |
+
<skyboxcatalog>
|
169 |
+
<file>skyboxcatalog.xml</file>
|
170 |
+
</skyboxcatalog>
|
171 |
+
</updates>
|
172 |
+
</layout>
|
173 |
+
</adminhtml>
|
174 |
+
|
175 |
</config>
|
app/code/community/Skybox/Catalog/sql/skyboxcatalog_setup/mysql4-install-0.1.0.php
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/* @var $installer Skybox_Catalog_Model_Resource_Setup */
|
4 |
-
$installer = $this;
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
8 |
-
|
9 |
-
// Product
|
10 |
-
$setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'skybox_category_id', array(
|
11 |
-
'group' => 'Prices',
|
12 |
-
'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
13 |
-
'backend' => 'eav/entity_attribute_backend_array',
|
14 |
-
'frontend' => '',
|
15 |
-
'label' => 'SkyboxCheckout Category',
|
16 |
-
'input' => 'select',
|
17 |
-
'class' => '',
|
18 |
-
'source' => 'skyboxcatalog/product_attribute_source_categories',
|
19 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
20 |
-
'visible' => true,
|
21 |
-
'required' => false,
|
22 |
-
'user_defined' => true,
|
23 |
-
'default' => '',
|
24 |
-
'searchable' => false,
|
25 |
-
'filterable' => true,
|
26 |
-
'comparable' => false,
|
27 |
-
'visible_on_front' => true,
|
28 |
-
'unique' => false,
|
29 |
-
'apply_to' => 'simple,configurable,virtual',
|
30 |
-
'is_configurable' => false
|
31 |
-
));
|
32 |
-
|
33 |
-
$setup->addAttributeToGroup(Mage_Catalog_Model_Product::ENTITY, 'Default', 'Prices', 'skybox_category_id', 100);
|
34 |
-
|
35 |
-
// Category
|
36 |
-
$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'skybox_category_id', array(
|
37 |
-
//$setup->updateAttribute('catalog_category', 'skybox_category_id', array(
|
38 |
-
'group' => 'SkyboxCheckout',
|
39 |
-
'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
40 |
-
'backend' => 'eav/entity_attribute_backend_array',
|
41 |
-
'frontend' => '',
|
42 |
-
'label' => 'Default Commodity',
|
43 |
-
'input' => 'select',
|
44 |
-
'source' => 'skyboxcatalog/product_attribute_source_categories',
|
45 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
46 |
-
'visible' => true,
|
47 |
-
'required' => false,
|
48 |
-
'user_defined' => true,
|
49 |
-
'default' => ''
|
50 |
-
));
|
51 |
-
|
52 |
-
// Category
|
53 |
-
$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'skybox_category_id_select', array(
|
54 |
-
//$setup->updateAttribute('catalog_category', 'skybox_category_id', array(
|
55 |
-
'group' => 'SkyboxCheckout',
|
56 |
-
'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
57 |
-
'backend' => 'eav/entity_attribute_backend_array',
|
58 |
-
'frontend' => '',
|
59 |
-
'label' => 'Select Commodity',
|
60 |
-
'input' => 'select',
|
61 |
-
'source' => 'skyboxcatalog/product_attribute_source_categories',
|
62 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
63 |
-
'visible' => true,
|
64 |
-
'required' => false,
|
65 |
-
'user_defined' => true,
|
66 |
-
'default' => ''
|
67 |
-
));
|
68 |
-
|
69 |
-
$setup->addAttributeToGroup(Mage_Catalog_Model_Category::ENTITY, 'Default', 'SkyboxCheckout', 'skybox_category_id', 100);
|
70 |
-
|
71 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* @var $installer Skybox_Catalog_Model_Resource_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
8 |
+
|
9 |
+
// Product
|
10 |
+
$setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'skybox_category_id', array(
|
11 |
+
'group' => 'Prices',
|
12 |
+
'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
13 |
+
'backend' => 'eav/entity_attribute_backend_array',
|
14 |
+
'frontend' => '',
|
15 |
+
'label' => 'SkyboxCheckout Category',
|
16 |
+
'input' => 'select',
|
17 |
+
'class' => '',
|
18 |
+
'source' => 'skyboxcatalog/product_attribute_source_categories',
|
19 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
20 |
+
'visible' => true,
|
21 |
+
'required' => false,
|
22 |
+
'user_defined' => true,
|
23 |
+
'default' => '',
|
24 |
+
'searchable' => false,
|
25 |
+
'filterable' => true,
|
26 |
+
'comparable' => false,
|
27 |
+
'visible_on_front' => true,
|
28 |
+
'unique' => false,
|
29 |
+
'apply_to' => 'simple,configurable,virtual',
|
30 |
+
'is_configurable' => false
|
31 |
+
));
|
32 |
+
|
33 |
+
$setup->addAttributeToGroup(Mage_Catalog_Model_Product::ENTITY, 'Default', 'Prices', 'skybox_category_id', 100);
|
34 |
+
|
35 |
+
// Category
|
36 |
+
$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'skybox_category_id', array(
|
37 |
+
//$setup->updateAttribute('catalog_category', 'skybox_category_id', array(
|
38 |
+
'group' => 'SkyboxCheckout',
|
39 |
+
'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
40 |
+
'backend' => 'eav/entity_attribute_backend_array',
|
41 |
+
'frontend' => '',
|
42 |
+
'label' => 'Default Commodity',
|
43 |
+
'input' => 'select',
|
44 |
+
'source' => 'skyboxcatalog/product_attribute_source_categories',
|
45 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
46 |
+
'visible' => true,
|
47 |
+
'required' => false,
|
48 |
+
'user_defined' => true,
|
49 |
+
'default' => ''
|
50 |
+
));
|
51 |
+
|
52 |
+
// Category
|
53 |
+
$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'skybox_category_id_select', array(
|
54 |
+
//$setup->updateAttribute('catalog_category', 'skybox_category_id', array(
|
55 |
+
'group' => 'SkyboxCheckout',
|
56 |
+
'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
57 |
+
'backend' => 'eav/entity_attribute_backend_array',
|
58 |
+
'frontend' => '',
|
59 |
+
'label' => 'Select Commodity',
|
60 |
+
'input' => 'select',
|
61 |
+
'source' => 'skyboxcatalog/product_attribute_source_categories',
|
62 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
63 |
+
'visible' => true,
|
64 |
+
'required' => false,
|
65 |
+
'user_defined' => true,
|
66 |
+
'default' => ''
|
67 |
+
));
|
68 |
+
|
69 |
+
$setup->addAttributeToGroup(Mage_Catalog_Model_Category::ENTITY, 'Default', 'SkyboxCheckout', 'skybox_category_id', 100);
|
70 |
+
|
71 |
$installer->endSetup();
|
app/code/community/Skybox/Checkout/Block/Cart/Item/Renderer.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer
|
11 |
-
{
|
12 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer
|
11 |
+
{
|
12 |
}
|
app/code/community/Skybox/Checkout/Block/Cart/Sidebar.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Block_Cart_Sidebar extends Mage_Checkout_Block_Cart_Sidebar
|
11 |
-
{
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Get shopping cart subtotal.
|
15 |
-
*
|
16 |
-
* It will include tax, if required by config settings.
|
17 |
-
*
|
18 |
-
* @param bool $skipTax flag for getting price with tax or not. Ignored in case when we display just subtotal incl.tax
|
19 |
-
* @return decimal
|
20 |
-
*/
|
21 |
-
public function getSubtotal($skipTax = true)
|
22 |
-
{
|
23 |
-
$quote = $this->getQuote();
|
24 |
-
|
25 |
-
/* $address Mage_Sales_Model_Quote_Address */
|
26 |
-
$address = $quote->getShippingAddress();
|
27 |
-
|
28 |
-
//$subtotal = $address->getSubtotalSkybox();
|
29 |
-
$subtotal = $address->getSubtotal();
|
30 |
-
return $subtotal;
|
31 |
-
}
|
32 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Block_Cart_Sidebar extends Mage_Checkout_Block_Cart_Sidebar
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Get shopping cart subtotal.
|
15 |
+
*
|
16 |
+
* It will include tax, if required by config settings.
|
17 |
+
*
|
18 |
+
* @param bool $skipTax flag for getting price with tax or not. Ignored in case when we display just subtotal incl.tax
|
19 |
+
* @return decimal
|
20 |
+
*/
|
21 |
+
public function getSubtotal($skipTax = true)
|
22 |
+
{
|
23 |
+
$quote = $this->getQuote();
|
24 |
+
|
25 |
+
/* $address Mage_Sales_Model_Quote_Address */
|
26 |
+
$address = $quote->getShippingAddress();
|
27 |
+
|
28 |
+
//$subtotal = $address->getSubtotalSkybox();
|
29 |
+
$subtotal = $address->getSubtotal();
|
30 |
+
return $subtotal;
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Skybox/Checkout/Block/Cart/Totals.php
CHANGED
@@ -1,171 +1,157 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
protected $
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
$
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
}
|
123 |
-
return
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
*
|
128 |
-
*
|
129 |
-
* @return
|
130 |
-
*/
|
131 |
-
public function
|
132 |
-
{
|
133 |
-
$
|
134 |
-
if ($
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
*
|
143 |
-
*
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
if ($
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
* @return Mage_Sales_Model_Quote
|
159 |
-
*/
|
160 |
-
public function getQuote()
|
161 |
-
{
|
162 |
-
if ($this->getCustomQuote()) {
|
163 |
-
return $this->getCustomQuote();
|
164 |
-
}
|
165 |
-
|
166 |
-
if (null === $this->_quote) {
|
167 |
-
$this->_quote = $this->getCheckout()->getQuote();
|
168 |
-
}
|
169 |
-
return $this->_quote;
|
170 |
-
}
|
171 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Abstract
|
11 |
+
{
|
12 |
+
protected $_totalRenderers;
|
13 |
+
protected $_defaultRenderer = 'checkout/total_default';
|
14 |
+
protected $_totals = null;
|
15 |
+
|
16 |
+
public function getTotals()
|
17 |
+
{
|
18 |
+
if (is_null($this->_totals)) {
|
19 |
+
return parent::getTotals();
|
20 |
+
}
|
21 |
+
return $this->_totals;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function setTotals($value)
|
25 |
+
{
|
26 |
+
$this->_totals = $value;
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _getTotalRenderer($code)
|
31 |
+
{
|
32 |
+
$blockName = $code . '_total_renderer';
|
33 |
+
$block = $this->getLayout()->getBlock($blockName);
|
34 |
+
if (!$block) {
|
35 |
+
$block = $this->_defaultRenderer;
|
36 |
+
$config = Mage::getConfig()->getNode("global/sales/quote/totals/{$code}/renderer");
|
37 |
+
if ($config) {
|
38 |
+
$block = (string)$config;
|
39 |
+
}
|
40 |
+
|
41 |
+
$block = $this->getLayout()->createBlock($block, $blockName);
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Transfer totals to renderer
|
45 |
+
*/
|
46 |
+
$block->setTotals($this->getTotals());
|
47 |
+
return $block;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function renderTotal($total, $area = null, $colspan = 1)
|
51 |
+
{
|
52 |
+
$code = $total->getCode();
|
53 |
+
/**
|
54 |
+
* Integration 3 start, show price shop in cart*
|
55 |
+
*/
|
56 |
+
$allowRunByIntegration3 = true;
|
57 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
58 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
59 |
+
if ($typeIntegration == 3) {
|
60 |
+
$allowRunByIntegration3 = false;
|
61 |
+
}
|
62 |
+
|
63 |
+
$locationAllow = Mage::getModel('skyboxcheckout/api_checkout')->getLocationAllow();
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Integration 3 end, show price shop in cart*
|
67 |
+
*/
|
68 |
+
if ($allowRunByIntegration3 && $locationAllow) {
|
69 |
+
if ($code != "subtotal") {
|
70 |
+
if ($total->getAs()) {
|
71 |
+
$code = $total->getAs();
|
72 |
+
}
|
73 |
+
return $this->_getTotalRenderer($code)
|
74 |
+
->setTotal($total)
|
75 |
+
->setColspan($colspan)
|
76 |
+
->setRenderingArea(is_null($area) ? -1 : $area)
|
77 |
+
->toHtml();
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
if ($total->getAs()) {
|
81 |
+
$code = $total->getAs();
|
82 |
+
}
|
83 |
+
return $this->_getTotalRenderer($code)
|
84 |
+
->setTotal($total)
|
85 |
+
->setColspan($colspan)
|
86 |
+
->setRenderingArea(is_null($area) ? -1 : $area)
|
87 |
+
->toHtml();
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Render totals html for specific totals area (footer, body)
|
95 |
+
*
|
96 |
+
* @param null|string $area
|
97 |
+
* @param int $colspan
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
public function renderTotals($area = null, $colspan = 1)
|
101 |
+
{
|
102 |
+
$html = '';
|
103 |
+
foreach ($this->getTotals() as $total) {
|
104 |
+
if ($total->getArea() != $area && $area != -1) {
|
105 |
+
continue;
|
106 |
+
}
|
107 |
+
$html .= $this->renderTotal($total, $area, $colspan);
|
108 |
+
}
|
109 |
+
return $html;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Check if we have display grand total in base currency
|
114 |
+
*
|
115 |
+
* @return bool
|
116 |
+
*/
|
117 |
+
public function needDisplayBaseGrandtotal()
|
118 |
+
{
|
119 |
+
$quote = $this->getQuote();
|
120 |
+
if ($quote->getBaseCurrencyCode() != $quote->getQuoteCurrencyCode()) {
|
121 |
+
return true;
|
122 |
+
}
|
123 |
+
return false;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get formated in base currency base grand total value
|
128 |
+
*
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function displayBaseGrandtotal()
|
132 |
+
{
|
133 |
+
$firstTotal = reset($this->_totals);
|
134 |
+
if ($firstTotal) {
|
135 |
+
$total = $firstTotal->getAddress()->getBaseGrandTotal();
|
136 |
+
return Mage::app()->getStore()->getBaseCurrency()->format($total, array(), true);
|
137 |
+
}
|
138 |
+
return '-';
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Get active or custom quote
|
143 |
+
*
|
144 |
+
* @return Mage_Sales_Model_Quote
|
145 |
+
*/
|
146 |
+
public function getQuote()
|
147 |
+
{
|
148 |
+
if ($this->getCustomQuote()) {
|
149 |
+
return $this->getCustomQuote();
|
150 |
+
}
|
151 |
+
|
152 |
+
if (null === $this->_quote) {
|
153 |
+
$this->_quote = $this->getCheckout()->getQuote();
|
154 |
+
}
|
155 |
+
return $this->_quote;
|
156 |
+
}
|
157 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Skybox/Checkout/Block/Checkout/Cart.php
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Checkout
|
23 |
-
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Shopping cart block
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Checkout
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Skybox_Checkout_Block_Checkout_Cart extends Mage_Checkout_Block_Cart
|
35 |
-
{
|
36 |
-
|
37 |
-
public function getCheckoutUrl()
|
38 |
-
{
|
39 |
-
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
40 |
-
return parent::getCheckoutUrl();
|
41 |
-
}
|
42 |
-
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Checkout
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shopping cart block
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Checkout
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Skybox_Checkout_Block_Checkout_Cart extends Mage_Checkout_Block_Cart
|
35 |
+
{
|
36 |
+
|
37 |
+
public function getCheckoutUrl()
|
38 |
+
{
|
39 |
+
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
40 |
+
return parent::getCheckoutUrl();
|
41 |
+
}
|
42 |
+
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Cart/Sidebar.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
class Skybox_Checkout_Block_Checkout_Cart_Sidebar extends Mage_Checkout_Block_Cart_Sidebar
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Get one page checkout page url
|
6 |
-
*
|
7 |
-
* @return bool
|
8 |
-
*/
|
9 |
-
public function getCheckoutUrl()
|
10 |
-
{
|
11 |
-
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
12 |
-
return parent::getCheckoutUrl();
|
13 |
-
}
|
14 |
-
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
15 |
-
}
|
16 |
-
}
|
1 |
+
<?php
|
2 |
+
class Skybox_Checkout_Block_Checkout_Cart_Sidebar extends Mage_Checkout_Block_Cart_Sidebar
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Get one page checkout page url
|
6 |
+
*
|
7 |
+
* @return bool
|
8 |
+
*/
|
9 |
+
public function getCheckoutUrl()
|
10 |
+
{
|
11 |
+
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
12 |
+
return parent::getCheckoutUrl();
|
13 |
+
}
|
14 |
+
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Links.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
class Skybox_Checkout_Block_Checkout_Links extends Mage_Checkout_Block_Links
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Add link on checkout page to parent block
|
6 |
-
*
|
7 |
-
* @return Mage_Checkout_Block_Links
|
8 |
-
*/
|
9 |
-
public function addCheckoutLink()
|
10 |
-
{
|
11 |
-
//Mage::log('get addCheckoutLink skybox', null, 'tracer.log', true);
|
12 |
-
|
13 |
-
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
14 |
-
return parent::addCheckoutLink();
|
15 |
-
}
|
16 |
-
|
17 |
-
if (!$this->helper('checkout')->canOnepageCheckout()) {
|
18 |
-
return $this;
|
19 |
-
}
|
20 |
-
if ($parentBlock = $this->getParentBlock()) {
|
21 |
-
$text = $this->__('Checkout');
|
22 |
-
$parentBlock->addLink($text, 'skbcheckout/international', $text, true, array('_secure'=>true), 60, null, 'class="top-link-skybox"');
|
23 |
-
}
|
24 |
-
return $this;
|
25 |
-
}
|
26 |
-
}
|
1 |
+
<?php
|
2 |
+
class Skybox_Checkout_Block_Checkout_Links extends Mage_Checkout_Block_Links
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Add link on checkout page to parent block
|
6 |
+
*
|
7 |
+
* @return Mage_Checkout_Block_Links
|
8 |
+
*/
|
9 |
+
public function addCheckoutLink()
|
10 |
+
{
|
11 |
+
//Mage::log('get addCheckoutLink skybox', null, 'tracer.log', true);
|
12 |
+
|
13 |
+
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
14 |
+
return parent::addCheckoutLink();
|
15 |
+
}
|
16 |
+
|
17 |
+
if (!$this->helper('checkout')->canOnepageCheckout()) {
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
if ($parentBlock = $this->getParentBlock()) {
|
21 |
+
$text = $this->__('Checkout');
|
22 |
+
$parentBlock->addLink($text, 'skbcheckout/international', $text, true, array('_secure'=>true), 60, null, 'class="top-link-skybox"');
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Onepage/Link.php
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
class Skybox_Checkout_Block_Checkout_Onepage_Link extends Mage_Checkout_Block_Onepage_Link
|
3 |
-
{
|
4 |
-
public function getCheckoutUrl()
|
5 |
-
{
|
6 |
-
// TODO: Refactoring
|
7 |
-
|
8 |
-
// $isEnabled = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
9 |
-
$isEnabled = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Integration 3 start
|
13 |
-
* Give to button a url by default in case is type 3
|
14 |
-
*/
|
15 |
-
$api = Mage::getModel('skyboxcatalog/api_product');
|
16 |
-
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
17 |
-
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
18 |
-
if (($api->getLocationAllow()==3) && $typeIntegration==3) {
|
19 |
-
return parent::getCheckoutUrl();
|
20 |
-
}
|
21 |
-
/**
|
22 |
-
* Integration 3 end
|
23 |
-
*/
|
24 |
-
|
25 |
-
if($isEnabled) {
|
26 |
-
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
27 |
-
}
|
28 |
-
/*
|
29 |
-
if (Mage::helper('onestepcheckout')->isRewriteCheckoutLinksEnabled()){
|
30 |
-
return $this->getUrl('onestepcheckout', array('_secure'=>true));
|
31 |
-
}
|
32 |
-
*/
|
33 |
-
/*
|
34 |
-
Mage::log('get getCheckoutUrl skybox', null, 'tracer.log', true);
|
35 |
-
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
36 |
-
return parent::getCheckoutUrl();
|
37 |
-
}
|
38 |
-
*/
|
39 |
-
|
40 |
-
return parent::getCheckoutUrl();
|
41 |
-
|
42 |
-
}
|
43 |
-
}
|
1 |
+
<?php
|
2 |
+
class Skybox_Checkout_Block_Checkout_Onepage_Link extends Mage_Checkout_Block_Onepage_Link
|
3 |
+
{
|
4 |
+
public function getCheckoutUrl()
|
5 |
+
{
|
6 |
+
// TODO: Refactoring
|
7 |
+
|
8 |
+
// $isEnabled = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
9 |
+
$isEnabled = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Integration 3 start
|
13 |
+
* Give to button a url by default in case is type 3
|
14 |
+
*/
|
15 |
+
$api = Mage::getModel('skyboxcatalog/api_product');
|
16 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
17 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
18 |
+
if (($api->getLocationAllow()==3) && $typeIntegration==3) {
|
19 |
+
return parent::getCheckoutUrl();
|
20 |
+
}
|
21 |
+
/**
|
22 |
+
* Integration 3 end
|
23 |
+
*/
|
24 |
+
|
25 |
+
if($isEnabled) {
|
26 |
+
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
27 |
+
}
|
28 |
+
/*
|
29 |
+
if (Mage::helper('onestepcheckout')->isRewriteCheckoutLinksEnabled()){
|
30 |
+
return $this->getUrl('onestepcheckout', array('_secure'=>true));
|
31 |
+
}
|
32 |
+
*/
|
33 |
+
/*
|
34 |
+
Mage::log('get getCheckoutUrl skybox', null, 'tracer.log', true);
|
35 |
+
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
36 |
+
return parent::getCheckoutUrl();
|
37 |
+
}
|
38 |
+
*/
|
39 |
+
|
40 |
+
return parent::getCheckoutUrl();
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Skybox/Checkout/Block/Sales/Order/Total.php
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Block_Sales_Order_Total extends Mage_Sales_Block_Order_Totals
|
11 |
-
{
|
12 |
-
|
13 |
-
public function initTotals() {
|
14 |
-
|
15 |
-
parent::_initTotals();
|
16 |
-
$order= $this->getOrder();
|
17 |
-
|
18 |
-
//Mage::log('$order', null, 'tracer.log', true);
|
19 |
-
//Mage::log(print_r($order->debug(), true), null, 'tracer.log', true);
|
20 |
-
|
21 |
-
$ConceptsSkyboxjson=json_decode($order->getConceptsSkybox());
|
22 |
-
|
23 |
-
//Mage::log('$ConceptsSkyboxjson', null, 'tracer.log', true);
|
24 |
-
// Mage::log(print_r($ConceptsSkyboxjson, true), null, 'tracer.log', true);
|
25 |
-
if(count($ConceptsSkyboxjson)>0){
|
26 |
-
|
27 |
-
$i = 0;
|
28 |
-
foreach ($ConceptsSkyboxjson as $item) {
|
29 |
-
if($item->Visible != 0)
|
30 |
-
{
|
31 |
-
$i+=1;
|
32 |
-
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
33 |
-
'code'=> 'checkout_total'.$i,
|
34 |
-
'value'=> $item->ValueUSD,//$item->Value
|
35 |
-
'base_value'=> $item->ValueUSD,//$item->Value
|
36 |
-
'label'=> $item->Concept,
|
37 |
-
)), 'subtotal', 'tax');
|
38 |
-
}
|
39 |
-
}
|
40 |
-
if($order->getShippingAmount() == 0){
|
41 |
-
$this->getParentBlock()->removeTotal('shipping');
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Block_Sales_Order_Total extends Mage_Sales_Block_Order_Totals
|
11 |
+
{
|
12 |
+
|
13 |
+
public function initTotals() {
|
14 |
+
|
15 |
+
parent::_initTotals();
|
16 |
+
$order= $this->getOrder();
|
17 |
+
|
18 |
+
//Mage::log('$order', null, 'tracer.log', true);
|
19 |
+
//Mage::log(print_r($order->debug(), true), null, 'tracer.log', true);
|
20 |
+
|
21 |
+
$ConceptsSkyboxjson=json_decode($order->getConceptsSkybox());
|
22 |
+
|
23 |
+
//Mage::log('$ConceptsSkyboxjson', null, 'tracer.log', true);
|
24 |
+
// Mage::log(print_r($ConceptsSkyboxjson, true), null, 'tracer.log', true);
|
25 |
+
if(count($ConceptsSkyboxjson)>0){
|
26 |
+
|
27 |
+
$i = 0;
|
28 |
+
foreach ($ConceptsSkyboxjson as $item) {
|
29 |
+
if($item->Visible != 0)
|
30 |
+
{
|
31 |
+
$i+=1;
|
32 |
+
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
33 |
+
'code'=> 'checkout_total'.$i,
|
34 |
+
'value'=> $item->ValueUSD,//$item->Value
|
35 |
+
'base_value'=> $item->ValueUSD,//$item->Value
|
36 |
+
'label'=> $item->Concept,
|
37 |
+
)), 'subtotal', 'tax');
|
38 |
+
}
|
39 |
+
}
|
40 |
+
if($order->getShippingAmount() == 0){
|
41 |
+
$this->getParentBlock()->removeTotal('shipping');
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Skybox/Checkout/Helper/Data.php
CHANGED
@@ -1,133 +1,156 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Helper_Data extends Mage_Checkout_Helper_Data
|
11 |
-
{
|
12 |
-
protected $_api = null;
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
$
|
46 |
-
$
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Helper_Data extends Mage_Checkout_Helper_Data
|
11 |
+
{
|
12 |
+
protected $_api = null;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Returns the helper for Location Allow
|
16 |
+
*
|
17 |
+
* @return Skybox_Core_Helper_Allow
|
18 |
+
*/
|
19 |
+
protected function _getAllowHelper()
|
20 |
+
{
|
21 |
+
return Mage::helper('skyboxcore/allow');
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _getApi()
|
25 |
+
{
|
26 |
+
if (null === $this->_api) {
|
27 |
+
$this->_api = Mage::getModel('skyboxcatalog/api_product');
|
28 |
+
}
|
29 |
+
return $this->_api;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function formatPrice($price)
|
33 |
+
{
|
34 |
+
|
35 |
+
if (!$this->isRewriteCheckoutLinksEnabled()) {
|
36 |
+
return parent::formatPrice($price);
|
37 |
+
}
|
38 |
+
|
39 |
+
if (!$this->_getAllowHelper()->isPriceEnabled()) {
|
40 |
+
return parent::formatPrice($price);
|
41 |
+
}
|
42 |
+
|
43 |
+
/* @var $config Skybox_Core_Model_Config */
|
44 |
+
/*$config = Mage::getModel("skyboxcore/config");
|
45 |
+
$skybox_user = $config->getSession()->getSkyboxUser();
|
46 |
+
$currency = $skybox_user->CartCurrencySymbol;
|
47 |
+
//return '<span class="price">' . $currency . ' ' . number_format($price, 2) . '</span>';
|
48 |
+
return '<span class="price">' . $currency . ' ' . $price . '</span>';*/
|
49 |
+
/* @var $config Skybox_Core_Model_Config */
|
50 |
+
|
51 |
+
$config = Mage::getModel("skyboxcore/config");
|
52 |
+
$skybox_user = $config->getSession()->getSkyboxUser();
|
53 |
+
|
54 |
+
if ($this->_getApi()->getLocationAllow()) {
|
55 |
+
$currency = $skybox_user->CartCurrencySymbol;
|
56 |
+
} else {
|
57 |
+
$currency = Mage::app()->getLocale()->currency($currency_code)->getSymbol();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Integration 3 Allow and not Allow start currency kind on cart
|
62 |
+
*
|
63 |
+
$request = Mage::app()->getRequest();
|
64 |
+
$module = $request->getModuleName();
|
65 |
+
$controller = $request->getControllerName();
|
66 |
+
$action = $request->getActionName();
|
67 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
68 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
69 |
+
|
70 |
+
if ($module == 'checkout' && $controller == 'cart' && $action == 'index') {
|
71 |
+
if ($typeIntegration == 3) {
|
72 |
+
$currency = Mage::app()->getLocale()->currency($currency_code)->getSymbol();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
*/
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Integration 3 Allow and not Allow end currency kind on cart
|
79 |
+
*/
|
80 |
+
|
81 |
+
//Mage::log("currency".$currency, null, 'cartlabels.log', true);
|
82 |
+
$price = str_replace(',', '', $price);
|
83 |
+
//Mage::log("precio".$price, null, 'cartlabels.log', true);
|
84 |
+
$price = Mage::getModel('directory/currency')->setData("currency_code",
|
85 |
+
Mage::app()->getStore(null)->getCurrentCurrency()->getCode())->format(
|
86 |
+
$price, array('display' => Zend_Currency::NO_SYMBOL), false);
|
87 |
+
|
88 |
+
if ($price < 0) {
|
89 |
+
return '<span class="price">(' . $currency . " " . $price . ')</span>';
|
90 |
+
}
|
91 |
+
return '<span class="price">' . $currency . " " . $price . '</span>';
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @deprecated
|
97 |
+
*/
|
98 |
+
public function getLayoutCheckoutSkybox()
|
99 |
+
{
|
100 |
+
$page_layout = Mage::getStoreConfig('customize_your_own');
|
101 |
+
|
102 |
+
if ($this->_getApi()->getLocationAllow()) {
|
103 |
+
$page_layout = 'skybox/checkout/onepage.phtml';
|
104 |
+
} else {
|
105 |
+
$page_layout = 'checkout/onepage.phtml';
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Integration 3 start
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
113 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
114 |
+
if ($typeIntegration == 3 && $this->_getApi()->getLocationAllow() == 3) {
|
115 |
+
$page_layout = 'checkout/onepage.phtml';
|
116 |
+
}
|
117 |
+
/**
|
118 |
+
* Integration 3 end
|
119 |
+
*/
|
120 |
+
|
121 |
+
return $page_layout;
|
122 |
+
}
|
123 |
+
|
124 |
+
public function isRewriteCheckoutLinksEnabled()
|
125 |
+
{
|
126 |
+
// return (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
127 |
+
return Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
128 |
+
}
|
129 |
+
|
130 |
+
public function concatNameDetailProduct($product, $sku = null)
|
131 |
+
{
|
132 |
+
Mage::log('concatNameDetailProduct', null, 'tracer.log');
|
133 |
+
$attributesConcat = '';
|
134 |
+
if ($product->getData('type_id') == 'configurable') {
|
135 |
+
$options = $this->getAllAttributesVariantConfigurableProducts($product);
|
136 |
+
$attributesData = $options[$product->getId()][$sku];
|
137 |
+
$attributesConcat = implode(', ', $attributesData);
|
138 |
+
}
|
139 |
+
return $attributesConcat;
|
140 |
+
}
|
141 |
+
|
142 |
+
public function getAllAttributesVariantConfigurableProducts($configurableProduct)
|
143 |
+
{
|
144 |
+
$attributes = array();
|
145 |
+
$productAttributesOptions = $configurableProduct->getTypeInstance(true)->getConfigurableOptions($configurableProduct);
|
146 |
+
foreach ($productAttributesOptions as $productAttributeOption) {
|
147 |
+
$attributes[$configurableProduct->getId()] = array();
|
148 |
+
foreach ($productAttributeOption as $optionValues) {
|
149 |
+
$val = ($optionValues['option_title']);
|
150 |
+
$attributes[$configurableProduct->getId()][$optionValues['sku']][] = $optionValues['attribute_code'] . '-' . $val;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
Mage::log(print_r($attributes, true), null, 'tracer.log');
|
154 |
+
return $attributes;
|
155 |
+
}
|
156 |
+
}
|
app/code/community/Skybox/Checkout/Helper/Url.php
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Checkout
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Checkout url helper
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Skybox_Checkout_Helper_Url extends Mage_Checkout_Helper_Url
|
33 |
-
{
|
34 |
-
/**
|
35 |
-
* Retrieve checkout url
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
public function getCheckoutUrl()
|
40 |
-
{
|
41 |
-
|
42 |
-
// $isEnabled = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
43 |
-
$isEnabled = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
44 |
-
|
45 |
-
if ($isEnabled) {
|
46 |
-
return $this->_getUrl('skbcheckout/international', array('_secure'=>true));
|
47 |
-
}
|
48 |
-
|
49 |
-
/*if (Mage::helper('onestepcheckout')->isRewriteCheckoutLinksEnabled()){
|
50 |
-
return $this->_getUrl('onestepcheckout', array('_secure'=>true));
|
51 |
-
}*/
|
52 |
-
|
53 |
-
if (!Mage::helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
54 |
-
return parent::getCheckoutUrl();
|
55 |
-
}
|
56 |
-
|
57 |
-
return parent::getCheckoutUrl();
|
58 |
-
}
|
59 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Checkout
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Checkout url helper
|
29 |
+
*
|
30 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
+
*/
|
32 |
+
class Skybox_Checkout_Helper_Url extends Mage_Checkout_Helper_Url
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Retrieve checkout url
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getCheckoutUrl()
|
40 |
+
{
|
41 |
+
|
42 |
+
// $isEnabled = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
43 |
+
$isEnabled = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
44 |
+
|
45 |
+
if ($isEnabled) {
|
46 |
+
return $this->_getUrl('skbcheckout/international', array('_secure'=>true));
|
47 |
+
}
|
48 |
+
|
49 |
+
/*if (Mage::helper('onestepcheckout')->isRewriteCheckoutLinksEnabled()){
|
50 |
+
return $this->_getUrl('onestepcheckout', array('_secure'=>true));
|
51 |
+
}*/
|
52 |
+
|
53 |
+
if (!Mage::helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
54 |
+
return parent::getCheckoutUrl();
|
55 |
+
}
|
56 |
+
|
57 |
+
return parent::getCheckoutUrl();
|
58 |
+
}
|
59 |
}
|
app/code/community/Skybox/Checkout/Model/Api/Checkout.php
CHANGED
@@ -1,221 +1,223 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
11 |
-
{
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Model instance
|
15 |
-
* @var Mage_Core_Catalog_Model_Product
|
16 |
-
*/
|
17 |
-
protected $_product = null;
|
18 |
-
|
19 |
-
protected $_currentProduct = null;
|
20 |
-
|
21 |
-
protected $_typeProduct = "catalog/product";
|
22 |
-
|
23 |
-
public function getProduct()
|
24 |
-
{
|
25 |
-
if (null === $this->_product)
|
26 |
-
$this->_product = Mage::getModel($this->_typeProduct);
|
27 |
-
|
28 |
-
return $this->_product;
|
29 |
-
}
|
30 |
-
|
31 |
-
public function InitializeBarSkybox()
|
32 |
-
{
|
33 |
-
//if(!$this->getErrorAuthenticate())
|
34 |
-
//{
|
35 |
-
//$this->_config = Mage::getModel('skyboxcore/config');
|
36 |
-
Mage::log("InitializeBarSkybox ", null, 'checkout.log', true);
|
37 |
-
|
38 |
-
$params = array(
|
39 |
-
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
40 |
-
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
41 |
-
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
42 |
-
'customeriplocal' => $this->_getConfig()->getHost(),
|
43 |
-
'customeripremote' => $this->_getConfig()->getRemoteAddr(),
|
44 |
-
'customeripproxy' => $this->_getConfig()->getProxy(),
|
45 |
-
'customerbrowser' => $this->_getConfig()->getUserAgent(),
|
46 |
-
'customerlanguages' => $this->_getConfig()->getLanguage()
|
47 |
-
);
|
48 |
-
|
49 |
-
//$response = $this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_INITIALICE, $params)->getResponse();
|
50 |
-
/**
|
51 |
-
* only one time for call to service start
|
52 |
-
*/
|
53 |
-
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
54 |
-
$callToSkyBox = $session->getData("callToSkyBox");
|
55 |
-
|
56 |
-
Mage::log($callToSkyBox, null, '
|
57 |
-
$initialize = $this->_getConfig()->getSession()->getCartSkybox();
|
58 |
-
if (!empty($initialize) && (!$callToSkyBox)) {
|
59 |
-
$response = $initialize;
|
60 |
-
} else {
|
61 |
-
$response = $this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_INITIALICE, $params)->getResponse();
|
62 |
-
$session->setData("callToSkyBox", false);
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
//
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
$
|
99 |
-
|
100 |
-
|
101 |
-
Skybox_Core_Model_Config::
|
102 |
-
|
103 |
-
|
104 |
-
'
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
108 |
-
'
|
109 |
-
'
|
110 |
-
'
|
111 |
-
'
|
112 |
-
'
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
Skybox_Core_Model_Config::
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
Skybox_Core_Model_Config::
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
Skybox_Core_Model_Config::
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
Skybox_Core_Model_Config::
|
208 |
-
|
209 |
-
|
210 |
-
'
|
211 |
-
'
|
212 |
-
'
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
221 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Model instance
|
15 |
+
* @var Mage_Core_Catalog_Model_Product
|
16 |
+
*/
|
17 |
+
protected $_product = null;
|
18 |
+
|
19 |
+
protected $_currentProduct = null;
|
20 |
+
|
21 |
+
protected $_typeProduct = "catalog/product";
|
22 |
+
|
23 |
+
public function getProduct()
|
24 |
+
{
|
25 |
+
if (null === $this->_product)
|
26 |
+
$this->_product = Mage::getModel($this->_typeProduct);
|
27 |
+
|
28 |
+
return $this->_product;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function InitializeBarSkybox()
|
32 |
+
{
|
33 |
+
//if(!$this->getErrorAuthenticate())
|
34 |
+
//{
|
35 |
+
//$this->_config = Mage::getModel('skyboxcore/config');
|
36 |
+
Mage::log("InitializeBarSkybox ", null, 'checkout.log', true);
|
37 |
+
|
38 |
+
$params = array(
|
39 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
40 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
41 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
42 |
+
'customeriplocal' => $this->_getConfig()->getHost(),
|
43 |
+
'customeripremote' => $this->_getConfig()->getRemoteAddr(),
|
44 |
+
'customeripproxy' => $this->_getConfig()->getProxy(),
|
45 |
+
'customerbrowser' => $this->_getConfig()->getUserAgent(),
|
46 |
+
'customerlanguages' => $this->_getConfig()->getLanguage()
|
47 |
+
);
|
48 |
+
|
49 |
+
//$response = $this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_INITIALICE, $params)->getResponse();
|
50 |
+
/**
|
51 |
+
* only one time for call to service start
|
52 |
+
*/
|
53 |
+
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
54 |
+
$callToSkyBox = $session->getData("callToSkyBox");
|
55 |
+
|
56 |
+
//Mage::log($callToSkyBox, null, 'local.log', true);
|
57 |
+
$initialize = $this->_getConfig()->getSession()->getCartSkybox();
|
58 |
+
if (!empty($initialize) && (!$callToSkyBox)) {
|
59 |
+
$response = $initialize;
|
60 |
+
} else {
|
61 |
+
$response = $this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_INITIALICE, $params)->getResponse();
|
62 |
+
$session->setData("callToSkyBox", false);
|
63 |
+
}
|
64 |
+
$response = $this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_INITIALICE, $params)->getResponse();
|
65 |
+
$session->setData("callToSkyBox", false);
|
66 |
+
/**
|
67 |
+
* only one time for call to service end
|
68 |
+
*/
|
69 |
+
// Set SkyboxUser session
|
70 |
+
$this->_getConfig()->getSession()->setSkyboxUser($response);
|
71 |
+
|
72 |
+
//if ($this->getLocationAllow()) { // Rogged, la primera vez q usuario ingresa con un pais disabled, lanza error porq no se envia datos a url de popup
|
73 |
+
$this->_getConfig()->getSession()->setCartSkybox($response);
|
74 |
+
//}
|
75 |
+
//}
|
76 |
+
}
|
77 |
+
|
78 |
+
public function setCurrentProduct($product)
|
79 |
+
{
|
80 |
+
$this->_currentProduct = $product;
|
81 |
+
}
|
82 |
+
public function getCurrentProduct()
|
83 |
+
{
|
84 |
+
return $this->_currentProduct;
|
85 |
+
}
|
86 |
+
|
87 |
+
public function AddProductOfCart($data, $quantity)
|
88 |
+
{
|
89 |
+
$detailProduct = Mage::helper('checkout')->concatNameDetailProduct($this->getCurrentProduct(), $data['sku']);
|
90 |
+
|
91 |
+
//Mage::log("entro AddProductOfCart", null, 'tracer.log', true);
|
92 |
+
if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
Mage::log("AddProductOfCart: " . print_r($data, true), null, 'skyboxcheckout.log', true);
|
97 |
+
|
98 |
+
$storeProductName = $data['name'].' '.$detailProduct;
|
99 |
+
|
100 |
+
$params = array(
|
101 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
102 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
103 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
104 |
+
'productid' => "0",
|
105 |
+
'quantity' => $quantity,
|
106 |
+
'storeproductcode' => $data['sku'],
|
107 |
+
'storeproductname' => $storeProductName,
|
108 |
+
'storeproductcategory' => $data['category_id'],
|
109 |
+
'storeproductprice' => $data['final_price'],
|
110 |
+
'weight' => ($data['weight'])?($data['weight']):1,
|
111 |
+
'weightunit' => $this->getWeightUnit(),
|
112 |
+
'storeproductimgurl' => $data['image_url'],
|
113 |
+
'VolWeight' => $data['VolWeight'],
|
114 |
+
'merchantproductid' => $data['merchantproductid']
|
115 |
+
);
|
116 |
+
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_ADD_PRODUCT_CART, $params);
|
117 |
+
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
|
121 |
+
public function GetTotalShoppingCart()
|
122 |
+
{
|
123 |
+
if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
124 |
+
return $this;
|
125 |
+
}
|
126 |
+
|
127 |
+
$params = array(
|
128 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
129 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
130 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi()
|
131 |
+
);
|
132 |
+
|
133 |
+
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TOTAL_SHOPINGCART, $params);
|
134 |
+
|
135 |
+
return $this;
|
136 |
+
}
|
137 |
+
|
138 |
+
public function UpdateProductOfCart($productId, $quantity)
|
139 |
+
{
|
140 |
+
if (!$this->getErrorAuthenticate() && $this->getLocationAllow()) {
|
141 |
+
$this->getProduct()->load($productId);
|
142 |
+
$params = array(
|
143 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
144 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
145 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
146 |
+
'productid' => $productId,
|
147 |
+
'quantity' => $quantity
|
148 |
+
);
|
149 |
+
|
150 |
+
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_UPDATE_PRODUCT_CART, $params);
|
151 |
+
}
|
152 |
+
|
153 |
+
return $this;
|
154 |
+
}
|
155 |
+
|
156 |
+
public function DeleteProductOfCart($productId)
|
157 |
+
{
|
158 |
+
|
159 |
+
#if (!$this->getErrorAuthenticate() && $this->getLocationAllow()) { // Rogged
|
160 |
+
if (!$this->getErrorAuthenticate()) { // Rogged
|
161 |
+
$params = array(
|
162 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
163 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
164 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
165 |
+
'productid' => $productId
|
166 |
+
);
|
167 |
+
|
168 |
+
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_DELETE_PRODUCT_CART, $params);
|
169 |
+
}
|
170 |
+
|
171 |
+
return $this;
|
172 |
+
}
|
173 |
+
|
174 |
+
public function getCartSkybox()
|
175 |
+
{
|
176 |
+
if (!$this->getErrorAuthenticate() && $this->getLocationAllow()) {
|
177 |
+
//$this->_config = Mage::getModel('skyboxcore/config');
|
178 |
+
return $this->_getConfig()->getSession()->getCartSkybox();
|
179 |
+
}
|
180 |
+
return "";
|
181 |
+
}
|
182 |
+
|
183 |
+
/*
|
184 |
+
* Get Categories
|
185 |
+
*
|
186 |
+
* @return $data json
|
187 |
+
*/
|
188 |
+
|
189 |
+
public function GetCategories()
|
190 |
+
{
|
191 |
+
$params = array(
|
192 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
193 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken()
|
194 |
+
);
|
195 |
+
|
196 |
+
/* var $response Skybox_Core_Model_Standard */
|
197 |
+
$response = $this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_CATEGORIES, $params);
|
198 |
+
$jsonData = $response->getResponse()->{'Categories'};
|
199 |
+
return $jsonData;
|
200 |
+
}
|
201 |
+
|
202 |
+
public function getValueAccessService()
|
203 |
+
{
|
204 |
+
$params = array(
|
205 |
+
"merchantCode" => $this->getMerchant(),
|
206 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
207 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
208 |
+
|
209 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
210 |
+
'customeriplocal' => $this->_getConfig()->getHost(),
|
211 |
+
'customeripremote' => $this->_getConfig()->getRemoteAddr(),
|
212 |
+
'customeripproxy' => $this->_getConfig()->getProxy(),
|
213 |
+
'customerbrowser' => $this->_getConfig()->getUserAgent(),
|
214 |
+
'customerlanguages' => $this->_getConfig()->getLanguage()
|
215 |
+
|
216 |
+
|
217 |
+
);
|
218 |
+
|
219 |
+
|
220 |
+
return $params;
|
221 |
+
|
222 |
+
}
|
223 |
}
|
app/code/community/Skybox/Checkout/Model/Carrier.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
class Skybox_Checkout_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
3 |
-
{
|
4 |
-
protected $_code = 'skyboxcheckout_shipping';
|
5 |
-
|
6 |
-
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
7 |
-
{
|
8 |
-
if (!$this->getConfigData('active') /*|| !Mage::helper('skyboxinternational')->getActive()*/) {
|
9 |
-
return false;
|
10 |
-
}
|
11 |
-
$result = Mage::getModel('shipping/rate_result');
|
12 |
-
$result->append($this->_getDefaultRate());
|
13 |
-
|
14 |
-
return $result;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function getAllowedMethods()
|
18 |
-
{
|
19 |
-
return array(
|
20 |
-
'skyboxcheckout' => 'skybox delivery'//$this->getConfigData('name'),
|
21 |
-
);
|
22 |
-
}
|
23 |
-
|
24 |
-
protected function _getDefaultRate()
|
25 |
-
{
|
26 |
-
$rate = Mage::getModel('shipping/rate_result_method');
|
27 |
-
|
28 |
-
$rate->setCarrier($this->_code);
|
29 |
-
$rate->setCarrierTitle($this->getConfigData('title'));
|
30 |
-
$rate->setMethod('skyboxcheckout');//$this->_code
|
31 |
-
$rate->setMethodTitle($this->getConfigData('title'));
|
32 |
-
$rate->setPrice($this->getConfigData('price'));
|
33 |
-
$rate->setCost(0);
|
34 |
-
|
35 |
-
return $rate;
|
36 |
-
}
|
37 |
}
|
1 |
+
<?php
|
2 |
+
class Skybox_Checkout_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
3 |
+
{
|
4 |
+
protected $_code = 'skyboxcheckout_shipping';
|
5 |
+
|
6 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
7 |
+
{
|
8 |
+
if (!$this->getConfigData('active') /*|| !Mage::helper('skyboxinternational')->getActive()*/) {
|
9 |
+
return false;
|
10 |
+
}
|
11 |
+
$result = Mage::getModel('shipping/rate_result');
|
12 |
+
$result->append($this->_getDefaultRate());
|
13 |
+
|
14 |
+
return $result;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getAllowedMethods()
|
18 |
+
{
|
19 |
+
return array(
|
20 |
+
'skyboxcheckout' => 'skybox delivery'//$this->getConfigData('name'),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _getDefaultRate()
|
25 |
+
{
|
26 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
27 |
+
|
28 |
+
$rate->setCarrier($this->_code);
|
29 |
+
$rate->setCarrierTitle($this->getConfigData('title'));
|
30 |
+
$rate->setMethod('skyboxcheckout');//$this->_code
|
31 |
+
$rate->setMethodTitle($this->getConfigData('title'));
|
32 |
+
$rate->setPrice($this->getConfigData('price'));
|
33 |
+
$rate->setCost(0);
|
34 |
+
|
35 |
+
return $rate;
|
36 |
+
}
|
37 |
}
|
app/code/community/Skybox/Checkout/Model/Cart.php
CHANGED
@@ -1,586 +1,689 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
11 |
-
{
|
12 |
-
|
13 |
-
protected $
|
14 |
-
protected $
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
$value = Mage::
|
30 |
-
$
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
*
|
38 |
-
*
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
return $this;
|
100 |
-
}
|
101 |
-
|
102 |
-
$
|
103 |
-
|
104 |
-
|
105 |
-
$this->
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
$
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
$
|
201 |
-
|
202 |
-
if ($product->
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
-
$
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
Mage::log(
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
$
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
$
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
$
|
344 |
-
$
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$item->
|
349 |
-
$item->
|
350 |
-
$item->
|
351 |
-
$item->
|
352 |
-
$item->
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
$item->
|
357 |
-
$item->
|
358 |
-
$item->
|
359 |
-
$item->
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
$item->
|
366 |
-
$item->
|
367 |
-
$item->
|
368 |
-
$item->
|
369 |
-
|
370 |
-
|
371 |
-
//$item->setOriginalCustomPrice($
|
372 |
-
|
373 |
-
|
374 |
-
$prices =
|
375 |
-
$
|
376 |
-
|
377 |
-
|
378 |
-
$
|
379 |
-
$item->
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
$
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
$item->
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
$item
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
*
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
//
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
11 |
+
{
|
12 |
+
const MESSAGE_FAIL_TO_ADD_PRODUCT = '[sales] Failed to add the product to the cart.';
|
13 |
+
protected $_api = null;
|
14 |
+
protected $_product = null;
|
15 |
+
protected $_enable = null;
|
16 |
+
|
17 |
+
/* @return Skybox_Checkout_Model_Api_Checkout */
|
18 |
+
protected function _getApi()
|
19 |
+
{
|
20 |
+
if (null === $this->_api) {
|
21 |
+
$this->_api = Mage::getModel('skyboxcheckout/api_checkout');
|
22 |
+
}
|
23 |
+
return $this->_api;
|
24 |
+
}
|
25 |
+
|
26 |
+
private function isEnable()
|
27 |
+
{
|
28 |
+
if (null === $this->_enable) {
|
29 |
+
// $value = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
30 |
+
$value = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
31 |
+
$this->_enable = $value;
|
32 |
+
}
|
33 |
+
return $this->_enable;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Return Skybox API Product
|
38 |
+
*
|
39 |
+
* @return Skybox_Catalog_Model_Api_Product
|
40 |
+
*/
|
41 |
+
protected function _getProductApi()
|
42 |
+
{
|
43 |
+
if (null === $this->_product) {
|
44 |
+
$this->_product = Mage::getModel('skyboxcatalog/api_product');
|
45 |
+
}
|
46 |
+
return $this->_product;
|
47 |
+
}
|
48 |
+
|
49 |
+
/*
|
50 |
+
* Grouped Product
|
51 |
+
*/
|
52 |
+
public function addGroupedProduct($productInfo, $requestInfo = null)
|
53 |
+
{
|
54 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter addBundleProduct', null, 'tracer.log', true);
|
55 |
+
$product = $this->_getProduct($productInfo);
|
56 |
+
$request = $this->_getProductRequest($requestInfo);
|
57 |
+
|
58 |
+
$quote = parent::addProduct($productInfo, $requestInfo);
|
59 |
+
|
60 |
+
$super_group = $request->getData('super_group');
|
61 |
+
//Mage::log(print_r($super_group, true), null, 'cart.log', true);
|
62 |
+
|
63 |
+
foreach ($super_group as $item => $qty) {
|
64 |
+
if ($qty <= 0) {
|
65 |
+
continue;
|
66 |
+
}
|
67 |
+
|
68 |
+
//Mage::log("Product: " . $item . " - " . $qty, null, 'cart.log', true);
|
69 |
+
|
70 |
+
$product = Mage::getModel('catalog/product')
|
71 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
72 |
+
->load($item);
|
73 |
+
|
74 |
+
$productId = $product->getId();
|
75 |
+
|
76 |
+
if ($product->getStockItem()) {
|
77 |
+
$minimumQty = $product->getStockItem()->getMinSaleQty();
|
78 |
+
//If product was not found in cart and there is set minimal qty for it
|
79 |
+
if ($minimumQty && $minimumQty > 0 && $qty < $minimumQty
|
80 |
+
&& !$this->getQuote()->hasProductId($productId)
|
81 |
+
) {
|
82 |
+
$request->setQty($minimumQty);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
$this->_getProductApi()->CalculatePrice($product, null);
|
87 |
+
|
88 |
+
if ($this->_getProductApi()->HasError()) {
|
89 |
+
|
90 |
+
$message = self::MESSAGE_FAIL_TO_ADD_PRODUCT;
|
91 |
+
|
92 |
+
if ($this->_getProductApi()->_getApi()->ErrorRatesNotFound()) {
|
93 |
+
$languageId = $this->getLanguageId();
|
94 |
+
$message = $this->_getProductApi()->_getApi()->getErrorRatesNotFoundMessage($languageId);
|
95 |
+
}
|
96 |
+
Mage::throwException(
|
97 |
+
Mage::helper('sales')->__($message)
|
98 |
+
);
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
$productId = $this->_getProductApi()->getProductId();
|
103 |
+
|
104 |
+
$_data = $this->_getProductApi()->getProductData();
|
105 |
+
$this->_getApi()->AddProductOfCart($_data, $qty);
|
106 |
+
|
107 |
+
if ($this->_getApi()->HasError()) {
|
108 |
+
Mage::throwException(Mage::helper('checkout')->__('[checkout] Failed to add the product to the cart.'));
|
109 |
+
return $this;
|
110 |
+
}
|
111 |
+
|
112 |
+
$productIdSkybox = $this->_getApi()->getParameter(
|
113 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID, "0");
|
114 |
+
|
115 |
+
$this->_updateQuoteItem($productId, $productIdSkybox);
|
116 |
+
}
|
117 |
+
|
118 |
+
return $quote;
|
119 |
+
}
|
120 |
+
|
121 |
+
/*
|
122 |
+
* Bundle Product
|
123 |
+
*/
|
124 |
+
public function addBundleProduct($productInfo, $requestInfo = null)
|
125 |
+
{
|
126 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter addBundleProduct', null, 'tracer.log', true);
|
127 |
+
$product = $this->_getProduct($productInfo);
|
128 |
+
$request = $this->_getProductRequest($requestInfo);
|
129 |
+
|
130 |
+
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
131 |
+
|
132 |
+
$quote = parent::addProduct($productInfo, $requestInfo);
|
133 |
+
|
134 |
+
// SkyBox Checkout
|
135 |
+
$this->_getProductApi()->CalculatePrice($product, $request);
|
136 |
+
|
137 |
+
if ($this->_getProductApi()->HasError()) {
|
138 |
+
|
139 |
+
$message = self::MESSAGE_FAIL_TO_ADD_PRODUCT;
|
140 |
+
|
141 |
+
if ($this->_getProductApi()->_getApi()->ErrorRatesNotFound()) {
|
142 |
+
$languageId = $this->getLanguageId();
|
143 |
+
$message = $this->_getProductApi()->_getApi()->getErrorRatesNotFoundMessage($languageId);
|
144 |
+
}
|
145 |
+
Mage::throwException(
|
146 |
+
Mage::helper('sales')->__($message)
|
147 |
+
);
|
148 |
+
return $this;
|
149 |
+
}
|
150 |
+
|
151 |
+
//$productId = $product->getId();
|
152 |
+
$productId = $this->_getProductApi()->getProductId();
|
153 |
+
|
154 |
+
Mage::dispatchEvent('checkout_cart_product_add_before', array(
|
155 |
+
'product' => $product,
|
156 |
+
'request' => $request
|
157 |
+
));
|
158 |
+
|
159 |
+
$_data = $this->_getProductApi()->getProductData();
|
160 |
+
|
161 |
+
Mage::log("Bundleproduct=Cart=" . print_r($_data, true), null, 'cart.log', true);
|
162 |
+
|
163 |
+
$this->_getApi()->AddProductOfCart($_data, $request->getQty());
|
164 |
+
|
165 |
+
if ($this->_getApi()->HasError()) {
|
166 |
+
Mage::throwException(Mage::helper('checkout')->__('[checkout] Failed to add the product to the cart.'));
|
167 |
+
return $this;
|
168 |
+
}
|
169 |
+
|
170 |
+
$productIdSkybox = $this->_getApi()->getParameter(
|
171 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID, "0");
|
172 |
+
|
173 |
+
$this->_updateQuoteItem($productId, $productIdSkybox);
|
174 |
+
return $quote;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Add product to shopping cart (quote)
|
179 |
+
*
|
180 |
+
* @param int|Mage_Catalog_Model_Product $productInfo
|
181 |
+
* @param mixed $requestInfo
|
182 |
+
* @return Mage_Checkout_Model_Cart
|
183 |
+
*/
|
184 |
+
public function addProduct($productInfo, $requestInfo = null)
|
185 |
+
{
|
186 |
+
if (!$this->isEnable()) {
|
187 |
+
parent::addProduct($productInfo, $requestInfo);
|
188 |
+
return $this;
|
189 |
+
}
|
190 |
+
|
191 |
+
$api_mproduct = Mage::getModel('skyboxcatalog/api_product');
|
192 |
+
|
193 |
+
if (!$api_mproduct->getLocationAllow()) {
|
194 |
+
parent::addProduct($productInfo, $requestInfo);
|
195 |
+
return $this;
|
196 |
+
}
|
197 |
+
|
198 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter addProduct', null, 'tracer.log', true);
|
199 |
+
$product = $this->_getProduct($productInfo);
|
200 |
+
$request = $this->_getProductRequest($requestInfo);
|
201 |
+
|
202 |
+
if ($product->isGrouped()) {
|
203 |
+
Mage::log("Product: " . $product->getName() . " is Grouped", null, 'cart.log', true);
|
204 |
+
return $this->addGroupedProduct($productInfo, $requestInfo);
|
205 |
+
}
|
206 |
+
|
207 |
+
if ($product->getTypeId() == 'bundle') {
|
208 |
+
Mage::log("Product: " . $product->getName() . " is Bundle", null, 'cart.log', true);
|
209 |
+
return $this->addBundleProduct($productInfo, $requestInfo);
|
210 |
+
}
|
211 |
+
|
212 |
+
// SkyBox Checkout
|
213 |
+
$this->_getProductApi()->CalculatePrice($product, $request);
|
214 |
+
|
215 |
+
if ($this->_getProductApi()->HasError()) {
|
216 |
+
|
217 |
+
$message = self::MESSAGE_FAIL_TO_ADD_PRODUCT;
|
218 |
+
|
219 |
+
if ($this->_getProductApi()->_getApi()->ErrorRatesNotFound()) {
|
220 |
+
$languageId = $this->getLanguageId();
|
221 |
+
$message = $this->_getProductApi()->_getApi()->getErrorRatesNotFoundMessage($languageId);
|
222 |
+
}
|
223 |
+
Mage::throwException(
|
224 |
+
Mage::helper('sales')->__($message)
|
225 |
+
);
|
226 |
+
return $this;
|
227 |
+
}
|
228 |
+
|
229 |
+
// $productId = $product->getId();
|
230 |
+
$productId = $this->_getProductApi()->getProductId();
|
231 |
+
|
232 |
+
if ($product->getStockItem()) {
|
233 |
+
$minimumQty = $product->getStockItem()->getMinSaleQty();
|
234 |
+
//If product was not found in cart and there is set minimal qty for it
|
235 |
+
if ($minimumQty && $minimumQty > 0 && $request->getQty() < $minimumQty
|
236 |
+
&& !$this->getQuote()->hasProductId($productId)
|
237 |
+
) {
|
238 |
+
$request->setQty($minimumQty);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
/*$product->setTaxPercent(0);
|
243 |
+
$product->setTaxAmount(0);
|
244 |
+
$product->setBaseTaxAmount(0);*/
|
245 |
+
|
246 |
+
Mage::dispatchEvent('checkout_cart_product_add_before', array(
|
247 |
+
'product' => $product,
|
248 |
+
'request' => $request
|
249 |
+
));
|
250 |
+
|
251 |
+
$_data = $this->_getProductApi()->getProductData();
|
252 |
+
Mage::log("product=Cart=" . print_r($_data, true), null, 'cart.log', true);
|
253 |
+
$this->_getApi()->setCurrentProduct($product);
|
254 |
+
$this->_getApi()->AddProductOfCart($_data, $request->getQty());
|
255 |
+
|
256 |
+
if ($this->_getApi()->HasError()) {
|
257 |
+
Mage::throwException(Mage::helper('checkout')->__('[checkout] Failed to add the product to the cart.'));
|
258 |
+
return $this;
|
259 |
+
}
|
260 |
+
|
261 |
+
$productIdSkybox = $this->_getApi()->getParameter(
|
262 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID, "0");
|
263 |
+
|
264 |
+
try {
|
265 |
+
$quote = parent::addProduct($productInfo, $requestInfo);
|
266 |
+
// $lastAddedProductId = $this->getCheckoutSession()->getLastAddedProductId();
|
267 |
+
// Mage::log("lastAddedProductId :: " . $lastAddedProductId, null, 'bueyada.log', true);
|
268 |
+
$this->_updateQuoteItem($productId, $productIdSkybox);
|
269 |
+
} catch (\Exception $e) {
|
270 |
+
Mage::log($e->getMessage(), null, 'tracer.log', true);
|
271 |
+
}
|
272 |
+
|
273 |
+
return $quote;
|
274 |
+
}
|
275 |
+
|
276 |
+
// protected function _getProduct($productInfo){
|
277 |
+
// Mage::log('Entro skybox _getProduct', null, 'tracer.log', true);
|
278 |
+
// Mage::log(print_r($productInfo,true), null, 'tracer.log', true);
|
279 |
+
// $product = parent::_getProduct($productInfo);
|
280 |
+
// return $product;
|
281 |
+
// }
|
282 |
+
|
283 |
+
public function addProductsByIds($productIds)
|
284 |
+
{
|
285 |
+
if (!$this->isEnable()) {
|
286 |
+
parent::addProductsByIds($productIds);
|
287 |
+
return $this;
|
288 |
+
}
|
289 |
+
|
290 |
+
//Mage::log('Entro skybox addProductsByIds', null, 'tracer.log', true);
|
291 |
+
//Mage::log(print_r($productIds,true), null, 'tracer.log', true);
|
292 |
+
if (count($productIds) > 0) {
|
293 |
+
foreach ($productIds as $idproduct) {
|
294 |
+
$idproduct = trim($idproduct);
|
295 |
+
if (empty($idproduct)) {
|
296 |
+
continue;
|
297 |
+
}
|
298 |
+
$this->addProduct($idproduct);
|
299 |
+
}
|
300 |
+
}
|
301 |
+
// $quote = parent::addProductsByIds($productIds);
|
302 |
+
return $this;
|
303 |
+
}
|
304 |
+
|
305 |
+
private function _updateQuoteItem($productId, $productIdSkybox)
|
306 |
+
{
|
307 |
+
Mage::log('pas x aqui2', null, 'minicars.log', true);
|
308 |
+
|
309 |
+
|
310 |
+
/**
|
311 |
+
* only one time for call to service start - Active
|
312 |
+
* when do add to cart
|
313 |
+
*/
|
314 |
+
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
315 |
+
$session->setData("callToSkyBox", true);
|
316 |
+
//Mage::log("Call true: add to cart", null, 'local.log', true);
|
317 |
+
/**
|
318 |
+
* when do add to cart end - Active
|
319 |
+
*/
|
320 |
+
foreach ($this->getQuote()->getAllItems() as $item) {
|
321 |
+
|
322 |
+
if ($item->getProductId() == $productId) {
|
323 |
+
|
324 |
+
if ($item instanceof Mage_Sales_Model_Quote_Item) {
|
325 |
+
$parentItem = $item->getParentItem();
|
326 |
+
if ($parentItem) {
|
327 |
+
$item = $parentItem;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
/**
|
331 |
+
* Integration 3 start, show price shop in cart*
|
332 |
+
*/
|
333 |
+
$isLocationAllow = false;
|
334 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
335 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
336 |
+
if ($typeIntegration == 3) {
|
337 |
+
$isLocationAllow = true;
|
338 |
+
}
|
339 |
+
/**
|
340 |
+
* Integration 3 end, show price shop in cart*
|
341 |
+
*/
|
342 |
+
if ($isLocationAllow) {
|
343 |
+
$productModel = Mage::getModel('catalog/product')->load($productId);
|
344 |
+
$total = str_replace(",", "", $productModel->getTotalPriceUSD());
|
345 |
+
$item->setIdProductSkybox($productIdSkybox);
|
346 |
+
|
347 |
+
// Currency amounts in the default currency of that customer
|
348 |
+
$item->setCustomsSkybox($productModel->getCustoms());
|
349 |
+
$item->setShippingSkybox($productModel->getShipping());
|
350 |
+
$item->setInsuranceSkybox($productModel->getInsurance());
|
351 |
+
$item->setPriceSkybox($productModel->getPrice());
|
352 |
+
$item->setTotalSkybox($productModel->getTotalPrice());
|
353 |
+
$item->setRowTotal($total);
|
354 |
+
|
355 |
+
// Currency amounts in the USD Currency
|
356 |
+
$item->setCustomsUsdSkybox($productModel->getCustomsUSD());
|
357 |
+
$item->setShippingUsdSkybox($productModel->getShippingUSD());
|
358 |
+
$item->setInsuranceUsdSkybox($productModel->getInsuranceUSD());
|
359 |
+
$item->setPriceUsdSkybox($productModel->getPriceUSD());
|
360 |
+
$item->setTotalUsdSkybox($productModel->getTotalPriceUSD());
|
361 |
+
|
362 |
+
$item->setGuidSkybox($productModel->getGuidSkybox()); //Set GUID
|
363 |
+
|
364 |
+
|
365 |
+
$item->setBasePriceSkybox($productModel->getBasePrice());
|
366 |
+
$item->setBasePriceUsdSkybox($productModel->getBasePriceUSD());
|
367 |
+
$item->setAdjustTotalSkybox($productModel->getAdjustPrice());
|
368 |
+
$item->setAdjustTotalUsdSkybox($productModel->getAdjustPriceUSD());
|
369 |
+
$item->setAdjustLabelSkybox($productModel->getAdjustLabel());
|
370 |
+
|
371 |
+
//$item->setOriginalCustomPrice($this->_getProductApi()->getTotalPriceUSD());
|
372 |
+
//$item->setOriginalCustomPrice($total);
|
373 |
+
// $item->setOriginalCustomPrice($this->_getProductApi()->getPrice());
|
374 |
+
$prices = str_replace(',', '', $productModel->getPrice());
|
375 |
+
$prices = number_format((float)($prices), 2, ',', '.');
|
376 |
+
$item->setOriginalCustomPrice($prices);
|
377 |
+
//$skybox_total = str_replace(",", "", $this->_getProductApi()->getTotalPrice());
|
378 |
+
$skybox_total = str_replace(",", "", $productModel->getPrice());
|
379 |
+
$row_total = floatval($skybox_total) * $item->getQty();
|
380 |
+
$item->setRowTotalSkybox($row_total);
|
381 |
+
} else {
|
382 |
+
$total = str_replace(",", "", $this->_getProductApi()->getTotalPriceUSD());
|
383 |
+
$item->setIdProductSkybox($productIdSkybox);
|
384 |
+
|
385 |
+
// Currency amounts in the default currency of that customer
|
386 |
+
$item->setCustomsSkybox($this->_getProductApi()->getCustoms());
|
387 |
+
$item->setShippingSkybox($this->_getProductApi()->getShipping());
|
388 |
+
$item->setInsuranceSkybox($this->_getProductApi()->getInsurance());
|
389 |
+
$item->setPriceSkybox($this->_getProductApi()->getPrice());
|
390 |
+
$item->setTotalSkybox($this->_getProductApi()->getTotalPrice());
|
391 |
+
$item->setRowTotal($total);
|
392 |
+
|
393 |
+
// Currency amounts in the USD Currency
|
394 |
+
$item->setCustomsUsdSkybox($this->_getProductApi()->getCustomsUSD());
|
395 |
+
$item->setShippingUsdSkybox($this->_getProductApi()->getShippingUSD());
|
396 |
+
$item->setInsuranceUsdSkybox($this->_getProductApi()->getInsuranceUSD());
|
397 |
+
$item->setPriceUsdSkybox($this->_getProductApi()->getPriceUSD());
|
398 |
+
$item->setTotalUsdSkybox($this->_getProductApi()->getTotalPriceUSD());
|
399 |
+
|
400 |
+
$item->setGuidSkybox($this->_getProductApi()->getGuidSkybox()); //Set GUID
|
401 |
+
|
402 |
+
|
403 |
+
$item->setBasePriceSkybox($this->_getProductApi()->getBasePrice());
|
404 |
+
$item->setBasePriceUsdSkybox($this->_getProductApi()->getBasePriceUSD());
|
405 |
+
$item->setAdjustTotalSkybox($this->_getProductApi()->getAdjustPrice());
|
406 |
+
$item->setAdjustTotalUsdSkybox($this->_getProductApi()->getAdjustPriceUSD());
|
407 |
+
$item->setAdjustLabelSkybox($this->_getProductApi()->getAdjustLabel());
|
408 |
+
|
409 |
+
//$item->setOriginalCustomPrice($this->_getProductApi()->getTotalPriceUSD());
|
410 |
+
//$item->setOriginalCustomPrice($total);
|
411 |
+
// $item->setOriginalCustomPrice($this->_getProductApi()->getPrice());
|
412 |
+
$prices = str_replace(',', '', $this->_getProductApi()->getPrice());
|
413 |
+
$prices = number_format((float)($prices), 2, ',', '.');
|
414 |
+
$item->setOriginalCustomPrice($prices);
|
415 |
+
//$skybox_total = str_replace(",", "", $this->_getProductApi()->getTotalPrice());
|
416 |
+
$skybox_total = str_replace(",", "", $this->_getProductApi()->getPrice());
|
417 |
+
$row_total = floatval($skybox_total) * $item->getQty();
|
418 |
+
$item->setRowTotalSkybox($row_total);
|
419 |
+
}
|
420 |
+
|
421 |
+
|
422 |
+
break;
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
private function _updateQuoteItem_backup($productId, $productIdSkybox)
|
429 |
+
{
|
430 |
+
Mage::log('pas x aqui2', null, 'minicars.log', true);
|
431 |
+
|
432 |
+
foreach ($this->getQuote()->getAllItems() as $item) {
|
433 |
+
|
434 |
+
if ($item->getProductId() == $productId) {
|
435 |
+
|
436 |
+
if ($item instanceof Mage_Sales_Model_Quote_Item) {
|
437 |
+
$parentItem = $item->getParentItem();
|
438 |
+
if ($parentItem) {
|
439 |
+
$item = $parentItem;
|
440 |
+
}
|
441 |
+
}
|
442 |
+
|
443 |
+
$total = str_replace(",", "", $this->_getProductApi()->getTotalPriceUSD());
|
444 |
+
$item->setIdProductSkybox($productIdSkybox);
|
445 |
+
|
446 |
+
// Currency amounts in the default currency of that customer
|
447 |
+
$item->setCustomsSkybox($this->_getProductApi()->getCustoms());
|
448 |
+
$item->setShippingSkybox($this->_getProductApi()->getShipping());
|
449 |
+
$item->setInsuranceSkybox($this->_getProductApi()->getInsurance());
|
450 |
+
$item->setPriceSkybox($this->_getProductApi()->getPrice());
|
451 |
+
$item->setTotalSkybox($this->_getProductApi()->getTotalPrice());
|
452 |
+
$item->setRowTotal($total);
|
453 |
+
|
454 |
+
// Currency amounts in the USD Currency
|
455 |
+
$item->setCustomsUsdSkybox($this->_getProductApi()->getCustomsUSD());
|
456 |
+
$item->setShippingUsdSkybox($this->_getProductApi()->getShippingUSD());
|
457 |
+
$item->setInsuranceUsdSkybox($this->_getProductApi()->getInsuranceUSD());
|
458 |
+
$item->setPriceUsdSkybox($this->_getProductApi()->getPriceUSD());
|
459 |
+
$item->setTotalUsdSkybox($this->_getProductApi()->getTotalPriceUSD());
|
460 |
+
|
461 |
+
$item->setGuidSkybox($this->_getProductApi()->getGuidSkybox()); //Set GUID
|
462 |
+
|
463 |
+
|
464 |
+
$item->setBasePriceSkybox($this->_getProductApi()->getBasePrice());
|
465 |
+
$item->setBasePriceUsdSkybox($this->_getProductApi()->getBasePriceUSD());
|
466 |
+
$item->setAdjustTotalSkybox($this->_getProductApi()->getAdjustPrice());
|
467 |
+
$item->setAdjustTotalUsdSkybox($this->_getProductApi()->getAdjustPriceUSD());
|
468 |
+
$item->setAdjustLabelSkybox($this->_getProductApi()->getAdjustLabel());
|
469 |
+
|
470 |
+
//$item->setOriginalCustomPrice($this->_getProductApi()->getTotalPriceUSD());
|
471 |
+
//$item->setOriginalCustomPrice($total);
|
472 |
+
// $item->setOriginalCustomPrice($this->_getProductApi()->getPrice());
|
473 |
+
$prices = str_replace(',', '', $this->_getProductApi()->getPrice());
|
474 |
+
$prices = number_format((float)($prices), 2, ',', '.');
|
475 |
+
$item->setOriginalCustomPrice($prices);
|
476 |
+
//$skybox_total = str_replace(",", "", $this->_getProductApi()->getTotalPrice());
|
477 |
+
$skybox_total = str_replace(",", "", $this->_getProductApi()->getPrice());
|
478 |
+
$row_total = floatval($skybox_total) * $item->getQty();
|
479 |
+
$item->setRowTotalSkybox($row_total);
|
480 |
+
|
481 |
+
break;
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Remove item from cart
|
489 |
+
*
|
490 |
+
* @param int $itemId
|
491 |
+
* @return Mage_Checkout_Model_Cart
|
492 |
+
*/
|
493 |
+
public function removeItem($itemId)
|
494 |
+
{
|
495 |
+
/**
|
496 |
+
* only one time for call to service start - Active
|
497 |
+
* when do remove
|
498 |
+
*/
|
499 |
+
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
500 |
+
$session->setData("callToSkyBox", true);
|
501 |
+
//Mage::log("Call true: remove", null, 'local.log', true);
|
502 |
+
/**
|
503 |
+
* when do remove
|
504 |
+
*/
|
505 |
+
if (!$this->isEnable()) {
|
506 |
+
parent::removeItem($itemId);
|
507 |
+
return $this;
|
508 |
+
}
|
509 |
+
|
510 |
+
$quoteItem = $this->getQuote()->getItemById($itemId);
|
511 |
+
|
512 |
+
if (!$quoteItem) {
|
513 |
+
Mage::throwException(Mage::helper('checkout')->__('ID incorrecto de producto.'));
|
514 |
+
return $this;
|
515 |
+
}
|
516 |
+
Mage::log("|removeItem|" . $quoteItem->getIdProductSkybox());
|
517 |
+
//Realizar llamada al servicio de agregar producto al carrito.
|
518 |
+
$idProductSkybox = $quoteItem->getIdProductSkybox();
|
519 |
+
$this->_getApi()->DeleteProductOfCart($idProductSkybox);
|
520 |
+
|
521 |
+
if ($this->_getApi()->HasError()) {
|
522 |
+
Mage::throwException(Mage::helper('checkout')->__('Error al eliminar producto al carrito.'));
|
523 |
+
return $this;
|
524 |
+
}
|
525 |
+
|
526 |
+
return parent::removeItem($itemId);
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Update cart items information
|
531 |
+
*
|
532 |
+
* @param array $data
|
533 |
+
* @return Mage_Checkout_Model_Cart
|
534 |
+
*/
|
535 |
+
public function updateItems($data)
|
536 |
+
{
|
537 |
+
/**
|
538 |
+
* only one time for call to service start - Active
|
539 |
+
* when do remove
|
540 |
+
*/
|
541 |
+
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
542 |
+
$session->setData("callToSkyBox", true);
|
543 |
+
//Mage::log("Call true: update cart", null, 'local.log', true);
|
544 |
+
/**
|
545 |
+
* when do remove
|
546 |
+
*/
|
547 |
+
if (!$this->isEnable()) {
|
548 |
+
parent::updateItems($data);
|
549 |
+
return $this;
|
550 |
+
}
|
551 |
+
|
552 |
+
Mage::log('pas x aqui5', null, 'minicars.log', true);
|
553 |
+
//Mage::log(print_r($data, true), null, 'tracer.log', true);
|
554 |
+
//Mage::log("Skybox_Checkout_Checkout_Model_Cart updateItem");
|
555 |
+
//return parent::updateItems($data);
|
556 |
+
// Mage::dispatchEvent('checkout_cart_update_items_before', array('cart'=>$this, 'info'=>$data));
|
557 |
+
|
558 |
+
foreach ($data as $itemId => $itemInfo) {
|
559 |
+
$item = $this->getQuote()->getItemById($itemId);
|
560 |
+
//Mage::log('item:', null, 'tracer.log', true);
|
561 |
+
//Mage::log(print_r($item->debug(), true), null, 'tracer.log', true);
|
562 |
+
//Mage::log(print_r($itemInfo, true), null, 'tracer.log', true);
|
563 |
+
//Mage::log('updateItems foreach', null, 'tracer.log', true);
|
564 |
+
if (!$item) {
|
565 |
+
//Mage::log('no item', null, 'tracer.log', true);
|
566 |
+
continue;
|
567 |
+
}
|
568 |
+
|
569 |
+
// if(isset($itemInfo['price']) && !empty($itemInfo['price'])) {
|
570 |
+
// //price, base_price, custom_price, row_total, base_row_total, row_total_with_discount, original_custom_price
|
571 |
+
// $price = (float) $itemInfo['price'];
|
572 |
+
// $item->setPrice($price);
|
573 |
+
// $item->setRowTotal($price);
|
574 |
+
// $item->setBasePrice($price);
|
575 |
+
// continue;
|
576 |
+
// }
|
577 |
+
|
578 |
+
if (!empty($itemInfo['remove']) || (isset($itemInfo['qty']) && $itemInfo['qty'] == '0')) {
|
579 |
+
$this->removeItem($itemId);
|
580 |
+
continue;
|
581 |
+
}
|
582 |
+
|
583 |
+
$qty = isset($itemInfo['qty']) ? (float)$itemInfo['qty'] : false;
|
584 |
+
//Mage::log('cantidad: '.$qty, null, 'tracer.log', true);
|
585 |
+
if ($qty > 0) {
|
586 |
+
|
587 |
+
$idProductSkybox = $item->getIdProductSkybox();
|
588 |
+
|
589 |
+
$this->_getApi()->UpdateProductOfCart($idProductSkybox, $qty);
|
590 |
+
|
591 |
+
$item->setQty($qty);
|
592 |
+
|
593 |
+
//$skybox_total = str_replace(",", "", $item->getTotalSkybox());
|
594 |
+
$skybox_total = str_replace(",", "", $item->getPriceSkybox());
|
595 |
+
|
596 |
+
|
597 |
+
$row_total = floatval($skybox_total) * $item->getQty();
|
598 |
+
$item->setRowTotalSkybox($row_total);
|
599 |
+
|
600 |
+
//Mage::log('fin qty', null, 'tracer.log', true);
|
601 |
+
}
|
602 |
+
}
|
603 |
+
|
604 |
+
// Mage::dispatchEvent('checkout_cart_update_items_after', array('cart'=>$this, 'info'=>$data));
|
605 |
+
$current = parent::updateItems($data);
|
606 |
+
return $current;
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* Mark all quote items as deleted (empty shopping cart)
|
611 |
+
*
|
612 |
+
* @return Mage_Checkout_Model_Cart
|
613 |
+
*/
|
614 |
+
public function truncate()
|
615 |
+
{
|
616 |
+
foreach ($this->getQuote()->getAllItems() as $item) {
|
617 |
+
//Mage::log("truncate() ". $item->getId(), null, 'api.log', true);
|
618 |
+
$this->removeItem($item->getId());
|
619 |
+
}
|
620 |
+
|
621 |
+
parent::truncate();
|
622 |
+
return $this;
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Mark all quote items as deleted (empty shopping cart)
|
627 |
+
* @return $this
|
628 |
+
*/
|
629 |
+
public function truncateMgCart()
|
630 |
+
{
|
631 |
+
parent::truncate();
|
632 |
+
return $this;
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Update item in shopping cart (quote)
|
637 |
+
* $requestInfo - either qty (int) or buyRequest in form of array or Varien_Object
|
638 |
+
* $updatingParams - information on how to perform update, passed to Quote->updateItem() method
|
639 |
+
*/
|
640 |
+
public function updateItem($itemId, $requestInfo = null, $updatingParams = null)
|
641 |
+
{
|
642 |
+
if (!$this->isEnable()) {
|
643 |
+
$result = parent::updateItem($itemId, $requestInfo, $updatingParams);
|
644 |
+
return $result;
|
645 |
+
}
|
646 |
+
|
647 |
+
$item = $this->getQuote()->getItemById($itemId);
|
648 |
+
$skyboxProductId = $item->getIdProductSkybox();
|
649 |
+
$_quoteItemId = $item->getId();
|
650 |
+
$_qty = $item->getQty();
|
651 |
+
|
652 |
+
/** @var Mage_Sales_Model_Quote_Item $result */
|
653 |
+
$result = parent::updateItem($itemId, $requestInfo, $updatingParams);
|
654 |
+
$quoteItemId = $result->getId();
|
655 |
+
$qty = $result->getQty();
|
656 |
+
|
657 |
+
// Update Product
|
658 |
+
if ($quoteItemId == $_quoteItemId) {
|
659 |
+
$this->_getApi()->UpdateProductOfCart($skyboxProductId, $qty);
|
660 |
+
} else {
|
661 |
+
// Delete and Add a New Product
|
662 |
+
$this->_getApi()->DeleteProductOfCart($skyboxProductId);
|
663 |
+
|
664 |
+
$product = $result->getProduct();
|
665 |
+
$this->_getProductApi()->CalculatePrice($product, $requestInfo);
|
666 |
+
|
667 |
+
$_data = $this->_getProductApi()->getProductData();
|
668 |
+
$this->_getApi()->setCurrentProduct($product);
|
669 |
+
$this->_getApi()->AddProductOfCart($_data, $qty);
|
670 |
+
|
671 |
+
$productId = $result->getProduct()->getId();
|
672 |
+
$skyboxProductId = $this->_getApi()->getParameter(
|
673 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID, "0");
|
674 |
+
|
675 |
+
$this->_updateQuoteItem($productId, $skyboxProductId);
|
676 |
+
}
|
677 |
+
|
678 |
+
return $result;
|
679 |
+
}
|
680 |
+
|
681 |
+
private function getLanguageId()
|
682 |
+
{
|
683 |
+
$_config = Mage::getModel('skyboxcore/config');
|
684 |
+
$cart = $_config->getSession()->getCartSkybox();
|
685 |
+
$id = $cart->{'LanguageId'};
|
686 |
+
return intval($id);
|
687 |
+
}
|
688 |
+
|
689 |
+
}
|
app/code/community/Skybox/Checkout/Model/Creditmemo/Total.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Creditmemo_Total extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract{
|
4 |
-
|
5 |
-
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
6 |
-
{
|
7 |
-
|
8 |
-
Mage::log("==============================ini", null, 'invoice.log', true);
|
9 |
-
$order = $creditmemo->getOrder();
|
10 |
-
$amount = 20;
|
11 |
-
if ($amount) {
|
12 |
-
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $amount);
|
13 |
-
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $amount);
|
14 |
-
}
|
15 |
-
|
16 |
-
return $this;
|
17 |
-
}
|
18 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Creditmemo_Total extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract{
|
4 |
+
|
5 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
6 |
+
{
|
7 |
+
|
8 |
+
Mage::log("==============================ini", null, 'invoice.log', true);
|
9 |
+
$order = $creditmemo->getOrder();
|
10 |
+
$amount = 20;
|
11 |
+
if ($amount) {
|
12 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $amount);
|
13 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $amount);
|
14 |
+
}
|
15 |
+
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
}
|
app/code/community/Skybox/Checkout/Model/Invoice/Total.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Invoice_Total extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
4 |
-
{
|
5 |
-
public function collect(Mage_Sales_Model_Order_Creditmemo $invoice)
|
6 |
-
{
|
7 |
-
|
8 |
-
/*Mage::log("==============================ini", null, 'invoice.log', true);
|
9 |
-
$order = $invoice->getOrder();
|
10 |
-
$amount = 40;
|
11 |
-
if ($amount) {
|
12 |
-
$invoice->setGrandTotal($invoice->getGrandTotal() + $amount);
|
13 |
-
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $amount);
|
14 |
-
}*/
|
15 |
-
|
16 |
-
return $this;
|
17 |
-
}
|
18 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Invoice_Total extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
4 |
+
{
|
5 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $invoice)
|
6 |
+
{
|
7 |
+
|
8 |
+
/*Mage::log("==============================ini", null, 'invoice.log', true);
|
9 |
+
$order = $invoice->getOrder();
|
10 |
+
$amount = 40;
|
11 |
+
if ($amount) {
|
12 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $amount);
|
13 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $amount);
|
14 |
+
}*/
|
15 |
+
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
}
|
app/code/community/Skybox/Checkout/Model/Observer.php
CHANGED
@@ -1,293 +1,293 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_Model_Observer
|
11 |
-
{
|
12 |
-
protected $_typeApi = 'skyboxcheckout/api_checkout';
|
13 |
-
/**
|
14 |
-
* Model instance
|
15 |
-
*
|
16 |
-
* @var Skybox_Checkout_Model_Api_Checkout
|
17 |
-
*/
|
18 |
-
protected $_api = null;
|
19 |
-
|
20 |
-
protected function _getApi()
|
21 |
-
{
|
22 |
-
if (null === $this->_api)
|
23 |
-
$this->_api = Mage::getModel($this->_typeApi);
|
24 |
-
|
25 |
-
return $this->_api;
|
26 |
-
}
|
27 |
-
|
28 |
-
protected $_typeProduct = 'skyboxcatalog/api_product';
|
29 |
-
protected $_product = null;
|
30 |
-
protected $_enable = null;
|
31 |
-
|
32 |
-
protected function _getProduct()
|
33 |
-
{
|
34 |
-
if (null === $this->_product)
|
35 |
-
$this->_product = Mage::getModel($this->_typeProduct);
|
36 |
-
|
37 |
-
return $this->_product;
|
38 |
-
}
|
39 |
-
|
40 |
-
private function isEnable() {
|
41 |
-
if ($this->_enable === null) {
|
42 |
-
// $value = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
43 |
-
$value = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
44 |
-
$this->_enable = $value;
|
45 |
-
}
|
46 |
-
return $this->_enable;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Metodo inicializador de Skybox Checkout
|
51 |
-
*/
|
52 |
-
public function InitializeSkybox($observer)
|
53 |
-
{
|
54 |
-
$event = $observer->getEvent();
|
55 |
-
Mage::log($event->getName());
|
56 |
-
$this->_getApi()->InitializeBarSkybox();
|
57 |
-
}
|
58 |
-
|
59 |
-
public function RemoveTax(Varien_Event_Observer $observer)
|
60 |
-
{
|
61 |
-
if(!$this->isEnable()) {
|
62 |
-
return;
|
63 |
-
}
|
64 |
-
|
65 |
-
Mage::log('RemoveTax->ini', null, 'SkyObserver.log', true);
|
66 |
-
$customer_id = Mage::getSingleton('customer/session')->getId();
|
67 |
-
$customer = Mage::getModel("customer/customer")->load($customer_id);
|
68 |
-
|
69 |
-
if($customer->getIsTaxExempt() == 1)
|
70 |
-
{
|
71 |
-
$items = $observer->getEvent()->getQuote()->getAllVisibleItems();
|
72 |
-
foreach($items as $item)
|
73 |
-
$item->getProduct()->setTaxClassId(0);
|
74 |
-
Mage::log('RemoveTax->Tax', null, 'SkyObserver.log', true);
|
75 |
-
}
|
76 |
-
Mage::log('RemoveTax->fin', null, 'SkyObserver.log', true);
|
77 |
-
}
|
78 |
-
|
79 |
-
public function CalculatePriceQuoteItem(Varien_Event_Observer $observer)
|
80 |
-
{
|
81 |
-
if(!$this->isEnable()) {
|
82 |
-
return $this;
|
83 |
-
}
|
84 |
-
Mage::log('Observer->CalculatePriceQuoteItem->ini', null, 'cart.log', true);
|
85 |
-
|
86 |
-
$event = $observer->getEvent();
|
87 |
-
$quote_item = $event->getQuoteItem();
|
88 |
-
|
89 |
-
/*if (count($quote_item)) {
|
90 |
-
foreach ($quote_item as $item) {
|
91 |
-
|
92 |
-
$item->setTaxPercent(0);
|
93 |
-
$item->setTaxAmount(0);
|
94 |
-
$item->setBaseTaxAmount(0);
|
95 |
-
|
96 |
-
$item->setPriceInclTax($item->getPrice());
|
97 |
-
$item->setBasePriceInclTax($item->getBasePrice());
|
98 |
-
$item->setBaseRowTotalInclTax($item->setBaseRowTotal());
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
//$quote_item->save();
|
103 |
-
Mage::log('|UpdateParametersQuoteItem|fin', null, 'cart.log', true);
|
104 |
-
}*/
|
105 |
-
|
106 |
-
return $this;
|
107 |
-
|
108 |
-
//$product = $quote_item->getProduct();
|
109 |
-
|
110 |
-
/*$quote = Mage::getSingleton('checkout/session');
|
111 |
-
foreach ($quote->getQuote()->getAllItems() as $item) {
|
112 |
-
if($item->getProductId() == $quote_item->getProductId())
|
113 |
-
{
|
114 |
-
Mage::throwException(
|
115 |
-
Mage::helper('sales')->__('Error al agregar producto al carrito.' . $item->getQty())
|
116 |
-
);
|
117 |
-
break;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
Mage::throwException(
|
121 |
-
Mage::helper('sales')->__('Error al agregar producto al carrito.-')
|
122 |
-
);*/
|
123 |
-
/*$this->_getProduct()->CalculatePrice($quote_item->getProductId(), $product->getFInalPrice());
|
124 |
-
|
125 |
-
if($this->_getProduct()->HasError())
|
126 |
-
{
|
127 |
-
Mage::throwException(
|
128 |
-
Mage::helper('sales')->__('Error al agregar producto al carrito.')
|
129 |
-
);
|
130 |
-
//return $this;
|
131 |
-
}
|
132 |
-
|
133 |
-
Mage::log(json_encode($this->_getProduct()->getResponse()));
|
134 |
-
|
135 |
-
$this->_getApi()->AddProductOfCart($quote_item->getProductId(), 1);
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
if($this->_getApi()->HasError())
|
140 |
-
{
|
141 |
-
Mage::throwException(
|
142 |
-
Mage::helper('sales')->__('Error al agregar producto al carrito')
|
143 |
-
);
|
144 |
-
//return $this;
|
145 |
-
}
|
146 |
-
|
147 |
-
$idProductSkybox = $this->_getApi()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID, "0");
|
148 |
-
$customsSkybox = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS, "0");
|
149 |
-
$shippingSkybox = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING, "0");
|
150 |
-
$insuranceSkybox = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE, "0");
|
151 |
-
$totalPrice = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL, "0");
|
152 |
-
|
153 |
-
$quote_item->setIdProductSkybox($idProductSkybox);
|
154 |
-
$quote_item->setCustomsSkybox($customsSkybox);
|
155 |
-
$quote_item->setShippingSkybox($shippingSkybox);
|
156 |
-
$quote_item->setInsureSkybox($insuranceSkybox);
|
157 |
-
$quote_item->setOriginalCustomPrice($totalPrice);
|
158 |
-
|
159 |
-
$quote_item->save();
|
160 |
-
*/
|
161 |
-
//Mage::log('|UpdateParametersQuoteItem| id->' . $quote_item->getId() . " quty->" . $quote_item->getQty(), null, 'cart.log', true);
|
162 |
-
}
|
163 |
-
|
164 |
-
public function changeQuoteAddressSkybox(Varien_Event_Observer $observer)
|
165 |
-
{
|
166 |
-
/**
|
167 |
-
* only one time for call to service start - Active
|
168 |
-
* This always run when you do alter to product as change/delete product
|
169 |
-
*/
|
170 |
-
//$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
171 |
-
//$session->setData("callToSkyBox", true);
|
172 |
-
|
173 |
-
/**
|
174 |
-
* only one time for call to service end - Active
|
175 |
-
*/
|
176 |
-
|
177 |
-
if(!$this->isEnable()) {
|
178 |
-
return $this;
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Integration 3 start, show price shop in cart*
|
183 |
-
*/
|
184 |
-
$allowRunByIntegration3 = true;
|
185 |
-
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
186 |
-
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
187 |
-
if ($typeIntegration==3) {
|
188 |
-
$allowRunByIntegration3 = false;
|
189 |
-
}
|
190 |
-
//Mage::log("Call true22: changeQuoteAddressSkybox", null, '
|
191 |
-
/**
|
192 |
-
* Integration 3 end, show price shop in cart*
|
193 |
-
*/
|
194 |
-
if($allowRunByIntegration3) {
|
195 |
-
if($this->_getApi()->getLocationAllow()){
|
196 |
-
Mage::log('Observer->changeQuoteAddressSkybox : ini', null, 'TotalSales.log', true);
|
197 |
-
/* $quote Mage_Sales_Model_Quote */
|
198 |
-
$quote = $observer->getEvent()->getQuote();
|
199 |
-
|
200 |
-
/* $address Mage_Sales_Model_Quote_Address */
|
201 |
-
$address = $quote->getShippingAddress();
|
202 |
-
|
203 |
-
$totals = 0;
|
204 |
-
$baseTotals = 0;
|
205 |
-
$totalTax=0;
|
206 |
-
|
207 |
-
foreach ($quote->getAllItems() as $item) {
|
208 |
-
|
209 |
-
//Estas lineas se agregaron para elimnar el Tax del Carrito
|
210 |
-
/*$item->setTaxPercent(0);
|
211 |
-
$item->setTaxAmount(0);
|
212 |
-
$item->setBaseTaxAmount(0);
|
213 |
-
|
214 |
-
$item->setPriceInclTax($item->getPrice());
|
215 |
-
$item->setBasePriceInclTax($item->getBasePrice());
|
216 |
-
$item->setBaseRowTotalInclTax($item->setBaseRowTotal());*/
|
217 |
-
//------------------------------------------------------------>
|
218 |
-
|
219 |
-
Mage::log('Observer->changeQuoteAddressSkybox->Item->getRowTotalSkybox->' . $item->getRowTotalSkybox(), null, 'TotalSales.log', true);
|
220 |
-
|
221 |
-
$totals += $item->getRowTotalSkybox();
|
222 |
-
}
|
223 |
-
|
224 |
-
$quote->save();
|
225 |
-
|
226 |
-
$baseTotals = $totals;
|
227 |
-
|
228 |
-
//$totalTax1= $address->getTaxAmount();
|
229 |
-
|
230 |
-
//Estas lineas se agregaron para elimnar el Tax del Carrito
|
231 |
-
$address->setTaxAmount(0);
|
232 |
-
$address->setBaseTaxAmount(0);
|
233 |
-
|
234 |
-
$applied_taxes = array();
|
235 |
-
|
236 |
-
$address->setAppliedTaxes($applied_taxes);
|
237 |
-
//------------------------------------------------------------>
|
238 |
-
|
239 |
-
//$address->save();
|
240 |
-
|
241 |
-
//$totales = $address->getTotalAmount("checkout_total1");
|
242 |
-
|
243 |
-
//$tamanio = count($totales);
|
244 |
-
//for ($x=0;$x<$tamanio; $x++) Mage::log('Observer->changeQuoteAddressSkybox->total->' . $totales[$x], null, 'TotalSales.log', true);
|
245 |
-
|
246 |
-
//Mage::log('Observer->changeQuoteAddressSkybox->totales->' . var_dump($totales["subtotal"]), null, 'TotalSales.log', true);
|
247 |
-
//Mage::log('Observer->changeQuoteAddressSkybox->totales->' . $totales, null, 'TotalSales.log', true);
|
248 |
-
|
249 |
-
$totalTax = 0; //$address->getTaxAmount(); //Comentado
|
250 |
-
|
251 |
-
//Recorremos los conceptos agrupados (esto debe modificarse no es lo optimo)
|
252 |
-
/*$conceptsSkybox = json_decode($address->getConceptsSkybox());
|
253 |
-
foreach ($conceptsSkybox as $concept) {
|
254 |
-
$totalTax = $totalTax + $concept->Value;
|
255 |
-
}*/
|
256 |
-
|
257 |
-
$totalRmt = 0;
|
258 |
-
//Recorremos los conceptos agrupados (esto debe modificarse no es lo optimo)
|
259 |
-
/*$rmtSkybox = json_decode($address->getRmtSkybox());
|
260 |
-
foreach ($rmtSkybox as $rmt) {
|
261 |
-
$totalRmt = $totalRmt + $rmt->Value;
|
262 |
-
}*/
|
263 |
-
|
264 |
-
//Mage::log('Observer->changeQuoteAddressSkybox->totalTax1->' . $totalTax1 . ' &totalbase->' . $baseTotals, null, 'TotalSales.log', true);
|
265 |
-
//Mage::log('Observer->changeQuoteAddressSkybox->totalTax->' . $totalTax . ' &totalbase->' . $baseTotals, null, 'TotalSales.log', true);
|
266 |
-
|
267 |
-
/*$address->setSubtotalSkybox($totals);
|
268 |
-
$address->setBaseSubtotalSkybox($baseTotals);
|
269 |
-
$address->setGrandTotalSkybox($totals+$totalTax);
|
270 |
-
$address->setBaseGrandTotalSkybox($baseTotals+$totalTax);*/
|
271 |
-
|
272 |
-
$baseTotals = $address->getBaseGrandTotalSkybox();
|
273 |
-
$totals = $address->getGrandTotalSkybox();
|
274 |
-
|
275 |
-
$address->setPriceInclTax($totals);
|
276 |
-
$address->setBasePriceInclTax($baseTotals);
|
277 |
-
|
278 |
-
$totals = floatval(preg_replace("/[^-0-9\.]/","",$totals));
|
279 |
-
//$address->setGrandTotal($totals+$totalTax);
|
280 |
-
$address->setGrandTotal($totals+$totalTax);
|
281 |
-
$address->setBaseGrandTotal($baseTotals+$totalTax);
|
282 |
-
|
283 |
-
//$address->save();
|
284 |
-
|
285 |
-
Mage::log('Observer->changeQuoteAddressSkybox : fin', null, 'TotalSales.log', true);
|
286 |
-
|
287 |
-
return $this;
|
288 |
-
}
|
289 |
-
return $this;
|
290 |
-
}
|
291 |
-
|
292 |
-
}
|
293 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Model_Observer
|
11 |
+
{
|
12 |
+
protected $_typeApi = 'skyboxcheckout/api_checkout';
|
13 |
+
/**
|
14 |
+
* Model instance
|
15 |
+
*
|
16 |
+
* @var Skybox_Checkout_Model_Api_Checkout
|
17 |
+
*/
|
18 |
+
protected $_api = null;
|
19 |
+
|
20 |
+
protected function _getApi()
|
21 |
+
{
|
22 |
+
if (null === $this->_api)
|
23 |
+
$this->_api = Mage::getModel($this->_typeApi);
|
24 |
+
|
25 |
+
return $this->_api;
|
26 |
+
}
|
27 |
+
|
28 |
+
protected $_typeProduct = 'skyboxcatalog/api_product';
|
29 |
+
protected $_product = null;
|
30 |
+
protected $_enable = null;
|
31 |
+
|
32 |
+
protected function _getProduct()
|
33 |
+
{
|
34 |
+
if (null === $this->_product)
|
35 |
+
$this->_product = Mage::getModel($this->_typeProduct);
|
36 |
+
|
37 |
+
return $this->_product;
|
38 |
+
}
|
39 |
+
|
40 |
+
private function isEnable() {
|
41 |
+
if ($this->_enable === null) {
|
42 |
+
// $value = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
43 |
+
$value = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
44 |
+
$this->_enable = $value;
|
45 |
+
}
|
46 |
+
return $this->_enable;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Metodo inicializador de Skybox Checkout
|
51 |
+
*/
|
52 |
+
public function InitializeSkybox($observer)
|
53 |
+
{
|
54 |
+
$event = $observer->getEvent();
|
55 |
+
Mage::log($event->getName());
|
56 |
+
$this->_getApi()->InitializeBarSkybox();
|
57 |
+
}
|
58 |
+
|
59 |
+
public function RemoveTax(Varien_Event_Observer $observer)
|
60 |
+
{
|
61 |
+
if(!$this->isEnable()) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
Mage::log('RemoveTax->ini', null, 'SkyObserver.log', true);
|
66 |
+
$customer_id = Mage::getSingleton('customer/session')->getId();
|
67 |
+
$customer = Mage::getModel("customer/customer")->load($customer_id);
|
68 |
+
|
69 |
+
if($customer->getIsTaxExempt() == 1)
|
70 |
+
{
|
71 |
+
$items = $observer->getEvent()->getQuote()->getAllVisibleItems();
|
72 |
+
foreach($items as $item)
|
73 |
+
$item->getProduct()->setTaxClassId(0);
|
74 |
+
Mage::log('RemoveTax->Tax', null, 'SkyObserver.log', true);
|
75 |
+
}
|
76 |
+
Mage::log('RemoveTax->fin', null, 'SkyObserver.log', true);
|
77 |
+
}
|
78 |
+
|
79 |
+
public function CalculatePriceQuoteItem(Varien_Event_Observer $observer)
|
80 |
+
{
|
81 |
+
if(!$this->isEnable()) {
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
Mage::log('Observer->CalculatePriceQuoteItem->ini', null, 'cart.log', true);
|
85 |
+
|
86 |
+
$event = $observer->getEvent();
|
87 |
+
$quote_item = $event->getQuoteItem();
|
88 |
+
|
89 |
+
/*if (count($quote_item)) {
|
90 |
+
foreach ($quote_item as $item) {
|
91 |
+
|
92 |
+
$item->setTaxPercent(0);
|
93 |
+
$item->setTaxAmount(0);
|
94 |
+
$item->setBaseTaxAmount(0);
|
95 |
+
|
96 |
+
$item->setPriceInclTax($item->getPrice());
|
97 |
+
$item->setBasePriceInclTax($item->getBasePrice());
|
98 |
+
$item->setBaseRowTotalInclTax($item->setBaseRowTotal());
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
//$quote_item->save();
|
103 |
+
Mage::log('|UpdateParametersQuoteItem|fin', null, 'cart.log', true);
|
104 |
+
}*/
|
105 |
+
|
106 |
+
return $this;
|
107 |
+
|
108 |
+
//$product = $quote_item->getProduct();
|
109 |
+
|
110 |
+
/*$quote = Mage::getSingleton('checkout/session');
|
111 |
+
foreach ($quote->getQuote()->getAllItems() as $item) {
|
112 |
+
if($item->getProductId() == $quote_item->getProductId())
|
113 |
+
{
|
114 |
+
Mage::throwException(
|
115 |
+
Mage::helper('sales')->__('Error al agregar producto al carrito.' . $item->getQty())
|
116 |
+
);
|
117 |
+
break;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
Mage::throwException(
|
121 |
+
Mage::helper('sales')->__('Error al agregar producto al carrito.-')
|
122 |
+
);*/
|
123 |
+
/*$this->_getProduct()->CalculatePrice($quote_item->getProductId(), $product->getFInalPrice());
|
124 |
+
|
125 |
+
if($this->_getProduct()->HasError())
|
126 |
+
{
|
127 |
+
Mage::throwException(
|
128 |
+
Mage::helper('sales')->__('Error al agregar producto al carrito.')
|
129 |
+
);
|
130 |
+
//return $this;
|
131 |
+
}
|
132 |
+
|
133 |
+
Mage::log(json_encode($this->_getProduct()->getResponse()));
|
134 |
+
|
135 |
+
$this->_getApi()->AddProductOfCart($quote_item->getProductId(), 1);
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
if($this->_getApi()->HasError())
|
140 |
+
{
|
141 |
+
Mage::throwException(
|
142 |
+
Mage::helper('sales')->__('Error al agregar producto al carrito')
|
143 |
+
);
|
144 |
+
//return $this;
|
145 |
+
}
|
146 |
+
|
147 |
+
$idProductSkybox = $this->_getApi()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID, "0");
|
148 |
+
$customsSkybox = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS, "0");
|
149 |
+
$shippingSkybox = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING, "0");
|
150 |
+
$insuranceSkybox = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE, "0");
|
151 |
+
$totalPrice = $this->_getProduct()->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL, "0");
|
152 |
+
|
153 |
+
$quote_item->setIdProductSkybox($idProductSkybox);
|
154 |
+
$quote_item->setCustomsSkybox($customsSkybox);
|
155 |
+
$quote_item->setShippingSkybox($shippingSkybox);
|
156 |
+
$quote_item->setInsureSkybox($insuranceSkybox);
|
157 |
+
$quote_item->setOriginalCustomPrice($totalPrice);
|
158 |
+
|
159 |
+
$quote_item->save();
|
160 |
+
*/
|
161 |
+
//Mage::log('|UpdateParametersQuoteItem| id->' . $quote_item->getId() . " quty->" . $quote_item->getQty(), null, 'cart.log', true);
|
162 |
+
}
|
163 |
+
|
164 |
+
public function changeQuoteAddressSkybox(Varien_Event_Observer $observer)
|
165 |
+
{
|
166 |
+
/**
|
167 |
+
* only one time for call to service start - Active
|
168 |
+
* This always run when you do alter to product as change/delete product
|
169 |
+
*/
|
170 |
+
//$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
171 |
+
//$session->setData("callToSkyBox", true);
|
172 |
+
|
173 |
+
/**
|
174 |
+
* only one time for call to service end - Active
|
175 |
+
*/
|
176 |
+
|
177 |
+
if(!$this->isEnable()) {
|
178 |
+
return $this;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Integration 3 start, show price shop in cart*
|
183 |
+
*/
|
184 |
+
$allowRunByIntegration3 = true;
|
185 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
186 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
187 |
+
if ($typeIntegration==3) {
|
188 |
+
$allowRunByIntegration3 = false;
|
189 |
+
}
|
190 |
+
//Mage::log("Call true22: changeQuoteAddressSkybox", null, 'local.log', true);
|
191 |
+
/**
|
192 |
+
* Integration 3 end, show price shop in cart*
|
193 |
+
*/
|
194 |
+
if($allowRunByIntegration3) {
|
195 |
+
if($this->_getApi()->getLocationAllow()){
|
196 |
+
Mage::log('Observer->changeQuoteAddressSkybox : ini', null, 'TotalSales.log', true);
|
197 |
+
/* $quote Mage_Sales_Model_Quote */
|
198 |
+
$quote = $observer->getEvent()->getQuote();
|
199 |
+
|
200 |
+
/* $address Mage_Sales_Model_Quote_Address */
|
201 |
+
$address = $quote->getShippingAddress();
|
202 |
+
|
203 |
+
$totals = 0;
|
204 |
+
$baseTotals = 0;
|
205 |
+
$totalTax=0;
|
206 |
+
|
207 |
+
foreach ($quote->getAllItems() as $item) {
|
208 |
+
|
209 |
+
//Estas lineas se agregaron para elimnar el Tax del Carrito
|
210 |
+
/*$item->setTaxPercent(0);
|
211 |
+
$item->setTaxAmount(0);
|
212 |
+
$item->setBaseTaxAmount(0);
|
213 |
+
|
214 |
+
$item->setPriceInclTax($item->getPrice());
|
215 |
+
$item->setBasePriceInclTax($item->getBasePrice());
|
216 |
+
$item->setBaseRowTotalInclTax($item->setBaseRowTotal());*/
|
217 |
+
//------------------------------------------------------------>
|
218 |
+
|
219 |
+
Mage::log('Observer->changeQuoteAddressSkybox->Item->getRowTotalSkybox->' . $item->getRowTotalSkybox(), null, 'TotalSales.log', true);
|
220 |
+
|
221 |
+
$totals += $item->getRowTotalSkybox();
|
222 |
+
}
|
223 |
+
|
224 |
+
$quote->save();
|
225 |
+
|
226 |
+
$baseTotals = $totals;
|
227 |
+
|
228 |
+
//$totalTax1= $address->getTaxAmount();
|
229 |
+
|
230 |
+
//Estas lineas se agregaron para elimnar el Tax del Carrito
|
231 |
+
$address->setTaxAmount(0);
|
232 |
+
$address->setBaseTaxAmount(0);
|
233 |
+
|
234 |
+
$applied_taxes = array();
|
235 |
+
|
236 |
+
$address->setAppliedTaxes($applied_taxes);
|
237 |
+
//------------------------------------------------------------>
|
238 |
+
|
239 |
+
//$address->save();
|
240 |
+
|
241 |
+
//$totales = $address->getTotalAmount("checkout_total1");
|
242 |
+
|
243 |
+
//$tamanio = count($totales);
|
244 |
+
//for ($x=0;$x<$tamanio; $x++) Mage::log('Observer->changeQuoteAddressSkybox->total->' . $totales[$x], null, 'TotalSales.log', true);
|
245 |
+
|
246 |
+
//Mage::log('Observer->changeQuoteAddressSkybox->totales->' . var_dump($totales["subtotal"]), null, 'TotalSales.log', true);
|
247 |
+
//Mage::log('Observer->changeQuoteAddressSkybox->totales->' . $totales, null, 'TotalSales.log', true);
|
248 |
+
|
249 |
+
$totalTax = 0; //$address->getTaxAmount(); //Comentado
|
250 |
+
|
251 |
+
//Recorremos los conceptos agrupados (esto debe modificarse no es lo optimo)
|
252 |
+
/*$conceptsSkybox = json_decode($address->getConceptsSkybox());
|
253 |
+
foreach ($conceptsSkybox as $concept) {
|
254 |
+
$totalTax = $totalTax + $concept->Value;
|
255 |
+
}*/
|
256 |
+
|
257 |
+
$totalRmt = 0;
|
258 |
+
//Recorremos los conceptos agrupados (esto debe modificarse no es lo optimo)
|
259 |
+
/*$rmtSkybox = json_decode($address->getRmtSkybox());
|
260 |
+
foreach ($rmtSkybox as $rmt) {
|
261 |
+
$totalRmt = $totalRmt + $rmt->Value;
|
262 |
+
}*/
|
263 |
+
|
264 |
+
//Mage::log('Observer->changeQuoteAddressSkybox->totalTax1->' . $totalTax1 . ' &totalbase->' . $baseTotals, null, 'TotalSales.log', true);
|
265 |
+
//Mage::log('Observer->changeQuoteAddressSkybox->totalTax->' . $totalTax . ' &totalbase->' . $baseTotals, null, 'TotalSales.log', true);
|
266 |
+
|
267 |
+
/*$address->setSubtotalSkybox($totals);
|
268 |
+
$address->setBaseSubtotalSkybox($baseTotals);
|
269 |
+
$address->setGrandTotalSkybox($totals+$totalTax);
|
270 |
+
$address->setBaseGrandTotalSkybox($baseTotals+$totalTax);*/
|
271 |
+
|
272 |
+
$baseTotals = $address->getBaseGrandTotalSkybox();
|
273 |
+
$totals = $address->getGrandTotalSkybox();
|
274 |
+
|
275 |
+
$address->setPriceInclTax($totals);
|
276 |
+
$address->setBasePriceInclTax($baseTotals);
|
277 |
+
|
278 |
+
$totals = floatval(preg_replace("/[^-0-9\.]/","",$totals));
|
279 |
+
//$address->setGrandTotal($totals+$totalTax);
|
280 |
+
$address->setGrandTotal($totals+$totalTax);
|
281 |
+
$address->setBaseGrandTotal($baseTotals+$totalTax);
|
282 |
+
|
283 |
+
//$address->save();
|
284 |
+
|
285 |
+
Mage::log('Observer->changeQuoteAddressSkybox : fin', null, 'TotalSales.log', true);
|
286 |
+
|
287 |
+
return $this;
|
288 |
+
}
|
289 |
+
return $this;
|
290 |
+
}
|
291 |
+
|
292 |
+
}
|
293 |
}
|
app/code/community/Skybox/Checkout/Model/Pay.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
class Skybox_Checkout_Model_Pay extends Mage_Payment_Model_Method_Abstract
|
3 |
-
{
|
4 |
-
|
5 |
-
protected $_code = 'skyboxcheckout_pay';
|
6 |
-
|
7 |
-
protected $_isInitializeNeeded = true;
|
8 |
-
protected $_canUseInternal = true;
|
9 |
-
protected $_canUseForMultishipping = false;
|
10 |
-
protected $_canUseCheckout = false;
|
11 |
-
|
12 |
}
|
1 |
+
<?php
|
2 |
+
class Skybox_Checkout_Model_Pay extends Mage_Payment_Model_Method_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
protected $_code = 'skyboxcheckout_pay';
|
6 |
+
|
7 |
+
protected $_isInitializeNeeded = true;
|
8 |
+
protected $_canUseInternal = true;
|
9 |
+
protected $_canUseForMultishipping = false;
|
10 |
+
protected $_canUseCheckout = false;
|
11 |
+
|
12 |
}
|
app/code/community/Skybox/Checkout/Model/Quote/Address/Total/Rmt.php
CHANGED
@@ -1,73 +1,87 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
$
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Model_Quote_Address_Total_Rmt extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Esta función es llamada cada vez que Magento requiere calcular los
|
14 |
+
* totales por cualquier motivo: carrito actualizado, usuario se logea,
|
15 |
+
* aplicar un cupón, selección de medios de envío, de pago, etc.
|
16 |
+
*
|
17 |
+
* Se trata de calcular lo que queremos añadir de recargo y actualizar
|
18 |
+
* el total del carrito (Magento itera sobre los totales y cada uno añade
|
19 |
+
* su parte)
|
20 |
+
**/
|
21 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
22 |
+
{
|
23 |
+
|
24 |
+
parent::collect($address); //Comentado por verificar
|
25 |
+
|
26 |
+
// Si no hay items, no hay nada que hacer
|
27 |
+
$items = $this->_getAddressItems($address);
|
28 |
+
if (!count($items)) {
|
29 |
+
return $this;
|
30 |
+
}
|
31 |
+
|
32 |
+
$quote = $address->getQuote();
|
33 |
+
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
//Verificar esta parte porque se podria raelizar desde el Total
|
38 |
+
|
39 |
+
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Esta función es llamada por Magento cuando quiere mostrar los totales en pantalla.
|
45 |
+
*
|
46 |
+
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
47 |
+
* simplemente retornar el valor formateado y que Magento lo muestre.
|
48 |
+
*/
|
49 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
50 |
+
{
|
51 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
52 |
+
if (!$activation) {
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
parent::fetch($address);
|
56 |
+
|
57 |
+
$quote = $address->getQuote();
|
58 |
+
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
|
59 |
+
return $this;
|
60 |
+
}
|
61 |
+
|
62 |
+
$RmtSkyboxjson = json_decode($address->getRmtSkybox());
|
63 |
+
|
64 |
+
Mage::log("quote->address->rmt->fetch : ini", null, 'TotalSales.log', true);
|
65 |
+
|
66 |
+
$i = 0;
|
67 |
+
foreach ($RmtSkyboxjson as $item) {
|
68 |
+
$i += 1;
|
69 |
+
$value = $item->Value;
|
70 |
+
$value = str_replace(',', '', $value);
|
71 |
+
// $value = abs($value);
|
72 |
+
|
73 |
+
$address->addTotal(array(
|
74 |
+
'code' => 'checkout_total_rmt' . $i,
|
75 |
+
'title' => $item->Concept,
|
76 |
+
'value' => $value
|
77 |
+
));
|
78 |
+
Mage::log("quote->address->rmt->fetch(Concepts)->" . $item->Concept . "=" . $item->Value, null,
|
79 |
+
'TotalSales.log', true);
|
80 |
+
}
|
81 |
+
|
82 |
+
Mage::log("quote->address->rmt->fetch : fini", null, 'TotalSales.log', true);
|
83 |
+
|
84 |
+
// Retornamos el total con su título
|
85 |
+
return $this;
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Skybox/Checkout/Model/Quote/Address/Total/Tax.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Address_Total_Tax extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Address_Total_Tax extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
}
|
app/code/community/Skybox/Checkout/Model/Quote/SubTotal.php
CHANGED
@@ -1,103 +1,103 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_SubTotal extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
// Cantidad del recargo sin impuestos
|
6 |
-
var $_amount;
|
7 |
-
|
8 |
-
protected $_api = null;
|
9 |
-
protected $_product = null;
|
10 |
-
|
11 |
-
/* @return Skybox_Checkout_Model_Api_Checkout */
|
12 |
-
protected function _getApi()
|
13 |
-
{
|
14 |
-
if (null === $this->_api) {
|
15 |
-
$this->_api = Mage::getModel('skyboxcheckout/api_checkout');
|
16 |
-
}
|
17 |
-
return $this->_api;
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Return Skybox API Product
|
22 |
-
*
|
23 |
-
* @return Skybox_Catalogo_Model_Api_Product
|
24 |
-
*/
|
25 |
-
protected function _getProductApi()
|
26 |
-
{
|
27 |
-
if (null === $this->_product) {
|
28 |
-
$this->_product = Mage::getModel('skyboxcatalog/api_product');
|
29 |
-
}
|
30 |
-
return $this->_product;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Esta función es llamada cada vez que Magento requiere calcular los
|
35 |
-
* totales por cualquier motivo: carrito actualizado, usuario se logea,
|
36 |
-
* aplicar un cupón, selección de medios de envío, de pago, etc.
|
37 |
-
*
|
38 |
-
* Se trata de calcular lo que queremos añadir de recargo y actualizar
|
39 |
-
* el total del carrito (Magento itera sobre los totales y cada uno añade
|
40 |
-
* su parte)
|
41 |
-
**/
|
42 |
-
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
43 |
-
|
44 |
-
parent::collect($address); //Comentado por verificar
|
45 |
-
|
46 |
-
// Si no hay items, no hay nada que hacer
|
47 |
-
$items = $this->_getAddressItems($address);
|
48 |
-
if (!count($items)) {
|
49 |
-
return $this;
|
50 |
-
}
|
51 |
-
|
52 |
-
$quote= $address->getQuote();
|
53 |
-
if(!$quote->isVirtual() && $address->getAddressType() == 'billing'){
|
54 |
-
return $this;
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
//$address->setSubTotal(100);
|
60 |
-
//$address->setBaseSubTotal(100);
|
61 |
-
|
62 |
-
$address->setRowtotalResult(100);
|
63 |
-
|
64 |
-
//$address->setTaxAmount(0);
|
65 |
-
|
66 |
-
//$address->save(); //Guardamos los Cambios
|
67 |
-
Mage::log("quote->address->collect->getSubTotal->" . $address->getSubTotal(), null, 'SubTotalSales.log', true);
|
68 |
-
Mage::log("quote->address->collect->getGrandTotal->" . $address->getGrandTotal(), null, 'SubTotalSales.log', true);
|
69 |
-
|
70 |
-
Mage::log("quote->address->collect->Total->" . $totalskybox, null, 'SubTotalSales.log', true);
|
71 |
-
Mage::log("quote->address->collect : fin", null, 'SubTotalSales.log', true);
|
72 |
-
|
73 |
-
return $this;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Esta función es llamada por Magento cuando quiere mostrar los totales en pantalla.
|
78 |
-
*
|
79 |
-
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
80 |
-
* simplemente retornar el valor formateado y que Magento lo muestre.
|
81 |
-
*/
|
82 |
-
public function fetch(Mage_Sales_Model_Quote_Address $address) {
|
83 |
-
|
84 |
-
parent::fetch($address); //Comentado por verificar
|
85 |
-
|
86 |
-
$quote= $address->getQuote();
|
87 |
-
if(!$quote->isVirtual() && $address->getAddressType() == 'billing'){
|
88 |
-
return $this;
|
89 |
-
}
|
90 |
-
|
91 |
-
$ConceptsSkyboxjson = json_decode($address->getConceptsSkybox());
|
92 |
-
|
93 |
-
$address->addTotal(array(
|
94 |
-
'code' => 'subtotal',
|
95 |
-
'title' => 'Sub Total',
|
96 |
-
'value' => 150
|
97 |
-
));
|
98 |
-
Mage::log("quote->address->fetch : fin", null, 'SubTotalSales.log', true);
|
99 |
-
// Retornamos el total con su título
|
100 |
-
return $this;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_SubTotal extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
// Cantidad del recargo sin impuestos
|
6 |
+
var $_amount;
|
7 |
+
|
8 |
+
protected $_api = null;
|
9 |
+
protected $_product = null;
|
10 |
+
|
11 |
+
/* @return Skybox_Checkout_Model_Api_Checkout */
|
12 |
+
protected function _getApi()
|
13 |
+
{
|
14 |
+
if (null === $this->_api) {
|
15 |
+
$this->_api = Mage::getModel('skyboxcheckout/api_checkout');
|
16 |
+
}
|
17 |
+
return $this->_api;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Return Skybox API Product
|
22 |
+
*
|
23 |
+
* @return Skybox_Catalogo_Model_Api_Product
|
24 |
+
*/
|
25 |
+
protected function _getProductApi()
|
26 |
+
{
|
27 |
+
if (null === $this->_product) {
|
28 |
+
$this->_product = Mage::getModel('skyboxcatalog/api_product');
|
29 |
+
}
|
30 |
+
return $this->_product;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Esta función es llamada cada vez que Magento requiere calcular los
|
35 |
+
* totales por cualquier motivo: carrito actualizado, usuario se logea,
|
36 |
+
* aplicar un cupón, selección de medios de envío, de pago, etc.
|
37 |
+
*
|
38 |
+
* Se trata de calcular lo que queremos añadir de recargo y actualizar
|
39 |
+
* el total del carrito (Magento itera sobre los totales y cada uno añade
|
40 |
+
* su parte)
|
41 |
+
**/
|
42 |
+
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
43 |
+
|
44 |
+
parent::collect($address); //Comentado por verificar
|
45 |
+
|
46 |
+
// Si no hay items, no hay nada que hacer
|
47 |
+
$items = $this->_getAddressItems($address);
|
48 |
+
if (!count($items)) {
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
$quote= $address->getQuote();
|
53 |
+
if(!$quote->isVirtual() && $address->getAddressType() == 'billing'){
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
//$address->setSubTotal(100);
|
60 |
+
//$address->setBaseSubTotal(100);
|
61 |
+
|
62 |
+
$address->setRowtotalResult(100);
|
63 |
+
|
64 |
+
//$address->setTaxAmount(0);
|
65 |
+
|
66 |
+
//$address->save(); //Guardamos los Cambios
|
67 |
+
Mage::log("quote->address->collect->getSubTotal->" . $address->getSubTotal(), null, 'SubTotalSales.log', true);
|
68 |
+
Mage::log("quote->address->collect->getGrandTotal->" . $address->getGrandTotal(), null, 'SubTotalSales.log', true);
|
69 |
+
|
70 |
+
Mage::log("quote->address->collect->Total->" . $totalskybox, null, 'SubTotalSales.log', true);
|
71 |
+
Mage::log("quote->address->collect : fin", null, 'SubTotalSales.log', true);
|
72 |
+
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Esta función es llamada por Magento cuando quiere mostrar los totales en pantalla.
|
78 |
+
*
|
79 |
+
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
80 |
+
* simplemente retornar el valor formateado y que Magento lo muestre.
|
81 |
+
*/
|
82 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address) {
|
83 |
+
|
84 |
+
parent::fetch($address); //Comentado por verificar
|
85 |
+
|
86 |
+
$quote= $address->getQuote();
|
87 |
+
if(!$quote->isVirtual() && $address->getAddressType() == 'billing'){
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
|
91 |
+
$ConceptsSkyboxjson = json_decode($address->getConceptsSkybox());
|
92 |
+
|
93 |
+
$address->addTotal(array(
|
94 |
+
'code' => 'subtotal',
|
95 |
+
'title' => 'Sub Total',
|
96 |
+
'value' => 150
|
97 |
+
));
|
98 |
+
Mage::log("quote->address->fetch : fin", null, 'SubTotalSales.log', true);
|
99 |
+
// Retornamos el total con su título
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total.php
CHANGED
@@ -1,276 +1,304 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
$
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
$
|
110 |
-
$
|
111 |
-
|
112 |
-
$
|
113 |
-
$
|
114 |
-
|
115 |
-
$
|
116 |
-
$
|
117 |
-
|
118 |
-
$
|
119 |
-
$
|
120 |
-
|
121 |
-
$
|
122 |
-
$
|
123 |
-
|
124 |
-
$
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
$
|
134 |
-
|
135 |
-
|
136 |
-
$
|
137 |
-
|
138 |
-
$
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
$address->
|
145 |
-
$address->
|
146 |
-
|
147 |
-
$address->
|
148 |
-
$address->
|
149 |
-
|
150 |
-
$address->
|
151 |
-
$address->
|
152 |
-
|
153 |
-
$address->
|
154 |
-
$address->
|
155 |
-
|
156 |
-
$address->
|
157 |
-
$address->
|
158 |
-
|
159 |
-
$address->
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
$
|
164 |
-
|
165 |
-
$
|
166 |
-
$
|
167 |
-
|
168 |
-
$
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
$
|
178 |
-
$
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
$address->
|
186 |
-
$address->
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
)
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
$
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
// Cantidad del recargo sin impuestos
|
14 |
+
// var $_amount;
|
15 |
+
|
16 |
+
protected $_api = null;
|
17 |
+
protected $_product = null;
|
18 |
+
|
19 |
+
/* @return Skybox_Checkout_Model_Api_Checkout */
|
20 |
+
protected function _getApi()
|
21 |
+
{
|
22 |
+
if (null === $this->_api) {
|
23 |
+
$this->_api = Mage::getModel('skyboxcheckout/api_checkout');
|
24 |
+
}
|
25 |
+
return $this->_api;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Return Skybox API Product
|
30 |
+
*
|
31 |
+
* @return Skybox_Catalogo_Model_Api_Product
|
32 |
+
*/
|
33 |
+
protected function _getProductApi()
|
34 |
+
{
|
35 |
+
if (null === $this->_product) {
|
36 |
+
$this->_product = Mage::getModel('skyboxcatalog/api_product');
|
37 |
+
}
|
38 |
+
return $this->_product;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Esta función es llamada cada vez que Magento requiere calcular los
|
43 |
+
* totales por cualquier motivo: carrito actualizado, usuario se logea,
|
44 |
+
* aplicar un cupón, selección de medios de envío, de pago, etc.
|
45 |
+
*
|
46 |
+
* Se trata de calcular lo que queremos añadir de recargo y actualizar
|
47 |
+
* el total del carrito (Magento itera sobre los totales y cada uno añade
|
48 |
+
* su parte)
|
49 |
+
**/
|
50 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
51 |
+
{
|
52 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
53 |
+
if (!$activation) {
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
$isIntegration3 = false;
|
57 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
58 |
+
if ($typeIntegration == 3) {
|
59 |
+
$isIntegration3 = true;
|
60 |
+
}
|
61 |
+
|
62 |
+
$locationAllow = $this->_getApi()->getLocationAllow();
|
63 |
+
|
64 |
+
if (!$isIntegration3 && $locationAllow) {
|
65 |
+
if ($this->_getApi()->getLocationAllow()) {
|
66 |
+
|
67 |
+
|
68 |
+
parent::collect($address); //Comentado por verificar
|
69 |
+
|
70 |
+
// Si no hay items, no hay nada que hacer
|
71 |
+
$items = $this->_getAddressItems($address);
|
72 |
+
if (!count($items)) {
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
$quote = $address->getQuote();
|
77 |
+
|
78 |
+
// $quote = Mage::helper('checkout/cart')->getCart()->getQuote();
|
79 |
+
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();
|
80 |
+
if ($shippingMethod) {
|
81 |
+
Mage::log('set shipping method null', null, 'tracer.log', true);
|
82 |
+
$quote->getShippingAddress()->setShippingMethod(null); //setting method to null
|
83 |
+
$quote->save();
|
84 |
+
}
|
85 |
+
|
86 |
+
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
|
90 |
+
//$quote->setCustomerTaxClassId(0);
|
91 |
+
|
92 |
+
//Limpiamos los Valores de Impuestos
|
93 |
+
/*$rates = array();
|
94 |
+
$address->setAppliedTaxes($rates);*/
|
95 |
+
|
96 |
+
/*--------Nuevos conceptos---------*/
|
97 |
+
$totals = $this->_getApi()->GetTotalShoppingCart();
|
98 |
+
|
99 |
+
if ($this->_getApi()->HasError()) {
|
100 |
+
Mage::log("StatusCode: Error", null, 'TotalSales.log', true);
|
101 |
+
return $this;
|
102 |
+
}
|
103 |
+
|
104 |
+
Mage::log("quote->address->collect : ini", null, 'TotalSales.log', true);
|
105 |
+
|
106 |
+
//$StatusCode = $totals->getParameter('StatusCode');
|
107 |
+
//$StatusCode = $totals->getParameter('StatusCode');//Comentado por estar repetido
|
108 |
+
|
109 |
+
$Customs = $totals->getParameter('Customs');
|
110 |
+
$CustomsUSD = $totals->getParameter('CustomsUSD');
|
111 |
+
|
112 |
+
$Shipping = $totals->getParameter('Shipping');
|
113 |
+
$ShippingUSD = $totals->getParameter('ShippingUSD');
|
114 |
+
|
115 |
+
$Insurance = $totals->getParameter('Insurance');
|
116 |
+
$InsuranceUSD = $totals->getParameter('InsuranceUSD');
|
117 |
+
|
118 |
+
$Taxes = $totals->getParameter('Taxes');
|
119 |
+
$TaxesUSD = $totals->getParameter('TaxesUSD');
|
120 |
+
|
121 |
+
$Duties = $totals->getParameter('Duties');
|
122 |
+
$DutiesUSD = $totals->getParameter('DutiesUSD');
|
123 |
+
|
124 |
+
$Handling = $totals->getParameter('Handling');
|
125 |
+
$HandlingUSD = $totals->getParameter('HandlingUSD');
|
126 |
+
|
127 |
+
$Clearence = $totals->getParameter('Clearence');
|
128 |
+
$ClearenceUSD = $totals->getParameter('ClearenceUSD');
|
129 |
+
|
130 |
+
$Others = $totals->getParameter('Others');
|
131 |
+
$OthersUSD = $totals->getParameter('OthersUSD');
|
132 |
+
|
133 |
+
$Adjustment = $totals->getParameter('Adjustment');
|
134 |
+
$AdjustmentUSD = $totals->getParameter('AdjustmentUSD');
|
135 |
+
|
136 |
+
$listAdjustjson = $totals->getResponse()->{'ListDetailConcepts'};
|
137 |
+
|
138 |
+
$listRmtjson = $totals->getResponse()->{'ListDetailAdjusts'};
|
139 |
+
|
140 |
+
/*--------------------------------*/
|
141 |
+
// Apuntamos lo que hemos calculado para usarlo luego
|
142 |
+
// Idealmente esto debería ir a parar a la base de datos a un campo
|
143 |
+
// creado a los efectos
|
144 |
+
$address->setCustomsTotalSkybox($Customs);
|
145 |
+
$address->setCustomsTotalUsdSkybox($CustomsUSD);
|
146 |
+
|
147 |
+
$address->setShippingTotalSkybox($Shipping);
|
148 |
+
$address->setShippingTotalUsdSkybox($ShippingUSD);
|
149 |
+
|
150 |
+
$address->setInsuranceTotalSkybox($Insurance);
|
151 |
+
$address->setInsuranceTotalUsdSkybox($InsuranceUSD);
|
152 |
+
|
153 |
+
$address->setTaxesTotalSkybox($Taxes);
|
154 |
+
$address->setTaxesTotalUsdSkybox($TaxesUSD);
|
155 |
+
|
156 |
+
$address->setDutiesTotalSkybox($Duties);
|
157 |
+
$address->setDutiesTotalUsdSkybox($DutiesUSD);
|
158 |
+
|
159 |
+
$address->setHandlingTotalSkybox($Handling);
|
160 |
+
$address->setHandlingTotalUsdSkybox($HandlingUSD);
|
161 |
+
|
162 |
+
$address->setClearenceTotalSkybox($Clearence);
|
163 |
+
$address->setClearenceTotalUsdSkybox($ClearenceUSD);
|
164 |
+
|
165 |
+
$address->setOthersTotalSkybox($Others);
|
166 |
+
$address->setOthersTotalUsdSkybox($OthersUSD);
|
167 |
+
|
168 |
+
$address->setAdjustTotalSkybox($Adjustment);
|
169 |
+
$address->setAdjustTotalUsdSkybox($AdjustmentUSD);
|
170 |
+
|
171 |
+
$address->setConceptsSkybox(json_encode($listAdjustjson));
|
172 |
+
|
173 |
+
$address->setRmtSkybox(json_encode($listRmtjson));
|
174 |
+
|
175 |
+
$totalskybox = 0;
|
176 |
+
//$totalskybox=$Taxes+$Handling+$Shipping+$Insurance+$Clearence+$Duties+$Others-$Adjustment;
|
177 |
+
$subtotalskybox = $totals->getResponse()->{'StoreProductPrice'};
|
178 |
+
$totalskybox = $totals->getResponse()->{'TotalProduct'};
|
179 |
+
//$totalskyboxbase=$TaxesUSD+$HandlingUSD+$ShippingUSD+$InsuranceUSD+$ClearenceUSD+$DutiesUSD+$OthersUSD-$AdjustmentUSD;
|
180 |
+
$subtotalskyboxbase = $totals->getResponse()->{'StoreProductPriceUSD'};
|
181 |
+
$totalskyboxbase = $totals->getResponse()->{'TotalProductUSD'};
|
182 |
+
/*$address->setBasePaypalfeeAmount($this->_amount);*/
|
183 |
+
|
184 |
+
// Actualizamos el total de la quote
|
185 |
+
//$address->setGrandTotal($address->getGrandTotal() +$totalskybox);
|
186 |
+
//$address->setBaseGrandTotal($address->getBaseGrandTotal() + $totalskyboxbase);
|
187 |
+
|
188 |
+
$address->setSubTotal(100);
|
189 |
+
$address->setBaseSubTotal(100);
|
190 |
+
$address->setGrandTotal($totalskybox);/*this is total variable on cart checkout*/
|
191 |
+
$address->setBaseGrandTotal($totalskyboxbase);
|
192 |
+
|
193 |
+
//$address->setGrandTotalSkybox($address->getGrandTotal() + $totalskybox);
|
194 |
+
//$address->setBaseGrandTotalSkybox($address->getBaseGrandTotal() + $totalskyboxbase);
|
195 |
+
|
196 |
+
$address->setSubtotalSkybox($subtotalskybox);
|
197 |
+
$address->setBaseSubtotalSkybox($totalskyboxbase);
|
198 |
+
$address->setGrandTotalSkybox($totalskybox);
|
199 |
+
$address->setBaseGrandTotalSkybox($totalskyboxbase);
|
200 |
+
|
201 |
+
//$address->setTaxAmount(0);
|
202 |
+
|
203 |
+
//$address->save(); //Guardamos los Cambios
|
204 |
+
Mage::log("quote->address->collect->getSubTotal->" . $address->getSubTotal(), null, 'TotalSales.log',
|
205 |
+
true);
|
206 |
+
Mage::log("quote->address->collect->getGrandTotal->" . $address->getGrandTotal(), null,
|
207 |
+
'TotalSales.log', true);
|
208 |
+
|
209 |
+
Mage::log("quote->address->collect->Total->" . $totalskybox, null, 'TotalSales.log', true);
|
210 |
+
Mage::log("quote->address->collect : fin", null, 'TotalSales.log', true);
|
211 |
+
|
212 |
+
return $this;
|
213 |
+
} else {
|
214 |
+
parent::collect($address);
|
215 |
+
}
|
216 |
+
}
|
217 |
+
return $this;
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Esta función es llamada por Magento cuando quiere mostrar los totales en pantalla.
|
223 |
+
*
|
224 |
+
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
225 |
+
* simplemente retornar el valor formateado y que Magento lo muestre.
|
226 |
+
*/
|
227 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
228 |
+
{
|
229 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
230 |
+
if (!$activation) {
|
231 |
+
return $this;
|
232 |
+
}
|
233 |
+
/**
|
234 |
+
* Integration 3 start, show price shop in cart*
|
235 |
+
*/
|
236 |
+
$allowRunByIntegration3 = true;
|
237 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
238 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
239 |
+
if ($typeIntegration == 3) {
|
240 |
+
$allowRunByIntegration3 = false;
|
241 |
+
}
|
242 |
+
/**
|
243 |
+
* Integration 3 end, show price shop in cart*
|
244 |
+
*/
|
245 |
+
if ($allowRunByIntegration3) {
|
246 |
+
|
247 |
+
if ($this->_getApi()->getLocationAllow()) {
|
248 |
+
parent::fetch($address); // check
|
249 |
+
|
250 |
+
$quote = $address->getQuote();
|
251 |
+
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
|
252 |
+
return $this;
|
253 |
+
}
|
254 |
+
|
255 |
+
$ConceptsSkyboxjson = json_decode($address->getConceptsSkybox());
|
256 |
+
|
257 |
+
Mage::log("quote->address->fetch : ini", null, 'TotalSales.log', true);
|
258 |
+
Mage::log("quote->address->fetch->getSubTotal->" . $address->getSubTotal(), null, 'TotalSales.log',
|
259 |
+
true);
|
260 |
+
Mage::log("quote->address->fetch->getGrandTotal->" . $address->getGrandTotal(), null, 'TotalSales.log',
|
261 |
+
true);
|
262 |
+
|
263 |
+
/*
|
264 |
+
* Reescribimos el monto del SubTotal a Mostrar
|
265 |
+
*/
|
266 |
+
|
267 |
+
// @todo: Make this code better!
|
268 |
+
$skyboxSubtotal = $address->getSubtotalSkybox();
|
269 |
+
$skyboxSubtotal = str_replace(',', '', $skyboxSubtotal);
|
270 |
+
|
271 |
+
$address->addTotal(array(
|
272 |
+
'code' => 'subtotal',
|
273 |
+
'title' => Mage::helper('sales')->__('Subtotal'),
|
274 |
+
'value' => $skyboxSubtotal
|
275 |
+
));
|
276 |
+
|
277 |
+
/*
|
278 |
+
* Reescribimos el monto de los conceptos a Mostrar
|
279 |
+
*/
|
280 |
+
$i = 0;
|
281 |
+
foreach ($ConceptsSkyboxjson as $item) {
|
282 |
+
if ($item->Visible != 0) {
|
283 |
+
$i += 1;
|
284 |
+
$address->addTotal(array(
|
285 |
+
'code' => 'checkout_total' . $i,
|
286 |
+
'title' => $item->Concept,
|
287 |
+
'value' => $item->Value
|
288 |
+
));
|
289 |
+
Mage::log("quote->address->fetch(Concepts)->" . $item->Concept . "=" . $item->Value, null,
|
290 |
+
'TotalSales.log', true);
|
291 |
+
}
|
292 |
+
}
|
293 |
+
Mage::log("quote->address->fetch : fin", null, 'TotalSales.log', true);
|
294 |
+
// Retornamos el total con su título
|
295 |
+
return $this;
|
296 |
+
} else {
|
297 |
+
parent::fetch($address);
|
298 |
+
return $this;
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total2.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total2 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
|
6 |
-
}
|
7 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total2 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
|
6 |
+
}
|
7 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total3.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total3 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
}
|
6 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total3 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
}
|
6 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total4.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total4 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
}
|
6 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total4 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
}
|
6 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total5.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total5 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
}
|
6 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total5 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
}
|
6 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total6.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total6 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
}
|
6 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total6 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
}
|
6 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total7.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total7 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
}
|
6 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total7 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
}
|
6 |
+
|
app/code/community/Skybox/Checkout/Model/Quote/Total8.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Skybox_Checkout_Model_Quote_Total8 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
-
|
5 |
-
|
6 |
-
}
|
7 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Skybox_Checkout_Model_Quote_Total8 extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
4 |
+
|
5 |
+
|
6 |
+
}
|
7 |
+
|
app/code/community/Skybox/Checkout/controllers/CalculateController.php
CHANGED
@@ -1,127 +1,127 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_CalculateController extends Mage_Core_Controller_Front_Action
|
11 |
-
{
|
12 |
-
public function indexAction()
|
13 |
-
{
|
14 |
-
$isAjax = Mage::app()->getRequest()->isAjax();
|
15 |
-
|
16 |
-
if ($isAjax) {
|
17 |
-
|
18 |
-
$productId = ($this->getRequest()->getParam('product_id')) ?
|
19 |
-
$this->getRequest()->getParam('product_id') : null;
|
20 |
-
|
21 |
-
$price = ($this->getRequest()->getParam('price')) ?
|
22 |
-
$this->getRequest()->getParam('price') : null;
|
23 |
-
|
24 |
-
$_request = ($this->getRequest()->getParam('request')) ?
|
25 |
-
$this->getRequest()->getParam('request') : null;
|
26 |
-
|
27 |
-
if (!isset($productId) || !isset($price)) {
|
28 |
-
//trigger_error('Invalid Product or Price.');
|
29 |
-
$this->_error('Invalid Product or Price.');
|
30 |
-
}
|
31 |
-
|
32 |
-
if ($_request) {
|
33 |
-
parse_str($_request, $request);
|
34 |
-
$request = $this->_array_filter_recursive($request);
|
35 |
-
$request = $this->_getProductRequest($request);
|
36 |
-
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
37 |
-
}
|
38 |
-
|
39 |
-
|
40 |
-
$productAPI = Mage::getModel('skyboxcatalog/api_product');
|
41 |
-
|
42 |
-
/* $product Mage_Catalog_Model_Product */
|
43 |
-
$product = Mage::getModel('catalog/product')->load($productId);
|
44 |
-
$type = $product->getTypeId();
|
45 |
-
$template = null;
|
46 |
-
//Mage::log(print_r('calculateController: '.$type, true), null, 'tracer.log', true);
|
47 |
-
switch ($type) {
|
48 |
-
case 'simple':
|
49 |
-
$template = $productAPI->CalculatePrice($product->getId(), null, $product->getFinalPrice(), 'simple')
|
50 |
-
->GetTemplateProduct();
|
51 |
-
break;
|
52 |
-
case 'configurable':
|
53 |
-
$template = $productAPI->CalculatePrice($product->getId(), null, $price, $product->getTypeId())
|
54 |
-
->GetTemplateProduct();
|
55 |
-
break;
|
56 |
-
case 'bundle':
|
57 |
-
try {
|
58 |
-
$template = $productAPI->CalculatePrice($product->getId(), $request, $price, 'bundle')
|
59 |
-
->GetTemplateProduct();
|
60 |
-
} catch (Exception $e) {
|
61 |
-
Mage::logException($e);
|
62 |
-
$template = '';
|
63 |
-
}
|
64 |
-
break;
|
65 |
-
default;
|
66 |
-
$this->_error('Invalid or not supported Product Type.');
|
67 |
-
break;
|
68 |
-
}
|
69 |
-
|
70 |
-
$extraHtml = '<p class="label" id="skybox-configurable-price-from-'
|
71 |
-
. $product->getId()
|
72 |
-
//. $this->getIdSuffix()
|
73 |
-
. ''
|
74 |
-
. '">'
|
75 |
-
. $template
|
76 |
-
. '</p>'
|
77 |
-
. '<div style="clear:both"></div>';
|
78 |
-
|
79 |
-
$this->getResponse()->setBody($extraHtml);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
private function _error($message = null)
|
84 |
-
{
|
85 |
-
if ($message == null) {
|
86 |
-
$message = "Unexpected error";
|
87 |
-
}
|
88 |
-
return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error' => $message)));
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Get request for product
|
93 |
-
*
|
94 |
-
* @param mixed $requestInfo
|
95 |
-
* @return Varien_Object
|
96 |
-
*/
|
97 |
-
private function _getProductRequest($requestInfo)
|
98 |
-
{
|
99 |
-
if ($requestInfo instanceof Varien_Object) {
|
100 |
-
$request = $requestInfo;
|
101 |
-
} elseif (is_numeric($requestInfo)) {
|
102 |
-
$request = new Varien_Object(array('qty' => $requestInfo));
|
103 |
-
} else {
|
104 |
-
$request = new Varien_Object($requestInfo);
|
105 |
-
}
|
106 |
-
|
107 |
-
if (!$request->hasQty()) {
|
108 |
-
$request->setQty(1);
|
109 |
-
}
|
110 |
-
|
111 |
-
return $request;
|
112 |
-
}
|
113 |
-
|
114 |
-
/*
|
115 |
-
* Array Filter Recursive (utils)
|
116 |
-
*/
|
117 |
-
private function _array_filter_recursive($input)
|
118 |
-
{
|
119 |
-
foreach ($input as &$value) {
|
120 |
-
if (is_array($value)) {
|
121 |
-
$value = $this->_array_filter_recursive($value);
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
return array_filter($input);
|
126 |
-
}
|
127 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_CalculateController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
$isAjax = Mage::app()->getRequest()->isAjax();
|
15 |
+
|
16 |
+
if ($isAjax) {
|
17 |
+
|
18 |
+
$productId = ($this->getRequest()->getParam('product_id')) ?
|
19 |
+
$this->getRequest()->getParam('product_id') : null;
|
20 |
+
|
21 |
+
$price = ($this->getRequest()->getParam('price')) ?
|
22 |
+
$this->getRequest()->getParam('price') : null;
|
23 |
+
|
24 |
+
$_request = ($this->getRequest()->getParam('request')) ?
|
25 |
+
$this->getRequest()->getParam('request') : null;
|
26 |
+
|
27 |
+
if (!isset($productId) || !isset($price)) {
|
28 |
+
//trigger_error('Invalid Product or Price.');
|
29 |
+
$this->_error('Invalid Product or Price.');
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($_request) {
|
33 |
+
parse_str($_request, $request);
|
34 |
+
$request = $this->_array_filter_recursive($request);
|
35 |
+
$request = $this->_getProductRequest($request);
|
36 |
+
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
37 |
+
}
|
38 |
+
|
39 |
+
/** @var Skybox_Catalog_Model_Api_Product $productAPI */
|
40 |
+
$productAPI = Mage::getModel('skyboxcatalog/api_product');
|
41 |
+
|
42 |
+
/* $product Mage_Catalog_Model_Product */
|
43 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
44 |
+
$type = $product->getTypeId();
|
45 |
+
$template = null;
|
46 |
+
//Mage::log(print_r('calculateController: '.$type, true), null, 'tracer.log', true);
|
47 |
+
switch ($type) {
|
48 |
+
case 'simple':
|
49 |
+
$template = $productAPI->CalculatePrice($product->getId(), null, $product->getFinalPrice(), 'simple')
|
50 |
+
->GetTemplateProduct();
|
51 |
+
break;
|
52 |
+
case 'configurable':
|
53 |
+
$template = $productAPI->CalculatePrice($product->getId(), null, $price, $product->getTypeId())
|
54 |
+
->GetTemplateProduct();
|
55 |
+
break;
|
56 |
+
case 'bundle':
|
57 |
+
try {
|
58 |
+
$template = $productAPI->CalculatePrice($product->getId(), $request, $price, 'bundle')
|
59 |
+
->GetTemplateProduct();
|
60 |
+
} catch (Exception $e) {
|
61 |
+
Mage::logException($e);
|
62 |
+
$template = '';
|
63 |
+
}
|
64 |
+
break;
|
65 |
+
default;
|
66 |
+
$this->_error('Invalid or not supported Product Type.');
|
67 |
+
break;
|
68 |
+
}
|
69 |
+
|
70 |
+
$extraHtml = '<p class="label" id="skybox-configurable-price-from-'
|
71 |
+
. $product->getId()
|
72 |
+
//. $this->getIdSuffix()
|
73 |
+
. ''
|
74 |
+
. '">'
|
75 |
+
. $template
|
76 |
+
. '</p>'
|
77 |
+
. '<div style="clear:both"></div>';
|
78 |
+
|
79 |
+
$this->getResponse()->setBody($extraHtml);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
private function _error($message = null)
|
84 |
+
{
|
85 |
+
if ($message == null) {
|
86 |
+
$message = "Unexpected error";
|
87 |
+
}
|
88 |
+
return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error' => $message)));
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Get request for product
|
93 |
+
*
|
94 |
+
* @param mixed $requestInfo
|
95 |
+
* @return Varien_Object
|
96 |
+
*/
|
97 |
+
private function _getProductRequest($requestInfo)
|
98 |
+
{
|
99 |
+
if ($requestInfo instanceof Varien_Object) {
|
100 |
+
$request = $requestInfo;
|
101 |
+
} elseif (is_numeric($requestInfo)) {
|
102 |
+
$request = new Varien_Object(array('qty' => $requestInfo));
|
103 |
+
} else {
|
104 |
+
$request = new Varien_Object($requestInfo);
|
105 |
+
}
|
106 |
+
|
107 |
+
if (!$request->hasQty()) {
|
108 |
+
$request->setQty(1);
|
109 |
+
}
|
110 |
+
|
111 |
+
return $request;
|
112 |
+
}
|
113 |
+
|
114 |
+
/*
|
115 |
+
* Array Filter Recursive (utils)
|
116 |
+
*/
|
117 |
+
private function _array_filter_recursive($input)
|
118 |
+
{
|
119 |
+
foreach ($input as &$value) {
|
120 |
+
if (is_array($value)) {
|
121 |
+
$value = $this->_array_filter_recursive($value);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
return array_filter($input);
|
126 |
+
}
|
127 |
+
}
|
app/code/community/Skybox/Checkout/controllers/InternationalController.php
CHANGED
@@ -1,65 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_InternationalController extends Mage_Core_Controller_Front_Action
|
11 |
-
{
|
12 |
-
public function indexAction()
|
13 |
-
{
|
14 |
-
/* var $checkout_cart Mage_Checkout_Model_Session */
|
15 |
-
$checkout_cart = Mage::getSingleton('checkout/cart');
|
16 |
-
$items = $checkout_cart->getItems();
|
17 |
-
|
18 |
-
if (!$items) {
|
19 |
-
$this->getResponse()->setRedirect(
|
20 |
-
Mage::getUrl('checkout/cart')
|
21 |
-
);
|
22 |
-
}
|
23 |
-
|
24 |
-
$this->loadLayout();
|
25 |
-
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
26 |
-
//$this->getLayout()->getBlock('root')->setTemplate('skybox/checkout/pagecheckout.phtml');
|
27 |
-
$this->renderLayout();
|
28 |
-
}
|
29 |
-
|
30 |
-
public function successAction()
|
31 |
-
{
|
32 |
-
Mage::log("Call true: successAction limpiar carro", null, '
|
33 |
-
Mage::getSingleton('checkout/cart')->truncate()->save();
|
34 |
-
|
35 |
-
|
36 |
-
$
|
37 |
-
$
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$this->
|
45 |
-
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
46 |
-
$this->
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
2 => "Gracias por su compra! Le enviaremos un correo electrónico de confirmación
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_InternationalController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
/* var $checkout_cart Mage_Checkout_Model_Session */
|
15 |
+
$checkout_cart = Mage::getSingleton('checkout/cart');
|
16 |
+
$items = $checkout_cart->getItems();
|
17 |
+
|
18 |
+
if (!$items) {
|
19 |
+
$this->getResponse()->setRedirect(
|
20 |
+
Mage::getUrl('checkout/cart')
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
$this->loadLayout();
|
25 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
26 |
+
//$this->getLayout()->getBlock('root')->setTemplate('skybox/checkout/pagecheckout.phtml');
|
27 |
+
$this->renderLayout();
|
28 |
+
}
|
29 |
+
|
30 |
+
public function successAction()
|
31 |
+
{
|
32 |
+
// Mage::log("Call true: successAction limpiar carro", null, 'local.log', true);
|
33 |
+
// Mage::getSingleton('checkout/cart')->truncate()->save();
|
34 |
+
Mage::getSingleton('checkout/cart')->truncateMgCart()->save();
|
35 |
+
|
36 |
+
$_config = Mage::getModel('skyboxcore/config');
|
37 |
+
$cart = $_config->getSession()->getCartSkybox();
|
38 |
+
$id = $cart->{'LanguageId'};
|
39 |
+
|
40 |
+
$message_success = $this->languages($id);
|
41 |
+
|
42 |
+
Mage::getSingleton('core/session')->setSkyboxSuccessMsg($message_success);
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
46 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
47 |
+
$this->renderLayout();
|
48 |
+
}
|
49 |
+
|
50 |
+
private function languages($id)
|
51 |
+
{
|
52 |
+
$languages = array(
|
53 |
+
0 => "Thanks for your purchase, We have received your order and we will contact you. We will send you a confirmation email.",
|
54 |
+
1 => "Thanks for your purchase, We have received your order and we will contact you. We will send you a confirmation email.",
|
55 |
+
// 2 => "!Gracias por su compra! Hemos recibido su orden y nos pondremos en contacto contigo. Le enviaremos un correo electrónico de confirmación",
|
56 |
+
2 => "Gracias por su compra! Le enviaremos un correo electrónico de confirmación.",
|
57 |
+
3 => "'Obrigado por sua compra, Recebemos seu pedido e entraremos em contato com você. Nós lhe enviaremos um e-mail de confirmação.",
|
58 |
+
);
|
59 |
+
if (isset($languages[$id])) {
|
60 |
+
return $languages[$id];
|
61 |
+
} else {
|
62 |
+
return $languages[0];
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
}
|
app/code/community/Skybox/Checkout/controllers/ProcessController.php
CHANGED
@@ -1,300 +1,335 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Checkout
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Checkout
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Action
|
11 |
-
{
|
12 |
-
public function indexAction()
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* only one time for call to service start - Active
|
16 |
-
* This always run when you do change country
|
17 |
-
*/
|
18 |
-
$session = Mage::getSingleton("core/session",
|
19 |
-
$session->setData("callToSkyBox", true);
|
20 |
-
Mage::log("Call true: Skybox_Checkout_ProcessController", null, '
|
21 |
-
/**
|
22 |
-
* only one time for call to service end - Active
|
23 |
-
*/
|
24 |
-
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Integration 3 start, show price shop in cart*
|
28 |
-
*/
|
29 |
-
$isLocationAllow = false;
|
30 |
-
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
31 |
-
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
32 |
-
if ($typeIntegration==3) {
|
33 |
-
$isLocationAllow = true;
|
34 |
-
}
|
35 |
-
/**
|
36 |
-
* Integration 3 end, show price shop in cart*
|
37 |
-
*/
|
38 |
-
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter index', null, 'tracer.log', true);
|
39 |
-
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
40 |
-
$_checkout->InitializeBarSkybox();
|
41 |
-
|
42 |
-
$return_url = ($this->getRequest()->getParam('return_url')) ?
|
43 |
-
$this->getRequest()->getParam('return_url') :
|
44 |
-
Mage::helper('core/url')->getHomeUrl();
|
45 |
-
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
46 |
-
$product_api = Mage::getSingleton('skyboxcatalog/api_product');
|
47 |
-
Mage::log("process", null, 'processcontroller.log', true);
|
48 |
-
|
49 |
-
/*---------------- Rogged ------------------*/
|
50 |
-
$_config = Mage::getModel('skyboxcore/config');
|
51 |
-
$cart
|
52 |
-
$CartItemCount=0;
|
53 |
-
if (!empty($cart)) {
|
54 |
-
$CartItemCount = intval($cart->{'CartItemCount'});
|
55 |
-
}
|
56 |
-
# check if local skybox shopping cart and skybox-checkout match
|
57 |
-
$differentqty=0;
|
58 |
-
$api_mproduct=Mage::getModel('skyboxcatalog/api_product');
|
59 |
-
// Mage::log('entro getAllItems $CartItemCount',null,'tracer.log',true);
|
60 |
-
// Mage::log((int)$quote->getItemsQty() .'-'.$CartItemCount,null,'tracer.log',true);
|
61 |
-
if(!$isLocationAllow) {
|
62 |
-
if((int)$quote->getItemsQty() != $CartItemCount && $api_mproduct->getLocationAllow()) {
|
63 |
-
$differentqty=1;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
/*-----------------------------------------*/
|
68 |
-
foreach ($quote->getAllItems() as $item) {
|
69 |
-
$parentItem = $item->getParentItem();
|
70 |
-
$parentItemId = $item->getParentItemId();
|
71 |
-
/*---------------- Rogged ------------------*/
|
72 |
-
if($differentqty==1){
|
73 |
-
$cart = Mage::getModel('skyboxcheckout/cart');
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
$
|
79 |
-
$paramsRequest=
|
80 |
-
$
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
$productParentId=
|
90 |
-
|
91 |
-
$
|
92 |
-
$
|
93 |
-
$
|
94 |
-
$_children
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$paramsRequest['
|
105 |
-
$
|
106 |
-
$paramsRequest
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
//
|
111 |
-
// $
|
112 |
-
// $paramsRequest
|
113 |
-
// $
|
114 |
-
// $
|
115 |
-
//
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
Mage::log("
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
if ($item->getProductType() === 'simple' &&
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
$productModel
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
$product_api->CalculatePrice($item->getProductId(), null, $
|
196 |
-
Mage::log("
|
197 |
-
}
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
$
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
$item->
|
217 |
-
$item->
|
218 |
-
$item->
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$item->
|
224 |
-
|
225 |
-
$item->
|
226 |
-
$item->
|
227 |
-
$item->
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
$
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
$
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
$
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$item->
|
262 |
-
$item->
|
263 |
-
$item->
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
$item->
|
269 |
-
|
270 |
-
$item->
|
271 |
-
$item->
|
272 |
-
$item->
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
$
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Checkout
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Checkout
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* only one time for call to service start - Active
|
16 |
+
* This always run when you do change country
|
17 |
+
*/
|
18 |
+
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
|
19 |
+
$session->setData("callToSkyBox", true);
|
20 |
+
//Mage::log("Call true: Skybox_Checkout_ProcessController", null, 'local.log', true);
|
21 |
+
/**
|
22 |
+
* only one time for call to service end - Active
|
23 |
+
*/
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Integration 3 start, show price shop in cart*
|
28 |
+
*/
|
29 |
+
$isLocationAllow = false;
|
30 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
31 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
32 |
+
if ($typeIntegration == 3) {
|
33 |
+
$isLocationAllow = true;
|
34 |
+
}
|
35 |
+
/**
|
36 |
+
* Integration 3 end, show price shop in cart*
|
37 |
+
*/
|
38 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter index', null, 'tracer.log', true);
|
39 |
+
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
40 |
+
$_checkout->InitializeBarSkybox();
|
41 |
+
|
42 |
+
$return_url = ($this->getRequest()->getParam('return_url')) ?
|
43 |
+
$this->getRequest()->getParam('return_url') :
|
44 |
+
Mage::helper('core/url')->getHomeUrl();
|
45 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
46 |
+
$product_api = Mage::getSingleton('skyboxcatalog/api_product');
|
47 |
+
Mage::log("process", null, 'processcontroller.log', true);
|
48 |
+
|
49 |
+
/*---------------- Rogged ------------------*/
|
50 |
+
$_config = Mage::getModel('skyboxcore/config');
|
51 |
+
$cart = $_config->getSession()->getCartSkybox();
|
52 |
+
$CartItemCount = 0;
|
53 |
+
if (!empty($cart)) {
|
54 |
+
$CartItemCount = intval($cart->{'CartItemCount'});
|
55 |
+
}
|
56 |
+
# check if local skybox shopping cart and skybox-checkout match
|
57 |
+
$differentqty = 0;
|
58 |
+
$api_mproduct = Mage::getModel('skyboxcatalog/api_product');
|
59 |
+
// Mage::log('entro getAllItems $CartItemCount',null,'tracer.log',true);
|
60 |
+
// Mage::log((int)$quote->getItemsQty() .'-'.$CartItemCount,null,'tracer.log',true);
|
61 |
+
if (!$isLocationAllow) {
|
62 |
+
if ((int)$quote->getItemsQty() != $CartItemCount && $api_mproduct->getLocationAllow()) {
|
63 |
+
$differentqty = 1;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/*-----------------------------------------*/
|
68 |
+
foreach ($quote->getAllItems() as $item) {
|
69 |
+
$parentItem = $item->getParentItem();
|
70 |
+
$parentItemId = $item->getParentItemId();
|
71 |
+
/*---------------- Rogged ------------------*/
|
72 |
+
if ($differentqty == 1) {
|
73 |
+
$cart = Mage::getModel('skyboxcheckout/cart');
|
74 |
+
|
75 |
+
if ($item->getProductType() === 'simple' && !$parentItem) {
|
76 |
+
$productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
77 |
+
$paramsRequest = array();
|
78 |
+
$paramsRequest['product'] = $item->getProductId();
|
79 |
+
$paramsRequest['qty'] = $item->getQty();
|
80 |
+
$cart->removeItem($item->getItemId());
|
81 |
+
$cart->addProduct($productModel, $paramsRequest);
|
82 |
+
}
|
83 |
+
/* end */
|
84 |
+
|
85 |
+
if ($item->getProductType() === 'simple' && $parentItem) {
|
86 |
+
$paramsRequest = array();
|
87 |
+
$productParentId = Mage::getModel('catalog/product_type_configurable')
|
88 |
+
->getParentIdsByChild($item->getProductId());
|
89 |
+
$productParentId = $productParentId[0];
|
90 |
+
$productModel = Mage::getModel('catalog/product')->load($productParentId);
|
91 |
+
$_typeInstance = $productModel->getTypeInstance(true);
|
92 |
+
$_children = $_typeInstance->getUsedProducts(null, $productModel);
|
93 |
+
$_attributes = $_typeInstance->getUsedProductAttributes($productModel);
|
94 |
+
foreach ($_children as $_child) {
|
95 |
+
if ($_child->entity_id == $item->getProductId()) {
|
96 |
+
$_superAttributes = array();
|
97 |
+
foreach ($_attributes as $_attribute) {
|
98 |
+
$_superAttributes[$_attribute->getAttributeId()] = $_child->getData($_attribute->getAttributeCode());
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
$paramsRequest['product'] = $item->getProductId();
|
103 |
+
$paramsRequest['qty'] = $item->getQty();
|
104 |
+
$paramsRequest['super_attribute'] = $_superAttributes;
|
105 |
+
$cart->removeItem($parentItemId);
|
106 |
+
$cart->addProduct($productModel, $paramsRequest);
|
107 |
+
}
|
108 |
+
// if ($item->getProductType() === 'simple' && !$parentItem && $item->getPriceSkybox()) {
|
109 |
+
// $productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
110 |
+
// $paramsRequest=array();
|
111 |
+
// $paramsRequest['product']=$item->getProductId();
|
112 |
+
// $paramsRequest['qty']=$item->getQty();
|
113 |
+
// $cart->removeItem($item->getItemId());
|
114 |
+
// $cart->addProduct($productModel,$paramsRequest);
|
115 |
+
// }
|
116 |
+
}
|
117 |
+
/*----------------------------------------*/
|
118 |
+
|
119 |
+
|
120 |
+
Mage::log("process", null, 'process.log', true);
|
121 |
+
//Mage::log("ITEM Class: " . get_class($item), null, 'cart.log', true);
|
122 |
+
//Mage::log("ITEM Id: " . $item->getProductId(), null, 'cart.log', true);
|
123 |
+
|
124 |
+
|
125 |
+
/*if ($item->getProductType() === 'configurable') continue;
|
126 |
+
if ($item->getProductType() === 'simple' && $parentItem && !$item->getPriceSkybox()) continue;
|
127 |
+
|
128 |
+
// Simple Product
|
129 |
+
if ($item->getProductType() === 'simple' && !$parentItem && $item->getPriceSkybox()) {
|
130 |
+
$product_api->CalculatePrice($item->getProductId(), null, null);
|
131 |
+
}
|
132 |
+
|
133 |
+
// Configurable Product
|
134 |
+
if ($item->getProductType() === 'simple' && $parentItem) {
|
135 |
+
$item = $parentItem;
|
136 |
+
$product_api->CalculatePrice($item->getProductId(), null, $item->getPriceUsdSkybox());
|
137 |
+
}
|
138 |
+
|
139 |
+
// Bundle Product
|
140 |
+
if ($item->getProductType() === 'bundle') {
|
141 |
+
$product_api->CalculatePrice($item->getProductId(), null, $item->getPriceUsdSkybox());
|
142 |
+
};
|
143 |
+
|
144 |
+
$total = str_replace(",", "", $product_api->getTotalPriceUSD());*/
|
145 |
+
|
146 |
+
/* -- Rogged --*/
|
147 |
+
/* Cuando se cambia de country no allow a otro country allow, no hay precio en skybox registrado, por eso tomamos el precio de tienda */
|
148 |
+
/** @var Mage_Catalog_Model_Resource_Product $productModel */
|
149 |
+
// $productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
150 |
+
|
151 |
+
/** @var Mage_Catalog_Model_Product $productModel */
|
152 |
+
$productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
153 |
+
|
154 |
+
if (!$isLocationAllow) {
|
155 |
+
if ($api_mproduct->getLocationAllow() && !$item->getPriceSkybox()) {
|
156 |
+
$item->setPriceSkybox($productModel->getPrice());
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/* -- ----- --*/
|
161 |
+
|
162 |
+
#echo $item->getPrice()." - ".$item->getPriceSkybox()."<br>";
|
163 |
+
|
164 |
+
|
165 |
+
// Mage::log(print_r($productModel->getFinalPrice(), true), null, 'processcontroller.log', true);
|
166 |
+
|
167 |
+
if ($item->getProductType() === 'configurable') {
|
168 |
+
|
169 |
+
$product_api->CalculatePrice($item->getProductId(), null, $productModel->getPriceUsdSkybox(),
|
170 |
+
$item->getProductType(), null);
|
171 |
+
Mage::log("configurable", null, 'processcontroller.log', true);
|
172 |
+
}
|
173 |
+
if ($item->getProductType() === 'simple' && $parentItem && !$item->getPriceSkybox()) {
|
174 |
+
|
175 |
+
$product_api->CalculatePrice($item->getProductId(), null, $productModel->getPriceUsdSkybox(),
|
176 |
+
$item->getProductType(), null);
|
177 |
+
Mage::log("simple1", null, 'processcontroller.log', true);
|
178 |
+
}
|
179 |
+
|
180 |
+
// Simple Product
|
181 |
+
if ($item->getProductType() === 'simple' && !$parentItem && $item->getPriceSkybox()) {
|
182 |
+
|
183 |
+
$product_api->CalculatePrice($item->getProductId(), null, null);
|
184 |
+
Mage::log("simple2", null, 'processcontroller.log', true);
|
185 |
+
}
|
186 |
+
|
187 |
+
// Configurable Product
|
188 |
+
if ($item->getProductType() === 'simple' && $parentItem) {
|
189 |
+
|
190 |
+
$item = $parentItem;
|
191 |
+
// $product_api->CalculatePrice($item->getProductId(), null, $productModel->getFinalPrice());
|
192 |
+
|
193 |
+
$_price = $productModel->getFinalPrice();
|
194 |
+
$_price = isset($_price) ? $productModel->getFinalPrice() : $productModel->getPrice();
|
195 |
+
$product_api->CalculatePrice($item->getProductId(), null, $_price);
|
196 |
+
Mage::log("simple3", null, 'processcontroller.log', true);
|
197 |
+
}
|
198 |
+
|
199 |
+
// Bundle Product
|
200 |
+
if ($item->getProductType() === 'bundle') {
|
201 |
+
|
202 |
+
$product_api->CalculatePrice($item->getProductId(), null, $productModel->getPriceUsdSkybox());
|
203 |
+
Mage::log("bundle", null, 'processcontroller.log', true);
|
204 |
+
};
|
205 |
+
|
206 |
+
if ($isLocationAllow) {
|
207 |
+
//$total = str_replace(",", "", $product_api->getPriceUSD());
|
208 |
+
$total = str_replace(",", "", $productModel->getTotalPriceUSD());
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Currency amounts in the default currency of that customer
|
212 |
+
*/
|
213 |
+
$item->setCustomsSkybox($productModel->getCustoms());
|
214 |
+
$item->setShippingSkybox($productModel->getShipping());
|
215 |
+
$item->setInsuranceSkybox($productModel->getInsurance());
|
216 |
+
$item->setPriceSkybox($productModel->getPrice());
|
217 |
+
$item->setTotalSkybox($productModel->getTotalPrice());
|
218 |
+
$item->setRowTotal($total);
|
219 |
+
|
220 |
+
/*
|
221 |
+
* Currency amounts in the USD Currency
|
222 |
+
*/
|
223 |
+
$item->setCustomsUsdSkybox($productModel->getCustomsUSD());
|
224 |
+
$item->setShippingUsdSkybox($productModel->getShippingUSD());
|
225 |
+
$item->setInsuranceUsdSkybox($productModel->getInsuranceUSD());
|
226 |
+
$item->setPriceUsdSkybox($productModel->getPriceUSD());
|
227 |
+
$item->setTotalUsdSkybox($productModel->getTotalPriceUSD());
|
228 |
+
|
229 |
+
// Set GUID
|
230 |
+
$item->setGuidSkybox($productModel->getGuidSkybox());
|
231 |
+
|
232 |
+
$item->setBasePriceSkybox($productModel->getBasePrice());
|
233 |
+
$item->setBasePriceUsdSkybox($productModel->getBasePriceUSD());
|
234 |
+
$item->setAdjustTotalSkybox($productModel->getAdjustPrice());
|
235 |
+
$item->setAdjustTotalUsdSkybox($productModel->getAdjustPriceUSD());
|
236 |
+
$item->setAdjustLabelSkybox($productModel->getAdjustLabel());
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Registramos el monto total en USD
|
240 |
+
*/
|
241 |
+
//$item->setOriginalCustomPrice($product_api->getTotalPriceUSD());
|
242 |
+
//$item->setOriginalCustomPrice($total);
|
243 |
+
$prices = str_replace(',', '', $productModel->getPrice());
|
244 |
+
$prices = number_format((float)($prices), 2, ',', '.');
|
245 |
+
$item->setOriginalCustomPrice($prices);
|
246 |
+
//$item->setOriginalCustomPrice($product_api->getPrice());
|
247 |
+
//$skybox_total = str_replace(",", "", $product_api->getTotalPrice());
|
248 |
+
$skybox_total = str_replace(",", "", $productModel->getPrice());
|
249 |
+
$row_total = floatval($skybox_total) * $item->getQty();
|
250 |
+
$item->setRowTotalSkybox($row_total);
|
251 |
+
} else {
|
252 |
+
//$total = str_replace(",", "", $product_api->getPriceUSD());
|
253 |
+
$total = str_replace(",", "", $product_api->getTotalPriceUSD());
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Currency amounts in the default currency of that customer
|
257 |
+
*/
|
258 |
+
$item->setCustomsSkybox($product_api->getCustoms());
|
259 |
+
$item->setShippingSkybox($product_api->getShipping());
|
260 |
+
$item->setInsuranceSkybox($product_api->getInsurance());
|
261 |
+
$item->setPriceSkybox($product_api->getPrice());
|
262 |
+
$item->setTotalSkybox($product_api->getTotalPrice());
|
263 |
+
$item->setRowTotal($total);
|
264 |
+
|
265 |
+
/*
|
266 |
+
* Currency amounts in the USD Currency
|
267 |
+
*/
|
268 |
+
$item->setCustomsUsdSkybox($product_api->getCustomsUSD());
|
269 |
+
$item->setShippingUsdSkybox($product_api->getShippingUSD());
|
270 |
+
$item->setInsuranceUsdSkybox($product_api->getInsuranceUSD());
|
271 |
+
$item->setPriceUsdSkybox($product_api->getPriceUSD());
|
272 |
+
$item->setTotalUsdSkybox($product_api->getTotalPriceUSD());
|
273 |
+
|
274 |
+
// Set GUID
|
275 |
+
$item->setGuidSkybox($product_api->getGuidSkybox());
|
276 |
+
|
277 |
+
$item->setBasePriceSkybox($product_api->getBasePrice());
|
278 |
+
$item->setBasePriceUsdSkybox($product_api->getBasePriceUSD());
|
279 |
+
$item->setAdjustTotalSkybox($product_api->getAdjustPrice());
|
280 |
+
$item->setAdjustTotalUsdSkybox($product_api->getAdjustPriceUSD());
|
281 |
+
$item->setAdjustLabelSkybox($product_api->getAdjustLabel());
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Registramos el monto total en USD
|
285 |
+
*/
|
286 |
+
//$item->setOriginalCustomPrice($product_api->getTotalPriceUSD());
|
287 |
+
//$item->setOriginalCustomPrice($total);
|
288 |
+
|
289 |
+
// $prices = str_replace(',', '', $product_api->getPrice());
|
290 |
+
// $prices = number_format((float)($prices), 2, ',', '.');
|
291 |
+
|
292 |
+
$prices = $this->getFormatPrice($product_api->getPrice());
|
293 |
+
|
294 |
+
$item->setOriginalCustomPrice($prices);
|
295 |
+
|
296 |
+
// @todo: Rewrite custom Quote and LocationAllow logic.
|
297 |
+
if ($product_api->getLocationAllow() == 0) {
|
298 |
+
Mage::log("The country is not allow", null, 'bueyada.log', true);
|
299 |
+
$item->setOriginalCustomPrice($productModel->getPrice());
|
300 |
+
}
|
301 |
+
//$item->setOriginalCustomPrice($product_api->getPrice());
|
302 |
+
//$skybox_total = str_replace(",", "", $product_api->getTotalPrice());
|
303 |
+
$skybox_total = str_replace(",", "", $product_api->getPrice());
|
304 |
+
$row_total = floatval($skybox_total) * $item->getQty();
|
305 |
+
$item->setRowTotalSkybox($row_total);
|
306 |
+
}
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
$quote->save();
|
311 |
+
|
312 |
+
// @note: Force to load Home Page due cache issue. (minicart)
|
313 |
+
if (strpos($return_url, 'force_reload')) {
|
314 |
+
$return_url = str_replace('force_reload', '', $return_url);
|
315 |
+
/** @var Skybox_Core_Model_Config $config */
|
316 |
+
$config = Mage::getModel("skyboxcore/config");
|
317 |
+
$config->getSession()->setChangeCountryHomePage(true);
|
318 |
+
}
|
319 |
+
|
320 |
+
//$this->getResponse()->setRedirect($return_url);
|
321 |
+
Mage::app()->getResponse()->setRedirect($return_url);
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Skybox Format Price
|
326 |
+
* @param $price
|
327 |
+
* @return mixed|string
|
328 |
+
*/
|
329 |
+
function getFormatPrice($price)
|
330 |
+
{
|
331 |
+
$value = str_replace(',', '', $price);
|
332 |
+
$value = number_format((float)($value), 2, ',', '.');
|
333 |
+
return $value;
|
334 |
+
}
|
335 |
+
}
|
app/code/community/Skybox/Checkout/etc/config.xml
CHANGED
@@ -1,467 +1,467 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Skybox_Checkout>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Skybox_Checkout>
|
8 |
-
</modules>
|
9 |
-
<global>
|
10 |
-
<fieldsets>
|
11 |
-
<sales_convert_quote_item>
|
12 |
-
<id_product_skybox>
|
13 |
-
<to_order_item>*</to_order_item>
|
14 |
-
</id_product_skybox>
|
15 |
-
<price_skybox>
|
16 |
-
<to_order_item>*</to_order_item>
|
17 |
-
</price_skybox>
|
18 |
-
<customs_skybox>
|
19 |
-
<to_order_item>*</to_order_item>
|
20 |
-
</customs_skybox>
|
21 |
-
<shipping_skybox>
|
22 |
-
<to_order_item>*</to_order_item>
|
23 |
-
</shipping_skybox>
|
24 |
-
<insurance_skybox>
|
25 |
-
<to_order_item>*</to_order_item>
|
26 |
-
</insurance_skybox>
|
27 |
-
<total_skybox>
|
28 |
-
<to_order_item>*</to_order_item>
|
29 |
-
</total_skybox>
|
30 |
-
<price_usd_skybox>
|
31 |
-
<to_order_item>*</to_order_item>
|
32 |
-
</price_usd_skybox>
|
33 |
-
<customs_usd_skybox>
|
34 |
-
<to_order_item>*</to_order_item>
|
35 |
-
</customs_usd_skybox>
|
36 |
-
<shipping_usd_skybox>
|
37 |
-
<to_order_item>*</to_order_item>
|
38 |
-
</shipping_usd_skybox>
|
39 |
-
<insurance_usd_skybox>
|
40 |
-
<to_order_item>*</to_order_item>
|
41 |
-
</insurance_usd_skybox>
|
42 |
-
<total_usd_skybox>
|
43 |
-
<to_order_item>*</to_order_item>
|
44 |
-
</total_usd_skybox>
|
45 |
-
<guid_skybox>
|
46 |
-
<to_order_item>*</to_order_item>
|
47 |
-
</guid_skybox>
|
48 |
-
<row_total_skybox>
|
49 |
-
<to_order_item>*</to_order_item>
|
50 |
-
</row_total_skybox>
|
51 |
-
<base_price_skybox>
|
52 |
-
<to_order_item>*</to_order_item>
|
53 |
-
</base_price_skybox>
|
54 |
-
<base_price_usd_skybox>
|
55 |
-
<to_order_item>*</to_order_item>
|
56 |
-
</base_price_usd_skybox>
|
57 |
-
<adjust_total_skybox>
|
58 |
-
<to_order_item>*</to_order_item>
|
59 |
-
</adjust_total_skybox>
|
60 |
-
<adjust_total_usd_skybox>
|
61 |
-
<to_order_item>*</to_order_item>
|
62 |
-
</adjust_total_usd_skybox>
|
63 |
-
<adjust_label_skybox>
|
64 |
-
<to_order_item>*</to_order_item>
|
65 |
-
</adjust_label_skybox>
|
66 |
-
<concepts_skybox>
|
67 |
-
<to_order_item>*</to_order_item>
|
68 |
-
</concepts_skybox>
|
69 |
-
<rmt_skybox>
|
70 |
-
<to_order_item>*</to_order_item>
|
71 |
-
</rmt_skybox>
|
72 |
-
</sales_convert_quote_item>
|
73 |
-
<sales_convert_order_item>
|
74 |
-
<id_product_skybox>
|
75 |
-
<to_quote_item>*</to_quote_item>
|
76 |
-
</id_product_skybox>
|
77 |
-
</sales_convert_order_item>
|
78 |
-
<sales_convert_quote_address>
|
79 |
-
<subtotal_skybox>
|
80 |
-
<to_order>*</to_order>
|
81 |
-
</subtotal_skybox>
|
82 |
-
<base_subtotal_skybox>
|
83 |
-
<to_order>*</to_order>
|
84 |
-
</base_subtotal_skybox>
|
85 |
-
<grand_total_skybox>
|
86 |
-
<to_order>*</to_order>
|
87 |
-
</grand_total_skybox>
|
88 |
-
<base_grand_total_skybox>
|
89 |
-
<to_order>*</to_order>
|
90 |
-
</base_grand_total_skybox>
|
91 |
-
<customs_total_skybox>
|
92 |
-
<to_order>*</to_order>
|
93 |
-
</customs_total_skybox>
|
94 |
-
<customs_total_usd_skybox>
|
95 |
-
<to_order>*</to_order>
|
96 |
-
</customs_total_usd_skybox>
|
97 |
-
<taxes_total_skybox>
|
98 |
-
<to_order>*</to_order>
|
99 |
-
</taxes_total_skybox>
|
100 |
-
<taxes_total_usd_skybox>
|
101 |
-
<to_order>*</to_order>
|
102 |
-
</taxes_total_usd_skybox>
|
103 |
-
<handling_total_skybox>
|
104 |
-
<to_order>*</to_order>
|
105 |
-
</handling_total_skybox>
|
106 |
-
<handling_total_usd_skybox>
|
107 |
-
<to_order>*</to_order>
|
108 |
-
</handling_total_usd_skybox>
|
109 |
-
<shipping_total_skybox>
|
110 |
-
<to_order>*</to_order>
|
111 |
-
</shipping_total_skybox>
|
112 |
-
<shipping_total_usd_skybox>
|
113 |
-
<to_order>*</to_order>
|
114 |
-
</shipping_total_usd_skybox>
|
115 |
-
<insurance_total_skybox>
|
116 |
-
<to_order>*</to_order>
|
117 |
-
</insurance_total_skybox>
|
118 |
-
<insurance_total_usd_skybox>
|
119 |
-
<to_order>*</to_order>
|
120 |
-
</insurance_total_usd_skybox>
|
121 |
-
<clearence_total_skybox>
|
122 |
-
<to_order>*</to_order>
|
123 |
-
</clearence_total_skybox>
|
124 |
-
<clearence_total_usd_skybox>
|
125 |
-
<to_order>*</to_order>
|
126 |
-
</clearence_total_usd_skybox>
|
127 |
-
<duties_total_skybox>
|
128 |
-
<to_order>*</to_order>
|
129 |
-
</duties_total_skybox>
|
130 |
-
<duties_total_usd_skybox>
|
131 |
-
<to_order>*</to_order>
|
132 |
-
</duties_total_usd_skybox>
|
133 |
-
<others_total_skybox>
|
134 |
-
<to_order>*</to_order>
|
135 |
-
</others_total_skybox>
|
136 |
-
<others_total_usd_skybox>
|
137 |
-
<to_order>*</to_order>
|
138 |
-
</others_total_usd_skybox>
|
139 |
-
<adjust_total_skybox>
|
140 |
-
<to_order>*</to_order>
|
141 |
-
</adjust_total_skybox>
|
142 |
-
<adjust_total_usd_skybox>
|
143 |
-
<to_order>*</to_order>
|
144 |
-
</adjust_total_usd_skybox>
|
145 |
-
<concepts_skybox>
|
146 |
-
<to_order>*</to_order>
|
147 |
-
</concepts_skybox>
|
148 |
-
<rmt_skybox>
|
149 |
-
<to_order>*</to_order>
|
150 |
-
</rmt_skybox>
|
151 |
-
</sales_convert_quote_address>
|
152 |
-
</fieldsets>
|
153 |
-
<models>
|
154 |
-
<skyboxcheckout>
|
155 |
-
<class>Skybox_Checkout_Model</class>
|
156 |
-
<resourceModel>Skybox_Checkout_mysql4</resourceModel>
|
157 |
-
</skyboxcheckout>
|
158 |
-
<checkout>
|
159 |
-
<rewrite>
|
160 |
-
<cart>Skybox_Checkout_Model_Cart</cart>
|
161 |
-
</rewrite>
|
162 |
-
</checkout>
|
163 |
-
</models>
|
164 |
-
<blocks>
|
165 |
-
<skyboxcheckout>
|
166 |
-
<class>Skybox_Checkout_Block</class>
|
167 |
-
</skyboxcheckout>
|
168 |
-
|
169 |
-
<checkout>
|
170 |
-
<rewrite>
|
171 |
-
<cart_sidebar>Skybox_Checkout_Block_Cart_Sidebar</cart_sidebar>
|
172 |
-
</rewrite>
|
173 |
-
</checkout>
|
174 |
-
|
175 |
-
<checkout>
|
176 |
-
<rewrite>
|
177 |
-
<cart_totals>Skybox_Checkout_Block_Cart_Totals</cart_totals>
|
178 |
-
</rewrite>
|
179 |
-
</checkout>
|
180 |
-
|
181 |
-
<checkout>
|
182 |
-
<rewrite>
|
183 |
-
<onepage_link>Skybox_Checkout_Block_Checkout_Onepage_Link</onepage_link>
|
184 |
-
</rewrite>
|
185 |
-
</checkout>
|
186 |
-
<checkout>
|
187 |
-
<rewrite>
|
188 |
-
<links>Skybox_Checkout_Block_Checkout_Links</links>
|
189 |
-
</rewrite>
|
190 |
-
</checkout>
|
191 |
-
<checkout>
|
192 |
-
<rewrite>
|
193 |
-
<cart>Skybox_Checkout_Block_Checkout_Cart</cart>
|
194 |
-
</rewrite>
|
195 |
-
</checkout>
|
196 |
-
<checkout>
|
197 |
-
<rewrite>
|
198 |
-
<cart_sidebar>Skybox_Checkout_Block_Checkout_Cart_Sidebar</cart_sidebar>
|
199 |
-
</rewrite>
|
200 |
-
</checkout>
|
201 |
-
|
202 |
-
</blocks>
|
203 |
-
<resources>
|
204 |
-
<!--skyboxcheckout_setup>
|
205 |
-
<setup>
|
206 |
-
<module>Skybox_Checkout</module>
|
207 |
-
</setup>
|
208 |
-
<connection>
|
209 |
-
<use>core_setup</use>
|
210 |
-
</connection>
|
211 |
-
</skyboxcheckout_setup-->
|
212 |
-
<skyboxcheckout_setup>
|
213 |
-
<setup>
|
214 |
-
<module>Skybox_Checkout</module>
|
215 |
-
</setup>
|
216 |
-
</skyboxcheckout_setup>
|
217 |
-
</resources>
|
218 |
-
<events>
|
219 |
-
<!--controller_front_init_routers>
|
220 |
-
<observers>
|
221 |
-
<Skybox_checkout_model_observer>
|
222 |
-
<type>singleton</type>
|
223 |
-
<class>Skybox_Checkout_Model_Observer</class>
|
224 |
-
<method>InitializeSkybox</method>
|
225 |
-
</Skybox_checkout_model_observer>
|
226 |
-
</observers>
|
227 |
-
</controller_front_init_routers-->
|
228 |
-
<!--sales_quote_add_item>
|
229 |
-
<observers>
|
230 |
-
<skyboxcheckout_calculate_price_observer>
|
231 |
-
<type>singleton</type>
|
232 |
-
<class>Skybox_Checkout_Model_Observer</class>
|
233 |
-
<method>CalculatePriceQuoteItem</method>
|
234 |
-
</skyboxcheckout_calculate_price_observer>
|
235 |
-
</observers>
|
236 |
-
</sales_quote_add_item-->
|
237 |
-
<!--sales_quote_collect_totals_before>
|
238 |
-
<observers>
|
239 |
-
<skyboxcheckout_removetax_observer>
|
240 |
-
<type>singleton</type>
|
241 |
-
<class>Skybox_Checkout_Model_Observer</class>
|
242 |
-
<method>RemoveTax</method>
|
243 |
-
</skyboxcheckout_removetax_observer>
|
244 |
-
</observers>
|
245 |
-
</sales_quote_collect_totals_before-->
|
246 |
-
</events>
|
247 |
-
<!--rewrite>
|
248 |
-
<skybox_checkout_cart>
|
249 |
-
<from><![CDATA[#^/checkout/cart/#]]></from>
|
250 |
-
<to>/checkout/cart/</to>
|
251 |
-
</skybox_checkout_cart>
|
252 |
-
</rewrite-->
|
253 |
-
<!-- Agregación de nuevos atributos -->
|
254 |
-
<sales>
|
255 |
-
<quote>
|
256 |
-
<item>
|
257 |
-
<product_attributes>
|
258 |
-
<id_product_skybox/>
|
259 |
-
</product_attributes>
|
260 |
-
</item>
|
261 |
-
<totals>
|
262 |
-
<!--subtotal>
|
263 |
-
<class>skyboxcheckout/quote_subtotal</class>
|
264 |
-
<after>discount,shipping</after>
|
265 |
-
<before>tax,grand_total</before>
|
266 |
-
</subtotal-->
|
267 |
-
<checkout_total1>
|
268 |
-
<class>skyboxcheckout/quote_total</class>
|
269 |
-
<after>subtotal,discount,shipping</after>
|
270 |
-
<before>tax,grand_total</before>
|
271 |
-
</checkout_total1>
|
272 |
-
<checkout_total2>
|
273 |
-
<class>skyboxcheckout/quote_total2</class>
|
274 |
-
<after>subtotal,discount,shipping</after>
|
275 |
-
<before>tax,grand_total</before>
|
276 |
-
</checkout_total2>
|
277 |
-
<checkout_total3>
|
278 |
-
<class>skyboxcheckout/quote_total3</class>
|
279 |
-
<after>subtotal,discount,shipping</after>
|
280 |
-
<before>tax,grand_total</before>
|
281 |
-
</checkout_total3>
|
282 |
-
<checkout_total4>
|
283 |
-
<class>skyboxcheckout/quote_total4</class>
|
284 |
-
<after>subtotal,discount,shipping</after>
|
285 |
-
<before>tax,grand_total</before>
|
286 |
-
</checkout_total4>
|
287 |
-
<checkout_total5>
|
288 |
-
<class>skyboxcheckout/quote_total5</class>
|
289 |
-
<after>subtotal,discount,shipping</after>
|
290 |
-
<before>tax,grand_total</before>
|
291 |
-
</checkout_total5>
|
292 |
-
<checkout_total6>
|
293 |
-
<class>skyboxcheckout/quote_total6</class>
|
294 |
-
<after>subtotal,discount,shipping</after>
|
295 |
-
<before>tax,grand_total</before>
|
296 |
-
</checkout_total6>
|
297 |
-
<checkout_total7>
|
298 |
-
<class>skyboxcheckout/quote_total7</class>
|
299 |
-
<after>subtotal,discount,shipping</after>
|
300 |
-
<before>tax,grand_total</before>
|
301 |
-
</checkout_total7>
|
302 |
-
<checkout_total8>
|
303 |
-
<class>skyboxcheckout/quote_total8</class>
|
304 |
-
<after>subtotal,discount,shipping</after>
|
305 |
-
<before>tax,grand_total</before>
|
306 |
-
</checkout_total8>
|
307 |
-
<!--Eliminar-->
|
308 |
-
<!--<skybox_insurance>
|
309 |
-
<class>skyboxcheckout/total_screen_quote</class>
|
310 |
-
<after>subtotal</after>
|
311 |
-
<before>tax</before>
|
312 |
-
</skybox_insurance>-->
|
313 |
-
<checkout_total_rmt1>
|
314 |
-
<class>skyboxcheckout/quote_address_total_rmt</class>
|
315 |
-
<after>subtotal,discount,shipping</after>
|
316 |
-
<before>tax,grand_total</before>
|
317 |
-
</checkout_total_rmt1>
|
318 |
-
</totals>
|
319 |
-
</quote>
|
320 |
-
<order_invoice>
|
321 |
-
<totals>
|
322 |
-
<checkout_total1>
|
323 |
-
<class>skyboxcheckout/invoice_total</class>
|
324 |
-
<after>subtotal,discount,shipping</after>
|
325 |
-
<before>tax,grand_total</before>
|
326 |
-
</checkout_total1>
|
327 |
-
<!--Eliminar-->
|
328 |
-
<!--<skybox_insurance>
|
329 |
-
<class>skyboxcheckout/total_screen_invoice</class>
|
330 |
-
<after>subtotal</after>
|
331 |
-
<before>tax</before>
|
332 |
-
</skybox_insurance>-->
|
333 |
-
</totals>
|
334 |
-
</order_invoice>
|
335 |
-
<order_creditmemo>
|
336 |
-
<totals>
|
337 |
-
<checkout_total1>
|
338 |
-
<class>skyboxcheckout/creditmemo_total</class>
|
339 |
-
<after>subtotal,discount,shipping</after>
|
340 |
-
<before>tax,grand_total</before>
|
341 |
-
</checkout_total1>
|
342 |
-
<!--Eliminar-->
|
343 |
-
<!--<skybox_insurance>
|
344 |
-
<class>skyboxcheckout/total_screen_creditmemo</class>
|
345 |
-
<after>subtotal</after>
|
346 |
-
<before>tax</before>
|
347 |
-
</skybox_insurance>-->
|
348 |
-
</totals>
|
349 |
-
</order_creditmemo>
|
350 |
-
</sales>
|
351 |
-
<!--routers>
|
352 |
-
<checkout>
|
353 |
-
<rewrite>
|
354 |
-
<onepage>
|
355 |
-
<to>Skybox_Checkout</to>
|
356 |
-
</onepage>
|
357 |
-
</rewrite>
|
358 |
-
</checkout>
|
359 |
-
</routers-->
|
360 |
-
<!--rewrite>
|
361 |
-
<skyboxcheckout_for_checkout>
|
362 |
-
<from><![CDATA[#^/checkout/onepage/#]]></from>
|
363 |
-
<to>/skbcheckout/international/</to>
|
364 |
-
</skyboxcheckout_for_checkout>
|
365 |
-
</rewrite-->
|
366 |
-
<helpers>
|
367 |
-
<checkout>
|
368 |
-
<rewrite>
|
369 |
-
<data>Skybox_Checkout_Helper_Data</data>
|
370 |
-
</rewrite>
|
371 |
-
</checkout>
|
372 |
-
<checkout>
|
373 |
-
<rewrite>
|
374 |
-
<url>Skybox_Checkout_Helper_Url</url>
|
375 |
-
</rewrite>
|
376 |
-
</checkout>
|
377 |
-
<!--<skyboxcheckout_pay>-->
|
378 |
-
<!--<class>Skybox_Checkout_Helper</class>-->
|
379 |
-
<!--</skyboxcheckout_pay>-->
|
380 |
-
</helpers>
|
381 |
-
|
382 |
-
</global>
|
383 |
-
<frontend>
|
384 |
-
<routers>
|
385 |
-
<skyboxcheckout>
|
386 |
-
<use>standard</use>
|
387 |
-
<args>
|
388 |
-
<module>Skybox_Checkout</module>
|
389 |
-
<frontName>skbcheckout</frontName>
|
390 |
-
</args>
|
391 |
-
</skyboxcheckout>
|
392 |
-
<!--checkout>
|
393 |
-
<args>
|
394 |
-
<modules>
|
395 |
-
<Skybox_Checkout before="Mage_Checkout">Skybox_Checkout</Skybox_Checkout>
|
396 |
-
</modules>
|
397 |
-
</args>
|
398 |
-
</checkout-->
|
399 |
-
</routers>
|
400 |
-
<!--events>
|
401 |
-
<controller_front_init_routers>
|
402 |
-
<observers>
|
403 |
-
<Skybox_checkout_model_observer>
|
404 |
-
<type>singleton</type>
|
405 |
-
<class>Skybox_Checkout_Model_Observer</class>
|
406 |
-
<method>InitializeSkybox</method>
|
407 |
-
</Skybox_checkout_model_observer>
|
408 |
-
</observers>
|
409 |
-
</controller_front_init_routers>
|
410 |
-
</events-->
|
411 |
-
<translate/>
|
412 |
-
<layout>
|
413 |
-
<updates>
|
414 |
-
<skyboxcheckout>
|
415 |
-
<file>skyboxcheckout.xml</file>
|
416 |
-
</skyboxcheckout>
|
417 |
-
</updates>
|
418 |
-
</layout>
|
419 |
-
<events>
|
420 |
-
<!-- -->
|
421 |
-
<sales_quote_collect_totals_after>
|
422 |
-
<observers>
|
423 |
-
<set_skybox_subtotals>
|
424 |
-
<class>skyboxcheckout/observer</class>
|
425 |
-
<method>changeQuoteAddressSkybox</method>
|
426 |
-
</set_skybox_subtotals>
|
427 |
-
</observers>
|
428 |
-
</sales_quote_collect_totals_after>
|
429 |
-
<!-- -->
|
430 |
-
</events>
|
431 |
-
</frontend>
|
432 |
-
<default>
|
433 |
-
<carriers>
|
434 |
-
<skyboxcheckout_shipping>
|
435 |
-
<active>
|
436 |
-
<model>skyboxcheckout/carrier</model>
|
437 |
-
<title>SkyboxCheckout Method</title>
|
438 |
-
<price>0</price>
|
439 |
-
<!--<sort_order>10</sort_order>-->
|
440 |
-
<!--<sallowspecific>0</sallowspecific>-->
|
441 |
-
</skyboxcheckout_shipping>
|
442 |
-
</carriers>
|
443 |
-
<payment>
|
444 |
-
<skyboxcheckout_pay>
|
445 |
-
<model>skyboxcheckout/pay</model>
|
446 |
-
<active>1</active>
|
447 |
-
<order_status>pending</order_status>
|
448 |
-
<title>Skybox Payment</title>
|
449 |
-
<!--<payment_action>sale</payment_action>-->
|
450 |
-
<!--<allowspecific>0</allowspecific>-->
|
451 |
-
<!--<sort_order>1</sort_order>-->
|
452 |
-
</skyboxcheckout_pay>
|
453 |
-
</payment>
|
454 |
-
<config_vars/>
|
455 |
-
<!--Eliminar-->
|
456 |
-
<!--<sales>
|
457 |
-
<totals_sort>
|
458 |
-
<skybox_insurance>0</skybox_insurance>
|
459 |
-
</totals_sort>
|
460 |
-
</sales>-->
|
461 |
-
<!--<sales>
|
462 |
-
<totals_sort>
|
463 |
-
<checkout_insurance>15</checkout_insurance>
|
464 |
-
</totals_sort>
|
465 |
-
</sales>-->
|
466 |
-
</default>
|
467 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Skybox_Checkout>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Skybox_Checkout>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<fieldsets>
|
11 |
+
<sales_convert_quote_item>
|
12 |
+
<id_product_skybox>
|
13 |
+
<to_order_item>*</to_order_item>
|
14 |
+
</id_product_skybox>
|
15 |
+
<price_skybox>
|
16 |
+
<to_order_item>*</to_order_item>
|
17 |
+
</price_skybox>
|
18 |
+
<customs_skybox>
|
19 |
+
<to_order_item>*</to_order_item>
|
20 |
+
</customs_skybox>
|
21 |
+
<shipping_skybox>
|
22 |
+
<to_order_item>*</to_order_item>
|
23 |
+
</shipping_skybox>
|
24 |
+
<insurance_skybox>
|
25 |
+
<to_order_item>*</to_order_item>
|
26 |
+
</insurance_skybox>
|
27 |
+
<total_skybox>
|
28 |
+
<to_order_item>*</to_order_item>
|
29 |
+
</total_skybox>
|
30 |
+
<price_usd_skybox>
|
31 |
+
<to_order_item>*</to_order_item>
|
32 |
+
</price_usd_skybox>
|
33 |
+
<customs_usd_skybox>
|
34 |
+
<to_order_item>*</to_order_item>
|
35 |
+
</customs_usd_skybox>
|
36 |
+
<shipping_usd_skybox>
|
37 |
+
<to_order_item>*</to_order_item>
|
38 |
+
</shipping_usd_skybox>
|
39 |
+
<insurance_usd_skybox>
|
40 |
+
<to_order_item>*</to_order_item>
|
41 |
+
</insurance_usd_skybox>
|
42 |
+
<total_usd_skybox>
|
43 |
+
<to_order_item>*</to_order_item>
|
44 |
+
</total_usd_skybox>
|
45 |
+
<guid_skybox>
|
46 |
+
<to_order_item>*</to_order_item>
|
47 |
+
</guid_skybox>
|
48 |
+
<row_total_skybox>
|
49 |
+
<to_order_item>*</to_order_item>
|
50 |
+
</row_total_skybox>
|
51 |
+
<base_price_skybox>
|
52 |
+
<to_order_item>*</to_order_item>
|
53 |
+
</base_price_skybox>
|
54 |
+
<base_price_usd_skybox>
|
55 |
+
<to_order_item>*</to_order_item>
|
56 |
+
</base_price_usd_skybox>
|
57 |
+
<adjust_total_skybox>
|
58 |
+
<to_order_item>*</to_order_item>
|
59 |
+
</adjust_total_skybox>
|
60 |
+
<adjust_total_usd_skybox>
|
61 |
+
<to_order_item>*</to_order_item>
|
62 |
+
</adjust_total_usd_skybox>
|
63 |
+
<adjust_label_skybox>
|
64 |
+
<to_order_item>*</to_order_item>
|
65 |
+
</adjust_label_skybox>
|
66 |
+
<concepts_skybox>
|
67 |
+
<to_order_item>*</to_order_item>
|
68 |
+
</concepts_skybox>
|
69 |
+
<rmt_skybox>
|
70 |
+
<to_order_item>*</to_order_item>
|
71 |
+
</rmt_skybox>
|
72 |
+
</sales_convert_quote_item>
|
73 |
+
<sales_convert_order_item>
|
74 |
+
<id_product_skybox>
|
75 |
+
<to_quote_item>*</to_quote_item>
|
76 |
+
</id_product_skybox>
|
77 |
+
</sales_convert_order_item>
|
78 |
+
<sales_convert_quote_address>
|
79 |
+
<subtotal_skybox>
|
80 |
+
<to_order>*</to_order>
|
81 |
+
</subtotal_skybox>
|
82 |
+
<base_subtotal_skybox>
|
83 |
+
<to_order>*</to_order>
|
84 |
+
</base_subtotal_skybox>
|
85 |
+
<grand_total_skybox>
|
86 |
+
<to_order>*</to_order>
|
87 |
+
</grand_total_skybox>
|
88 |
+
<base_grand_total_skybox>
|
89 |
+
<to_order>*</to_order>
|
90 |
+
</base_grand_total_skybox>
|
91 |
+
<customs_total_skybox>
|
92 |
+
<to_order>*</to_order>
|
93 |
+
</customs_total_skybox>
|
94 |
+
<customs_total_usd_skybox>
|
95 |
+
<to_order>*</to_order>
|
96 |
+
</customs_total_usd_skybox>
|
97 |
+
<taxes_total_skybox>
|
98 |
+
<to_order>*</to_order>
|
99 |
+
</taxes_total_skybox>
|
100 |
+
<taxes_total_usd_skybox>
|
101 |
+
<to_order>*</to_order>
|
102 |
+
</taxes_total_usd_skybox>
|
103 |
+
<handling_total_skybox>
|
104 |
+
<to_order>*</to_order>
|
105 |
+
</handling_total_skybox>
|
106 |
+
<handling_total_usd_skybox>
|
107 |
+
<to_order>*</to_order>
|
108 |
+
</handling_total_usd_skybox>
|
109 |
+
<shipping_total_skybox>
|
110 |
+
<to_order>*</to_order>
|
111 |
+
</shipping_total_skybox>
|
112 |
+
<shipping_total_usd_skybox>
|
113 |
+
<to_order>*</to_order>
|
114 |
+
</shipping_total_usd_skybox>
|
115 |
+
<insurance_total_skybox>
|
116 |
+
<to_order>*</to_order>
|
117 |
+
</insurance_total_skybox>
|
118 |
+
<insurance_total_usd_skybox>
|
119 |
+
<to_order>*</to_order>
|
120 |
+
</insurance_total_usd_skybox>
|
121 |
+
<clearence_total_skybox>
|
122 |
+
<to_order>*</to_order>
|
123 |
+
</clearence_total_skybox>
|
124 |
+
<clearence_total_usd_skybox>
|
125 |
+
<to_order>*</to_order>
|
126 |
+
</clearence_total_usd_skybox>
|
127 |
+
<duties_total_skybox>
|
128 |
+
<to_order>*</to_order>
|
129 |
+
</duties_total_skybox>
|
130 |
+
<duties_total_usd_skybox>
|
131 |
+
<to_order>*</to_order>
|
132 |
+
</duties_total_usd_skybox>
|
133 |
+
<others_total_skybox>
|
134 |
+
<to_order>*</to_order>
|
135 |
+
</others_total_skybox>
|
136 |
+
<others_total_usd_skybox>
|
137 |
+
<to_order>*</to_order>
|
138 |
+
</others_total_usd_skybox>
|
139 |
+
<adjust_total_skybox>
|
140 |
+
<to_order>*</to_order>
|
141 |
+
</adjust_total_skybox>
|
142 |
+
<adjust_total_usd_skybox>
|
143 |
+
<to_order>*</to_order>
|
144 |
+
</adjust_total_usd_skybox>
|
145 |
+
<concepts_skybox>
|
146 |
+
<to_order>*</to_order>
|
147 |
+
</concepts_skybox>
|
148 |
+
<rmt_skybox>
|
149 |
+
<to_order>*</to_order>
|
150 |
+
</rmt_skybox>
|
151 |
+
</sales_convert_quote_address>
|
152 |
+
</fieldsets>
|
153 |
+
<models>
|
154 |
+
<skyboxcheckout>
|
155 |
+
<class>Skybox_Checkout_Model</class>
|
156 |
+
<resourceModel>Skybox_Checkout_mysql4</resourceModel>
|
157 |
+
</skyboxcheckout>
|
158 |
+
<checkout>
|
159 |
+
<rewrite>
|
160 |
+
<cart>Skybox_Checkout_Model_Cart</cart>
|
161 |
+
</rewrite>
|
162 |
+
</checkout>
|
163 |
+
</models>
|
164 |
+
<blocks>
|
165 |
+
<skyboxcheckout>
|
166 |
+
<class>Skybox_Checkout_Block</class>
|
167 |
+
</skyboxcheckout>
|
168 |
+
|
169 |
+
<checkout>
|
170 |
+
<rewrite>
|
171 |
+
<cart_sidebar>Skybox_Checkout_Block_Cart_Sidebar</cart_sidebar>
|
172 |
+
</rewrite>
|
173 |
+
</checkout>
|
174 |
+
|
175 |
+
<checkout>
|
176 |
+
<rewrite>
|
177 |
+
<cart_totals>Skybox_Checkout_Block_Cart_Totals</cart_totals>
|
178 |
+
</rewrite>
|
179 |
+
</checkout>
|
180 |
+
|
181 |
+
<checkout>
|
182 |
+
<rewrite>
|
183 |
+
<onepage_link>Skybox_Checkout_Block_Checkout_Onepage_Link</onepage_link>
|
184 |
+
</rewrite>
|
185 |
+
</checkout>
|
186 |
+
<checkout>
|
187 |
+
<rewrite>
|
188 |
+
<links>Skybox_Checkout_Block_Checkout_Links</links>
|
189 |
+
</rewrite>
|
190 |
+
</checkout>
|
191 |
+
<checkout>
|
192 |
+
<rewrite>
|
193 |
+
<cart>Skybox_Checkout_Block_Checkout_Cart</cart>
|
194 |
+
</rewrite>
|
195 |
+
</checkout>
|
196 |
+
<checkout>
|
197 |
+
<rewrite>
|
198 |
+
<cart_sidebar>Skybox_Checkout_Block_Checkout_Cart_Sidebar</cart_sidebar>
|
199 |
+
</rewrite>
|
200 |
+
</checkout>
|
201 |
+
|
202 |
+
</blocks>
|
203 |
+
<resources>
|
204 |
+
<!--skyboxcheckout_setup>
|
205 |
+
<setup>
|
206 |
+
<module>Skybox_Checkout</module>
|
207 |
+
</setup>
|
208 |
+
<connection>
|
209 |
+
<use>core_setup</use>
|
210 |
+
</connection>
|
211 |
+
</skyboxcheckout_setup-->
|
212 |
+
<skyboxcheckout_setup>
|
213 |
+
<setup>
|
214 |
+
<module>Skybox_Checkout</module>
|
215 |
+
</setup>
|
216 |
+
</skyboxcheckout_setup>
|
217 |
+
</resources>
|
218 |
+
<events>
|
219 |
+
<!--controller_front_init_routers>
|
220 |
+
<observers>
|
221 |
+
<Skybox_checkout_model_observer>
|
222 |
+
<type>singleton</type>
|
223 |
+
<class>Skybox_Checkout_Model_Observer</class>
|
224 |
+
<method>InitializeSkybox</method>
|
225 |
+
</Skybox_checkout_model_observer>
|
226 |
+
</observers>
|
227 |
+
</controller_front_init_routers-->
|
228 |
+
<!--sales_quote_add_item>
|
229 |
+
<observers>
|
230 |
+
<skyboxcheckout_calculate_price_observer>
|
231 |
+
<type>singleton</type>
|
232 |
+
<class>Skybox_Checkout_Model_Observer</class>
|
233 |
+
<method>CalculatePriceQuoteItem</method>
|
234 |
+
</skyboxcheckout_calculate_price_observer>
|
235 |
+
</observers>
|
236 |
+
</sales_quote_add_item-->
|
237 |
+
<!--sales_quote_collect_totals_before>
|
238 |
+
<observers>
|
239 |
+
<skyboxcheckout_removetax_observer>
|
240 |
+
<type>singleton</type>
|
241 |
+
<class>Skybox_Checkout_Model_Observer</class>
|
242 |
+
<method>RemoveTax</method>
|
243 |
+
</skyboxcheckout_removetax_observer>
|
244 |
+
</observers>
|
245 |
+
</sales_quote_collect_totals_before-->
|
246 |
+
</events>
|
247 |
+
<!--rewrite>
|
248 |
+
<skybox_checkout_cart>
|
249 |
+
<from><![CDATA[#^/checkout/cart/#]]></from>
|
250 |
+
<to>/checkout/cart/</to>
|
251 |
+
</skybox_checkout_cart>
|
252 |
+
</rewrite-->
|
253 |
+
<!-- Agregación de nuevos atributos -->
|
254 |
+
<sales>
|
255 |
+
<quote>
|
256 |
+
<item>
|
257 |
+
<product_attributes>
|
258 |
+
<id_product_skybox/>
|
259 |
+
</product_attributes>
|
260 |
+
</item>
|
261 |
+
<totals>
|
262 |
+
<!--subtotal>
|
263 |
+
<class>skyboxcheckout/quote_subtotal</class>
|
264 |
+
<after>discount,shipping</after>
|
265 |
+
<before>tax,grand_total</before>
|
266 |
+
</subtotal-->
|
267 |
+
<checkout_total1>
|
268 |
+
<class>skyboxcheckout/quote_total</class>
|
269 |
+
<after>subtotal,discount,shipping</after>
|
270 |
+
<before>tax,grand_total</before>
|
271 |
+
</checkout_total1>
|
272 |
+
<checkout_total2>
|
273 |
+
<class>skyboxcheckout/quote_total2</class>
|
274 |
+
<after>subtotal,discount,shipping</after>
|
275 |
+
<before>tax,grand_total</before>
|
276 |
+
</checkout_total2>
|
277 |
+
<checkout_total3>
|
278 |
+
<class>skyboxcheckout/quote_total3</class>
|
279 |
+
<after>subtotal,discount,shipping</after>
|
280 |
+
<before>tax,grand_total</before>
|
281 |
+
</checkout_total3>
|
282 |
+
<checkout_total4>
|
283 |
+
<class>skyboxcheckout/quote_total4</class>
|
284 |
+
<after>subtotal,discount,shipping</after>
|
285 |
+
<before>tax,grand_total</before>
|
286 |
+
</checkout_total4>
|
287 |
+
<checkout_total5>
|
288 |
+
<class>skyboxcheckout/quote_total5</class>
|
289 |
+
<after>subtotal,discount,shipping</after>
|
290 |
+
<before>tax,grand_total</before>
|
291 |
+
</checkout_total5>
|
292 |
+
<checkout_total6>
|
293 |
+
<class>skyboxcheckout/quote_total6</class>
|
294 |
+
<after>subtotal,discount,shipping</after>
|
295 |
+
<before>tax,grand_total</before>
|
296 |
+
</checkout_total6>
|
297 |
+
<checkout_total7>
|
298 |
+
<class>skyboxcheckout/quote_total7</class>
|
299 |
+
<after>subtotal,discount,shipping</after>
|
300 |
+
<before>tax,grand_total</before>
|
301 |
+
</checkout_total7>
|
302 |
+
<checkout_total8>
|
303 |
+
<class>skyboxcheckout/quote_total8</class>
|
304 |
+
<after>subtotal,discount,shipping</after>
|
305 |
+
<before>tax,grand_total</before>
|
306 |
+
</checkout_total8>
|
307 |
+
<!--Eliminar-->
|
308 |
+
<!--<skybox_insurance>
|
309 |
+
<class>skyboxcheckout/total_screen_quote</class>
|
310 |
+
<after>subtotal</after>
|
311 |
+
<before>tax</before>
|
312 |
+
</skybox_insurance>-->
|
313 |
+
<checkout_total_rmt1>
|
314 |
+
<class>skyboxcheckout/quote_address_total_rmt</class>
|
315 |
+
<after>subtotal,discount,shipping</after>
|
316 |
+
<before>tax,grand_total</before>
|
317 |
+
</checkout_total_rmt1>
|
318 |
+
</totals>
|
319 |
+
</quote>
|
320 |
+
<order_invoice>
|
321 |
+
<totals>
|
322 |
+
<checkout_total1>
|
323 |
+
<class>skyboxcheckout/invoice_total</class>
|
324 |
+
<after>subtotal,discount,shipping</after>
|
325 |
+
<before>tax,grand_total</before>
|
326 |
+
</checkout_total1>
|
327 |
+
<!--Eliminar-->
|
328 |
+
<!--<skybox_insurance>
|
329 |
+
<class>skyboxcheckout/total_screen_invoice</class>
|
330 |
+
<after>subtotal</after>
|
331 |
+
<before>tax</before>
|
332 |
+
</skybox_insurance>-->
|
333 |
+
</totals>
|
334 |
+
</order_invoice>
|
335 |
+
<order_creditmemo>
|
336 |
+
<totals>
|
337 |
+
<checkout_total1>
|
338 |
+
<class>skyboxcheckout/creditmemo_total</class>
|
339 |
+
<after>subtotal,discount,shipping</after>
|
340 |
+
<before>tax,grand_total</before>
|
341 |
+
</checkout_total1>
|
342 |
+
<!--Eliminar-->
|
343 |
+
<!--<skybox_insurance>
|
344 |
+
<class>skyboxcheckout/total_screen_creditmemo</class>
|
345 |
+
<after>subtotal</after>
|
346 |
+
<before>tax</before>
|
347 |
+
</skybox_insurance>-->
|
348 |
+
</totals>
|
349 |
+
</order_creditmemo>
|
350 |
+
</sales>
|
351 |
+
<!--routers>
|
352 |
+
<checkout>
|
353 |
+
<rewrite>
|
354 |
+
<onepage>
|
355 |
+
<to>Skybox_Checkout</to>
|
356 |
+
</onepage>
|
357 |
+
</rewrite>
|
358 |
+
</checkout>
|
359 |
+
</routers-->
|
360 |
+
<!--rewrite>
|
361 |
+
<skyboxcheckout_for_checkout>
|
362 |
+
<from><![CDATA[#^/checkout/onepage/#]]></from>
|
363 |
+
<to>/skbcheckout/international/</to>
|
364 |
+
</skyboxcheckout_for_checkout>
|
365 |
+
</rewrite-->
|
366 |
+
<helpers>
|
367 |
+
<checkout>
|
368 |
+
<rewrite>
|
369 |
+
<data>Skybox_Checkout_Helper_Data</data>
|
370 |
+
</rewrite>
|
371 |
+
</checkout>
|
372 |
+
<checkout>
|
373 |
+
<rewrite>
|
374 |
+
<url>Skybox_Checkout_Helper_Url</url>
|
375 |
+
</rewrite>
|
376 |
+
</checkout>
|
377 |
+
<!--<skyboxcheckout_pay>-->
|
378 |
+
<!--<class>Skybox_Checkout_Helper</class>-->
|
379 |
+
<!--</skyboxcheckout_pay>-->
|
380 |
+
</helpers>
|
381 |
+
|
382 |
+
</global>
|
383 |
+
<frontend>
|
384 |
+
<routers>
|
385 |
+
<skyboxcheckout>
|
386 |
+
<use>standard</use>
|
387 |
+
<args>
|
388 |
+
<module>Skybox_Checkout</module>
|
389 |
+
<frontName>skbcheckout</frontName>
|
390 |
+
</args>
|
391 |
+
</skyboxcheckout>
|
392 |
+
<!--checkout>
|
393 |
+
<args>
|
394 |
+
<modules>
|
395 |
+
<Skybox_Checkout before="Mage_Checkout">Skybox_Checkout</Skybox_Checkout>
|
396 |
+
</modules>
|
397 |
+
</args>
|
398 |
+
</checkout-->
|
399 |
+
</routers>
|
400 |
+
<!--events>
|
401 |
+
<controller_front_init_routers>
|
402 |
+
<observers>
|
403 |
+
<Skybox_checkout_model_observer>
|
404 |
+
<type>singleton</type>
|
405 |
+
<class>Skybox_Checkout_Model_Observer</class>
|
406 |
+
<method>InitializeSkybox</method>
|
407 |
+
</Skybox_checkout_model_observer>
|
408 |
+
</observers>
|
409 |
+
</controller_front_init_routers>
|
410 |
+
</events-->
|
411 |
+
<translate/>
|
412 |
+
<layout>
|
413 |
+
<updates>
|
414 |
+
<skyboxcheckout>
|
415 |
+
<file>skyboxcheckout.xml</file>
|
416 |
+
</skyboxcheckout>
|
417 |
+
</updates>
|
418 |
+
</layout>
|
419 |
+
<events>
|
420 |
+
<!-- -->
|
421 |
+
<sales_quote_collect_totals_after>
|
422 |
+
<observers>
|
423 |
+
<set_skybox_subtotals>
|
424 |
+
<class>skyboxcheckout/observer</class>
|
425 |
+
<method>changeQuoteAddressSkybox</method>
|
426 |
+
</set_skybox_subtotals>
|
427 |
+
</observers>
|
428 |
+
</sales_quote_collect_totals_after>
|
429 |
+
<!-- -->
|
430 |
+
</events>
|
431 |
+
</frontend>
|
432 |
+
<default>
|
433 |
+
<carriers>
|
434 |
+
<skyboxcheckout_shipping>
|
435 |
+
<active>0</active>
|
436 |
+
<model>skyboxcheckout/carrier</model>
|
437 |
+
<title>SkyboxCheckout Method</title>
|
438 |
+
<price>0</price>
|
439 |
+
<!--<sort_order>10</sort_order>-->
|
440 |
+
<!--<sallowspecific>0</sallowspecific>-->
|
441 |
+
</skyboxcheckout_shipping>
|
442 |
+
</carriers>
|
443 |
+
<payment>
|
444 |
+
<skyboxcheckout_pay>
|
445 |
+
<model>skyboxcheckout/pay</model>
|
446 |
+
<active>1</active>
|
447 |
+
<order_status>pending</order_status>
|
448 |
+
<title>Skybox Payment</title>
|
449 |
+
<!--<payment_action>sale</payment_action>-->
|
450 |
+
<!--<allowspecific>0</allowspecific>-->
|
451 |
+
<!--<sort_order>1</sort_order>-->
|
452 |
+
</skyboxcheckout_pay>
|
453 |
+
</payment>
|
454 |
+
<config_vars/>
|
455 |
+
<!--Eliminar-->
|
456 |
+
<!--<sales>
|
457 |
+
<totals_sort>
|
458 |
+
<skybox_insurance>0</skybox_insurance>
|
459 |
+
</totals_sort>
|
460 |
+
</sales>-->
|
461 |
+
<!--<sales>
|
462 |
+
<totals_sort>
|
463 |
+
<checkout_insurance>15</checkout_insurance>
|
464 |
+
</totals_sort>
|
465 |
+
</sales>-->
|
466 |
+
</default>
|
467 |
+
</config>
|
app/code/community/Skybox/Checkout/etc/system.xml
CHANGED
@@ -1,127 +1,127 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<sections>
|
4 |
-
<carriers translate="label" module="shipping">
|
5 |
-
<groups>
|
6 |
-
<skyboxcheckout_shipping translate="label">
|
7 |
-
<label>Shipping SkyboxCheckout</label>
|
8 |
-
<frontend_type>text</frontend_type>
|
9 |
-
<sort_order>0</sort_order>
|
10 |
-
<show_in_default>1</show_in_default>
|
11 |
-
<show_in_website>1</show_in_website>
|
12 |
-
<show_in_store>1</show_in_store>
|
13 |
-
<fields>
|
14 |
-
<active translate="label">
|
15 |
-
<label>Enabled</label>
|
16 |
-
<frontend_type>select</frontend_type>
|
17 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
-
<sort_order>1</sort_order>
|
19 |
-
<show_in_default>1</show_in_default>
|
20 |
-
<show_in_website>1</show_in_website>
|
21 |
-
<show_in_store>1</show_in_store>
|
22 |
-
</active>
|
23 |
-
<title translate="label">
|
24 |
-
<label>Title</label>
|
25 |
-
<frontend_type>text</frontend_type>
|
26 |
-
<sort_order>2</sort_order>
|
27 |
-
<show_in_default>1</show_in_default>
|
28 |
-
<show_in_website>1</show_in_website>
|
29 |
-
<show_in_store>1</show_in_store>
|
30 |
-
</title>
|
31 |
-
<sort_order translate="label">
|
32 |
-
<label>Sort Order</label>
|
33 |
-
<frontend_type>text</frontend_type>
|
34 |
-
<sort_order>100</sort_order>
|
35 |
-
<show_in_default>1</show_in_default>
|
36 |
-
<show_in_website>1</show_in_website>
|
37 |
-
<show_in_store>0</show_in_store>
|
38 |
-
</sort_order>
|
39 |
-
<price translate="label">
|
40 |
-
<label>Price</label>
|
41 |
-
<frontend_type>text</frontend_type>
|
42 |
-
<sort_order>3</sort_order>
|
43 |
-
<show_in_default>1</show_in_default>
|
44 |
-
<show_in_website>1</show_in_website>
|
45 |
-
<show_in_store>1</show_in_store>
|
46 |
-
</price>
|
47 |
-
<!--
|
48 |
-
This value is used to specify whether
|
49 |
-
the carrier is available only for
|
50 |
-
specific countries or all countries
|
51 |
-
available in the current Magento
|
52 |
-
installation.
|
53 |
-
-->
|
54 |
-
<!--<sallowspecific translate="label">-->
|
55 |
-
<!--<label>Ship to Applicable Countries</label>-->
|
56 |
-
<!--<frontend_type>select</frontend_type>-->
|
57 |
-
<!--<sort_order>90</sort_order>-->
|
58 |
-
<!--<frontend_class>shipping-applicable-country</frontend_class>-->
|
59 |
-
<!--<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>-->
|
60 |
-
<!--<show_in_default>1</show_in_default>-->
|
61 |
-
<!--<show_in_website>1</show_in_website>-->
|
62 |
-
<!--<show_in_store>0</show_in_store>-->
|
63 |
-
<!--</sallowspecific>-->
|
64 |
-
<!--
|
65 |
-
If 'specific countries' is chosen
|
66 |
-
in the previous option, then this field
|
67 |
-
allows the administrator to specify
|
68 |
-
which specific countries this carrier
|
69 |
-
should be available for.
|
70 |
-
-->
|
71 |
-
<!--<specificcountry translate="label">-->
|
72 |
-
<!--<label>Ship to Specific Countries</label>-->
|
73 |
-
<!--<frontend_type>multiselect</frontend_type>-->
|
74 |
-
<!--<sort_order>91</sort_order>-->
|
75 |
-
<!--<source_model>adminhtml/system_config_source_country</source_model>-->
|
76 |
-
<!--<show_in_default>1</show_in_default>-->
|
77 |
-
<!--<show_in_website>1</show_in_website>-->
|
78 |
-
<!--<show_in_store>0</show_in_store>-->
|
79 |
-
<!--<can_be_empty>1</can_be_empty>-->
|
80 |
-
<!--</specificcountry>-->
|
81 |
-
</fields>
|
82 |
-
</skyboxcheckout_shipping>
|
83 |
-
</groups>
|
84 |
-
</carriers>
|
85 |
-
<payment>
|
86 |
-
<groups>
|
87 |
-
<skyboxcheckout_pay translate="label">
|
88 |
-
<label>Skybox Payment Module</label>
|
89 |
-
<sort_order>0</sort_order>
|
90 |
-
<show_in_default>1</show_in_default>
|
91 |
-
<show_in_website>1</show_in_website>
|
92 |
-
<show_in_store>0</show_in_store>
|
93 |
-
<fields>
|
94 |
-
<active translate="label">
|
95 |
-
<label>Enabled</label>
|
96 |
-
<frontend_type>select</frontend_type>
|
97 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
-
<sort_order>1</sort_order>
|
99 |
-
<show_in_default>1</show_in_default>
|
100 |
-
<show_in_website>1</show_in_website>
|
101 |
-
<show_in_store>0</show_in_store>
|
102 |
-
</active>
|
103 |
-
<order_status translate="label">
|
104 |
-
<label>New order status</label>
|
105 |
-
<frontend_type>select</frontend_type>
|
106 |
-
<source_model>adminhtml/system_config_source_order_status</source_model>
|
107 |
-
<!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
|
108 |
-
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
|
109 |
-
<sort_order>2</sort_order>
|
110 |
-
<show_in_default>1</show_in_default>
|
111 |
-
<show_in_website>1</show_in_website>
|
112 |
-
<show_in_store>0</show_in_store>
|
113 |
-
</order_status>
|
114 |
-
<title translate="label">
|
115 |
-
<label>Title</label>
|
116 |
-
<frontend_type>text</frontend_type>
|
117 |
-
<sort_order>3</sort_order>
|
118 |
-
<show_in_default>1</show_in_default>
|
119 |
-
<show_in_website>1</show_in_website>
|
120 |
-
<show_in_store>0</show_in_store>
|
121 |
-
</title>
|
122 |
-
</fields>
|
123 |
-
</skyboxcheckout_pay>
|
124 |
-
</groups>
|
125 |
-
</payment>
|
126 |
-
</sections>
|
127 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers translate="label" module="shipping">
|
5 |
+
<groups>
|
6 |
+
<skyboxcheckout_shipping translate="label">
|
7 |
+
<label>Shipping SkyboxCheckout</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>0</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label">
|
24 |
+
<label>Title</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</title>
|
31 |
+
<sort_order translate="label">
|
32 |
+
<label>Sort Order</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>100</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</sort_order>
|
39 |
+
<price translate="label">
|
40 |
+
<label>Price</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>3</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</price>
|
47 |
+
<!--
|
48 |
+
This value is used to specify whether
|
49 |
+
the carrier is available only for
|
50 |
+
specific countries or all countries
|
51 |
+
available in the current Magento
|
52 |
+
installation.
|
53 |
+
-->
|
54 |
+
<!--<sallowspecific translate="label">-->
|
55 |
+
<!--<label>Ship to Applicable Countries</label>-->
|
56 |
+
<!--<frontend_type>select</frontend_type>-->
|
57 |
+
<!--<sort_order>90</sort_order>-->
|
58 |
+
<!--<frontend_class>shipping-applicable-country</frontend_class>-->
|
59 |
+
<!--<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>-->
|
60 |
+
<!--<show_in_default>1</show_in_default>-->
|
61 |
+
<!--<show_in_website>1</show_in_website>-->
|
62 |
+
<!--<show_in_store>0</show_in_store>-->
|
63 |
+
<!--</sallowspecific>-->
|
64 |
+
<!--
|
65 |
+
If 'specific countries' is chosen
|
66 |
+
in the previous option, then this field
|
67 |
+
allows the administrator to specify
|
68 |
+
which specific countries this carrier
|
69 |
+
should be available for.
|
70 |
+
-->
|
71 |
+
<!--<specificcountry translate="label">-->
|
72 |
+
<!--<label>Ship to Specific Countries</label>-->
|
73 |
+
<!--<frontend_type>multiselect</frontend_type>-->
|
74 |
+
<!--<sort_order>91</sort_order>-->
|
75 |
+
<!--<source_model>adminhtml/system_config_source_country</source_model>-->
|
76 |
+
<!--<show_in_default>1</show_in_default>-->
|
77 |
+
<!--<show_in_website>1</show_in_website>-->
|
78 |
+
<!--<show_in_store>0</show_in_store>-->
|
79 |
+
<!--<can_be_empty>1</can_be_empty>-->
|
80 |
+
<!--</specificcountry>-->
|
81 |
+
</fields>
|
82 |
+
</skyboxcheckout_shipping>
|
83 |
+
</groups>
|
84 |
+
</carriers>
|
85 |
+
<payment>
|
86 |
+
<groups>
|
87 |
+
<skyboxcheckout_pay translate="label">
|
88 |
+
<label>Skybox Payment Module</label>
|
89 |
+
<sort_order>0</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>0</show_in_store>
|
93 |
+
<fields>
|
94 |
+
<active translate="label">
|
95 |
+
<label>Enabled</label>
|
96 |
+
<frontend_type>select</frontend_type>
|
97 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
+
<sort_order>1</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>0</show_in_store>
|
102 |
+
</active>
|
103 |
+
<order_status translate="label">
|
104 |
+
<label>New order status</label>
|
105 |
+
<frontend_type>select</frontend_type>
|
106 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
107 |
+
<!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
|
108 |
+
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
|
109 |
+
<sort_order>2</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_website>1</show_in_website>
|
112 |
+
<show_in_store>0</show_in_store>
|
113 |
+
</order_status>
|
114 |
+
<title translate="label">
|
115 |
+
<label>Title</label>
|
116 |
+
<frontend_type>text</frontend_type>
|
117 |
+
<sort_order>3</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>0</show_in_store>
|
121 |
+
</title>
|
122 |
+
</fields>
|
123 |
+
</skyboxcheckout_pay>
|
124 |
+
</groups>
|
125 |
+
</payment>
|
126 |
+
</sections>
|
127 |
+
</config>
|
app/code/community/Skybox/Checkout/sql/skyboxcheckout_setup/mysql4-install-0.1.0.php
CHANGED
@@ -1,133 +1,133 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
// Table: sales_flat_quote_address
|
7 |
-
|
8 |
-
$installer->addAttribute('quote_address', 'subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
9 |
-
$installer->addAttribute('quote_address', 'base_subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
10 |
-
$installer->addAttribute('quote_address', 'grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
11 |
-
$installer->addAttribute('quote_address', 'base_grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
12 |
-
|
13 |
-
$installer->addAttribute('quote_address', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
14 |
-
$installer->addAttribute('quote_address', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
15 |
-
|
16 |
-
$installer->addAttribute('quote_address', 'taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
17 |
-
$installer->addAttribute('quote_address', 'taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
18 |
-
|
19 |
-
$installer->addAttribute('quote_address', 'handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
20 |
-
$installer->addAttribute('quote_address', 'handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
21 |
-
|
22 |
-
$installer->addAttribute('quote_address', 'shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
23 |
-
$installer->addAttribute('quote_address', 'shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
24 |
-
|
25 |
-
$installer->addAttribute('quote_address', 'insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
26 |
-
$installer->addAttribute('quote_address', 'insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
27 |
-
|
28 |
-
$installer->addAttribute('quote_address', 'clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
29 |
-
$installer->addAttribute('quote_address', 'clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
30 |
-
|
31 |
-
$installer->addAttribute('quote_address', 'duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
32 |
-
$installer->addAttribute('quote_address', 'duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
33 |
-
|
34 |
-
$installer->addAttribute('quote_address', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
35 |
-
$installer->addAttribute('quote_address', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
36 |
-
|
37 |
-
$installer->addAttribute('quote_address', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
38 |
-
$installer->addAttribute('quote_address', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
39 |
-
|
40 |
-
$installer->addAttribute('quote_address', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
41 |
-
$installer->addAttribute('quote_address', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
42 |
-
|
43 |
-
// Table: sales_flat_quote_item
|
44 |
-
|
45 |
-
$installer->addAttribute('quote_item', 'id_product_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
46 |
-
$installer->addAttribute('quote_item', 'price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
47 |
-
$installer->addAttribute('quote_item', 'customs_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
48 |
-
$installer->addAttribute('quote_item', 'shipping_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
49 |
-
$installer->addAttribute('quote_item', 'insurance_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
50 |
-
$installer->addAttribute('quote_item', 'total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
51 |
-
|
52 |
-
$installer->addAttribute('quote_item', 'price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
53 |
-
$installer->addAttribute('quote_item', 'customs_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
54 |
-
$installer->addAttribute('quote_item', 'shipping_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
55 |
-
$installer->addAttribute('quote_item', 'insurance_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
56 |
-
$installer->addAttribute('quote_item', 'total_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
57 |
-
$installer->addAttribute('quote_item', 'guid_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
58 |
-
$installer->addAttribute('quote_item', 'row_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
59 |
-
|
60 |
-
$installer->addAttribute('quote_item', 'base_price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
61 |
-
$installer->addAttribute('quote_item', 'base_price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
62 |
-
$installer->addAttribute('quote_item', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
63 |
-
$installer->addAttribute('quote_item', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
64 |
-
$installer->addAttribute('quote_item', 'adjust_label_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
65 |
-
$installer->addAttribute('quote_item', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
66 |
-
$installer->addAttribute('quote_item', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
67 |
-
|
68 |
-
|
69 |
-
// Table: sales_flat_order_item
|
70 |
-
|
71 |
-
$installer->addAttribute('order_item', 'id_product_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
72 |
-
$installer->addAttribute('order_item', 'price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
73 |
-
$installer->addAttribute('order_item', 'customs_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
74 |
-
$installer->addAttribute('order_item', 'shipping_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
75 |
-
$installer->addAttribute('order_item', 'insurance_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
76 |
-
$installer->addAttribute('order_item', 'total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
77 |
-
|
78 |
-
$installer->addAttribute('order_item', 'price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
79 |
-
$installer->addAttribute('order_item', 'customs_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
80 |
-
$installer->addAttribute('order_item', 'shipping_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
81 |
-
$installer->addAttribute('order_item', 'insurance_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
82 |
-
$installer->addAttribute('order_item', 'total_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
83 |
-
$installer->addAttribute('order_item', 'guid_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
84 |
-
$installer->addAttribute('order_item', 'row_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
85 |
-
|
86 |
-
$installer->addAttribute('order_item', 'base_price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
87 |
-
$installer->addAttribute('order_item', 'base_price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
88 |
-
$installer->addAttribute('order_item', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
89 |
-
$installer->addAttribute('order_item', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
90 |
-
$installer->addAttribute('order_item', 'adjust_label_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
91 |
-
$installer->addAttribute('order_item', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
92 |
-
$installer->addAttribute('order_item', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
93 |
-
|
94 |
-
|
95 |
-
// Table: sales_flat_order
|
96 |
-
|
97 |
-
$installer->addAttribute('order', 'subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
98 |
-
$installer->addAttribute('order', 'base_subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
99 |
-
$installer->addAttribute('order', 'grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
100 |
-
$installer->addAttribute('order', 'base_grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
101 |
-
|
102 |
-
$installer->addAttribute('order', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
103 |
-
$installer->addAttribute('order', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
104 |
-
|
105 |
-
$installer->addAttribute('order', 'taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
106 |
-
$installer->addAttribute('order', 'taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
107 |
-
|
108 |
-
$installer->addAttribute('order', 'handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
109 |
-
$installer->addAttribute('order', 'handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
110 |
-
|
111 |
-
$installer->addAttribute('order', 'shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
112 |
-
$installer->addAttribute('order', 'shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
113 |
-
|
114 |
-
$installer->addAttribute('order', 'insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
115 |
-
$installer->addAttribute('order', 'insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
116 |
-
|
117 |
-
$installer->addAttribute('order', 'clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
118 |
-
$installer->addAttribute('order', 'clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
119 |
-
|
120 |
-
$installer->addAttribute('order', 'duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
121 |
-
$installer->addAttribute('order', 'duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
122 |
-
|
123 |
-
$installer->addAttribute('order', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
124 |
-
$installer->addAttribute('order', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
125 |
-
|
126 |
-
$installer->addAttribute('order', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
127 |
-
$installer->addAttribute('order', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
128 |
-
|
129 |
-
$installer->addAttribute('order', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
130 |
-
$installer->addAttribute('order', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
131 |
-
|
132 |
-
|
133 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
// Table: sales_flat_quote_address
|
7 |
+
|
8 |
+
$installer->addAttribute('quote_address', 'subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
9 |
+
$installer->addAttribute('quote_address', 'base_subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
10 |
+
$installer->addAttribute('quote_address', 'grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
11 |
+
$installer->addAttribute('quote_address', 'base_grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
12 |
+
|
13 |
+
$installer->addAttribute('quote_address', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
14 |
+
$installer->addAttribute('quote_address', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
15 |
+
|
16 |
+
$installer->addAttribute('quote_address', 'taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
17 |
+
$installer->addAttribute('quote_address', 'taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
18 |
+
|
19 |
+
$installer->addAttribute('quote_address', 'handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
20 |
+
$installer->addAttribute('quote_address', 'handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
21 |
+
|
22 |
+
$installer->addAttribute('quote_address', 'shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
23 |
+
$installer->addAttribute('quote_address', 'shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
24 |
+
|
25 |
+
$installer->addAttribute('quote_address', 'insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
26 |
+
$installer->addAttribute('quote_address', 'insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
27 |
+
|
28 |
+
$installer->addAttribute('quote_address', 'clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
29 |
+
$installer->addAttribute('quote_address', 'clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
30 |
+
|
31 |
+
$installer->addAttribute('quote_address', 'duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
32 |
+
$installer->addAttribute('quote_address', 'duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
33 |
+
|
34 |
+
$installer->addAttribute('quote_address', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
35 |
+
$installer->addAttribute('quote_address', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
36 |
+
|
37 |
+
$installer->addAttribute('quote_address', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
38 |
+
$installer->addAttribute('quote_address', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
39 |
+
|
40 |
+
$installer->addAttribute('quote_address', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
41 |
+
$installer->addAttribute('quote_address', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
42 |
+
|
43 |
+
// Table: sales_flat_quote_item
|
44 |
+
|
45 |
+
$installer->addAttribute('quote_item', 'id_product_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
46 |
+
$installer->addAttribute('quote_item', 'price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
47 |
+
$installer->addAttribute('quote_item', 'customs_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
48 |
+
$installer->addAttribute('quote_item', 'shipping_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
49 |
+
$installer->addAttribute('quote_item', 'insurance_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
50 |
+
$installer->addAttribute('quote_item', 'total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
51 |
+
|
52 |
+
$installer->addAttribute('quote_item', 'price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
53 |
+
$installer->addAttribute('quote_item', 'customs_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
54 |
+
$installer->addAttribute('quote_item', 'shipping_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
55 |
+
$installer->addAttribute('quote_item', 'insurance_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
56 |
+
$installer->addAttribute('quote_item', 'total_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
57 |
+
$installer->addAttribute('quote_item', 'guid_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
58 |
+
$installer->addAttribute('quote_item', 'row_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
59 |
+
|
60 |
+
$installer->addAttribute('quote_item', 'base_price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
61 |
+
$installer->addAttribute('quote_item', 'base_price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
62 |
+
$installer->addAttribute('quote_item', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
63 |
+
$installer->addAttribute('quote_item', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
64 |
+
$installer->addAttribute('quote_item', 'adjust_label_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
65 |
+
$installer->addAttribute('quote_item', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
66 |
+
$installer->addAttribute('quote_item', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
67 |
+
|
68 |
+
|
69 |
+
// Table: sales_flat_order_item
|
70 |
+
|
71 |
+
$installer->addAttribute('order_item', 'id_product_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
72 |
+
$installer->addAttribute('order_item', 'price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
73 |
+
$installer->addAttribute('order_item', 'customs_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
74 |
+
$installer->addAttribute('order_item', 'shipping_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
75 |
+
$installer->addAttribute('order_item', 'insurance_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
76 |
+
$installer->addAttribute('order_item', 'total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
77 |
+
|
78 |
+
$installer->addAttribute('order_item', 'price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
79 |
+
$installer->addAttribute('order_item', 'customs_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
80 |
+
$installer->addAttribute('order_item', 'shipping_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
81 |
+
$installer->addAttribute('order_item', 'insurance_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
82 |
+
$installer->addAttribute('order_item', 'total_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
83 |
+
$installer->addAttribute('order_item', 'guid_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
84 |
+
$installer->addAttribute('order_item', 'row_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
85 |
+
|
86 |
+
$installer->addAttribute('order_item', 'base_price_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
87 |
+
$installer->addAttribute('order_item', 'base_price_usd_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
88 |
+
$installer->addAttribute('order_item', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
89 |
+
$installer->addAttribute('order_item', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
90 |
+
$installer->addAttribute('order_item', 'adjust_label_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
91 |
+
$installer->addAttribute('order_item', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
92 |
+
$installer->addAttribute('order_item', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
93 |
+
|
94 |
+
|
95 |
+
// Table: sales_flat_order
|
96 |
+
|
97 |
+
$installer->addAttribute('order', 'subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
98 |
+
$installer->addAttribute('order', 'base_subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
99 |
+
$installer->addAttribute('order', 'grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
100 |
+
$installer->addAttribute('order', 'base_grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
101 |
+
|
102 |
+
$installer->addAttribute('order', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
103 |
+
$installer->addAttribute('order', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
104 |
+
|
105 |
+
$installer->addAttribute('order', 'taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
106 |
+
$installer->addAttribute('order', 'taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
107 |
+
|
108 |
+
$installer->addAttribute('order', 'handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
109 |
+
$installer->addAttribute('order', 'handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
110 |
+
|
111 |
+
$installer->addAttribute('order', 'shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
112 |
+
$installer->addAttribute('order', 'shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
113 |
+
|
114 |
+
$installer->addAttribute('order', 'insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
115 |
+
$installer->addAttribute('order', 'insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
116 |
+
|
117 |
+
$installer->addAttribute('order', 'clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
118 |
+
$installer->addAttribute('order', 'clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
119 |
+
|
120 |
+
$installer->addAttribute('order', 'duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
121 |
+
$installer->addAttribute('order', 'duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
122 |
+
|
123 |
+
$installer->addAttribute('order', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
124 |
+
$installer->addAttribute('order', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
125 |
+
|
126 |
+
$installer->addAttribute('order', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
127 |
+
$installer->addAttribute('order', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
128 |
+
|
129 |
+
$installer->addAttribute('order', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
130 |
+
$installer->addAttribute('order', 'rmt_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
131 |
+
|
132 |
+
|
133 |
$installer->endSetup();
|
app/code/community/Skybox/Checkout/sql/skyboxcheckout_setup/mysql4-upgrade-0.1.0-0.1.1.php
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
|
4 |
-
|
5 |
-
|
6 |
-
$installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
|
7 |
-
$installer->startSetup();
|
8 |
-
/*
|
9 |
-
$installer->addAttribute('quote_address', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
10 |
-
$installer->addAttribute('quote_address', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
11 |
-
|
12 |
-
$installer->addAttribute('quote_address', 'Taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
13 |
-
$installer->addAttribute('quote_address', 'Taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
14 |
-
|
15 |
-
$installer->addAttribute('quote_address', 'Handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
16 |
-
$installer->addAttribute('quote_address', 'Handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
17 |
-
|
18 |
-
$installer->addAttribute('quote_address', 'Shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
19 |
-
$installer->addAttribute('quote_address', 'Shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
20 |
-
|
21 |
-
$installer->addAttribute('quote_address', 'Insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
22 |
-
$installer->addAttribute('quote_address', 'Insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
23 |
-
|
24 |
-
$installer->addAttribute('quote_address', 'Clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
25 |
-
$installer->addAttribute('quote_address', 'Clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
26 |
-
|
27 |
-
$installer->addAttribute('quote_address', 'Duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
28 |
-
$installer->addAttribute('quote_address', 'Duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
29 |
-
|
30 |
-
$installer->addAttribute('quote_address', 'Adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
31 |
-
$installer->addAttribute('quote_address', 'Adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));*/
|
32 |
-
|
33 |
-
/*$installer->addAttribute('quote_address', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));*/
|
34 |
-
|
35 |
-
|
36 |
-
/*$installer->addAttribute('order', 'subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
37 |
-
$installer->addAttribute('order', 'base_subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
38 |
-
$installer->addAttribute('order', 'grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
39 |
-
$installer->addAttribute('order', 'base_grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
40 |
-
|
41 |
-
$installer->addAttribute('order', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
42 |
-
$installer->addAttribute('order', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
43 |
-
|
44 |
-
$installer->addAttribute('order', 'taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
45 |
-
$installer->addAttribute('order', 'taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
46 |
-
|
47 |
-
$installer->addAttribute('order', 'handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
48 |
-
$installer->addAttribute('order', 'handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
49 |
-
|
50 |
-
$installer->addAttribute('order', 'shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
51 |
-
$installer->addAttribute('order', 'shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
52 |
-
|
53 |
-
$installer->addAttribute('order', 'insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
54 |
-
$installer->addAttribute('order', 'insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
55 |
-
|
56 |
-
$installer->addAttribute('order', 'clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
57 |
-
$installer->addAttribute('order', 'clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
58 |
-
|
59 |
-
$installer->addAttribute('order', 'duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
60 |
-
$installer->addAttribute('order', 'duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
61 |
-
|
62 |
-
$installer->addAttribute('order', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
63 |
-
$installer->addAttribute('order', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
64 |
-
|
65 |
-
$installer->addAttribute('order', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
66 |
-
*/
|
67 |
-
|
68 |
-
$installer->endSetup();
|
69 |
-
|
70 |
-
die("Exit for now");
|
71 |
-
|
72 |
|
1 |
+
<?php
|
2 |
+
|
3 |
+
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
|
4 |
+
|
5 |
+
|
6 |
+
$installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
|
7 |
+
$installer->startSetup();
|
8 |
+
/*
|
9 |
+
$installer->addAttribute('quote_address', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
10 |
+
$installer->addAttribute('quote_address', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
11 |
+
|
12 |
+
$installer->addAttribute('quote_address', 'Taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
13 |
+
$installer->addAttribute('quote_address', 'Taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
14 |
+
|
15 |
+
$installer->addAttribute('quote_address', 'Handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
16 |
+
$installer->addAttribute('quote_address', 'Handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
17 |
+
|
18 |
+
$installer->addAttribute('quote_address', 'Shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
19 |
+
$installer->addAttribute('quote_address', 'Shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
20 |
+
|
21 |
+
$installer->addAttribute('quote_address', 'Insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
22 |
+
$installer->addAttribute('quote_address', 'Insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
23 |
+
|
24 |
+
$installer->addAttribute('quote_address', 'Clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
25 |
+
$installer->addAttribute('quote_address', 'Clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
26 |
+
|
27 |
+
$installer->addAttribute('quote_address', 'Duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
28 |
+
$installer->addAttribute('quote_address', 'Duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
29 |
+
|
30 |
+
$installer->addAttribute('quote_address', 'Adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
31 |
+
$installer->addAttribute('quote_address', 'Adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));*/
|
32 |
+
|
33 |
+
/*$installer->addAttribute('quote_address', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));*/
|
34 |
+
|
35 |
+
|
36 |
+
/*$installer->addAttribute('order', 'subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
37 |
+
$installer->addAttribute('order', 'base_subtotal_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
38 |
+
$installer->addAttribute('order', 'grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
39 |
+
$installer->addAttribute('order', 'base_grand_total_skybox', array('type' => 'varchar', 'visible' => false, 'required' => false));
|
40 |
+
|
41 |
+
$installer->addAttribute('order', 'customs_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
42 |
+
$installer->addAttribute('order', 'customs_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
43 |
+
|
44 |
+
$installer->addAttribute('order', 'taxes_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
45 |
+
$installer->addAttribute('order', 'taxes_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
46 |
+
|
47 |
+
$installer->addAttribute('order', 'handling_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
48 |
+
$installer->addAttribute('order', 'handling_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
49 |
+
|
50 |
+
$installer->addAttribute('order', 'shipping_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
51 |
+
$installer->addAttribute('order', 'shipping_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
52 |
+
|
53 |
+
$installer->addAttribute('order', 'insurance_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
54 |
+
$installer->addAttribute('order', 'insurance_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
55 |
+
|
56 |
+
$installer->addAttribute('order', 'clearence_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
57 |
+
$installer->addAttribute('order', 'clearence_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
58 |
+
|
59 |
+
$installer->addAttribute('order', 'duties_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
60 |
+
$installer->addAttribute('order', 'duties_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
61 |
+
|
62 |
+
$installer->addAttribute('order', 'adjust_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
63 |
+
$installer->addAttribute('order', 'adjust_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
64 |
+
|
65 |
+
$installer->addAttribute('order', 'concepts_skybox', array('type' => 'text', 'visible' => true, 'required' => false));
|
66 |
+
*/
|
67 |
+
|
68 |
+
$installer->endSetup();
|
69 |
+
|
70 |
+
die("Exit for now");
|
71 |
+
|
72 |
|
app/code/community/Skybox/Checkout/sql/skyboxcheckout_setup/mysql4-upgrade-0.1.0-0.1.2.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
|
4 |
-
|
5 |
-
|
6 |
-
$installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
|
7 |
-
$installer->startSetup();
|
8 |
-
/*
|
9 |
-
$installer->addAttribute('quote_address', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
10 |
-
$installer->addAttribute('quote_address', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
11 |
-
|
12 |
-
$installer->addAttribute('order', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
13 |
-
$installer->addAttribute('order', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
14 |
-
*/
|
15 |
-
$installer->endSetup();
|
16 |
-
|
17 |
-
die("Exit for now");
|
18 |
-
|
19 |
|
1 |
+
<?php
|
2 |
+
|
3 |
+
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
|
4 |
+
|
5 |
+
|
6 |
+
$installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
|
7 |
+
$installer->startSetup();
|
8 |
+
/*
|
9 |
+
$installer->addAttribute('quote_address', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
10 |
+
$installer->addAttribute('quote_address', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
11 |
+
|
12 |
+
$installer->addAttribute('order', 'others_total_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
13 |
+
$installer->addAttribute('order', 'others_total_usd_skybox', array('type' => 'varchar', 'visible' => true, 'required' => false));
|
14 |
+
*/
|
15 |
+
$installer->endSetup();
|
16 |
+
|
17 |
+
die("Exit for now");
|
18 |
+
|
19 |
|
app/code/community/Skybox/Core/Exception.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* Exception
|
14 |
-
*
|
15 |
-
* @author César Tapia M. <ctapia@skyworldint.com>
|
16 |
-
*/
|
17 |
-
class Skybox_Core_Exception extends Mage_Core_Exception{
|
18 |
-
|
19 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Exception
|
14 |
+
*
|
15 |
+
* @author César Tapia M. <ctapia@skyworldint.com>
|
16 |
+
*/
|
17 |
+
class Skybox_Core_Exception extends Mage_Core_Exception{
|
18 |
+
|
19 |
+
}
|
app/code/community/Skybox/Core/Helper/Allow.php
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Helper_Allow extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
const TYPE_LOCATION_ALLOW_STORE = 1;
|
13 |
+
const TYPE_LOCATION_ALLOW_CART_DISABLE = 0;
|
14 |
+
const TYPE_LOCATION_ALLOW_CART_SHOW = 1;
|
15 |
+
const TYPE_LOCATION_ALLOW_CART_HIDE = 3;
|
16 |
+
const FULL_ACTION_NAME_IFRAME = 'skbcheckout_international_index';
|
17 |
+
|
18 |
+
protected $_integrationType;
|
19 |
+
protected $_locationAllow;
|
20 |
+
protected $_actionName;
|
21 |
+
|
22 |
+
public function isPriceEnabled()
|
23 |
+
{
|
24 |
+
if ($this->getTypeLocationAllow()
|
25 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
26 |
+
) {
|
27 |
+
return true;
|
28 |
+
} elseif ($this->getTypeLocationAllow()
|
29 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
30 |
+
) {
|
31 |
+
return false;
|
32 |
+
} elseif ($this->getTypeLocationAllow()
|
33 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
34 |
+
) {
|
35 |
+
return false;
|
36 |
+
} elseif ($this->getTypeLocationAllow()
|
37 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
38 |
+
) {
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function isCartBarEnabled()
|
46 |
+
{
|
47 |
+
$fullActionName = $this->getFullActionName();
|
48 |
+
|
49 |
+
if ($this->getTypeLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_SHOW
|
50 |
+
&& $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE && $fullActionName != self::FULL_ACTION_NAME_IFRAME
|
51 |
+
) {
|
52 |
+
return true;
|
53 |
+
} elseif ($this->getTypeLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_SHOW
|
54 |
+
&& $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE && $fullActionName == self::FULL_ACTION_NAME_IFRAME
|
55 |
+
) {
|
56 |
+
return false;
|
57 |
+
} elseif ($this->getTypeLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_SHOW
|
58 |
+
&& $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
59 |
+
) {
|
60 |
+
return false;
|
61 |
+
} elseif ($this->getTypeLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_HIDE
|
62 |
+
&& $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE && $fullActionName != self::FULL_ACTION_NAME_IFRAME
|
63 |
+
) {
|
64 |
+
return false;
|
65 |
+
} elseif ($this->getTypeLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_HIDE
|
66 |
+
&& $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE && $fullActionName == self::FULL_ACTION_NAME_IFRAME
|
67 |
+
) {
|
68 |
+
return true;
|
69 |
+
} elseif ($this->getTypeLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_HIDE
|
70 |
+
&& $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
71 |
+
) {
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function isCartButtonEnabled()
|
79 |
+
{
|
80 |
+
if ($this->getTypeLocationAllow()
|
81 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
82 |
+
) {
|
83 |
+
return true;
|
84 |
+
} elseif ($this->getTypeLocationAllow()
|
85 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
86 |
+
) {
|
87 |
+
return false;
|
88 |
+
} elseif ($this->getTypeLocationAllow()
|
89 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
90 |
+
) {
|
91 |
+
return false;
|
92 |
+
} elseif ($this->getTypeLocationAllow()
|
93 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
94 |
+
) {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
|
101 |
+
public function isCartButtonSkyboxEnabled()
|
102 |
+
{
|
103 |
+
if ($this->getTypeLocationAllow()
|
104 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
105 |
+
) {
|
106 |
+
return false;
|
107 |
+
} elseif ($this->getTypeLocationAllow()
|
108 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
109 |
+
) {
|
110 |
+
return false;
|
111 |
+
} elseif ($this->getTypeLocationAllow()
|
112 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
113 |
+
) {
|
114 |
+
return true;
|
115 |
+
} elseif ($this->getTypeLocationAllow()
|
116 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
117 |
+
) {
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
|
124 |
+
public function isChangeCountryEnabled()
|
125 |
+
{
|
126 |
+
if ($this->getTypeLocationAllow()
|
127 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
128 |
+
) {
|
129 |
+
return true;
|
130 |
+
} elseif ($this->getTypeLocationAllow()
|
131 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
132 |
+
) {
|
133 |
+
return false;
|
134 |
+
} elseif ($this->getTypeLocationAllow()
|
135 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
136 |
+
) {
|
137 |
+
return false;
|
138 |
+
} elseif ($this->getTypeLocationAllow()
|
139 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
140 |
+
) {
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
public function isVisible()
|
148 |
+
{
|
149 |
+
return $this->getLocationAllow() != 0 ? true : false;
|
150 |
+
}
|
151 |
+
|
152 |
+
public function isOperationCartEnabled()
|
153 |
+
{
|
154 |
+
if ($this->getTypeLocationAllow()
|
155 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
156 |
+
) {
|
157 |
+
return false;
|
158 |
+
} elseif ($this->getTypeLocationAllow()
|
159 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
160 |
+
) {
|
161 |
+
return true;
|
162 |
+
} elseif ($this->getTypeLocationAllow()
|
163 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
164 |
+
) {
|
165 |
+
return false;
|
166 |
+
} elseif ($this->getTypeLocationAllow()
|
167 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
168 |
+
) {
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
public function showSubtotal()
|
176 |
+
{
|
177 |
+
if ($this->getTypeLocationAllow()
|
178 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
179 |
+
) {
|
180 |
+
return false;
|
181 |
+
} elseif ($this->getTypeLocationAllow()
|
182 |
+
== self::TYPE_LOCATION_ALLOW_CART_SHOW && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
183 |
+
) {
|
184 |
+
return true;
|
185 |
+
} elseif ($this->getTypeLocationAllow()
|
186 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() != self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
187 |
+
) {
|
188 |
+
return true;
|
189 |
+
} elseif ($this->getTypeLocationAllow()
|
190 |
+
== self::TYPE_LOCATION_ALLOW_CART_HIDE && $this->getLocationAllow() == self::TYPE_LOCATION_ALLOW_CART_DISABLE
|
191 |
+
) {
|
192 |
+
return true;
|
193 |
+
}
|
194 |
+
|
195 |
+
return true;
|
196 |
+
}
|
197 |
+
|
198 |
+
/*
|
199 |
+
* Get Store Type Location
|
200 |
+
*/
|
201 |
+
private function getTypeLocationAllow()
|
202 |
+
{
|
203 |
+
if ($this->_integrationType == null) {
|
204 |
+
$integrationType = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
205 |
+
$this->_integrationType = $integrationType;
|
206 |
+
}
|
207 |
+
return $this->_integrationType;
|
208 |
+
}
|
209 |
+
|
210 |
+
/*
|
211 |
+
* Get LocationAllow
|
212 |
+
*/
|
213 |
+
private function getLocationAllow()
|
214 |
+
{
|
215 |
+
if ($this->_locationAllow == null) {
|
216 |
+
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
217 |
+
$value = $_checkout->getLocationAllow();
|
218 |
+
$value = isset($value) ? $value : 0;
|
219 |
+
$this->_locationAllow = $value;
|
220 |
+
}
|
221 |
+
return $this->_locationAllow;
|
222 |
+
}
|
223 |
+
|
224 |
+
/*
|
225 |
+
* Get FullActionName router name
|
226 |
+
*/
|
227 |
+
private function getFullActionName()
|
228 |
+
{
|
229 |
+
$moduleName = Mage::app()->getRequest()->getModuleName();
|
230 |
+
$controllerName = Mage::app()->getRequest()->getControllerName();
|
231 |
+
$actionName = Mage::app()->getRequest()->getActionName();
|
232 |
+
|
233 |
+
$result = $moduleName . "_" . $controllerName . "_" . $actionName;
|
234 |
+
return $result;
|
235 |
+
}
|
236 |
+
}
|
app/code/community/Skybox/Core/Helper/Data.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Core_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
-
{
|
12 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
}
|
app/code/community/Skybox/Core/Helper/Email.php
CHANGED
@@ -1,53 +1,53 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
class Skybox_Core_Helper_Email extends Mage_Core_Helper_Abstract
|
12 |
-
{
|
13 |
-
public function sendException($message)
|
14 |
-
{
|
15 |
-
$storeName = "[" . Mage::app()->getStore()->getName() . "]";
|
16 |
-
$subject = $storeName . " - Exception generated at " . strftime("%H:%M:%S", time());
|
17 |
-
return $this->email($subject, $message);
|
18 |
-
}
|
19 |
-
|
20 |
-
public function sendAPIError($message)
|
21 |
-
{
|
22 |
-
$storeName = "[" . Mage::app()->getStore()->getName() . "]";
|
23 |
-
$subject = $storeName . " - Error trying to connect to API at " . strftime("%H:%M:%S", time());
|
24 |
-
return $this->email($subject, $message);
|
25 |
-
}
|
26 |
-
|
27 |
-
public function email($subject, $body)
|
28 |
-
{
|
29 |
-
$skybox_email = Mage::helper('skyboxinternational/data')->getSkyboxEmail();
|
30 |
-
|
31 |
-
if (!$skybox_email) {
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
|
35 |
-
/* @var $mail Mage_Core_Model_Email */
|
36 |
-
$mail = Mage::getModel('core/email');
|
37 |
-
$mail->setToName('Magento Store');
|
38 |
-
$mail->setToEmail($skybox_email);
|
39 |
-
$mail->setBody($body);
|
40 |
-
$mail->setSubject($subject);
|
41 |
-
$mail->setFromEmail($skybox_email);
|
42 |
-
$mail->setFromName('Magento Store');
|
43 |
-
$mail->setType('text');
|
44 |
-
|
45 |
-
try {
|
46 |
-
$myEmail = $mail->send();
|
47 |
-
Mage::log($myEmail);
|
48 |
-
Mage::log('SkyboxCheckout: Your request email has been sent');
|
49 |
-
} catch (Exception $e) {
|
50 |
-
Mage::log('SkyboxCheckout: Unable to send');
|
51 |
-
}
|
52 |
-
}
|
53 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Skybox_Core_Helper_Email extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
public function sendException($message)
|
14 |
+
{
|
15 |
+
$storeName = "[" . Mage::app()->getStore()->getName() . "]";
|
16 |
+
$subject = $storeName . " - Exception generated at " . strftime("%H:%M:%S", time());
|
17 |
+
return $this->email($subject, $message);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function sendAPIError($message)
|
21 |
+
{
|
22 |
+
$storeName = "[" . Mage::app()->getStore()->getName() . "]";
|
23 |
+
$subject = $storeName . " - Error trying to connect to API at " . strftime("%H:%M:%S", time());
|
24 |
+
return $this->email($subject, $message);
|
25 |
+
}
|
26 |
+
|
27 |
+
public function email($subject, $body)
|
28 |
+
{
|
29 |
+
$skybox_email = Mage::helper('skyboxinternational/data')->getSkyboxEmail();
|
30 |
+
|
31 |
+
if (!$skybox_email) {
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
|
35 |
+
/* @var $mail Mage_Core_Model_Email */
|
36 |
+
$mail = Mage::getModel('core/email');
|
37 |
+
$mail->setToName('Magento Store');
|
38 |
+
$mail->setToEmail($skybox_email);
|
39 |
+
$mail->setBody($body);
|
40 |
+
$mail->setSubject($subject);
|
41 |
+
$mail->setFromEmail($skybox_email);
|
42 |
+
$mail->setFromName('Magento Store');
|
43 |
+
$mail->setType('text');
|
44 |
+
|
45 |
+
try {
|
46 |
+
$myEmail = $mail->send();
|
47 |
+
Mage::log($myEmail);
|
48 |
+
Mage::log('SkyboxCheckout: Your request email has been sent');
|
49 |
+
} catch (Exception $e) {
|
50 |
+
Mage::log('SkyboxCheckout: Unable to send');
|
51 |
+
}
|
52 |
+
}
|
53 |
}
|
app/code/community/Skybox/Core/Model/Api/Abstract.php
CHANGED
@@ -1,369 +1,440 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox Checkout
|
4 |
-
*
|
5 |
-
* @category Mage
|
6 |
-
* @package Skybox_Core
|
7 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
*
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
*
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
*
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
*
|
53 |
-
* @
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
$this
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
//
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
*
|
81 |
-
* @
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
public function getResponse()
|
93 |
-
{
|
94 |
-
|
95 |
-
}
|
96 |
-
|
97 |
-
public function getResponseJson()
|
98 |
-
{
|
99 |
-
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
*
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
if($this->
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
if($this->
|
230 |
-
|
231 |
-
if($this->
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
if($this->
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
if($this->
|
240 |
-
|
241 |
-
|
242 |
-
if($this->
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
if($this->
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
public function
|
313 |
-
{
|
314 |
-
return $this->getStatusCode() == Skybox_Core_Model_Config::
|
315 |
-
}
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox Checkout
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Skybox_Core
|
7 |
+
* @copyright Copyright (c) 2014 - 2017 Skybox Checkout. (http://www.skyboxcheckout.com)
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* SkyBox API - Abstract Class
|
12 |
+
*/
|
13 |
+
class Skybox_Core_Model_Api_Abstract extends Varien_Object
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Config instance
|
17 |
+
* @var Skybox_Core_Model_Config
|
18 |
+
*/
|
19 |
+
protected $_config = null;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Respuesta de api
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
protected $_response = null;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Solicitud de api
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $_request = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Código de metodo actual
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
protected $_methodCode = null;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Código de metodo actual
|
41 |
+
* @var array()
|
42 |
+
*/
|
43 |
+
protected $_params = null;
|
44 |
+
|
45 |
+
/*
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
protected $_status_code = null;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Seteamos la instancia Config
|
52 |
+
* @param Skybox_Core_Model_Config $config
|
53 |
+
* @return Skybox_Core_Model_Api_Abstract
|
54 |
+
*/
|
55 |
+
public function setConfigObject(Skybox_Core_Model_Config $config)
|
56 |
+
{
|
57 |
+
$this->_config = $config;
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
public function setStatusCode($value)
|
62 |
+
{
|
63 |
+
$this->_status_code = $value;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getStatusCode()
|
67 |
+
{
|
68 |
+
//Mage::log("Error:" . $this->gerResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_STATUS});
|
69 |
+
//return $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_STATUS};
|
70 |
+
return $this->_status_code;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getStatusMessage()
|
74 |
+
{
|
75 |
+
return $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_MESSAGE};
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Seteamos la respuesta del api
|
80 |
+
* @param string $response
|
81 |
+
* @return Skybox_Core_Model_Api_Abstract
|
82 |
+
*/
|
83 |
+
public function setResponse($response)
|
84 |
+
{
|
85 |
+
//Mage::log('setResponse->' . $response);
|
86 |
+
if (!empty($response)) {
|
87 |
+
$this->_response = $response;
|
88 |
+
}
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getResponse()
|
93 |
+
{
|
94 |
+
return $this->_response;
|
95 |
+
}
|
96 |
+
|
97 |
+
public function getResponseJson()
|
98 |
+
{
|
99 |
+
//Mage::log('gerResponseJson->' . $this->_response);
|
100 |
+
return json_decode($this->_response);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Setea url de llamda al ApiRest con sus parametros
|
105 |
+
* @param String $action
|
106 |
+
* @param Array $params
|
107 |
+
* @return Skybox_Core_Model_Api_Abstract
|
108 |
+
*/
|
109 |
+
protected function setUrlService($method, $params)
|
110 |
+
{
|
111 |
+
$this->_methodCode = $method;
|
112 |
+
$paramsRequest = '';
|
113 |
+
if (!empty($params)) {
|
114 |
+
$paramsRequest = '?' . http_build_query($params);
|
115 |
+
}
|
116 |
+
//$this->_request = $this->_config->skyboxDefaultApiUrl . $method . $paramsRequest;
|
117 |
+
$this->_request = $this->_config->getSkyBoxUrlAPI() . $method . $paramsRequest;
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Retorna la url de llamada al servicio
|
123 |
+
* @return String
|
124 |
+
*/
|
125 |
+
public function getUrlService()
|
126 |
+
{
|
127 |
+
Mage::log(" | getUrlService | " . $this->_request);
|
128 |
+
return $this->_request;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Obtenemos el objeto Session
|
133 |
+
* @return Skybox_Core_Model_Session
|
134 |
+
*/
|
135 |
+
public function getSession()
|
136 |
+
{
|
137 |
+
return Mage::getSingleton('skybox/session');
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Obtenemos el objeto Cookie
|
142 |
+
* @return Mage_Core_Model_Cookie
|
143 |
+
*/
|
144 |
+
public function getCookie()
|
145 |
+
{
|
146 |
+
return Mage::getModel('core/cookie');
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Obtenemos el objeto Http
|
151 |
+
* @return Mage_Core_Helper_Http
|
152 |
+
*/
|
153 |
+
public function getHttp()
|
154 |
+
{
|
155 |
+
return Mage::helper('core/http');
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Current locale code getter
|
160 |
+
*
|
161 |
+
* @return string
|
162 |
+
*/
|
163 |
+
public function getLocaleCode()
|
164 |
+
{
|
165 |
+
return Mage::app()->getLocale()->getLocaleCode();
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Obtenemos inforamción del navegador del cliente
|
170 |
+
* @return HTTP_USER_AGENT
|
171 |
+
*/
|
172 |
+
public function getUserAgent()
|
173 |
+
{
|
174 |
+
return $this->getHttp()->getHttpUserAgent();
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Obtenemos la Ip Local Remota del Cliente
|
179 |
+
* @return REMOTE_ADDR
|
180 |
+
*/
|
181 |
+
public function getRemoteAddr()
|
182 |
+
{
|
183 |
+
return $_SERVER['REMOTE_ADDR'];
|
184 |
+
//return $this->getHttp()->getRemoteAddr();
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Obtenemos la Ip Proxy del Client
|
189 |
+
* @return HTTP_VIA or HTTP_X_FORWARDED_FOR
|
190 |
+
*/
|
191 |
+
public function getProxy()
|
192 |
+
{
|
193 |
+
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Obtenemos la Ip Local del Cliente
|
198 |
+
* @return String
|
199 |
+
*/
|
200 |
+
public function getHost()
|
201 |
+
{
|
202 |
+
return $this->getHttp()->getHttpHost();
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Obtenemos el lenguaje del Navegador del Cliente
|
207 |
+
*/
|
208 |
+
public function getLanguage()
|
209 |
+
{
|
210 |
+
return $this->getHttp()->getHttpAcceptLanguage();
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Sección de Validaciones
|
215 |
+
*/
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Valida que no exista ningun error
|
219 |
+
* @return bool
|
220 |
+
*/
|
221 |
+
public function HasError()
|
222 |
+
{
|
223 |
+
/*if($this->ErrorService()) return true;
|
224 |
+
if($this->ErrorKeyInvalid()) return true;
|
225 |
+
if($this->ErrorIpNoAllow()) return true;
|
226 |
+
if($this->ErrorMerchantInvalid()) return true;
|
227 |
+
if($this->ErrorGuidInvalid()) return true;
|
228 |
+
if($this->ErrorTokenInvalid()) return true;
|
229 |
+
if($this->ErrorToAddProductToCart()) return true;*/
|
230 |
+
|
231 |
+
if ($this->ErrorRatesNotFound()) {
|
232 |
+
return true;
|
233 |
+
}
|
234 |
+
|
235 |
+
if ($this->ErrorServiceNotController()) {
|
236 |
+
return true;
|
237 |
+
}
|
238 |
+
|
239 |
+
if ($this->ErrorIpNoAllow()) {
|
240 |
+
return true;
|
241 |
+
}
|
242 |
+
if ($this->ErrorIdMerchantInvalid()) {
|
243 |
+
return true;
|
244 |
+
}
|
245 |
+
if ($this->ErrorGuidInvalid()) {
|
246 |
+
return true;
|
247 |
+
}
|
248 |
+
if ($this->ErrorTokenExpired()) {
|
249 |
+
return true;
|
250 |
+
}
|
251 |
+
if ($this->ErrorToAddProductToCart()) {
|
252 |
+
return true;
|
253 |
+
}
|
254 |
+
if ($this->ErrorMerchantNotConfigured()) {
|
255 |
+
return true;
|
256 |
+
}
|
257 |
+
if ($this->ErrorProductCategoryRequired()) {
|
258 |
+
return true;
|
259 |
+
}
|
260 |
+
if ($this->ErrorProductUnitWeigthRequired()) {
|
261 |
+
return true;
|
262 |
+
}
|
263 |
+
if ($this->ErrorProductWeigthInvalid()) {
|
264 |
+
return true;
|
265 |
+
}
|
266 |
+
if ($this->ErrorProductWeigthIsnull()) {
|
267 |
+
return true;
|
268 |
+
}
|
269 |
+
if ($this->ErrorProductUnitWeightInvalid()) {
|
270 |
+
return true;
|
271 |
+
}
|
272 |
+
if ($this->ErrorStoreCityNotConfigured()) {
|
273 |
+
return true;
|
274 |
+
}
|
275 |
+
|
276 |
+
if ($this->ErrorTokenIsnull()) {
|
277 |
+
return true;
|
278 |
+
}
|
279 |
+
if ($this->ErrorGuidIsnull()) {
|
280 |
+
return true;
|
281 |
+
}
|
282 |
+
if ($this->ErrorRegionNotConfigured()) {
|
283 |
+
return true;
|
284 |
+
}
|
285 |
+
if ($this->ErrorProductNameRequiered()) {
|
286 |
+
return true;
|
287 |
+
}
|
288 |
+
if ($this->ErrorProductCodeRequiered()) {
|
289 |
+
return true;
|
290 |
+
}
|
291 |
+
|
292 |
+
if ($this->ErrorMerchantKeyIsnull()) {
|
293 |
+
return true;
|
294 |
+
}
|
295 |
+
if ($this->ErrorMerchantKeyInvalid()) {
|
296 |
+
return true;
|
297 |
+
}
|
298 |
+
|
299 |
+
return false;
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Valida si se devolvio un error por Merchant invalido
|
305 |
+
* @return bool
|
306 |
+
*/
|
307 |
+
public function ErrorIdMerchantInvalid()
|
308 |
+
{
|
309 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_IDMERCHANT_INVALID;
|
310 |
+
}
|
311 |
+
|
312 |
+
public function ErrorMerchantNotConfigured()
|
313 |
+
{
|
314 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_COUNTRY_NOT_CONFIGURED_TO_STORE;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Valida si se devolvio un error por Guid invalido
|
319 |
+
* @return bool
|
320 |
+
*/
|
321 |
+
public function ErrorGuidInvalid()
|
322 |
+
{
|
323 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_DEVICE_GUID_INVALID;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Valida si se devolvio un error por Token invalido
|
328 |
+
* @return bool
|
329 |
+
*/
|
330 |
+
public function ErrorTokenExpired()
|
331 |
+
{
|
332 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_TOKEN_EXPIRED;
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Valida si se devolvio un error de agregación de producto al carrito de compras
|
337 |
+
* @return bool
|
338 |
+
*/
|
339 |
+
public function ErrorToAddProductToCart()
|
340 |
+
{
|
341 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_NOT_IN_SHOPPING_CART;
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Valida si se devolvio un error no controlado la respuesta del servicio
|
346 |
+
* @return bool
|
347 |
+
*/
|
348 |
+
public function ErrorServiceNotController()
|
349 |
+
{
|
350 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_SERVICE_NOT_CONTROLLER;
|
351 |
+
}
|
352 |
+
|
353 |
+
|
354 |
+
public function ErrorIpNoAllow()
|
355 |
+
{
|
356 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_IP_NOT_ALLOWED;
|
357 |
+
}
|
358 |
+
|
359 |
+
public function ErrorProductCategoryRequired()
|
360 |
+
{
|
361 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_CATEGORY_INVALID;
|
362 |
+
}
|
363 |
+
|
364 |
+
public function ErrorProductUnitWeigthRequired()
|
365 |
+
{
|
366 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_UNITWEIGHT_IS_NULL;
|
367 |
+
}
|
368 |
+
|
369 |
+
public function ErrorProductWeigthInvalid()
|
370 |
+
{
|
371 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_WEIGHT_INVALID;
|
372 |
+
}
|
373 |
+
|
374 |
+
public function ErrorProductWeigthIsnull()
|
375 |
+
{
|
376 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_WEIGHT_IS_NULL;
|
377 |
+
}
|
378 |
+
|
379 |
+
public function ErrorProductUnitWeightInvalid()
|
380 |
+
{
|
381 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_UNITWEIGHT_INVALID;
|
382 |
+
}
|
383 |
+
|
384 |
+
public function ErrorStoreCityNotConfigured()
|
385 |
+
{
|
386 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_STORE_CITY_NOT_CONFIGURED;
|
387 |
+
}
|
388 |
+
|
389 |
+
public function ErrorTokenIsnull()
|
390 |
+
{
|
391 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_TOKEN_IS_NULL;
|
392 |
+
}
|
393 |
+
|
394 |
+
public function ErrorGuidIsnull()
|
395 |
+
{
|
396 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_GUID_IS_NULL;
|
397 |
+
}
|
398 |
+
|
399 |
+
public function ErrorRegionNotConfigured()
|
400 |
+
{
|
401 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_REGION_NOT_CONFIGURED_TO_STORE;
|
402 |
+
}
|
403 |
+
|
404 |
+
public function ErrorProductNameRequiered()
|
405 |
+
{
|
406 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_NAME_IS_NULL;
|
407 |
+
}
|
408 |
+
|
409 |
+
public function ErrorProductCodeRequiered()
|
410 |
+
{
|
411 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_PRODUCT_CODE_IS_NULL;
|
412 |
+
}
|
413 |
+
|
414 |
+
public function ErrorMerchantKeyInvalid()
|
415 |
+
{
|
416 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_MERCHANT_KEY_INVALID;
|
417 |
+
}
|
418 |
+
|
419 |
+
public function ErrorMerchantKeyIsnull()
|
420 |
+
{
|
421 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_MERCHANT_KEY_IS_NULL;
|
422 |
+
}
|
423 |
+
|
424 |
+
public function ErrorRatesNotFound()
|
425 |
+
{
|
426 |
+
return $this->getStatusCode() == Skybox_Core_Model_Config::SKYBOX_ERROR_GCODE_RATES_NOT_FOUND;
|
427 |
+
}
|
428 |
+
|
429 |
+
// @todo: Improved message exceptions
|
430 |
+
public function getErrorRatesNotFoundMessage($id = 0)
|
431 |
+
{
|
432 |
+
$languages = array(
|
433 |
+
0 => "U.S. Orders Only",
|
434 |
+
1 => "U.S. Orders Only",
|
435 |
+
2 => "Restringido fuera de USA",
|
436 |
+
3 => "Restringido fuera de USA",
|
437 |
+
);
|
438 |
+
return $languages[$id];
|
439 |
+
}
|
440 |
+
}
|
app/code/community/Skybox/Core/Model/Api/Restful.php
CHANGED
@@ -1,346 +1,363 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Core_Model_Api_Restful extends Skybox_Core_Model_Api_Abstract
|
11 |
-
{
|
12 |
-
public $_skybox_guid = "";
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Guardamos en sesión el Html Template del Botón
|
16 |
-
* @param string $value
|
17 |
-
* @return Skybox_Core_Model_Api_Restful
|
18 |
-
*/
|
19 |
-
public function setHtmlTemplateButton($value = null)
|
20 |
-
{
|
21 |
-
$html = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BUTTONHTML};
|
22 |
-
$htmlError = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BUTTONERRORHTML};
|
23 |
-
$this->_config->getSession()->setHtmlTemplateButton($html);
|
24 |
-
$this->_config->getSession()->setHtmlTemplateButtonError($htmlError);
|
25 |
-
return $this;
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Se recupera el Html Template del Botón almacenado en la sesión
|
30 |
-
* @return String
|
31 |
-
*/
|
32 |
-
public function getHtmlTemplateButton()
|
33 |
-
{
|
34 |
-
return $this->_config->getSession()->getHtmlTemplateButton();
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Guardamos en sesión el Html Template de la barra
|
39 |
-
* @param string $value
|
40 |
-
* @return Skybox_Core_Model_Api_Restful
|
41 |
-
*/
|
42 |
-
public function setHtmlTemplateBar($value = null)
|
43 |
-
{
|
44 |
-
$html = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BARHTML};
|
45 |
-
$this->_config->getSession()->setHtmlTemplateBar($html);
|
46 |
-
return $this;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Se recupera el Html Template del Botón almacenado en la sesión
|
51 |
-
* @return String
|
52 |
-
*/
|
53 |
-
public function getHtmlTemplateBar()
|
54 |
-
{
|
55 |
-
return $this->_config->getSession()->getHtmlTemplateBar();
|
56 |
-
}
|
57 |
-
|
58 |
-
public function setGuidApi($value = null)
|
59 |
-
{
|
60 |
-
$guidId = null;
|
61 |
-
|
62 |
-
if (!$guidId) {
|
63 |
-
$guidId = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_GUID};
|
64 |
-
Mage::log("GuidID Not cart: " . $guidId);
|
65 |
-
}
|
66 |
-
|
67 |
-
$this->_config->getSession()->setCookieGuid($guidId);
|
68 |
-
$this->_skybox_guid = $guidId;
|
69 |
-
Mage::log("GuidID found: " . $guidId);
|
70 |
-
return $this;
|
71 |
-
}
|
72 |
-
|
73 |
-
public function getGuidApi()
|
74 |
-
{
|
75 |
-
$guidId = null;
|
76 |
-
|
77 |
-
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
78 |
-
foreach ($quote->getAllItems() as $item) {
|
79 |
-
$guidId = $item->getGuidSkybox();
|
80 |
-
|
81 |
-
Mage::log("getGuidApi(): GuidID found (quote): "
|
82 |
-
break;
|
83 |
-
}
|
84 |
-
|
85 |
-
if (!$guidId) {
|
86 |
-
$skyboxSession = $this->_config->getSession()->getCookieGuid();
|
87 |
-
if ($skyboxSession) {
|
88 |
-
Mage::log(' | CallApiRest->Error2 | ', null, 'guid.log', true);
|
89 |
-
Mage::log("Call getGuidApi() from getSession(): "
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
*
|
110 |
-
* @
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
public function getLocationAllow()
|
123 |
-
{
|
124 |
-
return $this->_config->getSession()->getLocationAllow();
|
125 |
-
}
|
126 |
-
|
127 |
-
public function setStoreCode($value = null)
|
128 |
-
{
|
129 |
-
$storeCode = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_STORE_CODE};
|
130 |
-
$storeCode = trim($storeCode);
|
131 |
-
$this->_config->getSession()->setStoreCode($storeCode);
|
132 |
-
return $storeCode;
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
*
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
return $this;
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
*
|
171 |
-
* @
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
$
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
return
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
*
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
$this->
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
return $this;
|
278 |
-
}
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
*
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Model_Api_Restful extends Skybox_Core_Model_Api_Abstract
|
11 |
+
{
|
12 |
+
public $_skybox_guid = "";
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Guardamos en sesión el Html Template del Botón
|
16 |
+
* @param string $value
|
17 |
+
* @return Skybox_Core_Model_Api_Restful
|
18 |
+
*/
|
19 |
+
public function setHtmlTemplateButton($value = null)
|
20 |
+
{
|
21 |
+
$html = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BUTTONHTML};
|
22 |
+
$htmlError = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BUTTONERRORHTML};
|
23 |
+
$this->_config->getSession()->setHtmlTemplateButton($html);
|
24 |
+
$this->_config->getSession()->setHtmlTemplateButtonError($htmlError);
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Se recupera el Html Template del Botón almacenado en la sesión
|
30 |
+
* @return String
|
31 |
+
*/
|
32 |
+
public function getHtmlTemplateButton()
|
33 |
+
{
|
34 |
+
return $this->_config->getSession()->getHtmlTemplateButton();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Guardamos en sesión el Html Template de la barra
|
39 |
+
* @param string $value
|
40 |
+
* @return Skybox_Core_Model_Api_Restful
|
41 |
+
*/
|
42 |
+
public function setHtmlTemplateBar($value = null)
|
43 |
+
{
|
44 |
+
$html = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BARHTML};
|
45 |
+
$this->_config->getSession()->setHtmlTemplateBar($html);
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Se recupera el Html Template del Botón almacenado en la sesión
|
51 |
+
* @return String
|
52 |
+
*/
|
53 |
+
public function getHtmlTemplateBar()
|
54 |
+
{
|
55 |
+
return $this->_config->getSession()->getHtmlTemplateBar();
|
56 |
+
}
|
57 |
+
|
58 |
+
public function setGuidApi($value = null)
|
59 |
+
{
|
60 |
+
$guidId = null;
|
61 |
+
|
62 |
+
if (!$guidId) {
|
63 |
+
$guidId = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_GUID};
|
64 |
+
Mage::log("GuidID Not cart: " . $guidId);
|
65 |
+
}
|
66 |
+
|
67 |
+
$this->_config->getSession()->setCookieGuid($guidId);
|
68 |
+
$this->_skybox_guid = $guidId;
|
69 |
+
Mage::log("GuidID found: " . $guidId);
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getGuidApi()
|
74 |
+
{
|
75 |
+
$guidId = null;
|
76 |
+
|
77 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
78 |
+
foreach ($quote->getAllItems() as $item) {
|
79 |
+
$guidId = $item->getGuidSkybox();
|
80 |
+
Mage::log(' | CallApiRest->Error1 | ', null, 'guid.log', true);
|
81 |
+
Mage::log("getGuidApi(): GuidID found (quote): " . $guidId, null, 'guid.log', true);
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
|
85 |
+
if (!$guidId) {
|
86 |
+
$skyboxSession = $this->_config->getSession()->getCookieGuid();
|
87 |
+
if ($skyboxSession) {
|
88 |
+
Mage::log(' | CallApiRest->Error2 | ', null, 'guid.log', true);
|
89 |
+
Mage::log("Call getGuidApi() from getSession(): " . $this->_config->getSession()->getCookieGuid(), null,
|
90 |
+
'guid.log', true);
|
91 |
+
$guidId = $this->_config->getSession()->getCookieGuid();
|
92 |
+
}
|
93 |
+
}
|
94 |
+
return $guidId;
|
95 |
+
}
|
96 |
+
|
97 |
+
public function compareGuid()
|
98 |
+
{
|
99 |
+
$already_guid = $this->getGuidApi();
|
100 |
+
$called_guid = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_GUID};
|
101 |
+
|
102 |
+
if ($already_guid == $called_guid) {
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Seteamos si la localización del usuario esta permitida
|
110 |
+
* @param string $value
|
111 |
+
* @return Skybox_Core_Model_Api_Restful
|
112 |
+
*/
|
113 |
+
public function setLocationAllow($value = null)
|
114 |
+
{
|
115 |
+
$allow = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_LOCATION_ALLOW};
|
116 |
+
//$allow = 0; // Rogged
|
117 |
+
$this->_config->getSession()->setLocationAllow($allow);
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
public function getLocationAllow()
|
123 |
+
{
|
124 |
+
return $this->_config->getSession()->getLocationAllow();
|
125 |
+
}
|
126 |
+
|
127 |
+
public function setStoreCode($value = null)
|
128 |
+
{
|
129 |
+
$storeCode = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_STORE_CODE};
|
130 |
+
$storeCode = trim($storeCode);
|
131 |
+
$this->_config->getSession()->setStoreCode($storeCode);
|
132 |
+
return $storeCode;
|
133 |
+
}
|
134 |
+
|
135 |
+
public function getStoreCode()
|
136 |
+
{
|
137 |
+
return $this->_config->getSession()->getStoreCode();
|
138 |
+
}
|
139 |
+
|
140 |
+
public function setCssVersion($value = null)
|
141 |
+
{
|
142 |
+
$cssVersion = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_CSS_VERSION};
|
143 |
+
$cssVersion = (isset($cssVersion)) ? trim($cssVersion) : 1;
|
144 |
+
$this->_config->getSession()->setCssVersion($cssVersion);
|
145 |
+
return $cssVersion;
|
146 |
+
}
|
147 |
+
|
148 |
+
public function getCssVersion()
|
149 |
+
{
|
150 |
+
return $this->_config->getSession()->getCssVersion();
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Seteamos error del servicio
|
155 |
+
* @param string $value
|
156 |
+
* @return Skybox_Core_Model_Api_Restful
|
157 |
+
*/
|
158 |
+
public function setErrorAuthenticate()
|
159 |
+
{
|
160 |
+
$this->_config->getSession()->setErrorAuthenticate($this->HasError());
|
161 |
+
return $this;
|
162 |
+
}
|
163 |
+
|
164 |
+
public function getErrorAuthenticate()
|
165 |
+
{
|
166 |
+
return $this->_config->getSession()->getErrorAuthenticate();
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Guardamos en sesión el token de autorización
|
171 |
+
* @param string $value
|
172 |
+
* @return Skybox_Core_Model_Api_Restful
|
173 |
+
*/
|
174 |
+
public function setAuthorizedToken($value = null)
|
175 |
+
{
|
176 |
+
$token = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_TOKEN};
|
177 |
+
Mage::log('setAuthorizedToken token skybox: ' . $token);
|
178 |
+
// $token = urlencode($token);
|
179 |
+
$this->_config->getSession()->setTokenApiRest($token);
|
180 |
+
return $this;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Obtenemos el token de autorización almacenado en sesión
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
public function getAuthorizedToken()
|
188 |
+
{
|
189 |
+
//return $this->_config->getSession()->getTokenApiRest() ?: "";
|
190 |
+
$algo = $this->_config->getSession()->getTokenApiRest();
|
191 |
+
if (!empty($algo)) {
|
192 |
+
return $this->_config->getSession()->getTokenApiRest();
|
193 |
+
}
|
194 |
+
return "";
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Sección de llamadas a los metodos del ApiRest
|
199 |
+
*/
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Se realiza llamado al metodo del Servicio y se guarda resultado
|
203 |
+
* @return Skybox_Core_Model_Api_Restful
|
204 |
+
*/
|
205 |
+
protected function SetResponseService()
|
206 |
+
{
|
207 |
+
//$this->_response = file_get_contents($this->getUrlService());
|
208 |
+
$this->_response = $this->file_get_contents_curl($this->getUrlService());
|
209 |
+
return $this;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Invocamos al servicio
|
214 |
+
* @return Skybox_Core_Model_Api_Standard
|
215 |
+
*/
|
216 |
+
public function CallService($method, $params)
|
217 |
+
{
|
218 |
+
$start_time = time();
|
219 |
+
try {
|
220 |
+
/**
|
221 |
+
* Pasos
|
222 |
+
* 1: Generamos la Url del Servicio
|
223 |
+
* 2: Guardamos la solicitud que se realiza al servicio
|
224 |
+
* 3: Invocamos al response del Servicio
|
225 |
+
* 4: Asignamos valores a los parametros
|
226 |
+
* 5: Guardamos la respuesta del servicio
|
227 |
+
*/
|
228 |
+
|
229 |
+
$this->setUrlService($method, $params)
|
230 |
+
->SaveRequestService()
|
231 |
+
->SetResponseService()
|
232 |
+
->SetValuesResponse()
|
233 |
+
->SaveResponseService($method, $start_time);
|
234 |
+
} catch (Exception $e) {
|
235 |
+
//throw new Exception($e->getMessage(), 1);
|
236 |
+
Mage::log($e->getMessage());
|
237 |
+
Mage::helper('skyboxcore/email')->sendException($e->getMessage());
|
238 |
+
return $this;
|
239 |
+
}
|
240 |
+
|
241 |
+
return $this;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Seteamos valores a los parametros correspondientes a partir del methodo invocado
|
246 |
+
* @return Skybox_Core_Model_Api_Restful
|
247 |
+
*/
|
248 |
+
protected function SetValuesResponse()
|
249 |
+
{
|
250 |
+
$status = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_STATUS};
|
251 |
+
$this->setStatusCode($status);
|
252 |
+
|
253 |
+
switch ($this->_methodCode) {
|
254 |
+
case Skybox_Core_Model_Config::SKYBOX_ACTION_AUTHENTICATE:
|
255 |
+
$this->setAuthorizedToken();
|
256 |
+
$this->setErrorAuthenticate();
|
257 |
+
break;
|
258 |
+
|
259 |
+
case Skybox_Core_Model_Config::SKYBOX_ACTION_INITIALICE:
|
260 |
+
//$this->setGuidApi();
|
261 |
+
|
262 |
+
if ($this->compareGuid() && $this->getGuidApi()) {
|
263 |
+
$this->getGuidApi();
|
264 |
+
} else {
|
265 |
+
$this->setGuidApi();
|
266 |
+
}
|
267 |
+
$this->setLocationAllow();
|
268 |
+
$this->setStoreCode();
|
269 |
+
$this->setCssVersion();
|
270 |
+
$this->setHtmlTemplateBar();
|
271 |
+
break;
|
272 |
+
case Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TEMPLATE_BUTTON:
|
273 |
+
$this->setHtmlTemplateButton();
|
274 |
+
break;
|
275 |
+
}
|
276 |
+
|
277 |
+
return $this;
|
278 |
+
}
|
279 |
+
|
280 |
+
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Sesión de registro de log
|
284 |
+
*/
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Se registra la llamada al servicio
|
288 |
+
*/
|
289 |
+
public function SaveRequestService()
|
290 |
+
{
|
291 |
+
//Acciones
|
292 |
+
return $this;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* SaveResponseService
|
297 |
+
* Save Service Response
|
298 |
+
*
|
299 |
+
* @param string $action
|
300 |
+
* @param string $start_time
|
301 |
+
* @return Skybox_Core_Model_Api_Restful
|
302 |
+
*/
|
303 |
+
public function SaveResponseService($action, $start_time)
|
304 |
+
{
|
305 |
+
$skybox_log = Mage::helper('skyboxinternational/data')->getSkyboxLog();
|
306 |
+
|
307 |
+
if ($skybox_log) {
|
308 |
+
$data = array(
|
309 |
+
'action' => $action,
|
310 |
+
'request' => $this->getUrlService(),
|
311 |
+
'response' => $this->getResponse(),
|
312 |
+
'timestamp_request' => $start_time,
|
313 |
+
'timestamp_response' => time(),
|
314 |
+
);
|
315 |
+
|
316 |
+
try {
|
317 |
+
/* @var $log_service Skybox_Core_Model_Logservice */
|
318 |
+
$log_service = Mage::getModel('skyboxcore/logservice');
|
319 |
+
$log_service->setData($data);
|
320 |
+
$log_service->save();
|
321 |
+
|
322 |
+
} catch (Exception $e) {
|
323 |
+
Mage::log($e->getMessage());
|
324 |
+
}
|
325 |
+
}
|
326 |
+
return $this;
|
327 |
+
}
|
328 |
+
|
329 |
+
/*
|
330 |
+
* file_get_contents_curl
|
331 |
+
*/
|
332 |
+
|
333 |
+
function file_get_contents_curl($url)
|
334 |
+
{
|
335 |
+
if (!function_exists("curl_init")) {
|
336 |
+
die("cURL extension is not installed");
|
337 |
+
}
|
338 |
+
$ch = curl_init();
|
339 |
+
// Disable SSL verification
|
340 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
341 |
+
// Will return the response, if false it print the response
|
342 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
343 |
+
// To force the use of a new connection instead of a cached one
|
344 |
+
//curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
|
345 |
+
// Set the url
|
346 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
347 |
+
// Execute
|
348 |
+
$result = curl_exec($ch);
|
349 |
+
|
350 |
+
// Will dump a beauty json :3
|
351 |
+
//var_dump(json_decode($result, true));
|
352 |
+
return $result;
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Validad que el módulo de skybox este habilitado para la tienda
|
357 |
+
* @return bool
|
358 |
+
*/
|
359 |
+
public function isModuleEnable()
|
360 |
+
{
|
361 |
+
return (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
362 |
+
}
|
363 |
}
|
app/code/community/Skybox/Core/Model/Config.php
CHANGED
@@ -1,248 +1,250 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Configuración del modelo
|
13 |
-
* @author César Tapia M. <ctapia@skyworldint.com>
|
14 |
-
*/
|
15 |
-
class Skybox_Core_Model_Config
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* Skybox cookie
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
const SKYBOX_COOKIE_API_GUID = "int_guid_api";
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Skybox actions
|
25 |
-
* @var string
|
26 |
-
*/
|
27 |
-
const SKYBOX_ACTION_AUTHENTICATE = "AuthenticateService";
|
28 |
-
const SKYBOX_ACTION_INITIALICE = "InitializeSessionUser";
|
29 |
-
const SKYBOX_ACTION_CALCULATE = "Calculate";
|
30 |
-
const SKYBOX_ACTION_CATEGORIES = "Categories";
|
31 |
-
const SKYBOX_ACTION_ADD_PRODUCT_CART = "AddProductToCart";
|
32 |
-
const SKYBOX_ACTION_DELETE_PRODUCT_CART = "DelProductOfCart";
|
33 |
-
const SKYBOX_ACTION_UPDATE_PRODUCT_CART = "UpdateProductOfCart";
|
34 |
-
const SKYBOX_ACTION_GET_TEMPLATE_BUTTON = "GetButtonTemplate";
|
35 |
-
const SKYBOX_ACTION_GET_TOTAL_SHOPINGCART = "GetTotalShoppingCart";
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Skybox errors
|
39 |
-
* @var string
|
40 |
-
*/
|
41 |
-
const SKYBOX_ERROR_SERVICE_NOT_CONTROLLER = "50000";
|
42 |
-
const SKYBOX_ERROR_GCODE_IDMERCHANT_INVALID = "50001";
|
43 |
-
const SKYBOX_ERROR_GCODE_TOKEN_EXPIRED = "50002";
|
44 |
-
const SKYBOX_ERROR_GCODE_DEVICE_GUID_INVALID = "50003";
|
45 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_NOT_IN_SHOPPING_CART = "50004";
|
46 |
-
const SKYBOX_ERROR_GCODE_COUNTRY_NOT_CONFIGURED_TO_STORE = "50005";
|
47 |
-
const SKYBOX_ERROR_MERCHANT_KEY_INVALID = "50006";
|
48 |
-
const SKYBOX_ERROR_GCODE_IP_NOT_ALLOWED = "50007";
|
49 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_CATEGORY_INVALID = "50008";
|
50 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_UNITWEIGHT_IS_NULL = "50009";
|
51 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_WEIGHT_INVALID = "50010";
|
52 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_WEIGHT_IS_NULL = "50011";
|
53 |
-
const SKYBOX_ERROR_GCODE_MERCHANT_KEY_IS_NULL = "50013";
|
54 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_UNITWEIGHT_INVALID = "50014";
|
55 |
-
const SKYBOX_ERROR_GCODE_STORE_CITY_NOT_CONFIGURED = "50015";
|
56 |
-
const SKYBOX_ERROR_GCODE_TOKEN_IS_NULL = "50016";
|
57 |
-
const SKYBOX_ERROR_GCODE_GUID_IS_NULL = "50017";
|
58 |
-
const SKYBOX_ERROR_GCODE_REGION_NOT_CONFIGURED_TO_STORE = "50018";
|
59 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_NAME_IS_NULL = "50019";
|
60 |
-
const SKYBOX_ERROR_GCODE_PRODUCT_CODE_IS_NULL = "50020";
|
61 |
-
const SKYBOX_ERROR_GCODE_RATES_NOT_FOUND = "50021";
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Skybox PARAMETERS REQUEST
|
65 |
-
* @var string
|
66 |
-
*/
|
67 |
-
const SKYBOX_PARAMETER_MERCHANT = "merchant";
|
68 |
-
const SKYBOX_PARAMETER_MERCHANTKEY = "merchantKey";
|
69 |
-
const SKYBOX_PARAMETER_GUID = "guid";
|
70 |
-
const SKYBOX_PARAMETER_TOKEN = "token";
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Skybox PARAMETERS RESPONSE
|
74 |
-
* @var string
|
75 |
-
*/
|
76 |
-
const SKYBOX_PARAMETER_RESPONSE_TOKEN = "TokenCode";
|
77 |
-
const SKYBOX_PARAMETER_RESPONSE_GUID = "Guid";
|
78 |
-
const SKYBOX_PARAMETER_RESPONSE_MESSAGE = "StatusMessage";
|
79 |
-
const SKYBOX_PARAMETER_RESPONSE_STATUS = "StatusCode";
|
80 |
-
const SKYBOX_PARAMETER_RESPONSE_BARHTML = "BarHtmlTemplate";
|
81 |
-
const SKYBOX_PARAMETER_RESPONSE_LOCATION_ALLOW = "LocationAllow";
|
82 |
-
const SKYBOX_PARAMETER_RESPONSE_STORE_CODE = "StoreCode";
|
83 |
-
const SKYBOX_PARAMETER_RESPONSE_BUTTONHTML = "HtmlTemplate";
|
84 |
-
const SKYBOX_PARAMETER_RESPONSE_BUTTONERRORHTML = "HtmlTemplateError";
|
85 |
-
const SKYBOX_PARAMETER_RESPONSE_BUTTONERROR = "CalcErrorCode";
|
86 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID = "ProductId";
|
87 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS = "ProductCustoms";
|
88 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING = "ProductShipping";
|
89 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE = "ProductInsurance";
|
90 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL = "TotalProduct";
|
91 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_PRICE = "StoreProductPrice";
|
92 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS_USD = "ProductCustomsUSD";
|
93 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING_USD = "ProductShippingUSD";
|
94 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE_USD = "ProductInsuranceUSD";
|
95 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL_USD = "TotalProductUSD";
|
96 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_PRICE_USD = "StoreProductPriceUSD";
|
97 |
-
const SKYBOX_PARAMETER_RESPONSE_CART_CURRENCY_ISO = "CartCurrencyIso";
|
98 |
-
|
99 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_BASE_PRICE = "BaseProductPrice";
|
100 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_BASE_PRICE_USD = "BaseProductPriceUSD";
|
101 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_ADJUST_PRICE = "ProductAdjustment";
|
102 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_ADJUST_PRICE_USD = "ProductAdjustmentUSD";
|
103 |
-
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_LABEL_ADJUST = "WidgetLabelAdjustment";
|
104 |
-
|
105 |
-
const
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
*
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
public $skyboxDefaultApiUrl = 'http://
|
115 |
-
//public $skyboxDefaultApiUrl = 'http://
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
*
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
//public $skyboxDefaultUrl = 'http://
|
126 |
-
public $skyboxDefaultUrl = 'http://
|
127 |
-
//public $skyboxDefaultUrl = 'http://
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
*
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
*
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
*
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
*
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
*
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
*
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
*
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
*
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
*
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
248 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Configuración del modelo
|
13 |
+
* @author César Tapia M. <ctapia@skyworldint.com>
|
14 |
+
*/
|
15 |
+
class Skybox_Core_Model_Config
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Skybox cookie
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
const SKYBOX_COOKIE_API_GUID = "int_guid_api";
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Skybox actions
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
const SKYBOX_ACTION_AUTHENTICATE = "AuthenticateService";
|
28 |
+
const SKYBOX_ACTION_INITIALICE = "InitializeSessionUser";
|
29 |
+
const SKYBOX_ACTION_CALCULATE = "Calculate";
|
30 |
+
const SKYBOX_ACTION_CATEGORIES = "Categories";
|
31 |
+
const SKYBOX_ACTION_ADD_PRODUCT_CART = "AddProductToCart";
|
32 |
+
const SKYBOX_ACTION_DELETE_PRODUCT_CART = "DelProductOfCart";
|
33 |
+
const SKYBOX_ACTION_UPDATE_PRODUCT_CART = "UpdateProductOfCart";
|
34 |
+
const SKYBOX_ACTION_GET_TEMPLATE_BUTTON = "GetButtonTemplate";
|
35 |
+
const SKYBOX_ACTION_GET_TOTAL_SHOPINGCART = "GetTotalShoppingCart";
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Skybox errors
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
const SKYBOX_ERROR_SERVICE_NOT_CONTROLLER = "50000";
|
42 |
+
const SKYBOX_ERROR_GCODE_IDMERCHANT_INVALID = "50001";
|
43 |
+
const SKYBOX_ERROR_GCODE_TOKEN_EXPIRED = "50002";
|
44 |
+
const SKYBOX_ERROR_GCODE_DEVICE_GUID_INVALID = "50003";
|
45 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_NOT_IN_SHOPPING_CART = "50004";
|
46 |
+
const SKYBOX_ERROR_GCODE_COUNTRY_NOT_CONFIGURED_TO_STORE = "50005";
|
47 |
+
const SKYBOX_ERROR_MERCHANT_KEY_INVALID = "50006";
|
48 |
+
const SKYBOX_ERROR_GCODE_IP_NOT_ALLOWED = "50007";
|
49 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_CATEGORY_INVALID = "50008";
|
50 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_UNITWEIGHT_IS_NULL = "50009";
|
51 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_WEIGHT_INVALID = "50010";
|
52 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_WEIGHT_IS_NULL = "50011";
|
53 |
+
const SKYBOX_ERROR_GCODE_MERCHANT_KEY_IS_NULL = "50013";
|
54 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_UNITWEIGHT_INVALID = "50014";
|
55 |
+
const SKYBOX_ERROR_GCODE_STORE_CITY_NOT_CONFIGURED = "50015";
|
56 |
+
const SKYBOX_ERROR_GCODE_TOKEN_IS_NULL = "50016";
|
57 |
+
const SKYBOX_ERROR_GCODE_GUID_IS_NULL = "50017";
|
58 |
+
const SKYBOX_ERROR_GCODE_REGION_NOT_CONFIGURED_TO_STORE = "50018";
|
59 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_NAME_IS_NULL = "50019";
|
60 |
+
const SKYBOX_ERROR_GCODE_PRODUCT_CODE_IS_NULL = "50020";
|
61 |
+
const SKYBOX_ERROR_GCODE_RATES_NOT_FOUND = "50021";
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Skybox PARAMETERS REQUEST
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
const SKYBOX_PARAMETER_MERCHANT = "merchant";
|
68 |
+
const SKYBOX_PARAMETER_MERCHANTKEY = "merchantKey";
|
69 |
+
const SKYBOX_PARAMETER_GUID = "guid";
|
70 |
+
const SKYBOX_PARAMETER_TOKEN = "token";
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Skybox PARAMETERS RESPONSE
|
74 |
+
* @var string
|
75 |
+
*/
|
76 |
+
const SKYBOX_PARAMETER_RESPONSE_TOKEN = "TokenCode";
|
77 |
+
const SKYBOX_PARAMETER_RESPONSE_GUID = "Guid";
|
78 |
+
const SKYBOX_PARAMETER_RESPONSE_MESSAGE = "StatusMessage";
|
79 |
+
const SKYBOX_PARAMETER_RESPONSE_STATUS = "StatusCode";
|
80 |
+
const SKYBOX_PARAMETER_RESPONSE_BARHTML = "BarHtmlTemplate";
|
81 |
+
const SKYBOX_PARAMETER_RESPONSE_LOCATION_ALLOW = "LocationAllow";
|
82 |
+
const SKYBOX_PARAMETER_RESPONSE_STORE_CODE = "StoreCode";
|
83 |
+
const SKYBOX_PARAMETER_RESPONSE_BUTTONHTML = "HtmlTemplate";
|
84 |
+
const SKYBOX_PARAMETER_RESPONSE_BUTTONERRORHTML = "HtmlTemplateError";
|
85 |
+
const SKYBOX_PARAMETER_RESPONSE_BUTTONERROR = "CalcErrorCode";
|
86 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_ID = "ProductId";
|
87 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS = "ProductCustoms";
|
88 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING = "ProductShipping";
|
89 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE = "ProductInsurance";
|
90 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL = "TotalProduct";
|
91 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_PRICE = "StoreProductPrice";
|
92 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_CUSTOMS_USD = "ProductCustomsUSD";
|
93 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_SHIPPING_USD = "ProductShippingUSD";
|
94 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_INSURANCE_USD = "ProductInsuranceUSD";
|
95 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_TOTAL_USD = "TotalProductUSD";
|
96 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_PRICE_USD = "StoreProductPriceUSD";
|
97 |
+
const SKYBOX_PARAMETER_RESPONSE_CART_CURRENCY_ISO = "CartCurrencyIso";
|
98 |
+
|
99 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_BASE_PRICE = "BaseProductPrice";
|
100 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_BASE_PRICE_USD = "BaseProductPriceUSD";
|
101 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_ADJUST_PRICE = "ProductAdjustment";
|
102 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_ADJUST_PRICE_USD = "ProductAdjustmentUSD";
|
103 |
+
const SKYBOX_PARAMETER_RESPONSE_PRODUCT_LABEL_ADJUST = "WidgetLabelAdjustment";
|
104 |
+
|
105 |
+
const SKYBOX_PARAMETER_RESPONSE_CSS_VERSION = "CssVersion";
|
106 |
+
|
107 |
+
const SKYBOX_CURRENCY_USD = "USD";
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Default URL para Api Skybox Checkout
|
111 |
+
*
|
112 |
+
* @var string
|
113 |
+
*/
|
114 |
+
//public $skyboxDefaultApiUrl = 'http://www.skyboxcheckout.com/Service/ApiRest/';
|
115 |
+
//public $skyboxDefaultApiUrl = 'http://localhost:65065/ApiRest/';
|
116 |
+
public $skyboxDefaultApiUrl = 'http://127.0.0.1:65065/ApiRest/';
|
117 |
+
//public $skyboxDefaultApiUrl = 'http://checkout.skynet.com/Service/ApiRest/';
|
118 |
+
//public $skyboxDefaultApiUrl = 'http://beta.skyboxcheckout.com/ServiceTest/ApiRest/';
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Default URL para Skybox Checkout
|
122 |
+
*
|
123 |
+
* @var string
|
124 |
+
*/
|
125 |
+
//public $skyboxDefaultUrl = 'http://www.skyboxcheckout.com/';
|
126 |
+
//public $skyboxDefaultUrl = 'http://localhost:6761/';
|
127 |
+
//public $skyboxDefaultUrl = 'http://127.0.0.1:6761/';
|
128 |
+
public $skyboxDefaultUrl = 'http://127.0.0.1:6761/';
|
129 |
+
//public $skyboxDefaultUrl = 'http://checkout.skynet.com/';
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Código de Tienda
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $_merchantId = null;
|
137 |
+
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Llave de Tienda
|
141 |
+
*
|
142 |
+
* @var string
|
143 |
+
*/
|
144 |
+
protected $_merchantkey = null;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Código de Guid
|
148 |
+
* @var string
|
149 |
+
*/
|
150 |
+
protected $_guidapi = null;
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Obtenemos el objeto Session
|
154 |
+
* @return Skybox_Core_Model_Session
|
155 |
+
*/
|
156 |
+
public function getSession()
|
157 |
+
{
|
158 |
+
return Mage::getSingleton('skyboxcore/session');
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Obtenemos el objeto Cookie
|
163 |
+
* @return Mage_Core_Model_Cookie
|
164 |
+
*/
|
165 |
+
public function getCookie()
|
166 |
+
{
|
167 |
+
return Mage::getModel('core/cookie');
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Obtenemos el objeto Http
|
172 |
+
*
|
173 |
+
* @return Mage_Core_Helper_Http
|
174 |
+
*/
|
175 |
+
public function getHttp()
|
176 |
+
{
|
177 |
+
return Mage::helper('core/http');
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Current locale code getter
|
182 |
+
*
|
183 |
+
* @return string
|
184 |
+
*/
|
185 |
+
public function getLocaleCode()
|
186 |
+
{
|
187 |
+
return Mage::app()->getLocale()->getLocaleCode();
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Obtenemos inforamción del navegador del cliente
|
192 |
+
*
|
193 |
+
* @return HTTP_USER_AGENT
|
194 |
+
*/
|
195 |
+
public function getUserAgent()
|
196 |
+
{
|
197 |
+
return $this->getHttp()->getHttpUserAgent();
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Obtenemos la Ip Local Remota del Cliente
|
202 |
+
*
|
203 |
+
* @return REMOTE_ADDR
|
204 |
+
*/
|
205 |
+
public function getRemoteAddr()
|
206 |
+
{
|
207 |
+
return $this->getHttp()->getRemoteAddr();
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Obtenemos la Ip Proxy del Client
|
212 |
+
*
|
213 |
+
* @return HTTP_VIA or HTTP_X_FORWARDED_FOR
|
214 |
+
*/
|
215 |
+
public function getProxy()
|
216 |
+
{
|
217 |
+
$proxy = getenv('HTTP_X_FORWARDED_FOR');
|
218 |
+
return isset($proxy) ? $proxy : "";
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Obtenemos la Ip Local del Cliente
|
223 |
+
*
|
224 |
+
* @return String
|
225 |
+
*/
|
226 |
+
public function getHost()
|
227 |
+
{
|
228 |
+
return $this->getHttp()->getHttpHost();
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Obtenemos el lenguaje del Navegador del Cliente
|
233 |
+
*
|
234 |
+
* @return string
|
235 |
+
*/
|
236 |
+
public function getLanguage()
|
237 |
+
{
|
238 |
+
return $this->getHttp()->getHttpAcceptLanguage();
|
239 |
+
}
|
240 |
+
|
241 |
+
public function getSkyBoxUrlAPI()
|
242 |
+
{
|
243 |
+
return Mage::helper('skyboxinternational/data')->getSkyboxUrlAPI();
|
244 |
+
}
|
245 |
+
|
246 |
+
public function getSkyBoxUrlMain()
|
247 |
+
{
|
248 |
+
return Mage::helper('skyboxinternational/data')->getSkyboxUrlMain();
|
249 |
+
}
|
250 |
}
|
app/code/community/Skybox/Core/Model/Logservice.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Core_Model_Logservice extends Mage_Core_Model_Abstract
|
11 |
-
{
|
12 |
-
protected function _construct()
|
13 |
-
{
|
14 |
-
parent::_construct();
|
15 |
-
$this->_init('skyboxcore/logservice', 'service_id');
|
16 |
-
}
|
17 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Model_Logservice extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('skyboxcore/logservice', 'service_id');
|
16 |
+
}
|
17 |
}
|
app/code/community/Skybox/Core/Model/Mysql4.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Core_Model_Mysql4 extends Mage_Core_Model_Abstract
|
11 |
-
{
|
12 |
-
public function _construct()
|
13 |
-
{
|
14 |
-
parent::_construct();
|
15 |
-
$this->_init('skybox/mysql4');
|
16 |
-
}
|
17 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Model_Mysql4 extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('skybox/mysql4');
|
16 |
+
}
|
17 |
}
|
app/code/community/Skybox/Core/Model/Mysql4/Logservice.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* Skybox Log Service Model
|
14 |
-
*
|
15 |
-
*/
|
16 |
-
class Skybox_Core_Model_Mysql4_Logservice extends Mage_Core_Model_Mysql4_Abstract
|
17 |
-
{
|
18 |
-
protected function _construct()
|
19 |
-
{
|
20 |
-
//parent::_construct();
|
21 |
-
$this->_init('skyboxcore/logservice', 'service_id');
|
22 |
-
}
|
23 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Skybox Log Service Model
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Skybox_Core_Model_Mysql4_Logservice extends Mage_Core_Model_Mysql4_Abstract
|
17 |
+
{
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
//parent::_construct();
|
21 |
+
$this->_init('skyboxcore/logservice', 'service_id');
|
22 |
+
}
|
23 |
}
|
app/code/community/Skybox/Core/Model/Mysql4/Logservice/Collection.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Core_Model_Mysql4_Logservice_Collection
|
11 |
-
extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
-
{
|
13 |
-
|
14 |
-
protected function _construct()
|
15 |
-
{
|
16 |
-
$this->_init('skyboxcore/logservice', 'service_id');
|
17 |
-
}
|
18 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Model_Mysql4_Logservice_Collection
|
11 |
+
extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('skyboxcore/logservice', 'service_id');
|
17 |
+
}
|
18 |
}
|
app/code/community/Skybox/Core/Model/Session.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* Skybox transaction session namespace
|
14 |
-
*
|
15 |
-
* @author César Tapia M. <ctapia@skyworldint.com>
|
16 |
-
*/
|
17 |
-
class Skybox_Core_Model_Session extends Mage_Core_Model_Session_Abstract
|
18 |
-
{
|
19 |
-
public function __construct()
|
20 |
-
{
|
21 |
-
//$this->init('skybox');
|
22 |
-
//Mage::dispatchEvent('myapp_session_init', array('myapp_session' => $this));
|
23 |
-
|
24 |
-
$namespace = 'skyboxcore';
|
25 |
-
$namespace .= '_' . (Mage::app()->getStore()->getWebsite()->getCode());
|
26 |
-
|
27 |
-
$this->init($namespace);
|
28 |
-
Mage::dispatchEvent('skyboxcore_session_init', array('skyboxcore_session' => $this));
|
29 |
-
}
|
30 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Skybox transaction session namespace
|
14 |
+
*
|
15 |
+
* @author César Tapia M. <ctapia@skyworldint.com>
|
16 |
+
*/
|
17 |
+
class Skybox_Core_Model_Session extends Mage_Core_Model_Session_Abstract
|
18 |
+
{
|
19 |
+
public function __construct()
|
20 |
+
{
|
21 |
+
//$this->init('skybox');
|
22 |
+
//Mage::dispatchEvent('myapp_session_init', array('myapp_session' => $this));
|
23 |
+
|
24 |
+
$namespace = 'skyboxcore';
|
25 |
+
$namespace .= '_' . (Mage::app()->getStore()->getWebsite()->getCode());
|
26 |
+
|
27 |
+
$this->init($namespace);
|
28 |
+
Mage::dispatchEvent('skyboxcore_session_init', array('skyboxcore_session' => $this));
|
29 |
+
}
|
30 |
}
|
app/code/community/Skybox/Core/Model/Standard.php
CHANGED
@@ -1,287 +1,292 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Core
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Core
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Core_Model_Standard
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* Config instance
|
14 |
-
* @var Skybox_Core_Model_Config
|
15 |
-
*/
|
16 |
-
protected $_config = null;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Config Model Type
|
20 |
-
*
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
protected $_typeConfig = "skyboxcore/config";
|
24 |
-
|
25 |
-
/**
|
26 |
-
* API instance
|
27 |
-
* @var Skybox_Core_Model_Api_Restful
|
28 |
-
*/
|
29 |
-
protected $_api = null;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Api Model Type
|
33 |
-
*
|
34 |
-
* @var string
|
35 |
-
*/
|
36 |
-
protected $_apiType = 'skyboxcore/api_restful';
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Helper instance
|
40 |
-
* @var Skybox_International_Helper_Data
|
41 |
-
*/
|
42 |
-
protected $_help = null;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Api Model Type
|
46 |
-
*
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
protected $_helpType = 'skyboxinternational/data';
|
50 |
-
|
51 |
-
/* @return Skybox_Core_Model_Config */
|
52 |
-
protected function _getConfig()
|
53 |
-
{
|
54 |
-
if (null === $this->_config)
|
55 |
-
$this->_config = Mage::getModel($this->_typeConfig);
|
56 |
-
return $this->_config;
|
57 |
-
}
|
58 |
-
|
59 |
-
/* @return Skybox_Core_Model_Api_Restful */
|
60 |
-
|
61 |
-
{
|
62 |
-
if (null === $this->_api) {
|
63 |
-
$this->_api = Mage::getModel($this->_apiType)->setConfigObject($this->_config);
|
64 |
-
}
|
65 |
-
return $this->_api;
|
66 |
-
}
|
67 |
-
|
68 |
-
/* @return Skybox_International_Helper_Data */
|
69 |
-
protected function _getHelper()
|
70 |
-
{
|
71 |
-
if (null === $this->_help) {
|
72 |
-
$this->_help = Mage::helper($this->_helpType);
|
73 |
-
}
|
74 |
-
return $this->_help;
|
75 |
-
}
|
76 |
-
|
77 |
-
public function __construct($params = array())
|
78 |
-
{
|
79 |
-
$this->_getConfig();
|
80 |
-
$this->_getApi();
|
81 |
-
}
|
82 |
-
|
83 |
-
public function getMerchant()
|
84 |
-
{
|
85 |
-
return $this->_getHelper()->getMerchantCode();
|
86 |
-
}
|
87 |
-
|
88 |
-
public function getMerchantKey()
|
89 |
-
{
|
90 |
-
return $this->_getHelper()->getMerchantKey();
|
91 |
-
}
|
92 |
-
|
93 |
-
public function getEnabledAddSumTaxToPrice()
|
94 |
-
{
|
95 |
-
return $this->_getHelper()->getEnabledAddSumTaxToPrice();
|
96 |
-
}
|
97 |
-
|
98 |
-
public function getWeightUnit()
|
99 |
-
{
|
100 |
-
return $this->_getHelper()->getWeightUnit();
|
101 |
-
}
|
102 |
-
|
103 |
-
public function getAuthorizedToken()
|
104 |
-
{
|
105 |
-
return $this->_api->getAuthorizedToken();
|
106 |
-
}
|
107 |
-
|
108 |
-
public function getGuidApi()
|
109 |
-
{
|
110 |
-
return $this->_api->getGuidApi();
|
111 |
-
}
|
112 |
-
|
113 |
-
public function getResponse()
|
114 |
-
{
|
115 |
-
return $this->_api->getResponseJson();
|
116 |
-
}
|
117 |
-
|
118 |
-
public function getParameter($paramName, $valueDefault = null)
|
119 |
-
{
|
120 |
-
try {
|
121 |
-
return $this->getResponse()->{$paramName};
|
122 |
-
} catch (Exception $e) {
|
123 |
-
return $valueDefault;
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
public function getLocationAllow()
|
128 |
-
{
|
129 |
-
//return $this->_api->getLocationAllow() == "1";
|
130 |
-
return $this->_api->getLocationAllow();
|
131 |
-
}
|
132 |
-
|
133 |
-
public function getStoreCode()
|
134 |
-
{
|
135 |
-
return $this->_api->getStoreCode();
|
136 |
-
}
|
137 |
-
|
138 |
-
public function getErrorAuthenticate()
|
139 |
-
{
|
140 |
-
return $this->_api->getErrorAuthenticate();
|
141 |
-
}
|
142 |
-
|
143 |
-
public function getHtmlTemplateBar()
|
144 |
-
{
|
145 |
-
return $this->_api->getHtmlTemplateBar();
|
146 |
-
}
|
147 |
-
|
148 |
-
public function getHtmlTemplateButton()
|
149 |
-
{
|
150 |
-
return $this->_api->getHtmlTemplateButton();
|
151 |
-
}
|
152 |
-
|
153 |
-
public function getHtmlTemplateButtonError()
|
154 |
-
{
|
155 |
-
return $this->_api->getHtmlTemplateButtonError();
|
156 |
-
}
|
157 |
-
|
158 |
-
public function HasError()
|
159 |
-
{
|
160 |
-
return $this->_api->HasError();
|
161 |
-
}
|
162 |
-
|
163 |
-
public function getStatusCode()
|
164 |
-
{
|
165 |
-
return $this->_api->getStatusCode();
|
166 |
-
}
|
167 |
-
|
168 |
-
public function getStatusMessage()
|
169 |
-
{
|
170 |
-
return $this->_api->getStatusMessage();
|
171 |
-
}
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
if ($
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
}
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
$
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
$
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
Mage::
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Core
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Core
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Core_Model_Standard
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Config instance
|
14 |
+
* @var Skybox_Core_Model_Config
|
15 |
+
*/
|
16 |
+
protected $_config = null;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Config Model Type
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $_typeConfig = "skyboxcore/config";
|
24 |
+
|
25 |
+
/**
|
26 |
+
* API instance
|
27 |
+
* @var Skybox_Core_Model_Api_Restful
|
28 |
+
*/
|
29 |
+
protected $_api = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Api Model Type
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
protected $_apiType = 'skyboxcore/api_restful';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Helper instance
|
40 |
+
* @var Skybox_International_Helper_Data
|
41 |
+
*/
|
42 |
+
protected $_help = null;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Api Model Type
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
protected $_helpType = 'skyboxinternational/data';
|
50 |
+
|
51 |
+
/* @return Skybox_Core_Model_Config */
|
52 |
+
protected function _getConfig()
|
53 |
+
{
|
54 |
+
if (null === $this->_config)
|
55 |
+
$this->_config = Mage::getModel($this->_typeConfig);
|
56 |
+
return $this->_config;
|
57 |
+
}
|
58 |
+
|
59 |
+
/* @return Skybox_Core_Model_Api_Restful */
|
60 |
+
public function _getApi()
|
61 |
+
{
|
62 |
+
if (null === $this->_api) {
|
63 |
+
$this->_api = Mage::getModel($this->_apiType)->setConfigObject($this->_config);
|
64 |
+
}
|
65 |
+
return $this->_api;
|
66 |
+
}
|
67 |
+
|
68 |
+
/* @return Skybox_International_Helper_Data */
|
69 |
+
protected function _getHelper()
|
70 |
+
{
|
71 |
+
if (null === $this->_help) {
|
72 |
+
$this->_help = Mage::helper($this->_helpType);
|
73 |
+
}
|
74 |
+
return $this->_help;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function __construct($params = array())
|
78 |
+
{
|
79 |
+
$this->_getConfig();
|
80 |
+
$this->_getApi();
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getMerchant()
|
84 |
+
{
|
85 |
+
return $this->_getHelper()->getMerchantCode();
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getMerchantKey()
|
89 |
+
{
|
90 |
+
return $this->_getHelper()->getMerchantKey();
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getEnabledAddSumTaxToPrice()
|
94 |
+
{
|
95 |
+
return $this->_getHelper()->getEnabledAddSumTaxToPrice();
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getWeightUnit()
|
99 |
+
{
|
100 |
+
return $this->_getHelper()->getWeightUnit();
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getAuthorizedToken()
|
104 |
+
{
|
105 |
+
return $this->_api->getAuthorizedToken();
|
106 |
+
}
|
107 |
+
|
108 |
+
public function getGuidApi()
|
109 |
+
{
|
110 |
+
return $this->_api->getGuidApi();
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getResponse()
|
114 |
+
{
|
115 |
+
return $this->_api->getResponseJson();
|
116 |
+
}
|
117 |
+
|
118 |
+
public function getParameter($paramName, $valueDefault = null)
|
119 |
+
{
|
120 |
+
try {
|
121 |
+
return $this->getResponse()->{$paramName};
|
122 |
+
} catch (Exception $e) {
|
123 |
+
return $valueDefault;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
public function getLocationAllow()
|
128 |
+
{
|
129 |
+
//return $this->_api->getLocationAllow() == "1";
|
130 |
+
return $this->_api->getLocationAllow();
|
131 |
+
}
|
132 |
+
|
133 |
+
public function getStoreCode()
|
134 |
+
{
|
135 |
+
return $this->_api->getStoreCode();
|
136 |
+
}
|
137 |
+
|
138 |
+
public function getErrorAuthenticate()
|
139 |
+
{
|
140 |
+
return $this->_api->getErrorAuthenticate();
|
141 |
+
}
|
142 |
+
|
143 |
+
public function getHtmlTemplateBar()
|
144 |
+
{
|
145 |
+
return $this->_api->getHtmlTemplateBar();
|
146 |
+
}
|
147 |
+
|
148 |
+
public function getHtmlTemplateButton()
|
149 |
+
{
|
150 |
+
return $this->_api->getHtmlTemplateButton();
|
151 |
+
}
|
152 |
+
|
153 |
+
public function getHtmlTemplateButtonError()
|
154 |
+
{
|
155 |
+
return $this->_api->getHtmlTemplateButtonError();
|
156 |
+
}
|
157 |
+
|
158 |
+
public function HasError()
|
159 |
+
{
|
160 |
+
return $this->_api->HasError();
|
161 |
+
}
|
162 |
+
|
163 |
+
public function getStatusCode()
|
164 |
+
{
|
165 |
+
return $this->_api->getStatusCode();
|
166 |
+
}
|
167 |
+
|
168 |
+
public function getStatusMessage()
|
169 |
+
{
|
170 |
+
return $this->_api->getStatusMessage();
|
171 |
+
}
|
172 |
+
|
173 |
+
public function getCssVersion()
|
174 |
+
{
|
175 |
+
return$this->_api->getCssVersion();
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Se invoca al servicio para generar Token de Seguridad
|
180 |
+
* @return Skybox_Core_Model_Standard
|
181 |
+
*/
|
182 |
+
public function AuthenticateService()
|
183 |
+
{
|
184 |
+
//$this->_getApi(); // Why? http://goo.gl/xYs9zM
|
185 |
+
Mage::log("AuthenticateService ", null, 'autenticate.log', true);
|
186 |
+
|
187 |
+
$successService = false;
|
188 |
+
$errorService = 1;
|
189 |
+
|
190 |
+
while (!$successService) {
|
191 |
+
$params = array(
|
192 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
193 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANTKEY => $this->getMerchantKey()
|
194 |
+
);
|
195 |
+
|
196 |
+
Mage::log('|AuthenticateService|' . json_encode($params));
|
197 |
+
|
198 |
+
$this->_api->CallService(Skybox_Core_Model_Config::SKYBOX_ACTION_AUTHENTICATE, $params);
|
199 |
+
|
200 |
+
//if ($this->_api->ErrorKeyInvalid() || $this->_api->ErrorIpNoAllow()) break;
|
201 |
+
//if (!($this->_api->ErrorService())) $successService = true;
|
202 |
+
if ($this->_api->ErrorMerchantKeyInvalid() || $this->_api->ErrorIpNoAllow()) break;
|
203 |
+
if (!($this->_api->ErrorServiceNotController())) $successService = true;
|
204 |
+
$errorService++;
|
205 |
+
if ($errorService > 3) break;
|
206 |
+
}
|
207 |
+
|
208 |
+
if (!$successService) {
|
209 |
+
//throw new Exception("Error Processing Request", 1);
|
210 |
+
//Mage::throwException('Error: al comunicarse con el servidor, si el error persiste comunicarse con su administrador');
|
211 |
+
}
|
212 |
+
|
213 |
+
return $this;
|
214 |
+
}
|
215 |
+
|
216 |
+
public function CallApiRest($action, $params)
|
217 |
+
{
|
218 |
+
|
219 |
+
$start = microtime(true);
|
220 |
+
|
221 |
+
Mage::log("CallApiRest ", null, 'standart.log', true);
|
222 |
+
|
223 |
+
$successService = false;
|
224 |
+
$errorService = 1;
|
225 |
+
$successAuthenticate = true;
|
226 |
+
try {
|
227 |
+
//$this->_getApi(); // Why? http://goo.gl/xYs9zM
|
228 |
+
$variable = $this->getAuthorizedToken();
|
229 |
+
if (empty($variable)) {
|
230 |
+
Mage::log("empty ", null, 'standart.log', true);
|
231 |
+
|
232 |
+
$this->AuthenticateService();
|
233 |
+
$params = $this->resetValueDefault($params);
|
234 |
+
$successAuthenticate = !$this->getErrorAuthenticate();
|
235 |
+
}
|
236 |
+
|
237 |
+
if ($successAuthenticate) {
|
238 |
+
Mage::log("successAuthenticate ", null, 'standart.log', true);
|
239 |
+
|
240 |
+
while (!$successService) {
|
241 |
+
Mage::log(" ---------------------------------------------");
|
242 |
+
Mage::log(" | Call | " . $action);
|
243 |
+
$this->_api->CallService($action, $params);
|
244 |
+
|
245 |
+
if ($this->_api->HasError()) {
|
246 |
+
Mage::log("HasError ", null, 'standart.log', true);
|
247 |
+
Mage::log(' | CallApiRest->Error | ');
|
248 |
+
$errorService++;
|
249 |
+
//if ($this->_api->ErrorTokenInvalid()) $this->AuthenticateService();
|
250 |
+
if ($this->_api->ErrorTokenExpired()) $this->AuthenticateService();
|
251 |
+
if ($errorService > 3) break;
|
252 |
+
$params = $this->resetValueDefault($params);
|
253 |
+
} else {
|
254 |
+
Mage::log(' | CallApiRest->Success | ');
|
255 |
+
$successService = true;
|
256 |
+
}
|
257 |
+
}
|
258 |
+
}
|
259 |
+
} catch (Exception $e) {
|
260 |
+
Mage::log(' | CallApiRest->Error | ' . $e->getMessage());
|
261 |
+
Mage::helper('skyboxcore/email')->sendException($e->getMessage());
|
262 |
+
$successService = false;
|
263 |
+
}
|
264 |
+
|
265 |
+
if (!$successService) {
|
266 |
+
Mage::log(' | Error Processing Request / CallApiRest | ' . $action);
|
267 |
+
//throw new Exception("Error Processing Request", 1);
|
268 |
+
//Mage::throwException('Error: al comunicarse con el servidor, si el error persiste comunicarse con su administrador');
|
269 |
+
//Mage::helper('skyboxcore/email')->sendAPIError($e->getMessage());
|
270 |
+
}
|
271 |
+
|
272 |
+
|
273 |
+
$total_time = round(microtime(true)-$start, 4);
|
274 |
+
Mage::log('Servicio generado ['.$action.']: '.$total_time.' segundos.', null, 'timer.log',true);
|
275 |
+
|
276 |
+
return $this;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Setea los valores por defecto
|
281 |
+
* @return array()
|
282 |
+
*/
|
283 |
+
protected function resetValueDefault($params)
|
284 |
+
{
|
285 |
+
foreach ($params as $key => $val) {
|
286 |
+
if ($key == Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN) $params[$key] = $this->_api->getAuthorizedToken();
|
287 |
+
if ($key == Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID) $params[$key] = $this->_api->getGuidApi();
|
288 |
+
}
|
289 |
+
|
290 |
+
return $params;
|
291 |
+
}
|
292 |
+
}
|
app/code/community/Skybox/Core/etc/config.xml
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Skybox_Core>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Skybox_Core>
|
8 |
-
</modules>
|
9 |
-
<global>
|
10 |
-
|
11 |
-
<models>
|
12 |
-
<skyboxcore>
|
13 |
-
<class>Skybox_Core_Model</class>
|
14 |
-
<resourceModel>skyboxcore_mysql4</resourceModel>
|
15 |
-
</skyboxcore>
|
16 |
-
<skyboxcore_mysql4>
|
17 |
-
<class>Skybox_Core_Model_Mysql4</class>
|
18 |
-
<entities>
|
19 |
-
<logservice>
|
20 |
-
<table>skybox_log_service</table>
|
21 |
-
</logservice>
|
22 |
-
</entities>
|
23 |
-
</skyboxcore_mysql4>
|
24 |
-
</models>
|
25 |
-
|
26 |
-
<resources>
|
27 |
-
<skyboxcore_setup>
|
28 |
-
<setup>
|
29 |
-
<module>Skybox_Core</module>
|
30 |
-
</setup>
|
31 |
-
<connection>
|
32 |
-
<use>core_setup</use>
|
33 |
-
</connection>
|
34 |
-
</skyboxcore_setup>
|
35 |
-
<skyboxcore_write>
|
36 |
-
<connection>
|
37 |
-
<use>core_write</use>
|
38 |
-
</connection>
|
39 |
-
</skyboxcore_write>
|
40 |
-
<skyboxcore_read>
|
41 |
-
<connection>
|
42 |
-
<use>core_read</use>
|
43 |
-
</connection>
|
44 |
-
</skyboxcore_read>
|
45 |
-
</resources>
|
46 |
-
|
47 |
-
<helpers>
|
48 |
-
<skyboxcore>
|
49 |
-
<class>Skybox_Core_Helper</class>
|
50 |
-
</skyboxcore>
|
51 |
-
</helpers>
|
52 |
-
|
53 |
-
<blocks>
|
54 |
-
<skyboxcore>
|
55 |
-
<class>Skybox_Core_Block</class>
|
56 |
-
</skyboxcore>
|
57 |
-
</blocks>
|
58 |
-
|
59 |
-
</global>
|
60 |
</config>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Skybox_Core>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Skybox_Core>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
|
11 |
+
<models>
|
12 |
+
<skyboxcore>
|
13 |
+
<class>Skybox_Core_Model</class>
|
14 |
+
<resourceModel>skyboxcore_mysql4</resourceModel>
|
15 |
+
</skyboxcore>
|
16 |
+
<skyboxcore_mysql4>
|
17 |
+
<class>Skybox_Core_Model_Mysql4</class>
|
18 |
+
<entities>
|
19 |
+
<logservice>
|
20 |
+
<table>skybox_log_service</table>
|
21 |
+
</logservice>
|
22 |
+
</entities>
|
23 |
+
</skyboxcore_mysql4>
|
24 |
+
</models>
|
25 |
+
|
26 |
+
<resources>
|
27 |
+
<skyboxcore_setup>
|
28 |
+
<setup>
|
29 |
+
<module>Skybox_Core</module>
|
30 |
+
</setup>
|
31 |
+
<connection>
|
32 |
+
<use>core_setup</use>
|
33 |
+
</connection>
|
34 |
+
</skyboxcore_setup>
|
35 |
+
<skyboxcore_write>
|
36 |
+
<connection>
|
37 |
+
<use>core_write</use>
|
38 |
+
</connection>
|
39 |
+
</skyboxcore_write>
|
40 |
+
<skyboxcore_read>
|
41 |
+
<connection>
|
42 |
+
<use>core_read</use>
|
43 |
+
</connection>
|
44 |
+
</skyboxcore_read>
|
45 |
+
</resources>
|
46 |
+
|
47 |
+
<helpers>
|
48 |
+
<skyboxcore>
|
49 |
+
<class>Skybox_Core_Helper</class>
|
50 |
+
</skyboxcore>
|
51 |
+
</helpers>
|
52 |
+
|
53 |
+
<blocks>
|
54 |
+
<skyboxcore>
|
55 |
+
<class>Skybox_Core_Block</class>
|
56 |
+
</skyboxcore>
|
57 |
+
</blocks>
|
58 |
+
|
59 |
+
</global>
|
60 |
</config>
|
app/code/community/Skybox/Core/sql/skyboxcore_setup/mysql4-install-0.1.0.php
CHANGED
@@ -1,69 +1,69 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
$installer = $this;
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->run("
|
7 |
-
--DROP TABLE IF EXISTS {$this->getTable('skybox_log_service')};
|
8 |
-
|
9 |
-
CREATE TABLE {$this->getTable('skybox_log_service')} (
|
10 |
-
`service_id` int(11) NOT NULL auto_increment,
|
11 |
-
`action` text NOT NULl,
|
12 |
-
`request` text NOT NULl,
|
13 |
-
`response` text NULL,
|
14 |
-
`timestamp_request` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
15 |
-
`timestamp_response` timestamp NULL
|
16 |
-
PRIMARY KEY (`service_id`)
|
17 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
18 |
-
");
|
19 |
-
|
20 |
-
$installer->endSetup();
|
21 |
-
|
22 |
-
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
|
23 |
-
die("Exit for now");
|
24 |
-
//exit();
|
25 |
-
*/
|
26 |
-
|
27 |
-
$installer = $this;
|
28 |
-
$installer->startSetup();
|
29 |
-
|
30 |
-
//$table = $installer->getConnection()
|
31 |
-
// //->newTable($installer->getTable('skyboxcore/skybox_log_service'))
|
32 |
-
// ->newTable($installer->getTable('skybox_log_service'))
|
33 |
-
// ->addColumn('service_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
34 |
-
// 'identity' => true,
|
35 |
-
// 'unsigned' => true,
|
36 |
-
// 'nullable' => false,
|
37 |
-
// 'primary' => true,
|
38 |
-
// ), 'Service Id')
|
39 |
-
// ->addColumn('action', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
40 |
-
// 'nullable' => false,
|
41 |
-
// ), 'Action')
|
42 |
-
// ->addColumn('request', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
43 |
-
// 'request' => false,
|
44 |
-
// ), 'Request')
|
45 |
-
// ->addColumn('response', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
46 |
-
// 'request' => false,
|
47 |
-
// ), 'Response')
|
48 |
-
// ->addColumn('timestamp_request', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
49 |
-
// 'request' => false,
|
50 |
-
// ), 'Timestamp Request')
|
51 |
-
// ->addColumn('timestamp_response', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
52 |
-
// 'request' => false,
|
53 |
-
// ), 'Timestamp Response');
|
54 |
-
//$installer->getConnection()->createTable($table);
|
55 |
-
|
56 |
-
$installer->run("
|
57 |
-
DROP TABLE IF EXISTS `{$this->getTable('skybox_log_service')}`;
|
58 |
-
CREATE TABLE `skybox_log_service` (
|
59 |
-
`service_id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Service Id' ,
|
60 |
-
`action` TEXT NOT NULL COMMENT 'Action' ,
|
61 |
-
`request` TEXT NULL COMMENT 'Request' ,
|
62 |
-
`response` TEXT NULL COMMENT 'Response' ,
|
63 |
-
`timestamp_request` TIMESTAMP NULL DEFAULT NULL COMMENT 'Timestamp Request' ,
|
64 |
-
`timestamp_response` TIMESTAMP NULL DEFAULT NULL COMMENT 'Timestamp Response' ,
|
65 |
-
PRIMARY KEY (`service_id`)
|
66 |
-
)
|
67 |
-
COMMENT='skybox_log_service' ENGINE=INNODB CHARSET=utf8 COLLATE=utf8_general_ci;
|
68 |
-
");
|
69 |
-
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$installer->run("
|
7 |
+
--DROP TABLE IF EXISTS {$this->getTable('skybox_log_service')};
|
8 |
+
|
9 |
+
CREATE TABLE {$this->getTable('skybox_log_service')} (
|
10 |
+
`service_id` int(11) NOT NULL auto_increment,
|
11 |
+
`action` text NOT NULl,
|
12 |
+
`request` text NOT NULl,
|
13 |
+
`response` text NULL,
|
14 |
+
`timestamp_request` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
15 |
+
`timestamp_response` timestamp NULL
|
16 |
+
PRIMARY KEY (`service_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
18 |
+
");
|
19 |
+
|
20 |
+
$installer->endSetup();
|
21 |
+
|
22 |
+
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
|
23 |
+
die("Exit for now");
|
24 |
+
//exit();
|
25 |
+
*/
|
26 |
+
|
27 |
+
$installer = $this;
|
28 |
+
$installer->startSetup();
|
29 |
+
|
30 |
+
//$table = $installer->getConnection()
|
31 |
+
// //->newTable($installer->getTable('skyboxcore/skybox_log_service'))
|
32 |
+
// ->newTable($installer->getTable('skybox_log_service'))
|
33 |
+
// ->addColumn('service_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
34 |
+
// 'identity' => true,
|
35 |
+
// 'unsigned' => true,
|
36 |
+
// 'nullable' => false,
|
37 |
+
// 'primary' => true,
|
38 |
+
// ), 'Service Id')
|
39 |
+
// ->addColumn('action', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
40 |
+
// 'nullable' => false,
|
41 |
+
// ), 'Action')
|
42 |
+
// ->addColumn('request', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
43 |
+
// 'request' => false,
|
44 |
+
// ), 'Request')
|
45 |
+
// ->addColumn('response', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
46 |
+
// 'request' => false,
|
47 |
+
// ), 'Response')
|
48 |
+
// ->addColumn('timestamp_request', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
49 |
+
// 'request' => false,
|
50 |
+
// ), 'Timestamp Request')
|
51 |
+
// ->addColumn('timestamp_response', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
52 |
+
// 'request' => false,
|
53 |
+
// ), 'Timestamp Response');
|
54 |
+
//$installer->getConnection()->createTable($table);
|
55 |
+
|
56 |
+
$installer->run("
|
57 |
+
DROP TABLE IF EXISTS `{$this->getTable('skybox_log_service')}`;
|
58 |
+
CREATE TABLE `skybox_log_service` (
|
59 |
+
`service_id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Service Id' ,
|
60 |
+
`action` TEXT NOT NULL COMMENT 'Action' ,
|
61 |
+
`request` TEXT NULL COMMENT 'Request' ,
|
62 |
+
`response` TEXT NULL COMMENT 'Response' ,
|
63 |
+
`timestamp_request` TIMESTAMP NULL DEFAULT NULL COMMENT 'Timestamp Request' ,
|
64 |
+
`timestamp_response` TIMESTAMP NULL DEFAULT NULL COMMENT 'Timestamp Response' ,
|
65 |
+
PRIMARY KEY (`service_id`)
|
66 |
+
)
|
67 |
+
COMMENT='skybox_log_service' ENGINE=INNODB CHARSET=utf8 COLLATE=utf8_general_ci;
|
68 |
+
");
|
69 |
+
$installer->endSetup();
|
app/code/community/Skybox/International/Helper/Data.php
CHANGED
@@ -1,73 +1,78 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox International
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_International
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_International_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
-
{
|
12 |
-
public function getMerchantCode()
|
13 |
-
{
|
14 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/merchantcode', Mage::app()->getStore());
|
15 |
-
}
|
16 |
-
|
17 |
-
public function getMerchantKey()
|
18 |
-
{
|
19 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/merchantkey', Mage::app()->getStore());
|
20 |
-
}
|
21 |
-
|
22 |
-
public function getWeightUnit()
|
23 |
-
{
|
24 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/weigthunitproduct', Mage::app()->getStore());
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getActive()
|
28 |
-
{
|
29 |
-
// return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
30 |
-
return Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getSkyboxLog()
|
34 |
-
{
|
35 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxlog', Mage::app()->getStore());
|
36 |
-
}
|
37 |
-
|
38 |
-
public function getSkyboxEmail()
|
39 |
-
{
|
40 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxemail', Mage::app()->getStore());
|
41 |
-
}
|
42 |
-
|
43 |
-
public function getSkyboxIntegration()
|
44 |
-
{
|
45 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxintegration', Mage::app()->getStore());
|
46 |
-
}
|
47 |
-
|
48 |
-
public function getSkyboxUrlAPI()
|
49 |
-
{
|
50 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxurlapi', Mage::app()->getStore());
|
51 |
-
}
|
52 |
-
|
53 |
-
public function getSkyboxUrlMain()
|
54 |
-
{
|
55 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxurlmain', Mage::app()->getStore());
|
56 |
-
}
|
57 |
-
|
58 |
-
public function getEnabledAddSumTaxToPrice()
|
59 |
-
{
|
60 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxproduct/skyboxaddtaxtopriceenable', Mage::app()->getStore());
|
61 |
-
}
|
62 |
-
|
63 |
-
public function getStoreId()
|
64 |
-
{
|
65 |
-
//return $this->helper('core')->getStoreId();
|
66 |
-
return Mage::app()->getStore()->getId();
|
67 |
-
}
|
68 |
-
|
69 |
-
public function getCartId()
|
70 |
-
{
|
71 |
-
return Mage::getSingleton('checkout/session')->getQuoteId();
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox International
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_International
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout, Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_International_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
public function getMerchantCode()
|
13 |
+
{
|
14 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/merchantcode', Mage::app()->getStore());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getMerchantKey()
|
18 |
+
{
|
19 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/merchantkey', Mage::app()->getStore());
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getWeightUnit()
|
23 |
+
{
|
24 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/weigthunitproduct', Mage::app()->getStore());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getActive()
|
28 |
+
{
|
29 |
+
// return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
30 |
+
return Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getSkyboxLog()
|
34 |
+
{
|
35 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxlog', Mage::app()->getStore());
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getSkyboxEmail()
|
39 |
+
{
|
40 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxemail', Mage::app()->getStore());
|
41 |
+
}
|
42 |
+
|
43 |
+
public function getSkyboxIntegration()
|
44 |
+
{
|
45 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxintegration', Mage::app()->getStore());
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getSkyboxUrlAPI()
|
49 |
+
{
|
50 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxurlapi', Mage::app()->getStore());
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getSkyboxUrlMain()
|
54 |
+
{
|
55 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxurlmain', Mage::app()->getStore());
|
56 |
+
}
|
57 |
+
|
58 |
+
public function getEnabledAddSumTaxToPrice()
|
59 |
+
{
|
60 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxproduct/skyboxaddtaxtopriceenable', Mage::app()->getStore());
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getStoreId()
|
64 |
+
{
|
65 |
+
//return $this->helper('core')->getStoreId();
|
66 |
+
return Mage::app()->getStore()->getId();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getCartId()
|
70 |
+
{
|
71 |
+
return Mage::getSingleton('checkout/session')->getQuoteId();
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getCssVersion()
|
75 |
+
{
|
76 |
+
return Mage::getModel('skyboxcatalog/api_product')->getCssVersion();
|
77 |
+
}
|
78 |
}
|
app/code/community/Skybox/International/Model/Config.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skybox International
|
4 |
-
*
|
5 |
-
* @category Skybox
|
6 |
-
* @package Skybox_International
|
7 |
-
* @subpackage Skybox_International_Model
|
8 |
-
* @copyright Copyright (c) 2014 SkyBOX Checkout Inc. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
class Skybox_International_Model_Config extends Mage_Core_Model_Abstract
|
12 |
-
{
|
13 |
-
public function __construct($params = array())
|
14 |
-
{
|
15 |
-
}
|
16 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skybox International
|
4 |
+
*
|
5 |
+
* @category Skybox
|
6 |
+
* @package Skybox_International
|
7 |
+
* @subpackage Skybox_International_Model
|
8 |
+
* @copyright Copyright (c) 2014 SkyBOX Checkout Inc. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Skybox_International_Model_Config extends Mage_Core_Model_Abstract
|
12 |
+
{
|
13 |
+
public function __construct($params = array())
|
14 |
+
{
|
15 |
+
}
|
16 |
}
|
app/code/community/Skybox/International/etc/adminhtml.xml
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<menu>
|
4 |
-
<skyboxinternational translate="title" module="skyboxinternational">
|
5 |
-
<title>Skybox Checkout</title>
|
6 |
-
<sort_order>300</sort_order>
|
7 |
-
<children>
|
8 |
-
<skyboxinternational translate="title" module="skyboxinternational">
|
9 |
-
<title>Skybox Settings</title>
|
10 |
-
<sort_order>1</sort_order>
|
11 |
-
<action>adminhtml/system_config/edit/section/skyboxinternational</action>
|
12 |
-
</skyboxinternational>
|
13 |
-
</children>
|
14 |
-
</skyboxinternational>
|
15 |
-
</menu>
|
16 |
-
<acl>
|
17 |
-
<resources>
|
18 |
-
<all>
|
19 |
-
<title>Allow Everything</title>
|
20 |
-
</all>
|
21 |
-
<admin>
|
22 |
-
<children>
|
23 |
-
<system>
|
24 |
-
<children>
|
25 |
-
<config>
|
26 |
-
<children>
|
27 |
-
<skyboxinternational translate="title" module="skyboxinternational">
|
28 |
-
<title>Skybox Checkout</title>
|
29 |
-
<sort_order>300</sort_order>
|
30 |
-
</skyboxinternational>
|
31 |
-
</children>
|
32 |
-
</config>
|
33 |
-
</children>
|
34 |
-
</system>
|
35 |
-
</children>
|
36 |
-
</admin>
|
37 |
-
</resources>
|
38 |
-
</acl>
|
39 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<skyboxinternational translate="title" module="skyboxinternational">
|
5 |
+
<title>Skybox Checkout</title>
|
6 |
+
<sort_order>300</sort_order>
|
7 |
+
<children>
|
8 |
+
<skyboxinternational translate="title" module="skyboxinternational">
|
9 |
+
<title>Skybox Settings</title>
|
10 |
+
<sort_order>1</sort_order>
|
11 |
+
<action>adminhtml/system_config/edit/section/skyboxinternational</action>
|
12 |
+
</skyboxinternational>
|
13 |
+
</children>
|
14 |
+
</skyboxinternational>
|
15 |
+
</menu>
|
16 |
+
<acl>
|
17 |
+
<resources>
|
18 |
+
<all>
|
19 |
+
<title>Allow Everything</title>
|
20 |
+
</all>
|
21 |
+
<admin>
|
22 |
+
<children>
|
23 |
+
<system>
|
24 |
+
<children>
|
25 |
+
<config>
|
26 |
+
<children>
|
27 |
+
<skyboxinternational translate="title" module="skyboxinternational">
|
28 |
+
<title>Skybox Checkout</title>
|
29 |
+
<sort_order>300</sort_order>
|
30 |
+
</skyboxinternational>
|
31 |
+
</children>
|
32 |
+
</config>
|
33 |
+
</children>
|
34 |
+
</system>
|
35 |
+
</children>
|
36 |
+
</admin>
|
37 |
+
</resources>
|
38 |
+
</acl>
|
39 |
+
</config>
|
app/code/community/Skybox/International/etc/config.xml
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
<config>
|
2 |
-
<modules>
|
3 |
-
<Skybox_International>
|
4 |
-
<version>0.1.0</version>
|
5 |
-
<codePool>community</codePool>
|
6 |
-
</Skybox_International>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<models>
|
10 |
-
<skyboxinternational>
|
11 |
-
<class>Skybox_International_Model</class>
|
12 |
-
</skyboxinternational>
|
13 |
-
</models>
|
14 |
-
<helpers>
|
15 |
-
<skyboxinternational>
|
16 |
-
<class>Skybox_International_Helper</class>
|
17 |
-
</skyboxinternational>
|
18 |
-
</helpers>
|
19 |
-
<resources>
|
20 |
-
<skyboxinternational_setup>
|
21 |
-
<setup>
|
22 |
-
<module>Skybox_International</module>
|
23 |
-
</setup>
|
24 |
-
<connection>
|
25 |
-
<use>core_setup</use>
|
26 |
-
</connection>
|
27 |
-
</skyboxinternational_setup>
|
28 |
-
</resources>
|
29 |
-
</global>
|
30 |
-
<admin>
|
31 |
-
<routers>
|
32 |
-
<skyboxinternational>
|
33 |
-
<use>admin</use>
|
34 |
-
<args>
|
35 |
-
<module>Skybox_International</module>
|
36 |
-
<frontName>skyboxinternational</frontName>
|
37 |
-
</args>
|
38 |
-
</skyboxinternational>
|
39 |
-
</routers>
|
40 |
-
</admin>
|
41 |
-
<adminhtml>
|
42 |
-
<layout>
|
43 |
-
<updates>
|
44 |
-
<skyboxinternational>
|
45 |
-
<file>skyboxinternational.xml</file>
|
46 |
-
</skyboxinternational>
|
47 |
-
</updates>
|
48 |
-
</layout>
|
49 |
-
</adminhtml>
|
50 |
-
<default>
|
51 |
-
<skyboxinternational>
|
52 |
-
<skyboxsettings>
|
53 |
-
<!--host><![CDATA[localhost]]></host-->
|
54 |
-
<skyboxactive>0</skyboxactive>
|
55 |
-
</skyboxsettings>
|
56 |
-
<skyboxproduct>
|
57 |
-
<skyboxaddtaxtopriceenable>0</skyboxaddtaxtopriceenable>
|
58 |
-
</skyboxproduct>
|
59 |
-
</skyboxinternational>
|
60 |
-
</default>
|
61 |
</config>
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Skybox_International>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
</Skybox_International>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<skyboxinternational>
|
11 |
+
<class>Skybox_International_Model</class>
|
12 |
+
</skyboxinternational>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<skyboxinternational>
|
16 |
+
<class>Skybox_International_Helper</class>
|
17 |
+
</skyboxinternational>
|
18 |
+
</helpers>
|
19 |
+
<resources>
|
20 |
+
<skyboxinternational_setup>
|
21 |
+
<setup>
|
22 |
+
<module>Skybox_International</module>
|
23 |
+
</setup>
|
24 |
+
<connection>
|
25 |
+
<use>core_setup</use>
|
26 |
+
</connection>
|
27 |
+
</skyboxinternational_setup>
|
28 |
+
</resources>
|
29 |
+
</global>
|
30 |
+
<admin>
|
31 |
+
<routers>
|
32 |
+
<skyboxinternational>
|
33 |
+
<use>admin</use>
|
34 |
+
<args>
|
35 |
+
<module>Skybox_International</module>
|
36 |
+
<frontName>skyboxinternational</frontName>
|
37 |
+
</args>
|
38 |
+
</skyboxinternational>
|
39 |
+
</routers>
|
40 |
+
</admin>
|
41 |
+
<adminhtml>
|
42 |
+
<layout>
|
43 |
+
<updates>
|
44 |
+
<skyboxinternational>
|
45 |
+
<file>skyboxinternational.xml</file>
|
46 |
+
</skyboxinternational>
|
47 |
+
</updates>
|
48 |
+
</layout>
|
49 |
+
</adminhtml>
|
50 |
+
<default>
|
51 |
+
<skyboxinternational>
|
52 |
+
<skyboxsettings>
|
53 |
+
<!--host><![CDATA[localhost]]></host-->
|
54 |
+
<skyboxactive>0</skyboxactive>
|
55 |
+
</skyboxsettings>
|
56 |
+
<skyboxproduct>
|
57 |
+
<skyboxaddtaxtopriceenable>0</skyboxaddtaxtopriceenable>
|
58 |
+
</skyboxproduct>
|
59 |
+
</skyboxinternational>
|
60 |
+
</default>
|
61 |
</config>
|
app/code/community/Skybox/International/etc/system.xml
CHANGED
@@ -1,134 +1,134 @@
|
|
1 |
-
<config>
|
2 |
-
<tabs>
|
3 |
-
<skyboxinternational translate="label" module="skyboxinternational">
|
4 |
-
<label>Skybox Checkout</label>
|
5 |
-
<sort_order>100</sort_order>
|
6 |
-
</skyboxinternational>
|
7 |
-
</tabs>
|
8 |
-
<sections>
|
9 |
-
<skyboxinternational translate="label" module="skyboxinternational">
|
10 |
-
<label>Skybox Checkout Settings</label>
|
11 |
-
<tab>skyboxinternational</tab>
|
12 |
-
<sort_order>1000</sort_order>
|
13 |
-
<show_in_default>1</show_in_default>
|
14 |
-
<show_in_website>1</show_in_website>
|
15 |
-
<show_in_store>1</show_in_store>
|
16 |
-
<groups>
|
17 |
-
<skyboxsettings translate="label" module="skyboxinternational">
|
18 |
-
<label>Merchant Settings</label>
|
19 |
-
<frontend_type>text</frontend_type>
|
20 |
-
<sort_order>10</sort_order>
|
21 |
-
<show_in_default>1</show_in_default>
|
22 |
-
<show_in_website>1</show_in_website>
|
23 |
-
<show_in_store>1</show_in_store>
|
24 |
-
<fields>
|
25 |
-
<skyboxactive translate="label">
|
26 |
-
<label>Enabled</label>
|
27 |
-
<frontend_type>select</frontend_type>
|
28 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
29 |
-
<sort_order>1</sort_order>
|
30 |
-
<show_in_default>1</show_in_default>
|
31 |
-
<show_in_website>1</show_in_website>
|
32 |
-
<show_in_store>1</show_in_store>
|
33 |
-
</skyboxactive>
|
34 |
-
<merchantcode translate="label">
|
35 |
-
<label>Merchant Id:</label>
|
36 |
-
<comment>Code Merchant by Skybox Checkout International</comment>
|
37 |
-
<frontend_type>text</frontend_type>
|
38 |
-
<sort_order>2</sort_order>
|
39 |
-
<show_in_default>1</show_in_default>
|
40 |
-
<show_in_website>1</show_in_website>
|
41 |
-
<show_in_store>1</show_in_store>
|
42 |
-
</merchantcode>
|
43 |
-
<merchantkey translate="label">
|
44 |
-
<label>Merchant Key:</label>
|
45 |
-
<comment>Key Merchant by Skybox Checkout International</comment>
|
46 |
-
<frontend_type>text</frontend_type>
|
47 |
-
<sort_order>3</sort_order>
|
48 |
-
<show_in_default>1</show_in_default>
|
49 |
-
<show_in_website>1</show_in_website>
|
50 |
-
<show_in_store>1</show_in_store>
|
51 |
-
</merchantkey>
|
52 |
-
<weigthunitproduct translate="label">
|
53 |
-
<label>Weight Unit:</label>
|
54 |
-
<comment>Source model provider Magento's unit of measure values</comment>
|
55 |
-
<frontend_type>select</frontend_type>
|
56 |
-
<sort_order>4</sort_order>
|
57 |
-
<show_in_default>1</show_in_default>
|
58 |
-
<show_in_website>1</show_in_website>
|
59 |
-
<show_in_store>1</show_in_store>
|
60 |
-
<source_model>usa/shipping_carrier_ups_source_unitofmeasure</source_model>
|
61 |
-
</weigthunitproduct>
|
62 |
-
<skyboxlog translate="label">
|
63 |
-
<label>Save API Responses</label>
|
64 |
-
<frontend_type>select</frontend_type>
|
65 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
-
<sort_order>5</sort_order>
|
67 |
-
<show_in_default>1</show_in_default>
|
68 |
-
<show_in_website>1</show_in_website>
|
69 |
-
<show_in_store>1</show_in_store>
|
70 |
-
</skyboxlog>
|
71 |
-
<skyboxemail translate="label">
|
72 |
-
<label>SkyBox Email:</label>
|
73 |
-
<comment>SkyBox Email</comment>
|
74 |
-
<frontend_type>text</frontend_type>
|
75 |
-
<validate>validate-email</validate>
|
76 |
-
<sort_order>6</sort_order>
|
77 |
-
<show_in_default>1</show_in_default>
|
78 |
-
<show_in_website>1</show_in_website>
|
79 |
-
<show_in_store>1</show_in_store>
|
80 |
-
</skyboxemail>
|
81 |
-
<skyboxintegration translate="label">
|
82 |
-
<label>SkyBox Itegration:</label>
|
83 |
-
<comment>SkyBox Integration</comment>
|
84 |
-
<frontend_type>text</frontend_type>
|
85 |
-
<!-- validate>validate-email</validate -->
|
86 |
-
<sort_order>7</sort_order>
|
87 |
-
<show_in_default>1</show_in_default>
|
88 |
-
<show_in_website>1</show_in_website>
|
89 |
-
<show_in_store>1</show_in_store>
|
90 |
-
</skyboxintegration>
|
91 |
-
<skyboxurlapi translate="label">
|
92 |
-
<label>SkyBox Url API:</label>
|
93 |
-
<comment>Url API By Skybox Checkout International</comment>
|
94 |
-
<frontend_type>text</frontend_type>
|
95 |
-
<sort_order>8</sort_order>
|
96 |
-
<show_in_default>1</show_in_default>
|
97 |
-
<show_in_website>1</show_in_website>
|
98 |
-
<show_in_store>1</show_in_store>
|
99 |
-
</skyboxurlapi>
|
100 |
-
<skyboxurlmain translate="label">
|
101 |
-
<label>SkyBox Url Client:</label>
|
102 |
-
<comment>Url Client By Skybox Checkout International</comment>
|
103 |
-
<frontend_type>text</frontend_type>
|
104 |
-
<sort_order>9</sort_order>
|
105 |
-
<show_in_default>1</show_in_default>
|
106 |
-
<show_in_website>1</show_in_website>
|
107 |
-
<show_in_store>1</show_in_store>
|
108 |
-
</skyboxurlmain>
|
109 |
-
</fields>
|
110 |
-
</skyboxsettings>
|
111 |
-
<skyboxproduct translate="label" module="skyboxinternational">
|
112 |
-
<label>Tax Product</label>
|
113 |
-
<frontend_type>text</frontend_type>
|
114 |
-
<!--<comment>Tax + Price product</comment>-->
|
115 |
-
<sort_order>20</sort_order>
|
116 |
-
<show_in_default>1</show_in_default>
|
117 |
-
<show_in_website>1</show_in_website>
|
118 |
-
<show_in_store>1</show_in_store>
|
119 |
-
<fields>
|
120 |
-
<skyboxaddtaxtopriceenable translate="label">
|
121 |
-
<label>Add Tax to Price</label>
|
122 |
-
<frontend_type>select</frontend_type>
|
123 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
124 |
-
<sort_order>1</sort_order>
|
125 |
-
<show_in_default>1</show_in_default>
|
126 |
-
<show_in_website>1</show_in_website>
|
127 |
-
<show_in_store>1</show_in_store>
|
128 |
-
</skyboxaddtaxtopriceenable>
|
129 |
-
</fields>
|
130 |
-
</skyboxproduct>
|
131 |
-
</groups>
|
132 |
-
</skyboxinternational>
|
133 |
-
</sections>
|
134 |
</config>
|
1 |
+
<config>
|
2 |
+
<tabs>
|
3 |
+
<skyboxinternational translate="label" module="skyboxinternational">
|
4 |
+
<label>Skybox Checkout</label>
|
5 |
+
<sort_order>100</sort_order>
|
6 |
+
</skyboxinternational>
|
7 |
+
</tabs>
|
8 |
+
<sections>
|
9 |
+
<skyboxinternational translate="label" module="skyboxinternational">
|
10 |
+
<label>Skybox Checkout Settings</label>
|
11 |
+
<tab>skyboxinternational</tab>
|
12 |
+
<sort_order>1000</sort_order>
|
13 |
+
<show_in_default>1</show_in_default>
|
14 |
+
<show_in_website>1</show_in_website>
|
15 |
+
<show_in_store>1</show_in_store>
|
16 |
+
<groups>
|
17 |
+
<skyboxsettings translate="label" module="skyboxinternational">
|
18 |
+
<label>Merchant Settings</label>
|
19 |
+
<frontend_type>text</frontend_type>
|
20 |
+
<sort_order>10</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<fields>
|
25 |
+
<skyboxactive translate="label">
|
26 |
+
<label>Enabled</label>
|
27 |
+
<frontend_type>select</frontend_type>
|
28 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
29 |
+
<sort_order>1</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</skyboxactive>
|
34 |
+
<merchantcode translate="label">
|
35 |
+
<label>Merchant Id:</label>
|
36 |
+
<comment>Code Merchant by Skybox Checkout International</comment>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<sort_order>2</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
</merchantcode>
|
43 |
+
<merchantkey translate="label">
|
44 |
+
<label>Merchant Key:</label>
|
45 |
+
<comment>Key Merchant by Skybox Checkout International</comment>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>3</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</merchantkey>
|
52 |
+
<weigthunitproduct translate="label">
|
53 |
+
<label>Weight Unit:</label>
|
54 |
+
<comment>Source model provider Magento's unit of measure values</comment>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<sort_order>4</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
<source_model>usa/shipping_carrier_ups_source_unitofmeasure</source_model>
|
61 |
+
</weigthunitproduct>
|
62 |
+
<skyboxlog translate="label">
|
63 |
+
<label>Save API Responses</label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
+
<sort_order>5</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</skyboxlog>
|
71 |
+
<skyboxemail translate="label">
|
72 |
+
<label>SkyBox Email:</label>
|
73 |
+
<comment>SkyBox Email</comment>
|
74 |
+
<frontend_type>text</frontend_type>
|
75 |
+
<validate>validate-email</validate>
|
76 |
+
<sort_order>6</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</skyboxemail>
|
81 |
+
<skyboxintegration translate="label">
|
82 |
+
<label>SkyBox Itegration:</label>
|
83 |
+
<comment>SkyBox Integration</comment>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<!-- validate>validate-email</validate -->
|
86 |
+
<sort_order>7</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
</skyboxintegration>
|
91 |
+
<skyboxurlapi translate="label">
|
92 |
+
<label>SkyBox Url API:</label>
|
93 |
+
<comment>Url API By Skybox Checkout International</comment>
|
94 |
+
<frontend_type>text</frontend_type>
|
95 |
+
<sort_order>8</sort_order>
|
96 |
+
<show_in_default>1</show_in_default>
|
97 |
+
<show_in_website>1</show_in_website>
|
98 |
+
<show_in_store>1</show_in_store>
|
99 |
+
</skyboxurlapi>
|
100 |
+
<skyboxurlmain translate="label">
|
101 |
+
<label>SkyBox Url Client:</label>
|
102 |
+
<comment>Url Client By Skybox Checkout International</comment>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<sort_order>9</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
</skyboxurlmain>
|
109 |
+
</fields>
|
110 |
+
</skyboxsettings>
|
111 |
+
<skyboxproduct translate="label" module="skyboxinternational">
|
112 |
+
<label>Tax Product</label>
|
113 |
+
<frontend_type>text</frontend_type>
|
114 |
+
<!--<comment>Tax + Price product</comment>-->
|
115 |
+
<sort_order>20</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>1</show_in_store>
|
119 |
+
<fields>
|
120 |
+
<skyboxaddtaxtopriceenable translate="label">
|
121 |
+
<label>Add Tax to Price</label>
|
122 |
+
<frontend_type>select</frontend_type>
|
123 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
124 |
+
<sort_order>1</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>1</show_in_store>
|
128 |
+
</skyboxaddtaxtopriceenable>
|
129 |
+
</fields>
|
130 |
+
</skyboxproduct>
|
131 |
+
</groups>
|
132 |
+
</skyboxinternational>
|
133 |
+
</sections>
|
134 |
</config>
|
app/code/community/Skybox/Services/Model/Api.php
CHANGED
@@ -1,310 +1,310 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Services
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Services
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* Skybox Services API
|
14 |
-
*
|
15 |
-
* @author Luis Alex Cordova Leon <lcordova@skyworldint.com>
|
16 |
-
*/
|
17 |
-
|
18 |
-
class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
19 |
-
{
|
20 |
-
const SKYBOX_SHIPPING = 'skyboxcheckout_shipping_skyboxcheckout';
|
21 |
-
const SKYBOX_PAYMENT = 'skyboxcheckout_pay';
|
22 |
-
|
23 |
-
public function __construct()
|
24 |
-
{
|
25 |
-
Mage::log("API Construct started " . date('m/d/Y h:i:s a', time()));
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Field name in session for saving store id
|
31 |
-
* @var int $orderIncrementId
|
32 |
-
* @var string $status
|
33 |
-
* @return boolean
|
34 |
-
*/
|
35 |
-
public function setStatusOrder($orderIncrementId, $status)
|
36 |
-
{
|
37 |
-
try {
|
38 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
39 |
-
$order->setData('state', $status); //complete
|
40 |
-
$order->setStatus($status);
|
41 |
-
if(Mage_Sales_Model_Order::STATE_PROCESSING == $status){
|
42 |
-
$order->setTotalPaid($order->getGrandTotal());
|
43 |
-
}elseif(Mage_Sales_Model_Order::STATE_COMPLETE == $status){
|
44 |
-
$history = $order->addStatusHistoryComment('La orden se estableció como completa', false);
|
45 |
-
$history->setIsCustomerNotified(false);
|
46 |
-
}
|
47 |
-
$order->save();
|
48 |
-
return true;
|
49 |
-
} catch (Exception $e) {
|
50 |
-
return false;
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
|
55 |
-
public function setQuoteDesactive($quoteId)
|
56 |
-
{
|
57 |
-
try {
|
58 |
-
Mage::log("API setQuoteDesactive started " . date('m/d/Y h:i:s a', time()));
|
59 |
-
$quote = Mage::getModel("sales/quote");
|
60 |
-
$quote->loadByIdWithoutStore($quoteId);
|
61 |
-
$quote->setIsActive(false);
|
62 |
-
$quote->save();
|
63 |
-
Mage::log("API setQuoteDesactive finished " . date('m/d/Y h:i:s a', time()));
|
64 |
-
return true;
|
65 |
-
} catch (Exception $e) {
|
66 |
-
return false;
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
/*
|
71 |
-
* Return a order generated
|
72 |
-
*
|
73 |
-
* @params many
|
74 |
-
* @return integer Quote ID
|
75 |
-
*/
|
76 |
-
public function generateOrder($IdCart, $IdStore, $CustomerName, $CustomerLasName, $CustomerEmail, $CustomerAdresss, $CustomerPhone, $CustomerZipCode, $CityName, $CountryId, $RegionId, $regionName = '')
|
77 |
-
{
|
78 |
-
|
79 |
-
Mage::log("API generateOrder started " . date('m/d/Y h:i:s a', time()));
|
80 |
-
|
81 |
-
$quoteId = $IdCart; // should be!
|
82 |
-
|
83 |
-
/* @var $quote Mage_Sales_Model_Quote */
|
84 |
-
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
85 |
-
|
86 |
-
$address = $quote->getShippingAddress();
|
87 |
-
|
88 |
-
foreach ($quote->getAllItems() as $item) {
|
89 |
-
Mage::log(print_r($item->debug(), true), null, 'tracer.log', true);
|
90 |
-
$item->setCustomPrice($item->getPriceUsdSkybox());
|
91 |
-
$item->setOriginalCustomPrice($item->getPriceUsdSkybox());
|
92 |
-
// getOrderCurrencyCode
|
93 |
-
// $item->getProduct()->setIsSuperMode(true);
|
94 |
-
// $item->save();
|
95 |
-
}
|
96 |
-
|
97 |
-
/*
|
98 |
-
// Bug: When a customer is already registered as guest,
|
99 |
-
// it doesn't work with Customer validation
|
100 |
-
|
101 |
-
/* @var $customer Mage_Customer_Model_Customer
|
102 |
-
$customer = Mage::getModel('customer/customer');
|
103 |
-
$customer
|
104 |
-
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())// or 1
|
105 |
-
->loadByEmail($CustomerEmail);
|
106 |
-
|
107 |
-
if ($customer->getId()) {
|
108 |
-
$quote->assignCustomer($customer); // for customer orders
|
109 |
-
} else {
|
110 |
-
// ...
|
111 |
-
}
|
112 |
-
*/
|
113 |
-
|
114 |
-
// for guest orders only
|
115 |
-
$quote->setIsMultiShipping(false);
|
116 |
-
$quote->setCheckoutMethod('guest');
|
117 |
-
$quote->setCustomerId(null);
|
118 |
-
$quote->setCustomerEmail($CustomerEmail);
|
119 |
-
$quote->setCustomerIsGuest(true);
|
120 |
-
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
121 |
-
|
122 |
-
$grandTotal = $address->getBaseGrandTotalSkybox();
|
123 |
-
// $quote->setBaseGrandTotal($grandTotal);
|
124 |
-
// $quote->setGrandTotal($grandTotal);
|
125 |
-
// setBaseCurrencyCode(string $value)
|
126 |
-
// setGlobalCurrencyCode(string $value)
|
127 |
-
// setQuoteCurrencyCode(string $value)
|
128 |
-
// setStoreCurrencyCode(string $value)
|
129 |
-
|
130 |
-
// Just for Guest User
|
131 |
-
$CustomerLasName = ($CustomerLasName != null) ? $CustomerLasName : $CustomerName;
|
132 |
-
|
133 |
-
$addressData = array(
|
134 |
-
'firstname' => $CustomerName,
|
135 |
-
'lastname' => $CustomerLasName,
|
136 |
-
'street' => $CustomerAdresss,
|
137 |
-
'city' => $CityName,
|
138 |
-
'postcode' => $CustomerZipCode,
|
139 |
-
'telephone' => $CustomerPhone,
|
140 |
-
'country_id' => $CountryId,
|
141 |
-
'region_id' => $RegionId,
|
142 |
-
'region' => $regionName,
|
143 |
-
'is_default_billing' => '1',
|
144 |
-
);
|
145 |
-
|
146 |
-
$billingAddress = $quote->getBillingAddress()->addData($addressData);
|
147 |
-
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
|
148 |
-
|
149 |
-
// if(!Mage::getStoreConfig('payment/checkmo/active')){
|
150 |
-
// Mage::log('Desactivado checkmo', null, 'tracer.log', true);
|
151 |
-
// Mage::app()->getStore()->setConfig('payment/checkmo/active', true);
|
152 |
-
// }
|
153 |
-
|
154 |
-
$shippingAddress->setCollectShippingRates(true)
|
155 |
-
->collectShippingRates()
|
156 |
-
->setShippingMethod(self::SKYBOX_SHIPPING)//flatrate_flatrate
|
157 |
-
->setPaymentMethod(self::SKYBOX_PAYMENT);
|
158 |
-
|
159 |
-
$quote->getPayment()->importData(array('method' => self::SKYBOX_PAYMENT));
|
160 |
-
// $quote->getPayment()->importData(array('method' => 'checkmo'));
|
161 |
-
|
162 |
-
$quote->collectTotals()->save();
|
163 |
-
|
164 |
-
$address->setGrandTotal($grandTotal);
|
165 |
-
$address->setBaseGrandTotal($grandTotal);
|
166 |
-
|
167 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
168 |
-
$service->submitAll();
|
169 |
-
|
170 |
-
try {
|
171 |
-
$order = $service->getOrder();
|
172 |
-
|
173 |
-
// Comment
|
174 |
-
$comment = "This order was generated by Skybox Checkout";
|
175 |
-
$order->addStatusHistoryComment($comment);
|
176 |
-
$order->save();
|
177 |
-
|
178 |
-
// setQuoteDesactive
|
179 |
-
$this->setQuoteDesactive($quoteId);
|
180 |
-
//$quote->setIsActive(false);
|
181 |
-
|
182 |
-
/*Mage::log("Order " . $order->getIncrementId() . " was created");
|
183 |
-
Mage::log("API generateOrder finished " . date('m/d/Y h:i:s a', time()));
|
184 |
-
Mage::log("API Construct finished " . date('m/d/Y h:i:s a', time()));
|
185 |
-
Mage::log("getShippingMethod: " . $order->getShippingMethod());*/
|
186 |
-
return $order->getIncrementId();
|
187 |
-
} catch (Exception $e) {
|
188 |
-
Mage::log("exception", null, 'servicios.log', true);
|
189 |
-
Mage::log($e->getMessage());
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
public function generateOrderFull($DataProducts, $IdStore, $CustomerName, $CustomerLasName, $CustomerEmail, $CustomerAdresss, $CustomerPhone, $CustomerZipCode, $CityName, $CountryId, $RegionId, $regionName = '')
|
194 |
-
{
|
195 |
-
Mage::log("API generateOrderFull started " . date('m/d/Y h:i:s a', time()));
|
196 |
-
|
197 |
-
$IdStore = !empty($IdStore)?$IdStore:Mage::app()->getStore('default')->getId();
|
198 |
-
$quote = Mage::getModel('sales/quote')->setStoreId($IdStore);
|
199 |
-
$productList = array();
|
200 |
-
$objData = json_decode($DataProducts);
|
201 |
-
Mage::log('########### $objData ###########', null, 'tracer.log', true);
|
202 |
-
Mage::log(print_r($objData, true), null, 'tracer.log', true);
|
203 |
-
if(count($objData->Products)>0){
|
204 |
-
foreach ($objData->Products as $prod){
|
205 |
-
$product = Mage::getModel('catalog/product')->load($prod->ProductId);
|
206 |
-
$buyInfo = array(
|
207 |
-
'qty' => $prod->Quantity,
|
208 |
-
// custom option id => value id
|
209 |
-
// or
|
210 |
-
// configurable attribute id => value id
|
211 |
-
);
|
212 |
-
$productList[$prod->ProductId] = $prod;
|
213 |
-
$quote->addProduct($product, new Varien_Object($buyInfo));
|
214 |
-
}
|
215 |
-
}
|
216 |
-
Mage::log('########### $productList ###########', null, 'tracer.log', true);
|
217 |
-
Mage::log(print_r($productList, true), null, 'tracer.log', true);
|
218 |
-
|
219 |
-
$quoteId = $quote->getId();
|
220 |
-
|
221 |
-
$address = $quote->getShippingAddress();
|
222 |
-
|
223 |
-
foreach ($quote->getAllItems() as $item) {
|
224 |
-
Mage::log('########### $item ###########', null, 'tracer.log', true);
|
225 |
-
// Mage::log(print_r($item->debug(), true), null, 'tracer.log', true);
|
226 |
-
Mage::log(print_r($item->getProductId(), true), null, 'tracer.log', true);
|
227 |
-
$prod = $productList[$item->getProductId()];
|
228 |
-
Mage::log('########### PROD ###########', null, 'tracer.log', true);
|
229 |
-
Mage::log(print_r($prod, true), null, 'tracer.log', true);
|
230 |
-
$item->setCustomPrice($prod->ProductPriceUSD);
|
231 |
-
$item->setOriginalCustomPrice($prod->ProductPriceUSD);
|
232 |
-
// getOrderCurrencyCode
|
233 |
-
// $item->getProduct()->setIsSuperMode(true);
|
234 |
-
// $item->save();
|
235 |
-
}
|
236 |
-
|
237 |
-
// for guest orders only
|
238 |
-
$quote->setIsMultiShipping(false);
|
239 |
-
$quote->setCheckoutMethod('guest');
|
240 |
-
$quote->setCustomerId(null);
|
241 |
-
$quote->setCustomerEmail($CustomerEmail);
|
242 |
-
$quote->setCustomerIsGuest(true);
|
243 |
-
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
244 |
-
|
245 |
-
// $grandTotal = $address->getBaseGrandTotalSkybox();
|
246 |
-
$grandTotal = $objData->TotalShoppingCart->TotalPriceUSD;
|
247 |
-
Mage::log('########### $grandTotal ###########', null, 'tracer.log', true);
|
248 |
-
Mage::log(print_r($grandTotal, true), null, 'tracer.log', true);
|
249 |
-
// $quote->setBaseGrandTotal($grandTotal);
|
250 |
-
// $quote->setGrandTotal($grandTotal);
|
251 |
-
// setBaseCurrencyCode(string $value)
|
252 |
-
// setGlobalCurrencyCode(string $value)
|
253 |
-
// setQuoteCurrencyCode(string $value)
|
254 |
-
// setStoreCurrencyCode(string $value)
|
255 |
-
|
256 |
-
// Just for Guest User
|
257 |
-
$CustomerLasName = ($CustomerLasName != null) ? $CustomerLasName : $CustomerName;
|
258 |
-
|
259 |
-
$addressData = array(
|
260 |
-
'firstname' => $CustomerName,
|
261 |
-
'lastname' => $CustomerLasName,
|
262 |
-
'street' => $CustomerAdresss,
|
263 |
-
'city' => $CityName,
|
264 |
-
'postcode' => $CustomerZipCode,
|
265 |
-
'telephone' => $CustomerPhone,
|
266 |
-
'country_id' => $CountryId,
|
267 |
-
'region_id' => $RegionId,
|
268 |
-
'region' => $regionName,
|
269 |
-
'is_default_billing' => '1',
|
270 |
-
);
|
271 |
-
|
272 |
-
$billingAddress = $quote->getBillingAddress()->addData($addressData);
|
273 |
-
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
|
274 |
-
|
275 |
-
$shippingAddress->setCollectShippingRates(true)
|
276 |
-
->collectShippingRates()
|
277 |
-
->setShippingMethod(self::SKYBOX_SHIPPING)//flatrate_flatrate
|
278 |
-
->setPaymentMethod(self::SKYBOX_PAYMENT);
|
279 |
-
|
280 |
-
$quote->getPayment()->importData(array('method' => self::SKYBOX_PAYMENT));
|
281 |
-
|
282 |
-
$quote->collectTotals()->save();
|
283 |
-
|
284 |
-
$address->setConceptsSkybox(json_encode($objData->TotalShoppingCart->ListDetailConcepts));
|
285 |
-
$address->setGrandTotal($grandTotal);
|
286 |
-
$address->setBaseGrandTotal($grandTotal);
|
287 |
-
|
288 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
289 |
-
$service->submitAll();
|
290 |
-
|
291 |
-
try {
|
292 |
-
$order = $service->getOrder();
|
293 |
-
|
294 |
-
// Comment
|
295 |
-
$comment = "This order was generated by Skybox Checkout";
|
296 |
-
$order->addStatusHistoryComment($comment);
|
297 |
-
$order->setTotalPaid($order->getGrandTotal());
|
298 |
-
$order->save();
|
299 |
-
|
300 |
-
// setQuoteDesactive
|
301 |
-
$this->setQuoteDesactive($quoteId);
|
302 |
-
//$quote->setIsActive(false);
|
303 |
-
|
304 |
-
return $order->getIncrementId();
|
305 |
-
} catch (Exception $e) {
|
306 |
-
Mage::log("exception", null, 'servicios.log', true);
|
307 |
-
Mage::log($e->getMessage());
|
308 |
-
}
|
309 |
-
}
|
310 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Services
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Services
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
*
|
13 |
+
* Skybox Services API
|
14 |
+
*
|
15 |
+
* @author Luis Alex Cordova Leon <lcordova@skyworldint.com>
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
19 |
+
{
|
20 |
+
const SKYBOX_SHIPPING = 'skyboxcheckout_shipping_skyboxcheckout';
|
21 |
+
const SKYBOX_PAYMENT = 'skyboxcheckout_pay';
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
Mage::log("API Construct started " . date('m/d/Y h:i:s a', time()));
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Field name in session for saving store id
|
31 |
+
* @var int $orderIncrementId
|
32 |
+
* @var string $status
|
33 |
+
* @return boolean
|
34 |
+
*/
|
35 |
+
public function setStatusOrder($orderIncrementId, $status)
|
36 |
+
{
|
37 |
+
try {
|
38 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
39 |
+
$order->setData('state', $status); //complete
|
40 |
+
$order->setStatus($status);
|
41 |
+
if(Mage_Sales_Model_Order::STATE_PROCESSING == $status){
|
42 |
+
$order->setTotalPaid($order->getGrandTotal());
|
43 |
+
}elseif(Mage_Sales_Model_Order::STATE_COMPLETE == $status){
|
44 |
+
$history = $order->addStatusHistoryComment('La orden se estableció como completa', false);
|
45 |
+
$history->setIsCustomerNotified(false);
|
46 |
+
}
|
47 |
+
$order->save();
|
48 |
+
return true;
|
49 |
+
} catch (Exception $e) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
public function setQuoteDesactive($quoteId)
|
56 |
+
{
|
57 |
+
try {
|
58 |
+
Mage::log("API setQuoteDesactive started " . date('m/d/Y h:i:s a', time()));
|
59 |
+
$quote = Mage::getModel("sales/quote");
|
60 |
+
$quote->loadByIdWithoutStore($quoteId);
|
61 |
+
$quote->setIsActive(false);
|
62 |
+
$quote->save();
|
63 |
+
Mage::log("API setQuoteDesactive finished " . date('m/d/Y h:i:s a', time()));
|
64 |
+
return true;
|
65 |
+
} catch (Exception $e) {
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/*
|
71 |
+
* Return a order generated
|
72 |
+
*
|
73 |
+
* @params many
|
74 |
+
* @return integer Quote ID
|
75 |
+
*/
|
76 |
+
public function generateOrder($IdCart, $IdStore, $CustomerName, $CustomerLasName, $CustomerEmail, $CustomerAdresss, $CustomerPhone, $CustomerZipCode, $CityName, $CountryId, $RegionId, $regionName = '')
|
77 |
+
{
|
78 |
+
|
79 |
+
Mage::log("API generateOrder started " . date('m/d/Y h:i:s a', time()));
|
80 |
+
|
81 |
+
$quoteId = $IdCart; // should be!
|
82 |
+
|
83 |
+
/* @var $quote Mage_Sales_Model_Quote */
|
84 |
+
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
85 |
+
|
86 |
+
$address = $quote->getShippingAddress();
|
87 |
+
|
88 |
+
foreach ($quote->getAllItems() as $item) {
|
89 |
+
Mage::log(print_r($item->debug(), true), null, 'tracer.log', true);
|
90 |
+
$item->setCustomPrice($item->getPriceUsdSkybox());
|
91 |
+
$item->setOriginalCustomPrice($item->getPriceUsdSkybox());
|
92 |
+
// getOrderCurrencyCode
|
93 |
+
// $item->getProduct()->setIsSuperMode(true);
|
94 |
+
// $item->save();
|
95 |
+
}
|
96 |
+
|
97 |
+
/*
|
98 |
+
// Bug: When a customer is already registered as guest,
|
99 |
+
// it doesn't work with Customer validation
|
100 |
+
|
101 |
+
/* @var $customer Mage_Customer_Model_Customer
|
102 |
+
$customer = Mage::getModel('customer/customer');
|
103 |
+
$customer
|
104 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())// or 1
|
105 |
+
->loadByEmail($CustomerEmail);
|
106 |
+
|
107 |
+
if ($customer->getId()) {
|
108 |
+
$quote->assignCustomer($customer); // for customer orders
|
109 |
+
} else {
|
110 |
+
// ...
|
111 |
+
}
|
112 |
+
*/
|
113 |
+
|
114 |
+
// for guest orders only
|
115 |
+
$quote->setIsMultiShipping(false);
|
116 |
+
$quote->setCheckoutMethod('guest');
|
117 |
+
$quote->setCustomerId(null);
|
118 |
+
$quote->setCustomerEmail($CustomerEmail);
|
119 |
+
$quote->setCustomerIsGuest(true);
|
120 |
+
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
121 |
+
|
122 |
+
$grandTotal = $address->getBaseGrandTotalSkybox();
|
123 |
+
// $quote->setBaseGrandTotal($grandTotal);
|
124 |
+
// $quote->setGrandTotal($grandTotal);
|
125 |
+
// setBaseCurrencyCode(string $value)
|
126 |
+
// setGlobalCurrencyCode(string $value)
|
127 |
+
// setQuoteCurrencyCode(string $value)
|
128 |
+
// setStoreCurrencyCode(string $value)
|
129 |
+
|
130 |
+
// Just for Guest User
|
131 |
+
$CustomerLasName = ($CustomerLasName != null) ? $CustomerLasName : $CustomerName;
|
132 |
+
|
133 |
+
$addressData = array(
|
134 |
+
'firstname' => $CustomerName,
|
135 |
+
'lastname' => $CustomerLasName,
|
136 |
+
'street' => $CustomerAdresss,
|
137 |
+
'city' => $CityName,
|
138 |
+
'postcode' => $CustomerZipCode,
|
139 |
+
'telephone' => $CustomerPhone,
|
140 |
+
'country_id' => $CountryId,
|
141 |
+
'region_id' => $RegionId,
|
142 |
+
'region' => $regionName,
|
143 |
+
'is_default_billing' => '1',
|
144 |
+
);
|
145 |
+
|
146 |
+
$billingAddress = $quote->getBillingAddress()->addData($addressData);
|
147 |
+
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
|
148 |
+
|
149 |
+
// if(!Mage::getStoreConfig('payment/checkmo/active')){
|
150 |
+
// Mage::log('Desactivado checkmo', null, 'tracer.log', true);
|
151 |
+
// Mage::app()->getStore()->setConfig('payment/checkmo/active', true);
|
152 |
+
// }
|
153 |
+
|
154 |
+
$shippingAddress->setCollectShippingRates(true)
|
155 |
+
->collectShippingRates()
|
156 |
+
->setShippingMethod(self::SKYBOX_SHIPPING)//flatrate_flatrate
|
157 |
+
->setPaymentMethod(self::SKYBOX_PAYMENT);
|
158 |
+
|
159 |
+
$quote->getPayment()->importData(array('method' => self::SKYBOX_PAYMENT));
|
160 |
+
// $quote->getPayment()->importData(array('method' => 'checkmo'));
|
161 |
+
|
162 |
+
$quote->collectTotals()->save();
|
163 |
+
|
164 |
+
$address->setGrandTotal($grandTotal);
|
165 |
+
$address->setBaseGrandTotal($grandTotal);
|
166 |
+
|
167 |
+
$service = Mage::getModel('sales/service_quote', $quote);
|
168 |
+
$service->submitAll();
|
169 |
+
|
170 |
+
try {
|
171 |
+
$order = $service->getOrder();
|
172 |
+
|
173 |
+
// Comment
|
174 |
+
$comment = "This order was generated by Skybox Checkout";
|
175 |
+
$order->addStatusHistoryComment($comment);
|
176 |
+
$order->save();
|
177 |
+
|
178 |
+
// setQuoteDesactive
|
179 |
+
$this->setQuoteDesactive($quoteId);
|
180 |
+
//$quote->setIsActive(false);
|
181 |
+
|
182 |
+
/*Mage::log("Order " . $order->getIncrementId() . " was created");
|
183 |
+
Mage::log("API generateOrder finished " . date('m/d/Y h:i:s a', time()));
|
184 |
+
Mage::log("API Construct finished " . date('m/d/Y h:i:s a', time()));
|
185 |
+
Mage::log("getShippingMethod: " . $order->getShippingMethod());*/
|
186 |
+
return $order->getIncrementId();
|
187 |
+
} catch (Exception $e) {
|
188 |
+
Mage::log("exception", null, 'servicios.log', true);
|
189 |
+
Mage::log($e->getMessage());
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
public function generateOrderFull($DataProducts, $IdStore, $CustomerName, $CustomerLasName, $CustomerEmail, $CustomerAdresss, $CustomerPhone, $CustomerZipCode, $CityName, $CountryId, $RegionId, $regionName = '')
|
194 |
+
{
|
195 |
+
Mage::log("API generateOrderFull started " . date('m/d/Y h:i:s a', time()));
|
196 |
+
|
197 |
+
$IdStore = !empty($IdStore)?$IdStore:Mage::app()->getStore('default')->getId();
|
198 |
+
$quote = Mage::getModel('sales/quote')->setStoreId($IdStore);
|
199 |
+
$productList = array();
|
200 |
+
$objData = json_decode($DataProducts);
|
201 |
+
Mage::log('########### $objData ###########', null, 'tracer.log', true);
|
202 |
+
Mage::log(print_r($objData, true), null, 'tracer.log', true);
|
203 |
+
if(count($objData->Products)>0){
|
204 |
+
foreach ($objData->Products as $prod){
|
205 |
+
$product = Mage::getModel('catalog/product')->load($prod->ProductId);
|
206 |
+
$buyInfo = array(
|
207 |
+
'qty' => $prod->Quantity,
|
208 |
+
// custom option id => value id
|
209 |
+
// or
|
210 |
+
// configurable attribute id => value id
|
211 |
+
);
|
212 |
+
$productList[$prod->ProductId] = $prod;
|
213 |
+
$quote->addProduct($product, new Varien_Object($buyInfo));
|
214 |
+
}
|
215 |
+
}
|
216 |
+
Mage::log('########### $productList ###########', null, 'tracer.log', true);
|
217 |
+
Mage::log(print_r($productList, true), null, 'tracer.log', true);
|
218 |
+
|
219 |
+
$quoteId = $quote->getId();
|
220 |
+
|
221 |
+
$address = $quote->getShippingAddress();
|
222 |
+
|
223 |
+
foreach ($quote->getAllItems() as $item) {
|
224 |
+
Mage::log('########### $item ###########', null, 'tracer.log', true);
|
225 |
+
// Mage::log(print_r($item->debug(), true), null, 'tracer.log', true);
|
226 |
+
Mage::log(print_r($item->getProductId(), true), null, 'tracer.log', true);
|
227 |
+
$prod = $productList[$item->getProductId()];
|
228 |
+
Mage::log('########### PROD ###########', null, 'tracer.log', true);
|
229 |
+
Mage::log(print_r($prod, true), null, 'tracer.log', true);
|
230 |
+
$item->setCustomPrice($prod->ProductPriceUSD);
|
231 |
+
$item->setOriginalCustomPrice($prod->ProductPriceUSD);
|
232 |
+
// getOrderCurrencyCode
|
233 |
+
// $item->getProduct()->setIsSuperMode(true);
|
234 |
+
// $item->save();
|
235 |
+
}
|
236 |
+
|
237 |
+
// for guest orders only
|
238 |
+
$quote->setIsMultiShipping(false);
|
239 |
+
$quote->setCheckoutMethod('guest');
|
240 |
+
$quote->setCustomerId(null);
|
241 |
+
$quote->setCustomerEmail($CustomerEmail);
|
242 |
+
$quote->setCustomerIsGuest(true);
|
243 |
+
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
244 |
+
|
245 |
+
// $grandTotal = $address->getBaseGrandTotalSkybox();
|
246 |
+
$grandTotal = $objData->TotalShoppingCart->TotalPriceUSD;
|
247 |
+
Mage::log('########### $grandTotal ###########', null, 'tracer.log', true);
|
248 |
+
Mage::log(print_r($grandTotal, true), null, 'tracer.log', true);
|
249 |
+
// $quote->setBaseGrandTotal($grandTotal);
|
250 |
+
// $quote->setGrandTotal($grandTotal);
|
251 |
+
// setBaseCurrencyCode(string $value)
|
252 |
+
// setGlobalCurrencyCode(string $value)
|
253 |
+
// setQuoteCurrencyCode(string $value)
|
254 |
+
// setStoreCurrencyCode(string $value)
|
255 |
+
|
256 |
+
// Just for Guest User
|
257 |
+
$CustomerLasName = ($CustomerLasName != null) ? $CustomerLasName : $CustomerName;
|
258 |
+
|
259 |
+
$addressData = array(
|
260 |
+
'firstname' => $CustomerName,
|
261 |
+
'lastname' => $CustomerLasName,
|
262 |
+
'street' => $CustomerAdresss,
|
263 |
+
'city' => $CityName,
|
264 |
+
'postcode' => $CustomerZipCode,
|
265 |
+
'telephone' => $CustomerPhone,
|
266 |
+
'country_id' => $CountryId,
|
267 |
+
'region_id' => $RegionId,
|
268 |
+
'region' => $regionName,
|
269 |
+
'is_default_billing' => '1',
|
270 |
+
);
|
271 |
+
|
272 |
+
$billingAddress = $quote->getBillingAddress()->addData($addressData);
|
273 |
+
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
|
274 |
+
|
275 |
+
$shippingAddress->setCollectShippingRates(true)
|
276 |
+
->collectShippingRates()
|
277 |
+
->setShippingMethod(self::SKYBOX_SHIPPING)//flatrate_flatrate
|
278 |
+
->setPaymentMethod(self::SKYBOX_PAYMENT);
|
279 |
+
|
280 |
+
$quote->getPayment()->importData(array('method' => self::SKYBOX_PAYMENT));
|
281 |
+
|
282 |
+
$quote->collectTotals()->save();
|
283 |
+
|
284 |
+
$address->setConceptsSkybox(json_encode($objData->TotalShoppingCart->ListDetailConcepts));
|
285 |
+
$address->setGrandTotal($grandTotal);
|
286 |
+
$address->setBaseGrandTotal($grandTotal);
|
287 |
+
|
288 |
+
$service = Mage::getModel('sales/service_quote', $quote);
|
289 |
+
$service->submitAll();
|
290 |
+
|
291 |
+
try {
|
292 |
+
$order = $service->getOrder();
|
293 |
+
|
294 |
+
// Comment
|
295 |
+
$comment = "This order was generated by Skybox Checkout";
|
296 |
+
$order->addStatusHistoryComment($comment);
|
297 |
+
$order->setTotalPaid($order->getGrandTotal());
|
298 |
+
$order->save();
|
299 |
+
|
300 |
+
// setQuoteDesactive
|
301 |
+
$this->setQuoteDesactive($quoteId);
|
302 |
+
//$quote->setIsActive(false);
|
303 |
+
|
304 |
+
return $order->getIncrementId();
|
305 |
+
} catch (Exception $e) {
|
306 |
+
Mage::log("exception", null, 'servicios.log', true);
|
307 |
+
Mage::log($e->getMessage());
|
308 |
+
}
|
309 |
+
}
|
310 |
}
|
app/code/community/Skybox/Services/Model/Api/V2.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Skybox Services
|
5 |
-
*
|
6 |
-
* @category Skybox
|
7 |
-
* @package Skybox_Services
|
8 |
-
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
-
*/
|
10 |
-
class Skybox_Services_Model_Api_V2 extends Skybox_Services_Model_Api
|
11 |
-
{
|
12 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Skybox Services
|
5 |
+
*
|
6 |
+
* @category Skybox
|
7 |
+
* @package Skybox_Services
|
8 |
+
* @copyright Copyright (c) 2014 Skybox Checkout. (http://www.skyboxcheckout.com)
|
9 |
+
*/
|
10 |
+
class Skybox_Services_Model_Api_V2 extends Skybox_Services_Model_Api
|
11 |
+
{
|
12 |
}
|
app/code/community/Skybox/Services/etc/api.xml
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<api>
|
4 |
-
<resources>
|
5 |
-
<services>
|
6 |
-
<model>services/api</model>
|
7 |
-
<title>Skybox Web Services</title>
|
8 |
-
<methods>
|
9 |
-
<setStatusOrder translate="title" module="services">
|
10 |
-
<title>Change status order to complete</title>
|
11 |
-
<method>setStatusOrder</method>
|
12 |
-
<acl>services/setStatusOrder</acl>
|
13 |
-
</setStatusOrder>
|
14 |
-
<setQuoteDesactive translate="title" module="services">
|
15 |
-
<title>Change Quote to Desactive</title>
|
16 |
-
<method>setQuoteDesactive</method>
|
17 |
-
<acl>services/setQuoteDesactive</acl>
|
18 |
-
</setQuoteDesactive>
|
19 |
-
<generateOrder translate="title" module="services">
|
20 |
-
<title>Generate Order Magento</title>
|
21 |
-
<method>generateOrder</method>
|
22 |
-
<acl>services/generateOrder</acl>
|
23 |
-
</generateOrder>
|
24 |
-
<generateOrderFull translate="title" module="services">
|
25 |
-
<title>Generate Order Full Magento</title>
|
26 |
-
<method>generateOrderFull</method>
|
27 |
-
<acl>services/generateOrderFull</acl>
|
28 |
-
</generateOrderFull>
|
29 |
-
</methods>
|
30 |
-
</services>
|
31 |
-
</resources>
|
32 |
-
<v2>
|
33 |
-
<resources_function_prefix>
|
34 |
-
<services>services</services>
|
35 |
-
</resources_function_prefix>
|
36 |
-
</v2>
|
37 |
-
</api>
|
38 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<api>
|
4 |
+
<resources>
|
5 |
+
<services>
|
6 |
+
<model>services/api</model>
|
7 |
+
<title>Skybox Web Services</title>
|
8 |
+
<methods>
|
9 |
+
<setStatusOrder translate="title" module="services">
|
10 |
+
<title>Change status order to complete</title>
|
11 |
+
<method>setStatusOrder</method>
|
12 |
+
<acl>services/setStatusOrder</acl>
|
13 |
+
</setStatusOrder>
|
14 |
+
<setQuoteDesactive translate="title" module="services">
|
15 |
+
<title>Change Quote to Desactive</title>
|
16 |
+
<method>setQuoteDesactive</method>
|
17 |
+
<acl>services/setQuoteDesactive</acl>
|
18 |
+
</setQuoteDesactive>
|
19 |
+
<generateOrder translate="title" module="services">
|
20 |
+
<title>Generate Order Magento</title>
|
21 |
+
<method>generateOrder</method>
|
22 |
+
<acl>services/generateOrder</acl>
|
23 |
+
</generateOrder>
|
24 |
+
<generateOrderFull translate="title" module="services">
|
25 |
+
<title>Generate Order Full Magento</title>
|
26 |
+
<method>generateOrderFull</method>
|
27 |
+
<acl>services/generateOrderFull</acl>
|
28 |
+
</generateOrderFull>
|
29 |
+
</methods>
|
30 |
+
</services>
|
31 |
+
</resources>
|
32 |
+
<v2>
|
33 |
+
<resources_function_prefix>
|
34 |
+
<services>services</services>
|
35 |
+
</resources_function_prefix>
|
36 |
+
</v2>
|
37 |
+
</api>
|
38 |
</config>
|
app/code/community/Skybox/Services/etc/config.xml
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Skybox_Services>
|
5 |
-
<active>true</active>
|
6 |
-
<version>0.1.0</version>
|
7 |
-
<codePool>community</codePool>
|
8 |
-
</Skybox_Services>
|
9 |
-
</modules>
|
10 |
-
<global>
|
11 |
-
<models>
|
12 |
-
<services>
|
13 |
-
<class>Skybox_Services_Model</class>
|
14 |
-
</services>
|
15 |
-
</models>
|
16 |
-
</global>
|
17 |
-
<!--frontend>
|
18 |
-
<events>
|
19 |
-
<controller_front_init_routers>
|
20 |
-
<observers>
|
21 |
-
<Skybox_checkout_model_observer><type>disabled</type></Skybox_checkout_model_observer>
|
22 |
-
</observers>
|
23 |
-
</controller_front_init_routers>
|
24 |
-
</events>
|
25 |
-
</frontend-->
|
26 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Skybox_Services>
|
5 |
+
<active>true</active>
|
6 |
+
<version>0.1.0</version>
|
7 |
+
<codePool>community</codePool>
|
8 |
+
</Skybox_Services>
|
9 |
+
</modules>
|
10 |
+
<global>
|
11 |
+
<models>
|
12 |
+
<services>
|
13 |
+
<class>Skybox_Services_Model</class>
|
14 |
+
</services>
|
15 |
+
</models>
|
16 |
+
</global>
|
17 |
+
<!--frontend>
|
18 |
+
<events>
|
19 |
+
<controller_front_init_routers>
|
20 |
+
<observers>
|
21 |
+
<Skybox_checkout_model_observer><type>disabled</type></Skybox_checkout_model_observer>
|
22 |
+
</observers>
|
23 |
+
</controller_front_init_routers>
|
24 |
+
</events>
|
25 |
+
</frontend-->
|
26 |
</config>
|
app/code/community/Skybox/Services/etc/wsdl.xml
CHANGED
@@ -1,142 +1,142 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
3 |
-
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
|
4 |
-
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
|
5 |
-
<types>
|
6 |
-
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
|
7 |
-
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
|
8 |
-
</schema>
|
9 |
-
</types>
|
10 |
-
|
11 |
-
<message name="servicesSetStatusOrderRequest">
|
12 |
-
<part name="sessionId" type="xsd:string" />
|
13 |
-
<part name="orderIncrementId" type="xsd:string" />
|
14 |
-
<part name="status" type="xsd:string" />
|
15 |
-
</message>
|
16 |
-
<message name="servicesSetStatusOrderResponse">
|
17 |
-
<part name="result" type="xsd:boolean" />
|
18 |
-
</message>
|
19 |
-
|
20 |
-
<message name="servicesSetQuoteDesactiveRequest">
|
21 |
-
<part name="sessionId" type="xsd:string" />
|
22 |
-
<part name="quoteId" type="xsd:int" />
|
23 |
-
</message>
|
24 |
-
<message name="servicesSetQuoteDesactiveResponse">
|
25 |
-
<part name="result" type="xsd:boolean" />
|
26 |
-
</message>
|
27 |
-
|
28 |
-
|
29 |
-
<message name="servicesGenerateOrderRequest">
|
30 |
-
<part name="sessionId" type="xsd:string" />
|
31 |
-
<part name="IdCart" type="xsd:int" />
|
32 |
-
<part name="IdStore" type="xsd:string" />
|
33 |
-
<part name="CustomerName" type="xsd:string" />
|
34 |
-
<part name="CustomerLasName" type="xsd:string" />
|
35 |
-
<part name="CustomerEmail" type="xsd:string" />
|
36 |
-
<part name="CustomerAdresss" type="xsd:string" />
|
37 |
-
<part name="CustomerPhone" type="xsd:string" />
|
38 |
-
<part name="CustomerZipCode" type="xsd:string" />
|
39 |
-
<part name="CityName" type="xsd:string" />
|
40 |
-
<part name="CountryId" type="xsd:string" />
|
41 |
-
<part name="RegionId" type="xsd:string" />
|
42 |
-
<part name="RegionName" type="xsd:string" />
|
43 |
-
</message>
|
44 |
-
|
45 |
-
<message name="servicesGenerateOrderResponse">
|
46 |
-
<part name="result" type="xsd:string" />
|
47 |
-
</message>
|
48 |
-
|
49 |
-
<message name="servicesGenerateOrderFullRequest">
|
50 |
-
<part name="sessionId" type="xsd:string" />
|
51 |
-
<part name="DataProducts" type="xsd:string" />
|
52 |
-
<part name="IdStore" type="xsd:string" />
|
53 |
-
<part name="CustomerName" type="xsd:string" />
|
54 |
-
<part name="CustomerLasName" type="xsd:string" />
|
55 |
-
<part name="CustomerEmail" type="xsd:string" />
|
56 |
-
<part name="CustomerAdresss" type="xsd:string" />
|
57 |
-
<part name="CustomerPhone" type="xsd:string" />
|
58 |
-
<part name="CustomerZipCode" type="xsd:string" />
|
59 |
-
<part name="CityName" type="xsd:string" />
|
60 |
-
<part name="CountryId" type="xsd:string" />
|
61 |
-
<part name="RegionId" type="xsd:string" />
|
62 |
-
<part name="RegionName" type="xsd:string" />
|
63 |
-
</message>
|
64 |
-
|
65 |
-
<message name="servicesGenerateOrderFullResponse">
|
66 |
-
<part name="result" type="xsd:string" />
|
67 |
-
</message>
|
68 |
-
|
69 |
-
|
70 |
-
<portType name="{{var wsdl.handler}}PortType">
|
71 |
-
|
72 |
-
<operation name="servicesSetStatusOrder">
|
73 |
-
<documentation>Change status order to complete</documentation>
|
74 |
-
<input message="typens:servicesSetStatusOrderRequest" />
|
75 |
-
<output message="typens:servicesSetStatusOrderResponse" />
|
76 |
-
</operation>
|
77 |
-
|
78 |
-
<operation name="servicesSetQuoteDesactive">
|
79 |
-
<documentation>Change Quote to Desactive</documentation>
|
80 |
-
<input message="typens:servicesSetQuoteDesactiveRequest" />
|
81 |
-
<output message="typens:servicesSetQuoteDesactiveResponse" />
|
82 |
-
</operation>
|
83 |
-
|
84 |
-
<operation name="servicesGenerateOrder">
|
85 |
-
<documentation>Generate Order Magento</documentation>
|
86 |
-
<input message="typens:servicesGenerateOrderRequest" />
|
87 |
-
<output message="typens:servicesGenerateOrderResponse" />
|
88 |
-
</operation>
|
89 |
-
|
90 |
-
<operation name="servicesGenerateOrderFull">
|
91 |
-
<documentation>Generate Order Full Magento</documentation>
|
92 |
-
<input message="typens:servicesGenerateOrderFullRequest" />
|
93 |
-
<output message="typens:servicesGenerateOrderFullResponse" />
|
94 |
-
</operation>
|
95 |
-
|
96 |
-
|
97 |
-
</portType>
|
98 |
-
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
|
99 |
-
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
|
100 |
-
|
101 |
-
<operation name="servicesSetStatusOrder">
|
102 |
-
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
103 |
-
<input>
|
104 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
105 |
-
</input>
|
106 |
-
<output>
|
107 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
108 |
-
</output>
|
109 |
-
</operation>
|
110 |
-
|
111 |
-
<operation name="servicesSetQuoteDesactive">
|
112 |
-
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
113 |
-
<input>
|
114 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
115 |
-
</input>
|
116 |
-
<output>
|
117 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
118 |
-
</output>
|
119 |
-
</operation>
|
120 |
-
|
121 |
-
<operation name="servicesGenerateOrder">
|
122 |
-
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
123 |
-
<input>
|
124 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
125 |
-
</input>
|
126 |
-
<output>
|
127 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
128 |
-
</output>
|
129 |
-
</operation>
|
130 |
-
|
131 |
-
<operation name="servicesGenerateOrderFull">
|
132 |
-
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
133 |
-
<input>
|
134 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
135 |
-
</input>
|
136 |
-
<output>
|
137 |
-
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
138 |
-
</output>
|
139 |
-
</operation>
|
140 |
-
|
141 |
-
</binding>
|
142 |
</definitions>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
3 |
+
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
|
4 |
+
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
|
5 |
+
<types>
|
6 |
+
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
|
7 |
+
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
|
8 |
+
</schema>
|
9 |
+
</types>
|
10 |
+
|
11 |
+
<message name="servicesSetStatusOrderRequest">
|
12 |
+
<part name="sessionId" type="xsd:string" />
|
13 |
+
<part name="orderIncrementId" type="xsd:string" />
|
14 |
+
<part name="status" type="xsd:string" />
|
15 |
+
</message>
|
16 |
+
<message name="servicesSetStatusOrderResponse">
|
17 |
+
<part name="result" type="xsd:boolean" />
|
18 |
+
</message>
|
19 |
+
|
20 |
+
<message name="servicesSetQuoteDesactiveRequest">
|
21 |
+
<part name="sessionId" type="xsd:string" />
|
22 |
+
<part name="quoteId" type="xsd:int" />
|
23 |
+
</message>
|
24 |
+
<message name="servicesSetQuoteDesactiveResponse">
|
25 |
+
<part name="result" type="xsd:boolean" />
|
26 |
+
</message>
|
27 |
+
|
28 |
+
|
29 |
+
<message name="servicesGenerateOrderRequest">
|
30 |
+
<part name="sessionId" type="xsd:string" />
|
31 |
+
<part name="IdCart" type="xsd:int" />
|
32 |
+
<part name="IdStore" type="xsd:string" />
|
33 |
+
<part name="CustomerName" type="xsd:string" />
|
34 |
+
<part name="CustomerLasName" type="xsd:string" />
|
35 |
+
<part name="CustomerEmail" type="xsd:string" />
|
36 |
+
<part name="CustomerAdresss" type="xsd:string" />
|
37 |
+
<part name="CustomerPhone" type="xsd:string" />
|
38 |
+
<part name="CustomerZipCode" type="xsd:string" />
|
39 |
+
<part name="CityName" type="xsd:string" />
|
40 |
+
<part name="CountryId" type="xsd:string" />
|
41 |
+
<part name="RegionId" type="xsd:string" />
|
42 |
+
<part name="RegionName" type="xsd:string" />
|
43 |
+
</message>
|
44 |
+
|
45 |
+
<message name="servicesGenerateOrderResponse">
|
46 |
+
<part name="result" type="xsd:string" />
|
47 |
+
</message>
|
48 |
+
|
49 |
+
<message name="servicesGenerateOrderFullRequest">
|
50 |
+
<part name="sessionId" type="xsd:string" />
|
51 |
+
<part name="DataProducts" type="xsd:string" />
|
52 |
+
<part name="IdStore" type="xsd:string" />
|
53 |
+
<part name="CustomerName" type="xsd:string" />
|
54 |
+
<part name="CustomerLasName" type="xsd:string" />
|
55 |
+
<part name="CustomerEmail" type="xsd:string" />
|
56 |
+
<part name="CustomerAdresss" type="xsd:string" />
|
57 |
+
<part name="CustomerPhone" type="xsd:string" />
|
58 |
+
<part name="CustomerZipCode" type="xsd:string" />
|
59 |
+
<part name="CityName" type="xsd:string" />
|
60 |
+
<part name="CountryId" type="xsd:string" />
|
61 |
+
<part name="RegionId" type="xsd:string" />
|
62 |
+
<part name="RegionName" type="xsd:string" />
|
63 |
+
</message>
|
64 |
+
|
65 |
+
<message name="servicesGenerateOrderFullResponse">
|
66 |
+
<part name="result" type="xsd:string" />
|
67 |
+
</message>
|
68 |
+
|
69 |
+
|
70 |
+
<portType name="{{var wsdl.handler}}PortType">
|
71 |
+
|
72 |
+
<operation name="servicesSetStatusOrder">
|
73 |
+
<documentation>Change status order to complete</documentation>
|
74 |
+
<input message="typens:servicesSetStatusOrderRequest" />
|
75 |
+
<output message="typens:servicesSetStatusOrderResponse" />
|
76 |
+
</operation>
|
77 |
+
|
78 |
+
<operation name="servicesSetQuoteDesactive">
|
79 |
+
<documentation>Change Quote to Desactive</documentation>
|
80 |
+
<input message="typens:servicesSetQuoteDesactiveRequest" />
|
81 |
+
<output message="typens:servicesSetQuoteDesactiveResponse" />
|
82 |
+
</operation>
|
83 |
+
|
84 |
+
<operation name="servicesGenerateOrder">
|
85 |
+
<documentation>Generate Order Magento</documentation>
|
86 |
+
<input message="typens:servicesGenerateOrderRequest" />
|
87 |
+
<output message="typens:servicesGenerateOrderResponse" />
|
88 |
+
</operation>
|
89 |
+
|
90 |
+
<operation name="servicesGenerateOrderFull">
|
91 |
+
<documentation>Generate Order Full Magento</documentation>
|
92 |
+
<input message="typens:servicesGenerateOrderFullRequest" />
|
93 |
+
<output message="typens:servicesGenerateOrderFullResponse" />
|
94 |
+
</operation>
|
95 |
+
|
96 |
+
|
97 |
+
</portType>
|
98 |
+
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
|
99 |
+
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
|
100 |
+
|
101 |
+
<operation name="servicesSetStatusOrder">
|
102 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
103 |
+
<input>
|
104 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
105 |
+
</input>
|
106 |
+
<output>
|
107 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
108 |
+
</output>
|
109 |
+
</operation>
|
110 |
+
|
111 |
+
<operation name="servicesSetQuoteDesactive">
|
112 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
113 |
+
<input>
|
114 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
115 |
+
</input>
|
116 |
+
<output>
|
117 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
118 |
+
</output>
|
119 |
+
</operation>
|
120 |
+
|
121 |
+
<operation name="servicesGenerateOrder">
|
122 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
123 |
+
<input>
|
124 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
125 |
+
</input>
|
126 |
+
<output>
|
127 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
128 |
+
</output>
|
129 |
+
</operation>
|
130 |
+
|
131 |
+
<operation name="servicesGenerateOrderFull">
|
132 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
133 |
+
<input>
|
134 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
135 |
+
</input>
|
136 |
+
<output>
|
137 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
138 |
+
</output>
|
139 |
+
</operation>
|
140 |
+
|
141 |
+
</binding>
|
142 |
</definitions>
|
app/code/community/Skybox/Services/etc/wsi.xml
CHANGED
@@ -1,159 +1,159 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
|
3 |
-
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
4 |
-
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
5 |
-
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
6 |
-
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
7 |
-
name="{{var wsdl.name}}"
|
8 |
-
targetNamespace="urn:{{var wsdl.name}}">
|
9 |
-
<wsdl:types>
|
10 |
-
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
|
11 |
-
|
12 |
-
|
13 |
-
<xsd:element name="servicesSetStatusOrderRequestParam">
|
14 |
-
<xsd:complexType>
|
15 |
-
<xsd:sequence>
|
16 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
|
17 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="orderIncrementId" type="xsd:string" />
|
18 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="status" type="xsd:string" />
|
19 |
-
</xsd:sequence>
|
20 |
-
</xsd:complexType>
|
21 |
-
</xsd:element>
|
22 |
-
<xsd:element name="servicesSetStatusOrderResponseParam">
|
23 |
-
<xsd:complexType>
|
24 |
-
<xsd:sequence>
|
25 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
|
26 |
-
</xsd:sequence>
|
27 |
-
</xsd:complexType>
|
28 |
-
</xsd:element>
|
29 |
-
|
30 |
-
|
31 |
-
<xsd:element name="servicesSetQuoteDesactiveRequestParam">
|
32 |
-
<xsd:complexType>
|
33 |
-
<xsd:sequence>
|
34 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
|
35 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="quoteId" type="xsd:int" />
|
36 |
-
</xsd:sequence>
|
37 |
-
</xsd:complexType>
|
38 |
-
</xsd:element>
|
39 |
-
<xsd:element name="servicesSetQuoteDesactiveResponseParam">
|
40 |
-
<xsd:complexType>
|
41 |
-
<xsd:sequence>
|
42 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
|
43 |
-
</xsd:sequence>
|
44 |
-
</xsd:complexType>
|
45 |
-
</xsd:element>
|
46 |
-
|
47 |
-
|
48 |
-
<xsd:element name="servicesGenerateOrderRequestParam">
|
49 |
-
<xsd:complexType>
|
50 |
-
<xsd:sequence>
|
51 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
|
52 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="IdCart" type="xsd:int" />
|
53 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="IdStore" type="xsd:string" />
|
54 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerName" type="xsd:string" />
|
55 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerLasName" type="xsd:string" />
|
56 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerEmail" type="xsd:string" />
|
57 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerAdresss" type="xsd:string" />
|
58 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerPhone" type="xsd:string" />
|
59 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerZipCode" type="xsd:string" />
|
60 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CityName" type="xsd:string" />
|
61 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="CountryId" type="xsd:string" />
|
62 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="RegionId" type="xsd:string" />
|
63 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="RegionName" type="xsd:string" />
|
64 |
-
</xsd:sequence>
|
65 |
-
</xsd:complexType>
|
66 |
-
</xsd:element>
|
67 |
-
<xsd:element name="servicesGenerateOrderResponseParam">
|
68 |
-
<xsd:complexType>
|
69 |
-
<xsd:sequence>
|
70 |
-
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" />
|
71 |
-
</xsd:sequence>
|
72 |
-
</xsd:complexType>
|
73 |
-
</xsd:element>
|
74 |
-
|
75 |
-
|
76 |
-
</xsd:schema>
|
77 |
-
</wsdl:types>
|
78 |
-
|
79 |
-
|
80 |
-
<wsdl:message name="ServicesSetStatusOrderRequest">
|
81 |
-
<wsdl:part name="parameters" element="typens:servicesSetStatusOrderRequestParam" />
|
82 |
-
</wsdl:message>
|
83 |
-
<wsdl:message name="ServicesSetStatusOrderResponse">
|
84 |
-
<wsdl:part name="parameters" element="typens:servicesSetStatusOrderResponseParam" />
|
85 |
-
</wsdl:message>
|
86 |
-
|
87 |
-
<wsdl:message name="ServicesSetQuoteDesactiveRequest">
|
88 |
-
<wsdl:part name="parameters" element="typens:servicesSetQuoteDesactiveRequestParam" />
|
89 |
-
</wsdl:message>
|
90 |
-
<wsdl:message name="ServicesSetQuoteDesactiveResponse">
|
91 |
-
<wsdl:part name="parameters" element="typens:servicesSetQuoteDesactiveResponseParam" />
|
92 |
-
</wsdl:message>
|
93 |
-
|
94 |
-
<wsdl:message name="ServicesGenerateOrderRequest">
|
95 |
-
<wsdl:part name="parameters" element="typens:servicesGenerateOrderRequestParam" />
|
96 |
-
</wsdl:message>
|
97 |
-
<wsdl:message name="ServicesGenerateOrderResponse">
|
98 |
-
<wsdl:part name="parameters" element="typens:servicesGenerateOrderResponseParam" />
|
99 |
-
</wsdl:message>
|
100 |
-
|
101 |
-
|
102 |
-
<wsdl:portType name="{{var wsdl.handler}}PortType">
|
103 |
-
|
104 |
-
<wsdl:operation name="ServicesSetStatusOrder">
|
105 |
-
<wsdl:documentation>Service set status</wsdl:documentation>
|
106 |
-
<wsdl:input message="typens:ServicesSetStatusOrderRequest" />
|
107 |
-
<wsdl:output message="typens:ServicesSetStatusOrderResponse" />
|
108 |
-
</wsdl:operation>
|
109 |
-
|
110 |
-
|
111 |
-
<wsdl:operation name="ServicesSetQuoteDesactive">
|
112 |
-
<wsdl:documentation>Service desactive quote</wsdl:documentation>
|
113 |
-
<wsdl:input message="typens:ServicesSetQuoteDesactiveRequest" />
|
114 |
-
<wsdl:output message="typens:ServicesSetQuoteDesactiveResponse" />
|
115 |
-
</wsdl:operation>
|
116 |
-
|
117 |
-
<wsdl:operation name="ServicesGenerateOrder">
|
118 |
-
<wsdl:documentation>Generate Order Magento</wsdl:documentation>
|
119 |
-
<wsdl:input message="typens:ServicesGenerateOrderRequest" />
|
120 |
-
<wsdl:output message="typens:ServicesGenerateOrderResponse" />
|
121 |
-
</wsdl:operation>
|
122 |
-
|
123 |
-
</wsdl:portType>
|
124 |
-
|
125 |
-
<wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
|
126 |
-
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
127 |
-
|
128 |
-
<wsdl:operation name="ServicesSetStatusOrder">
|
129 |
-
<soap:operation soapAction="" />
|
130 |
-
<wsdl:input>
|
131 |
-
<soap:body use="literal" />
|
132 |
-
</wsdl:input>
|
133 |
-
<wsdl:output>
|
134 |
-
<soap:body use="literal" />
|
135 |
-
</wsdl:output>
|
136 |
-
</wsdl:operation>
|
137 |
-
|
138 |
-
<wsdl:operation name="ServicesSetQuoteDesactive">
|
139 |
-
<soap:operation soapAction="" />
|
140 |
-
<wsdl:input>
|
141 |
-
<soap:body use="literal" />
|
142 |
-
</wsdl:input>
|
143 |
-
<wsdl:output>
|
144 |
-
<soap:body use="literal" />
|
145 |
-
</wsdl:output>
|
146 |
-
</wsdl:operation>
|
147 |
-
|
148 |
-
<wsdl:operation name="ServicesGenerateOrder">
|
149 |
-
<soap:operation soapAction="" />
|
150 |
-
<wsdl:input>
|
151 |
-
<soap:body use="literal" />
|
152 |
-
</wsdl:input>
|
153 |
-
<wsdl:output>
|
154 |
-
<soap:body use="literal" />
|
155 |
-
</wsdl:output>
|
156 |
-
</wsdl:operation>
|
157 |
-
|
158 |
-
</wsdl:binding>
|
159 |
-
</wsdl:definitions>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
|
3 |
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
4 |
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
5 |
+
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
6 |
+
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
7 |
+
name="{{var wsdl.name}}"
|
8 |
+
targetNamespace="urn:{{var wsdl.name}}">
|
9 |
+
<wsdl:types>
|
10 |
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
|
11 |
+
|
12 |
+
|
13 |
+
<xsd:element name="servicesSetStatusOrderRequestParam">
|
14 |
+
<xsd:complexType>
|
15 |
+
<xsd:sequence>
|
16 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
|
17 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="orderIncrementId" type="xsd:string" />
|
18 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="status" type="xsd:string" />
|
19 |
+
</xsd:sequence>
|
20 |
+
</xsd:complexType>
|
21 |
+
</xsd:element>
|
22 |
+
<xsd:element name="servicesSetStatusOrderResponseParam">
|
23 |
+
<xsd:complexType>
|
24 |
+
<xsd:sequence>
|
25 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
|
26 |
+
</xsd:sequence>
|
27 |
+
</xsd:complexType>
|
28 |
+
</xsd:element>
|
29 |
+
|
30 |
+
|
31 |
+
<xsd:element name="servicesSetQuoteDesactiveRequestParam">
|
32 |
+
<xsd:complexType>
|
33 |
+
<xsd:sequence>
|
34 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
|
35 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="quoteId" type="xsd:int" />
|
36 |
+
</xsd:sequence>
|
37 |
+
</xsd:complexType>
|
38 |
+
</xsd:element>
|
39 |
+
<xsd:element name="servicesSetQuoteDesactiveResponseParam">
|
40 |
+
<xsd:complexType>
|
41 |
+
<xsd:sequence>
|
42 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
|
43 |
+
</xsd:sequence>
|
44 |
+
</xsd:complexType>
|
45 |
+
</xsd:element>
|
46 |
+
|
47 |
+
|
48 |
+
<xsd:element name="servicesGenerateOrderRequestParam">
|
49 |
+
<xsd:complexType>
|
50 |
+
<xsd:sequence>
|
51 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
|
52 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="IdCart" type="xsd:int" />
|
53 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="IdStore" type="xsd:string" />
|
54 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerName" type="xsd:string" />
|
55 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerLasName" type="xsd:string" />
|
56 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerEmail" type="xsd:string" />
|
57 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerAdresss" type="xsd:string" />
|
58 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerPhone" type="xsd:string" />
|
59 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CustomerZipCode" type="xsd:string" />
|
60 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CityName" type="xsd:string" />
|
61 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="CountryId" type="xsd:string" />
|
62 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="RegionId" type="xsd:string" />
|
63 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="RegionName" type="xsd:string" />
|
64 |
+
</xsd:sequence>
|
65 |
+
</xsd:complexType>
|
66 |
+
</xsd:element>
|
67 |
+
<xsd:element name="servicesGenerateOrderResponseParam">
|
68 |
+
<xsd:complexType>
|
69 |
+
<xsd:sequence>
|
70 |
+
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" />
|
71 |
+
</xsd:sequence>
|
72 |
+
</xsd:complexType>
|
73 |
+
</xsd:element>
|
74 |
+
|
75 |
+
|
76 |
+
</xsd:schema>
|
77 |
+
</wsdl:types>
|
78 |
+
|
79 |
+
|
80 |
+
<wsdl:message name="ServicesSetStatusOrderRequest">
|
81 |
+
<wsdl:part name="parameters" element="typens:servicesSetStatusOrderRequestParam" />
|
82 |
+
</wsdl:message>
|
83 |
+
<wsdl:message name="ServicesSetStatusOrderResponse">
|
84 |
+
<wsdl:part name="parameters" element="typens:servicesSetStatusOrderResponseParam" />
|
85 |
+
</wsdl:message>
|
86 |
+
|
87 |
+
<wsdl:message name="ServicesSetQuoteDesactiveRequest">
|
88 |
+
<wsdl:part name="parameters" element="typens:servicesSetQuoteDesactiveRequestParam" />
|
89 |
+
</wsdl:message>
|
90 |
+
<wsdl:message name="ServicesSetQuoteDesactiveResponse">
|
91 |
+
<wsdl:part name="parameters" element="typens:servicesSetQuoteDesactiveResponseParam" />
|
92 |
+
</wsdl:message>
|
93 |
+
|
94 |
+
<wsdl:message name="ServicesGenerateOrderRequest">
|
95 |
+
<wsdl:part name="parameters" element="typens:servicesGenerateOrderRequestParam" />
|
96 |
+
</wsdl:message>
|
97 |
+
<wsdl:message name="ServicesGenerateOrderResponse">
|
98 |
+
<wsdl:part name="parameters" element="typens:servicesGenerateOrderResponseParam" />
|
99 |
+
</wsdl:message>
|
100 |
+
|
101 |
+
|
102 |
+
<wsdl:portType name="{{var wsdl.handler}}PortType">
|
103 |
+
|
104 |
+
<wsdl:operation name="ServicesSetStatusOrder">
|
105 |
+
<wsdl:documentation>Service set status</wsdl:documentation>
|
106 |
+
<wsdl:input message="typens:ServicesSetStatusOrderRequest" />
|
107 |
+
<wsdl:output message="typens:ServicesSetStatusOrderResponse" />
|
108 |
+
</wsdl:operation>
|
109 |
+
|
110 |
+
|
111 |
+
<wsdl:operation name="ServicesSetQuoteDesactive">
|
112 |
+
<wsdl:documentation>Service desactive quote</wsdl:documentation>
|
113 |
+
<wsdl:input message="typens:ServicesSetQuoteDesactiveRequest" />
|
114 |
+
<wsdl:output message="typens:ServicesSetQuoteDesactiveResponse" />
|
115 |
+
</wsdl:operation>
|
116 |
+
|
117 |
+
<wsdl:operation name="ServicesGenerateOrder">
|
118 |
+
<wsdl:documentation>Generate Order Magento</wsdl:documentation>
|
119 |
+
<wsdl:input message="typens:ServicesGenerateOrderRequest" />
|
120 |
+
<wsdl:output message="typens:ServicesGenerateOrderResponse" />
|
121 |
+
</wsdl:operation>
|
122 |
+
|
123 |
+
</wsdl:portType>
|
124 |
+
|
125 |
+
<wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
|
126 |
+
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
127 |
+
|
128 |
+
<wsdl:operation name="ServicesSetStatusOrder">
|
129 |
+
<soap:operation soapAction="" />
|
130 |
+
<wsdl:input>
|
131 |
+
<soap:body use="literal" />
|
132 |
+
</wsdl:input>
|
133 |
+
<wsdl:output>
|
134 |
+
<soap:body use="literal" />
|
135 |
+
</wsdl:output>
|
136 |
+
</wsdl:operation>
|
137 |
+
|
138 |
+
<wsdl:operation name="ServicesSetQuoteDesactive">
|
139 |
+
<soap:operation soapAction="" />
|
140 |
+
<wsdl:input>
|
141 |
+
<soap:body use="literal" />
|
142 |
+
</wsdl:input>
|
143 |
+
<wsdl:output>
|
144 |
+
<soap:body use="literal" />
|
145 |
+
</wsdl:output>
|
146 |
+
</wsdl:operation>
|
147 |
+
|
148 |
+
<wsdl:operation name="ServicesGenerateOrder">
|
149 |
+
<soap:operation soapAction="" />
|
150 |
+
<wsdl:input>
|
151 |
+
<soap:body use="literal" />
|
152 |
+
</wsdl:input>
|
153 |
+
<wsdl:output>
|
154 |
+
<soap:body use="literal" />
|
155 |
+
</wsdl:output>
|
156 |
+
</wsdl:operation>
|
157 |
+
|
158 |
+
</wsdl:binding>
|
159 |
+
</wsdl:definitions>
|
app/design/adminhtml/default/default/layout/skyboxcatalog.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<default>
|
4 |
-
<reference name="head">
|
5 |
-
<action method="addJs"><script>skybox/adminhtml.category.js</script></action>
|
6 |
-
</reference>
|
7 |
-
</default>
|
8 |
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs"><script>skybox/adminhtml.category.js</script></action>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
</layout>
|
app/design/adminhtml/default/default/layout/skyboxinternational.xml
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<skyboxinternational_adminhtml_debug_index>
|
4 |
-
<reference name="content">
|
5 |
-
<block type="skyboxinternational/adminhtml_debug" name="skyboxinternational_debug_info" />
|
6 |
-
</reference>
|
7 |
-
</skyboxinternational_adminhtml_debug_index>
|
8 |
-
|
9 |
-
<adminhtml_sales_order_view>
|
10 |
-
<reference name="order_totals">
|
11 |
-
<block type="skyboxcheckout/sales_order_total" before="tax" />
|
12 |
-
</reference>
|
13 |
-
</adminhtml_sales_order_view>
|
14 |
-
|
15 |
</layout>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<skyboxinternational_adminhtml_debug_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="skyboxinternational/adminhtml_debug" name="skyboxinternational_debug_info" />
|
6 |
+
</reference>
|
7 |
+
</skyboxinternational_adminhtml_debug_index>
|
8 |
+
|
9 |
+
<adminhtml_sales_order_view>
|
10 |
+
<reference name="order_totals">
|
11 |
+
<block type="skyboxcheckout/sales_order_total" before="tax" />
|
12 |
+
</reference>
|
13 |
+
</adminhtml_sales_order_view>
|
14 |
+
|
15 |
</layout>
|
app/design/frontend/base/default/layout/skyboxcheckout.xml
CHANGED
@@ -1,156 +1,156 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<skyboxcheckout_international_index>
|
4 |
-
<remove name="top.container"/>
|
5 |
-
<reference name="content">
|
6 |
-
<block type="core/template" name="skyboxcheckout.international.index" template="skybox/checkout/skyboxcheckout.phtml"></block>
|
7 |
-
</reference>
|
8 |
-
</skyboxcheckout_international_index>
|
9 |
-
<skyboxcheckout_international_success>
|
10 |
-
<reference name="content">
|
11 |
-
<block type="core/template" name="skyboxcheckout.international.index" template="skybox/checkout/skyboxsuccess.phtml"></block>
|
12 |
-
</reference>
|
13 |
-
</skyboxcheckout_international_success>
|
14 |
-
<checkout_onepage_index>
|
15 |
-
<reference name="checkout.onepage">
|
16 |
-
<!--<action method="setTemplate"><template>skybox/checkout/onepage.phtml</template></action>-->
|
17 |
-
<action method="setTemplate" ><template helper="checkout/data/getLayoutCheckoutSkybox"/></action> <!-- Rogged -->
|
18 |
-
</reference>
|
19 |
-
</checkout_onepage_index>
|
20 |
-
|
21 |
-
<!--
|
22 |
-
Shopping cart item renderer
|
23 |
-
-->
|
24 |
-
|
25 |
-
|
26 |
-
<checkout_cart_index>
|
27 |
-
<!-- Rogged he quitado la invocación de cart -->
|
28 |
-
|
29 |
-
<reference name="checkout.cart.methods">
|
30 |
-
<block type="core/template" before="content" name="skybox.checkout.cart.methods.onepage.bottom" template="skybox/checkout/onepage/link.phtml"/>
|
31 |
-
</reference>
|
32 |
-
|
33 |
-
<reference name="checkout.cart.shipping">
|
34 |
-
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
35 |
-
</reference>
|
36 |
-
|
37 |
-
<reference name="checkout.cart.sidebar">
|
38 |
-
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
39 |
-
</reference>
|
40 |
-
<!--
|
41 |
-
<reference name="checkout.cart">
|
42 |
-
|
43 |
-
<action method="setTemplate">
|
44 |
-
<template>skybox/checkout/cart_list.phtml</template>
|
45 |
-
</action>
|
46 |
-
|
47 |
-
<action method="setCartTemplate"><value>skybox/checkout/cart_list.phtml</value></action>
|
48 |
-
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
|
49 |
-
<action method="chooseTemplate"/>
|
50 |
-
|
51 |
-
<action method="addItemRender">
|
52 |
-
<type>simple</type>
|
53 |
-
<block>checkout/cart_item_renderer</block>
|
54 |
-
<template>skybox/checkout/cart/item/default.phtml</template>
|
55 |
-
</action>
|
56 |
-
|
57 |
-
<action method="addItemRender">
|
58 |
-
<type>grouped</type>
|
59 |
-
<block>checkout/cart_item_renderer_grouped</block>
|
60 |
-
<template>skybox/checkout/cart/item/default.phtml</template>
|
61 |
-
</action>
|
62 |
-
|
63 |
-
<action method="addItemRender">
|
64 |
-
<type>configurable</type>
|
65 |
-
<block>checkout/cart_item_renderer_configurable</block>
|
66 |
-
<template>skybox/checkout/cart/item/default.phtml</template>
|
67 |
-
</action>
|
68 |
-
|
69 |
-
<action method="addItemRender">
|
70 |
-
<type>bundle</type>
|
71 |
-
<block>bundle/checkout_cart_item_renderer</block>
|
72 |
-
<template>skybox/checkout/cart/item/default.phtml</template>
|
73 |
-
</action>
|
74 |
-
|
75 |
-
</reference>
|
76 |
-
|
77 |
-
<reference name="checkout.cart.shipping">
|
78 |
-
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
79 |
-
</reference>
|
80 |
-
|
81 |
-
<reference name="checkout.cart.sidebar">
|
82 |
-
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
83 |
-
</reference>
|
84 |
-
-->
|
85 |
-
</checkout_cart_index>
|
86 |
-
|
87 |
-
<default>
|
88 |
-
<reference name="head">
|
89 |
-
<!--<block type="directory/currency" name="custom_currency_selector" template="currency/currency.phtml"/>-->
|
90 |
-
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><script>prototype/window.js</script></action>
|
91 |
-
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><script>prototype/debug.js</script></action>
|
92 |
-
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><script>prototype/effects.js</script></action>
|
93 |
-
<action method="addItem" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
94 |
-
<action method="addItem" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><type>js_css</type><name>prototype/windows/themes/alphacube.css</name></action>
|
95 |
-
|
96 |
-
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive">
|
97 |
-
<script>skybox/load-jquery.js</script>
|
98 |
-
</action>
|
99 |
-
|
100 |
-
<!-- jQuery ver. 1.7.2 -->
|
101 |
-
<!--
|
102 |
-
<action method="addJs"><script>skybox/jquery.min.js</script></action>
|
103 |
-
<action method="addJs"><script>skybox/jquery.ba-resize.min.js</script></action>
|
104 |
-
|
105 |
-
<block type="core/text" name="google.cdn.jquery">
|
106 |
-
<action method="setText">
|
107 |
-
<text><![CDATA[<script type="text/javascript">jQuery.noConflict();</script>]]></text>
|
108 |
-
</action>
|
109 |
-
</block>
|
110 |
-
-->
|
111 |
-
|
112 |
-
<!--
|
113 |
-
<block type="core/text" name="google.cdn.jquery">
|
114 |
-
<action method="setText">
|
115 |
-
<text><![CDATA[<script type="text/javascript">
|
116 |
-
if ( (typeof jQuery === 'undefined') && !window.jQuery ) {
|
117 |
-
document.write(unescape("%3Cscript type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'%3E%3C/script%3E"));
|
118 |
-
document.write(unescape("%3Cscript type='text/javascript'%3E%3C/script%3E jQuery.noConflict(); %3Cscript%3E%3C/script%3E"));
|
119 |
-
}</script>]]></text>
|
120 |
-
</action>
|
121 |
-
</block>
|
122 |
-
-->
|
123 |
-
|
124 |
-
<action method="addItem" ifconfig="skyboxinternational/skyboxsettings/skyboxactive">
|
125 |
-
<type>skin_js</type><name>js/skybox/catalog.product.configurable.js</name>
|
126 |
-
</action>
|
127 |
-
</reference>
|
128 |
-
|
129 |
-
<!--
|
130 |
-
<reference name="content">
|
131 |
-
<block type="core/template" name="skyboxcheckout.top.container.cart" before="-" template="skybox/checkout/cart.phtml"/>
|
132 |
-
</reference>
|
133 |
-
-->
|
134 |
-
|
135 |
-
<reference name="top.container">
|
136 |
-
<!--<reference name="content">-->
|
137 |
-
<block type="core/template" name="skyboxcheckout.top.container.cart">
|
138 |
-
<action method="setTemplate" ifconfig="skyboxinternational/skyboxsettings/skyboxactive">
|
139 |
-
<template>skybox/checkout/cart.phtml</template>
|
140 |
-
</action>
|
141 |
-
<action method="unsetData"><key>cache_lifetime</key></action>
|
142 |
-
<action method="unsetData"><key>cache_tags</key></action>
|
143 |
-
</block>
|
144 |
-
</reference>
|
145 |
-
|
146 |
-
<reference name="right">
|
147 |
-
<remove name="checkout/cart_sidebar"/>
|
148 |
-
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
|
149 |
-
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>skybox/checkout/cart/sidebar/default.phtml</template></action>
|
150 |
-
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>skybox/checkout/cart/sidebar/default.phtml</template></action>
|
151 |
-
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>skybox/checkout/cart/sidebar/default.phtml</template></action>
|
152 |
-
</block>
|
153 |
-
</reference>
|
154 |
-
|
155 |
-
</default>
|
156 |
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<skyboxcheckout_international_index>
|
4 |
+
<remove name="top.container"/>
|
5 |
+
<reference name="content">
|
6 |
+
<block type="core/template" name="skyboxcheckout.international.index" template="skybox/checkout/skyboxcheckout.phtml"></block>
|
7 |
+
</reference>
|
8 |
+
</skyboxcheckout_international_index>
|
9 |
+
<skyboxcheckout_international_success>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="core/template" name="skyboxcheckout.international.index" template="skybox/checkout/skyboxsuccess.phtml"></block>
|
12 |
+
</reference>
|
13 |
+
</skyboxcheckout_international_success>
|
14 |
+
<checkout_onepage_index>
|
15 |
+
<reference name="checkout.onepage">
|
16 |
+
<!--<action method="setTemplate"><template>skybox/checkout/onepage.phtml</template></action>-->
|
17 |
+
<action method="setTemplate" ><template helper="checkout/data/getLayoutCheckoutSkybox"/></action> <!-- Rogged -->
|
18 |
+
</reference>
|
19 |
+
</checkout_onepage_index>
|
20 |
+
|
21 |
+
<!--
|
22 |
+
Shopping cart item renderer
|
23 |
+
-->
|
24 |
+
|
25 |
+
|
26 |
+
<checkout_cart_index>
|
27 |
+
<!-- Rogged he quitado la invocación de cart -->
|
28 |
+
|
29 |
+
<reference name="checkout.cart.methods">
|
30 |
+
<block type="core/template" before="content" name="skybox.checkout.cart.methods.onepage.bottom" template="skybox/checkout/onepage/link.phtml"/>
|
31 |
+
</reference>
|
32 |
+
|
33 |
+
<reference name="checkout.cart.shipping">
|
34 |
+
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
35 |
+
</reference>
|
36 |
+
|
37 |
+
<reference name="checkout.cart.sidebar">
|
38 |
+
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
39 |
+
</reference>
|
40 |
+
<!--
|
41 |
+
<reference name="checkout.cart">
|
42 |
+
|
43 |
+
<action method="setTemplate">
|
44 |
+
<template>skybox/checkout/cart_list.phtml</template>
|
45 |
+
</action>
|
46 |
+
|
47 |
+
<action method="setCartTemplate"><value>skybox/checkout/cart_list.phtml</value></action>
|
48 |
+
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
|
49 |
+
<action method="chooseTemplate"/>
|
50 |
+
|
51 |
+
<action method="addItemRender">
|
52 |
+
<type>simple</type>
|
53 |
+
<block>checkout/cart_item_renderer</block>
|
54 |
+
<template>skybox/checkout/cart/item/default.phtml</template>
|
55 |
+
</action>
|
56 |
+
|
57 |
+
<action method="addItemRender">
|
58 |
+
<type>grouped</type>
|
59 |
+
<block>checkout/cart_item_renderer_grouped</block>
|
60 |
+
<template>skybox/checkout/cart/item/default.phtml</template>
|
61 |
+
</action>
|
62 |
+
|
63 |
+
<action method="addItemRender">
|
64 |
+
<type>configurable</type>
|
65 |
+
<block>checkout/cart_item_renderer_configurable</block>
|
66 |
+
<template>skybox/checkout/cart/item/default.phtml</template>
|
67 |
+
</action>
|
68 |
+
|
69 |
+
<action method="addItemRender">
|
70 |
+
<type>bundle</type>
|
71 |
+
<block>bundle/checkout_cart_item_renderer</block>
|
72 |
+
<template>skybox/checkout/cart/item/default.phtml</template>
|
73 |
+
</action>
|
74 |
+
|
75 |
+
</reference>
|
76 |
+
|
77 |
+
<reference name="checkout.cart.shipping">
|
78 |
+
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
79 |
+
</reference>
|
80 |
+
|
81 |
+
<reference name="checkout.cart.sidebar">
|
82 |
+
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
83 |
+
</reference>
|
84 |
+
-->
|
85 |
+
</checkout_cart_index>
|
86 |
+
|
87 |
+
<default>
|
88 |
+
<reference name="head">
|
89 |
+
<!--<block type="directory/currency" name="custom_currency_selector" template="currency/currency.phtml"/>-->
|
90 |
+
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><script>prototype/window.js</script></action>
|
91 |
+
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><script>prototype/debug.js</script></action>
|
92 |
+
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><script>prototype/effects.js</script></action>
|
93 |
+
<action method="addItem" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
94 |
+
<action method="addItem" ifconfig="skyboxinternational/skyboxsettings/skyboxactive"><type>js_css</type><name>prototype/windows/themes/alphacube.css</name></action>
|
95 |
+
|
96 |
+
<action method="addJs" ifconfig="skyboxinternational/skyboxsettings/skyboxactive">
|
97 |
+
<script>skybox/load-jquery.js</script>
|
98 |
+
</action>
|
99 |
+
|
100 |
+
<!-- jQuery ver. 1.7.2 -->
|
101 |
+
<!--
|
102 |
+
<action method="addJs"><script>skybox/jquery.min.js</script></action>
|
103 |
+
<action method="addJs"><script>skybox/jquery.ba-resize.min.js</script></action>
|
104 |
+
|
105 |
+
<block type="core/text" name="google.cdn.jquery">
|
106 |
+
<action method="setText">
|
107 |
+
<text><![CDATA[<script type="text/javascript">jQuery.noConflict();</script>]]></text>
|
108 |
+
</action>
|
109 |
+
</block>
|
110 |
+
-->
|
111 |
+
|
112 |
+
<!--
|
113 |
+
<block type="core/text" name="google.cdn.jquery">
|
114 |
+
<action method="setText">
|
115 |
+
<text><![CDATA[<script type="text/javascript">
|
116 |
+
if ( (typeof jQuery === 'undefined') && !window.jQuery ) {
|
117 |
+
document.write(unescape("%3Cscript type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'%3E%3C/script%3E"));
|
118 |
+
document.write(unescape("%3Cscript type='text/javascript'%3E%3C/script%3E jQuery.noConflict(); %3Cscript%3E%3C/script%3E"));
|
119 |
+
}</script>]]></text>
|
120 |
+
</action>
|
121 |
+
</block>
|
122 |
+
-->
|
123 |
+
|
124 |
+
<action method="addItem" ifconfig="skyboxinternational/skyboxsettings/skyboxactive">
|
125 |
+
<type>skin_js</type><name>js/skybox/catalog.product.configurable.js</name>
|
126 |
+
</action>
|
127 |
+
</reference>
|
128 |
+
|
129 |
+
<!--
|
130 |
+
<reference name="content">
|
131 |
+
<block type="core/template" name="skyboxcheckout.top.container.cart" before="-" template="skybox/checkout/cart.phtml"/>
|
132 |
+
</reference>
|
133 |
+
-->
|
134 |
+
|
135 |
+
<reference name="top.container">
|
136 |
+
<!--<reference name="content">-->
|
137 |
+
<block type="core/template" name="skyboxcheckout.top.container.cart">
|
138 |
+
<action method="setTemplate" ifconfig="skyboxinternational/skyboxsettings/skyboxactive">
|
139 |
+
<template>skybox/checkout/cart.phtml</template>
|
140 |
+
</action>
|
141 |
+
<action method="unsetData"><key>cache_lifetime</key></action>
|
142 |
+
<action method="unsetData"><key>cache_tags</key></action>
|
143 |
+
</block>
|
144 |
+
</reference>
|
145 |
+
|
146 |
+
<reference name="right">
|
147 |
+
<remove name="checkout/cart_sidebar"/>
|
148 |
+
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
|
149 |
+
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>skybox/checkout/cart/sidebar/default.phtml</template></action>
|
150 |
+
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>skybox/checkout/cart/sidebar/default.phtml</template></action>
|
151 |
+
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>skybox/checkout/cart/sidebar/default.phtml</template></action>
|
152 |
+
</block>
|
153 |
+
</reference>
|
154 |
+
|
155 |
+
</default>
|
156 |
</layout>
|
app/design/frontend/base/default/template/skybox/checkout/cart.phtml
CHANGED
@@ -1,356 +1,291 @@
|
|
1 |
-
<?php
|
2 |
-
$_helper = Mage::helper('skyboxinternational/data');
|
3 |
-
|
4 |
-
$
|
5 |
-
$
|
6 |
-
|
7 |
-
$
|
8 |
-
$
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
$
|
16 |
-
$
|
17 |
-
$
|
18 |
-
$
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
var
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
function
|
184 |
-
var
|
185 |
-
var
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
var
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
}
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
}
|
242 |
-
|
243 |
-
function
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
//
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
{
|
271 |
-
|
272 |
-
if(
|
273 |
-
|
274 |
-
|
275 |
-
var
|
276 |
-
|
277 |
-
|
278 |
-
}
|
279 |
-
}
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
}
|
293 |
-
function browserResize()
|
294 |
-
{
|
295 |
-
jQuery(window).resize(function() {
|
296 |
-
if(!jQuery.isEmptyObject(popup)){
|
297 |
-
var _size = getSizeForPopup();
|
298 |
-
popup.setSize(_size.width, _size.height)
|
299 |
-
}
|
300 |
-
});
|
301 |
-
}
|
302 |
-
|
303 |
-
function getSizeForPopup()
|
304 |
-
{
|
305 |
-
var _width = jQuery(window).width();
|
306 |
-
var _height = jQuery(window).height();
|
307 |
-
if(_width < popupWidth){
|
308 |
-
_width = _width - 30;
|
309 |
-
}else{
|
310 |
-
_width = popupWidth;
|
311 |
-
}
|
312 |
-
return {width: _width, height: popupHeight};
|
313 |
-
}
|
314 |
-
|
315 |
-
$(document).ready(function () {
|
316 |
-
widthPage = $(window).width();
|
317 |
-
heightPage = $(window).height();
|
318 |
-
$(".skx_banner_image_car").click(goToCart);
|
319 |
-
$(".skx_position_option_country").click(goToLocation);
|
320 |
-
$(".skx_banner_image_account").click(goToInitializeSession);
|
321 |
-
$(".skx_banner_image_tracking").click(goToTrackingLocation);
|
322 |
-
$("#link_choise_country").click(goToCart);
|
323 |
-
postMessageIframe()
|
324 |
-
loadIframe();
|
325 |
-
browserResize();
|
326 |
-
<?php
|
327 |
-
if(Mage::getBlockSingleton('page/html_header')->getIsHomePage() && $change_country == true) {
|
328 |
-
?>
|
329 |
-
|
330 |
-
if ( !getCookie('tivoli_latam_homepage') ) {
|
331 |
-
createCookie('tivoli_latam_homepage', 1);
|
332 |
-
//goToLocation();
|
333 |
-
}
|
334 |
-
<?php
|
335 |
-
}
|
336 |
-
?>
|
337 |
-
});
|
338 |
-
|
339 |
-
// Windows.close = function (id, event) {
|
340 |
-
// var actualUri = "<?php //echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'] ?>//";
|
341 |
-
// indexParams = actualUri.indexOf('?');
|
342 |
-
// popup = {};
|
343 |
-
// top.location = actualUri.substring(0, indexParams);
|
344 |
-
// }
|
345 |
-
|
346 |
-
})(jQuery);
|
347 |
-
|
348 |
-
</script>
|
349 |
-
|
350 |
-
<script type="text/javascript">
|
351 |
-
//<![CDATA[
|
352 |
-
var SKYBOX_OPTIONS_PRICE_URL = '<?php echo Mage::getUrl(); ?>skbcheckout/calculate';
|
353 |
-
//]]>
|
354 |
-
</script>
|
355 |
-
|
356 |
-
<script type="text/javascript" src="<?php echo $api_js_button_international; ?>"></script>
|
1 |
+
<?php
|
2 |
+
$_helper = Mage::helper('skyboxinternational/data');
|
3 |
+
|
4 |
+
/** @var Skybox_Core_Model_Config $_config */
|
5 |
+
$_config = Mage::getModel('skyboxcore/config');
|
6 |
+
|
7 |
+
/** @var Skybox_Checkout_Model_Api_Checkout $_checkout */
|
8 |
+
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
9 |
+
|
10 |
+
/** @var Skybox_Core_Helper_Allow $allowHelper */
|
11 |
+
$allowHelper = Mage::helper('skyboxcore/allow');
|
12 |
+
|
13 |
+
$isCartEnabled = $allowHelper->isCartBarEnabled();
|
14 |
+
|
15 |
+
$_cartDataURL = "";
|
16 |
+
$_merchant = $_helper->getMerchantCode();
|
17 |
+
$template = "";
|
18 |
+
$cartId = $_helper->getCartId();
|
19 |
+
|
20 |
+
Mage::log("InitializeBarSkybox ", null, 'cartphtml.log', true);
|
21 |
+
$_checkout->InitializeBarSkybox();
|
22 |
+
|
23 |
+
$change_country = false;
|
24 |
+
|
25 |
+
$request = $this->getRequest();
|
26 |
+
$module = $request->getModuleName();
|
27 |
+
$controller = $request->getControllerName();
|
28 |
+
$action = $request->getActionName();
|
29 |
+
$getHomeUrl = Mage::helper('core/url')->getHomeUrl();
|
30 |
+
$urlCheckCart = Mage::getUrl("checkout/cart");
|
31 |
+
|
32 |
+
$cart = $_config->getSession()->getCartSkybox();
|
33 |
+
/**
|
34 |
+
* Start Aditional we add a line debug with integration information
|
35 |
+
*/
|
36 |
+
echo '<script>
|
37 |
+
console.log("LocationAllowService: ' . $_checkout->getLocationAllow() . ' ");
|
38 |
+
</script>';
|
39 |
+
/**
|
40 |
+
* End Aditional we add a line debug with integration information
|
41 |
+
*/
|
42 |
+
//$template = "<a href='#' id='link_choise_country'> </a>";
|
43 |
+
// Load CSS & JS
|
44 |
+
$skybox_url = $_helper->getSkyboxUrlMain();// $_config->skyboxDefaultUrl;
|
45 |
+
$api_css_button_international = $skybox_url . 'widgets/api-button/css/api-button-international-css.ashx';
|
46 |
+
$api_css_button_international .= '?s=' . $_helper->getMerchantCode();
|
47 |
+
$api_css_button_international .= '&CssVersion=' . $_helper->getCssVersion();
|
48 |
+
$api_js_button_international = $skybox_url . 'Content/debug/API/js/api-button-tooltip.js';
|
49 |
+
$countryChange = 0;
|
50 |
+
|
51 |
+
if($allowHelper->isCartBarEnabled()) :
|
52 |
+
$countryChange = 1;
|
53 |
+
$template = '';
|
54 |
+
$cart = $_config->getSession()->getCartSkybox();
|
55 |
+
if (!empty($cart)) :
|
56 |
+
$template = $cart->BarHtmlTemplate;
|
57 |
+
foreach ($cart as $key => $value) :
|
58 |
+
$template = str_replace('{' . $key . '}', $value, $template);
|
59 |
+
endforeach;
|
60 |
+
endif;
|
61 |
+
$_cartDataURL = $cart->CartDataURL;
|
62 |
+
echo $template;
|
63 |
+
endif;
|
64 |
+
|
65 |
+
if($allowHelper->isChangeCountryEnabled()):
|
66 |
+
$cart = $_config->getSession()->getCartSkybox();
|
67 |
+
$template = "<div class='main-container' style='padding: 10px 0 0;text-align: right;'>";
|
68 |
+
$template .= "<div class='change_country'>";
|
69 |
+
$template .= "<a class='skx_position_option_country' href='javascript:;'>Change country</a>";
|
70 |
+
$template .= "</div>";
|
71 |
+
$template .= "</div>";
|
72 |
+
$change_country = true;
|
73 |
+
$countryChange = 0;
|
74 |
+
$_cartDataURL = $cart->CartDataURL;
|
75 |
+
echo $template;
|
76 |
+
endif;
|
77 |
+
|
78 |
+
$skyBoxUrlClientBase= $_helper->getSkyBoxUrlAPI();
|
79 |
+
$storeCode = Mage::getModel('skyboxcatalog/api_product')->getStoreCode();
|
80 |
+
$skyBoxUrlClientGet = str_replace("apirest/", "", $skyBoxUrlClientBase);
|
81 |
+
$skyBoxUrlClient = $skyBoxUrlClientGet . "multiplecalculate/" . $storeCode . "/calc-";
|
82 |
+
?>
|
83 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $api_css_button_international; ?>"/>
|
84 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/skybox/style.css?v=' . $_helper->getCssVersion()); ?>"/>
|
85 |
+
<script type="text/javascript">
|
86 |
+
var URL_CHECK_CART = "<?php echo $urlCheckCart ?>";
|
87 |
+
var CART_ID = "<?php echo $cartId ?>";
|
88 |
+
var CART_DATA_URL_SKYBOX= "<?php echo $_cartDataURL ?>";
|
89 |
+
var MERCHANT_ID_SKYBOX = "<?php echo $_merchant ?>";
|
90 |
+
var SKYBOX_URL = "<?php echo $skybox_url ?>";
|
91 |
+
var CHANGE_COUNTRY = "<?php echo $change_country ?>";
|
92 |
+
var ACTUAL_URI = "<?php echo 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] ?>";
|
93 |
+
var GET_HOME_URL = "<?php echo $getHomeUrl ?>";
|
94 |
+
var COUNTRY_CHANGE = "<?php echo $countryChange?>";
|
95 |
+
var IS_SKYBOX_VISIBLE = "<?php echo $_checkout->getLocationAllow(); ?>";
|
96 |
+
var URL_BASE_MAGENTO = "<?php echo Mage::getBaseUrl() ?>";
|
97 |
+
var IS_REGISTRATION_DISABLED_SKYBOX = 1;
|
98 |
+
|
99 |
+
jQuery(document).ready(function () {
|
100 |
+
if (!jQuery().fancybox) {
|
101 |
+
var fileref = document.createElement("link");
|
102 |
+
fileref.rel = "stylesheet";
|
103 |
+
fileref.type = "text/css";
|
104 |
+
fileref.href = "<?php echo $this->getSkinUrl('css/skybox/jquery.fancybox.css');?>";
|
105 |
+
document.getElementsByTagName("head")[0].appendChild(fileref);
|
106 |
+
jQuery('head').append(jQuery('<script />').attr('src','<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'js/skybox/jquery.fancybox.js'; ?>'));
|
107 |
+
}
|
108 |
+
jQuery(".skybox-price-set").each(function (index) {
|
109 |
+
var SkyBoxUrlClient = "<?php echo $skyBoxUrlClient;?>";
|
110 |
+
var dataId = jQuery(this).attr("id");
|
111 |
+
var id = jQuery(this).attr("product-id");
|
112 |
+
var url = SkyBoxUrlClient + id + ".html";
|
113 |
+
var content = jQuery.get(url, function (data) {
|
114 |
+
jQuery("#" + dataId).html(data);
|
115 |
+
});
|
116 |
+
});
|
117 |
+
});
|
118 |
+
</script>
|
119 |
+
<script src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'js/skybox/main.js'; ?>"></script>
|
120 |
+
<script type="text/javascript">
|
121 |
+
(function ($) {
|
122 |
+
|
123 |
+
var widthPage = 0;
|
124 |
+
var heightPage = 0;
|
125 |
+
var popup = {};
|
126 |
+
var popupWidth = 540;
|
127 |
+
var popupHeight = 545;
|
128 |
+
var win = '';
|
129 |
+
|
130 |
+
function goToCart() {
|
131 |
+
document.location = URL_CHECK_CART;
|
132 |
+
}
|
133 |
+
|
134 |
+
function goToInitializeSession() {
|
135 |
+
var idCart = CART_ID;
|
136 |
+
var datos = CART_DATA_URL_SKYBOX;
|
137 |
+
var merchant = MERCHANT_ID_SKYBOX;
|
138 |
+
var actualUri = ACTUAL_URI + "?LoadFrame=1";
|
139 |
+
var url = SKYBOX_URL + "WebForms/PublicSite/Tracking.aspx?" + datos + "&merchant=" + merchant + "&idCart=" + idCart + "&ReLoad=1&uri=" + actualUri;
|
140 |
+
var name = 'initSession' + Date.now();
|
141 |
+
callAlphacube();
|
142 |
+
}
|
143 |
+
|
144 |
+
function getReturnUrl() {
|
145 |
+
var result = document.URL;
|
146 |
+
<?php $forceReload = (Mage::getBlockSingleton('page/html_header')->getIsHomePage()) ? 'force_reload' : '';?>
|
147 |
+
result += '<?php echo $forceReload; ?>';
|
148 |
+
return result;
|
149 |
+
}
|
150 |
+
|
151 |
+
function callAlphacube() {
|
152 |
+
var alphacube_ = document.querySelectorAll('.alphacube_close');
|
153 |
+
if (alphacube_.length > 0) {
|
154 |
+
var overlay_ = document.getElementById("overlay_modal");
|
155 |
+
if (overlay_ !== null) overlay_.style.display = '';
|
156 |
+
var id_modal = (alphacube_[1]) ? alphacube_[1].parentNode.getAttribute('id') : '';
|
157 |
+
try { document.getElementById(id_modal).remove();} catch (e) {}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
function goToLocation() {
|
162 |
+
win = 'resync';
|
163 |
+
var datos = CART_DATA_URL_SKYBOX;
|
164 |
+
var process_url = GET_HOME_URL + "skbcheckout/process";
|
165 |
+
var return_url = getReturnUrl();
|
166 |
+
var change_country_status = CHANGE_COUNTRY;
|
167 |
+
var url = SKYBOX_URL + "Webforms/PublicSite/ReSync.aspx?" + datos;
|
168 |
+
url += "&process_url=" + process_url;
|
169 |
+
url += "&return_url=" + return_url;
|
170 |
+
url += "&change_country=" + change_country_status;
|
171 |
+
|
172 |
+
var _size = getSizeForPopup();
|
173 |
+
var name = 'selectLocation' + Date.now();
|
174 |
+
callAlphacube();
|
175 |
+
}
|
176 |
+
|
177 |
+
function goToTrackingLocation() {
|
178 |
+
var url = SKYBOX_URL + "Webforms/PublicSite/Tracking.aspx?" + CART_DATA_URL_SKYBOX + "&idCart=" + CART_ID;
|
179 |
+
var name = 'tracking' + Date.now();
|
180 |
+
showPopup(name, '', url, (widthPage - 50 ), ((heightPage < 800) ? heightPage - 50 : 800));
|
181 |
+
}
|
182 |
+
|
183 |
+
function loadIframe() {
|
184 |
+
var actualUri = ACTUAL_URI;
|
185 |
+
var flgLoadIframe = "<?php echo (isset($_GET['LoadFrame'])) ? $_GET['LoadFrame'] : 0; ?>";
|
186 |
+
if (flgLoadIframe === "1") {
|
187 |
+
if (actualUri.indexOf("skbcheckout/international") === -1) goToInitializeSession();
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
function postMessageIframe() {
|
192 |
+
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
|
193 |
+
var eventer = window[eventMethod];
|
194 |
+
var messageEvent = (eventMethod === "attachEvent") ? "onmessage" : "message";
|
195 |
+
eventer(messageEvent, function (e) {recalculateHeightIframe(e.data);}, false);
|
196 |
+
}
|
197 |
+
|
198 |
+
function recalculateHeightIframe(data) {
|
199 |
+
if (data.win === 'resync') {
|
200 |
+
popupHeight = data.height;
|
201 |
+
var _size = getSizeForPopup();
|
202 |
+
try{ popup.setSize(_size.width, _size.height);}
|
203 |
+
catch (e) {}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
function browserResize() {
|
208 |
+
jQuery(window).resize(function () {
|
209 |
+
if (!jQuery.isEmptyObject(popup)) {
|
210 |
+
var _size = getSizeForPopup();
|
211 |
+
popup.setSize(_size.width, _size.height)
|
212 |
+
}
|
213 |
+
});
|
214 |
+
}
|
215 |
+
|
216 |
+
function getSizeForPopup() {
|
217 |
+
var _width = jQuery(window).width();
|
218 |
+
var _height = jQuery(window).height();
|
219 |
+
_width = (_width < popupWidth) ? _width - 30 : popupWidth ;
|
220 |
+
return {width: _width, height: popupHeight};
|
221 |
+
}
|
222 |
+
|
223 |
+
$(".skx_position_option_country").unbind().click(function(){
|
224 |
+
goToLocation();
|
225 |
+
});
|
226 |
+
|
227 |
+
$(".skx_banner_image_account").unbind().click(function(){
|
228 |
+
goToInitializeSession();
|
229 |
+
});
|
230 |
+
|
231 |
+
$(".skx_banner_image_car").unbind().click(function(){
|
232 |
+
goToCart();
|
233 |
+
});
|
234 |
+
|
235 |
+
$(".skx_banner_image_tracking").unbind().click(function(){
|
236 |
+
goToTrackingLocation();
|
237 |
+
});
|
238 |
+
|
239 |
+
$("#link_choise_country").unbind().click(function(){
|
240 |
+
goToCart();
|
241 |
+
});
|
242 |
+
|
243 |
+
$(document).ready(function () {
|
244 |
+
widthPage = $(window).width();
|
245 |
+
heightPage = $(window).height();
|
246 |
+
postMessageIframe();
|
247 |
+
loadIframe();
|
248 |
+
browserResize();
|
249 |
+
<?php
|
250 |
+
// note: Just to force reload page on Home Page.
|
251 |
+
$forceReload = $_config->getSession()->getChangeCountryHomePage();
|
252 |
+
if (Mage::getBlockSingleton('page/html_header')->getIsHomePage() && $forceReload) :
|
253 |
+
$_config->getSession()->setChangeCountryHomePage(null);
|
254 |
+
echo 'window.location.reload(false);';
|
255 |
+
endif;
|
256 |
+
?>
|
257 |
+
});
|
258 |
+
})(jQuery);
|
259 |
+
</script>
|
260 |
+
|
261 |
+
<script type="text/javascript">
|
262 |
+
//<![CDATA[
|
263 |
+
var SKYBOX_OPTIONS_PRICE_URL = '<?php echo Mage::getUrl(); ?>skbcheckout/calculate';
|
264 |
+
//]]>
|
265 |
+
</script>
|
266 |
+
<script type="text/javascript" src="<?php echo $api_js_button_international; ?>"></script>
|
267 |
+
<script>
|
268 |
+
setTimeout(function(){
|
269 |
+
var country_change = "<?php echo $countryChange?>";
|
270 |
+
if(parseInt(country_change) === 1){
|
271 |
+
var currencyISO_ = document.getElementsByClassName('skx_banner_label_currencyISO');
|
272 |
+
if(currencyISO_.length > 1){
|
273 |
+
var nextSiblingOne = currencyISO_[0].nextElementSibling;
|
274 |
+
var getAttrNextSiblingOne = nextSiblingOne.getAttribute('class');
|
275 |
+
var nextSiblingLast = currencyISO_[1].nextElementSibling;
|
276 |
+
nextSiblingLast.setAttribute('class',getAttrNextSiblingOne);
|
277 |
+
currencyISO_[1].innerHTML = currencyISO_[0].innerHTML;
|
278 |
+
}
|
279 |
+
}else{
|
280 |
+
var optCountry = document.getElementsByClassName('skx_position_option_country');
|
281 |
+
if(optCountry.length > 1) {
|
282 |
+
optCountry[1].innerHTML = optCountry[0].innerText;
|
283 |
+
try{
|
284 |
+
document.getElementById('l_checkout_view_account').style.display = 'none';
|
285 |
+
}catch (e){
|
286 |
+
|
287 |
+
}
|
288 |
+
}
|
289 |
+
}
|
290 |
+
},500);
|
291 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/skybox/checkout/cart/item/default.phtml
CHANGED
@@ -1,294 +1,294 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
$_item = $this->getItem();
|
29 |
-
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
30 |
-
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
|
31 |
-
?>
|
32 |
-
<tr>
|
33 |
-
<td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
|
34 |
-
<td>
|
35 |
-
<h2 class="product-name">
|
36 |
-
<?php if ($this->hasProductUrl()):?>
|
37 |
-
<a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a>
|
38 |
-
<?php else: ?>
|
39 |
-
<?php echo $this->escapeHtml($this->getProductName()) ?>
|
40 |
-
<?php endif; ?>
|
41 |
-
</h2>
|
42 |
-
<?php if ($_options = $this->getOptionList()):?>
|
43 |
-
<dl class="item-options">
|
44 |
-
<?php foreach ($_options as $_option) : ?>
|
45 |
-
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
46 |
-
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
47 |
-
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
48 |
-
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
49 |
-
<div class="truncated_full_value">
|
50 |
-
<dl class="item-options">
|
51 |
-
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
52 |
-
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
53 |
-
</dl>
|
54 |
-
</div>
|
55 |
-
<?php endif; ?>
|
56 |
-
</dd>
|
57 |
-
<?php endforeach; ?>
|
58 |
-
</dl>
|
59 |
-
<?php endif;?>
|
60 |
-
<?php if ($messages = $this->getMessages()): ?>
|
61 |
-
<?php foreach ($messages as $message): ?>
|
62 |
-
<p class="item-msg <?php echo $message['type'] ?>">* <?php echo $this->escapeHtml($message['text']) ?></p>
|
63 |
-
<?php endforeach; ?>
|
64 |
-
<?php endif; ?>
|
65 |
-
<?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
|
66 |
-
<?php if ($addInfoBlock): ?>
|
67 |
-
<?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
|
68 |
-
<?php endif;?>
|
69 |
-
</td>
|
70 |
-
<td class="a-center">
|
71 |
-
<?php if ($isVisibleProduct): ?>
|
72 |
-
<a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item parameters') ?>"><?php echo $this->__('Edit') ?></a>
|
73 |
-
<?php endif ?>
|
74 |
-
</td>
|
75 |
-
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
76 |
-
<td class="a-center">
|
77 |
-
<?php if ($isVisibleProduct): ?>
|
78 |
-
<a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move'); ?></a>
|
79 |
-
<?php endif ?>
|
80 |
-
</td>
|
81 |
-
<?php endif ?>
|
82 |
-
|
83 |
-
<?php if ($canApplyMsrp): ?>
|
84 |
-
<td class="a-right"<?php if ($this->helper('tax')->displayCartBothPrices()): ?> colspan="2"<?php endif; ?>>
|
85 |
-
<span class="cart-price">
|
86 |
-
<span class="cart-msrp-unit"><?php echo $this->__('See price before order confirmation.'); ?></span>
|
87 |
-
<?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
|
88 |
-
<a id="<?php echo $helpLinkId ?>" href="#" class="map-help-link"><?php echo $this->__("What's this?"); ?></a>
|
89 |
-
<script type="text/javascript">
|
90 |
-
Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo $this->__("Whats this?") ?>");
|
91 |
-
</script>
|
92 |
-
</span>
|
93 |
-
</td>
|
94 |
-
<?php else: ?>
|
95 |
-
|
96 |
-
<!-- Skybox Checkout -->
|
97 |
-
<!--<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getPriceSkybox()); ?></td>
|
98 |
-
<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getCustomsSkybox()); ?></td>
|
99 |
-
<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getInsuranceSkybox()); ?></td>
|
100 |
-
<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getShippingSkybox()); ?></td>-->
|
101 |
-
<!-- /Skybox Checkout -->
|
102 |
-
|
103 |
-
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
104 |
-
<td class="a-right">
|
105 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
106 |
-
<span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
107 |
-
<?php else: ?>
|
108 |
-
<span class="cart-price" style="white-space: nowrap;">
|
109 |
-
<?php endif; ?>
|
110 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
111 |
-
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
112 |
-
<?php else: ?>
|
113 |
-
<?php echo $this->helper('checkout')->formatPrice($_item->getPriceSkybox()); ?>
|
114 |
-
|
115 |
-
<!--<?php echo $this->helper('checkout')->formatPrice($_item->getTotalSkybox()); ?>-->
|
116 |
-
<?php endif; ?>
|
117 |
-
<?php if ($_item->getBasePriceSkybox() > $_item->getPriceSkybox()):?>
|
118 |
-
<span class="price price-discount" style="text-decoration: line-through;">
|
119 |
-
(<?php echo $this->helper('checkout')->formatPrice($_item->getBasePriceSkybox()); ?>)
|
120 |
-
</span>
|
121 |
-
<span class="text-discount"><?php echo $_item->getAdjustLabelSkybox(); ?></span>
|
122 |
-
<?php endif; ?>
|
123 |
-
</span>
|
124 |
-
|
125 |
-
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
126 |
-
|
127 |
-
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
128 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
129 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
130 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
131 |
-
<?php endforeach; ?>
|
132 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
133 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
134 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
135 |
-
<?php endforeach; ?>
|
136 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
137 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
138 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
139 |
-
<?php endforeach; ?>
|
140 |
-
<?php endif; ?>
|
141 |
-
</div>
|
142 |
-
|
143 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
144 |
-
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
145 |
-
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
146 |
-
</div>
|
147 |
-
<?php endif; ?>
|
148 |
-
<?php endif; ?>
|
149 |
-
</td>
|
150 |
-
<?php endif; ?><!-- inclusive price starts here -->
|
151 |
-
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
152 |
-
<td>
|
153 |
-
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
154 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
155 |
-
<span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
156 |
-
<?php else: ?>
|
157 |
-
<span class="cart-price">
|
158 |
-
<?php endif; ?>
|
159 |
-
|
160 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
161 |
-
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
|
162 |
-
<?php else: ?>
|
163 |
-
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
164 |
-
<?php endif; ?>
|
165 |
-
|
166 |
-
</span>
|
167 |
-
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
168 |
-
|
169 |
-
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
170 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
171 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
172 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
173 |
-
<?php endforeach; ?>
|
174 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
175 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
176 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
177 |
-
<?php endforeach; ?>
|
178 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
179 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
180 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
181 |
-
<?php endforeach; ?>
|
182 |
-
<?php endif; ?>
|
183 |
-
</div>
|
184 |
-
|
185 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
186 |
-
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
187 |
-
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
|
188 |
-
</div>
|
189 |
-
<?php endif; ?>
|
190 |
-
<?php endif; ?>
|
191 |
-
</td>
|
192 |
-
<?php endif; ?>
|
193 |
-
<?php endif; ?>
|
194 |
-
<td class="a-center">
|
195 |
-
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
|
196 |
-
</td>
|
197 |
-
|
198 |
-
<!--Sub total starts here -->
|
199 |
-
<?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
|
200 |
-
<td class="a-right" style="white-space: nowrap;">
|
201 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
202 |
-
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
203 |
-
<?php else: ?>
|
204 |
-
<span class="cart-price">
|
205 |
-
<?php endif; ?>
|
206 |
-
|
207 |
-
<?php if ($canApplyMsrp): ?>
|
208 |
-
<span class="cart-msrp-subtotal">--</span>
|
209 |
-
<?php else: ?>
|
210 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
211 |
-
<?php echo $this->helper('checkout')->formatPrice($_item->getTotalSkybox()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
212 |
-
<?php else: ?>
|
213 |
-
<?php //echo $this->helper('checkout')->formatPrice($_item->getRowTotalSkybox()) ?>
|
214 |
-
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotalSkybox()) ?><!--total-->
|
215 |
-
<?php endif; ?>
|
216 |
-
<?php endif; ?>
|
217 |
-
|
218 |
-
</span>
|
219 |
-
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
220 |
-
|
221 |
-
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
222 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
223 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
224 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
225 |
-
<?php endforeach; ?>
|
226 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
227 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
228 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
229 |
-
<?php endforeach; ?>
|
230 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
231 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
232 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
233 |
-
<?php endforeach; ?>
|
234 |
-
<?php endif; ?>
|
235 |
-
</div>
|
236 |
-
|
237 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
238 |
-
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
239 |
-
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
240 |
-
</div>
|
241 |
-
<?php endif; ?>
|
242 |
-
<?php endif; ?>
|
243 |
-
</td>
|
244 |
-
<?php endif; ?>
|
245 |
-
<?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
|
246 |
-
<td>
|
247 |
-
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
248 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
249 |
-
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
250 |
-
<?php else: ?>
|
251 |
-
<span class="cart-price">
|
252 |
-
<?php endif; ?>
|
253 |
-
|
254 |
-
<?php if ($canApplyMsrp): ?>
|
255 |
-
<span class="cart-msrp-subtotal">--</span>
|
256 |
-
<?php else: ?>
|
257 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
258 |
-
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
|
259 |
-
<?php else: ?>
|
260 |
-
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
261 |
-
<?php endif; ?>
|
262 |
-
<?php endif; ?>
|
263 |
-
|
264 |
-
</span>
|
265 |
-
|
266 |
-
|
267 |
-
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
268 |
-
|
269 |
-
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
270 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
271 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
272 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
273 |
-
<?php endforeach; ?>
|
274 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
275 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
276 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
277 |
-
<?php endforeach; ?>
|
278 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
279 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
280 |
-
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
281 |
-
<?php endforeach; ?>
|
282 |
-
<?php endif; ?>
|
283 |
-
</div>
|
284 |
-
|
285 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
286 |
-
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
287 |
-
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
|
288 |
-
</div>
|
289 |
-
<?php endif; ?>
|
290 |
-
<?php endif; ?>
|
291 |
-
</td>
|
292 |
-
<?php endif; ?>
|
293 |
-
<td class="a-center"><a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo $this->__('Remove item')?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a></td>
|
294 |
-
</tr>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
$_item = $this->getItem();
|
29 |
+
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
30 |
+
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
|
31 |
+
?>
|
32 |
+
<tr>
|
33 |
+
<td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
|
34 |
+
<td>
|
35 |
+
<h2 class="product-name">
|
36 |
+
<?php if ($this->hasProductUrl()):?>
|
37 |
+
<a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a>
|
38 |
+
<?php else: ?>
|
39 |
+
<?php echo $this->escapeHtml($this->getProductName()) ?>
|
40 |
+
<?php endif; ?>
|
41 |
+
</h2>
|
42 |
+
<?php if ($_options = $this->getOptionList()):?>
|
43 |
+
<dl class="item-options">
|
44 |
+
<?php foreach ($_options as $_option) : ?>
|
45 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
46 |
+
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
47 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
48 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
49 |
+
<div class="truncated_full_value">
|
50 |
+
<dl class="item-options">
|
51 |
+
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
52 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
53 |
+
</dl>
|
54 |
+
</div>
|
55 |
+
<?php endif; ?>
|
56 |
+
</dd>
|
57 |
+
<?php endforeach; ?>
|
58 |
+
</dl>
|
59 |
+
<?php endif;?>
|
60 |
+
<?php if ($messages = $this->getMessages()): ?>
|
61 |
+
<?php foreach ($messages as $message): ?>
|
62 |
+
<p class="item-msg <?php echo $message['type'] ?>">* <?php echo $this->escapeHtml($message['text']) ?></p>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
<?php endif; ?>
|
65 |
+
<?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
|
66 |
+
<?php if ($addInfoBlock): ?>
|
67 |
+
<?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
|
68 |
+
<?php endif;?>
|
69 |
+
</td>
|
70 |
+
<td class="a-center">
|
71 |
+
<?php if ($isVisibleProduct): ?>
|
72 |
+
<a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item parameters') ?>"><?php echo $this->__('Edit') ?></a>
|
73 |
+
<?php endif ?>
|
74 |
+
</td>
|
75 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
76 |
+
<td class="a-center">
|
77 |
+
<?php if ($isVisibleProduct): ?>
|
78 |
+
<a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move'); ?></a>
|
79 |
+
<?php endif ?>
|
80 |
+
</td>
|
81 |
+
<?php endif ?>
|
82 |
+
|
83 |
+
<?php if ($canApplyMsrp): ?>
|
84 |
+
<td class="a-right"<?php if ($this->helper('tax')->displayCartBothPrices()): ?> colspan="2"<?php endif; ?>>
|
85 |
+
<span class="cart-price">
|
86 |
+
<span class="cart-msrp-unit"><?php echo $this->__('See price before order confirmation.'); ?></span>
|
87 |
+
<?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
|
88 |
+
<a id="<?php echo $helpLinkId ?>" href="#" class="map-help-link"><?php echo $this->__("What's this?"); ?></a>
|
89 |
+
<script type="text/javascript">
|
90 |
+
Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo $this->__("Whats this?") ?>");
|
91 |
+
</script>
|
92 |
+
</span>
|
93 |
+
</td>
|
94 |
+
<?php else: ?>
|
95 |
+
|
96 |
+
<!-- Skybox Checkout -->
|
97 |
+
<!--<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getPriceSkybox()); ?></td>
|
98 |
+
<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getCustomsSkybox()); ?></td>
|
99 |
+
<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getInsuranceSkybox()); ?></td>
|
100 |
+
<td class="a-center"><?php echo $this->helper('checkout')->formatPrice($_item->getShippingSkybox()); ?></td>-->
|
101 |
+
<!-- /Skybox Checkout -->
|
102 |
+
|
103 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
104 |
+
<td class="a-right">
|
105 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
106 |
+
<span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
107 |
+
<?php else: ?>
|
108 |
+
<span class="cart-price" style="white-space: nowrap;">
|
109 |
+
<?php endif; ?>
|
110 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
111 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
112 |
+
<?php else: ?>
|
113 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getPriceSkybox()); ?>
|
114 |
+
|
115 |
+
<!--<?php echo $this->helper('checkout')->formatPrice($_item->getTotalSkybox()); ?>-->
|
116 |
+
<?php endif; ?>
|
117 |
+
<?php if ($_item->getBasePriceSkybox() > $_item->getPriceSkybox()):?>
|
118 |
+
<span class="price price-discount" style="text-decoration: line-through;">
|
119 |
+
(<?php echo $this->helper('checkout')->formatPrice($_item->getBasePriceSkybox()); ?>)
|
120 |
+
</span>
|
121 |
+
<span class="text-discount"><?php echo $_item->getAdjustLabelSkybox(); ?></span>
|
122 |
+
<?php endif; ?>
|
123 |
+
</span>
|
124 |
+
|
125 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
126 |
+
|
127 |
+
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
128 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
129 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
130 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
131 |
+
<?php endforeach; ?>
|
132 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
133 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
134 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
135 |
+
<?php endforeach; ?>
|
136 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
137 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
138 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
139 |
+
<?php endforeach; ?>
|
140 |
+
<?php endif; ?>
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
144 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
145 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
146 |
+
</div>
|
147 |
+
<?php endif; ?>
|
148 |
+
<?php endif; ?>
|
149 |
+
</td>
|
150 |
+
<?php endif; ?><!-- inclusive price starts here -->
|
151 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
152 |
+
<td>
|
153 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
154 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
155 |
+
<span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
156 |
+
<?php else: ?>
|
157 |
+
<span class="cart-price">
|
158 |
+
<?php endif; ?>
|
159 |
+
|
160 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
161 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
|
162 |
+
<?php else: ?>
|
163 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
164 |
+
<?php endif; ?>
|
165 |
+
|
166 |
+
</span>
|
167 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
168 |
+
|
169 |
+
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
170 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
171 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
172 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
173 |
+
<?php endforeach; ?>
|
174 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
175 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
176 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
177 |
+
<?php endforeach; ?>
|
178 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
179 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
180 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
181 |
+
<?php endforeach; ?>
|
182 |
+
<?php endif; ?>
|
183 |
+
</div>
|
184 |
+
|
185 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
186 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
187 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
|
188 |
+
</div>
|
189 |
+
<?php endif; ?>
|
190 |
+
<?php endif; ?>
|
191 |
+
</td>
|
192 |
+
<?php endif; ?>
|
193 |
+
<?php endif; ?>
|
194 |
+
<td class="a-center">
|
195 |
+
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
|
196 |
+
</td>
|
197 |
+
|
198 |
+
<!--Sub total starts here -->
|
199 |
+
<?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
|
200 |
+
<td class="a-right" style="white-space: nowrap;">
|
201 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
202 |
+
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
203 |
+
<?php else: ?>
|
204 |
+
<span class="cart-price">
|
205 |
+
<?php endif; ?>
|
206 |
+
|
207 |
+
<?php if ($canApplyMsrp): ?>
|
208 |
+
<span class="cart-msrp-subtotal">--</span>
|
209 |
+
<?php else: ?>
|
210 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
211 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getTotalSkybox()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
212 |
+
<?php else: ?>
|
213 |
+
<?php //echo $this->helper('checkout')->formatPrice($_item->getRowTotalSkybox()) ?>
|
214 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotalSkybox()) ?><!--total-->
|
215 |
+
<?php endif; ?>
|
216 |
+
<?php endif; ?>
|
217 |
+
|
218 |
+
</span>
|
219 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
220 |
+
|
221 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
222 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
223 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
224 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
225 |
+
<?php endforeach; ?>
|
226 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
227 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
228 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
229 |
+
<?php endforeach; ?>
|
230 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
231 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
232 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
233 |
+
<?php endforeach; ?>
|
234 |
+
<?php endif; ?>
|
235 |
+
</div>
|
236 |
+
|
237 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
238 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
239 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
240 |
+
</div>
|
241 |
+
<?php endif; ?>
|
242 |
+
<?php endif; ?>
|
243 |
+
</td>
|
244 |
+
<?php endif; ?>
|
245 |
+
<?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
|
246 |
+
<td>
|
247 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
248 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
249 |
+
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
250 |
+
<?php else: ?>
|
251 |
+
<span class="cart-price">
|
252 |
+
<?php endif; ?>
|
253 |
+
|
254 |
+
<?php if ($canApplyMsrp): ?>
|
255 |
+
<span class="cart-msrp-subtotal">--</span>
|
256 |
+
<?php else: ?>
|
257 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
258 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
|
259 |
+
<?php else: ?>
|
260 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
261 |
+
<?php endif; ?>
|
262 |
+
<?php endif; ?>
|
263 |
+
|
264 |
+
</span>
|
265 |
+
|
266 |
+
|
267 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
268 |
+
|
269 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
270 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
271 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
272 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
273 |
+
<?php endforeach; ?>
|
274 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
275 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
276 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
277 |
+
<?php endforeach; ?>
|
278 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
279 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
280 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
281 |
+
<?php endforeach; ?>
|
282 |
+
<?php endif; ?>
|
283 |
+
</div>
|
284 |
+
|
285 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
286 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
287 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
|
288 |
+
</div>
|
289 |
+
<?php endif; ?>
|
290 |
+
<?php endif; ?>
|
291 |
+
</td>
|
292 |
+
<?php endif; ?>
|
293 |
+
<td class="a-center"><a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo $this->__('Remove item')?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a></td>
|
294 |
+
</tr>
|
app/design/frontend/base/default/template/skybox/checkout/cart/shipping.phtml
CHANGED
@@ -1,161 +1,161 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @see Mage_Checkout_Block_Cart_Shipping
|
4 |
-
*/
|
5 |
-
?>
|
6 |
-
<?php
|
7 |
-
$_config = Mage::getModel('skyboxcore/config');
|
8 |
-
$cartSkybox = $_config->getSession()->getCartSkybox();
|
9 |
-
|
10 |
-
if ('USA' == $cartSkybox->CartCountryName && 1 == 0) {
|
11 |
-
?>
|
12 |
-
|
13 |
-
<div class="shipping">
|
14 |
-
|
15 |
-
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
16 |
-
|
17 |
-
<div class="shipping-form">
|
18 |
-
<form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
|
19 |
-
<p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
|
20 |
-
<ul class="form-list">
|
21 |
-
<li>
|
22 |
-
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
23 |
-
|
24 |
-
<div class="input-box">
|
25 |
-
<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
|
26 |
-
</div>
|
27 |
-
</li>
|
28 |
-
<?php //if($this->getStateActive()): ?>
|
29 |
-
<li>
|
30 |
-
<label
|
31 |
-
for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
|
32 |
-
|
33 |
-
<div class="input-box">
|
34 |
-
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>"
|
35 |
-
style="display:none;"<?php echo($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
|
36 |
-
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
37 |
-
</select>
|
38 |
-
<script type="text/javascript">
|
39 |
-
//<![CDATA[
|
40 |
-
$('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
|
41 |
-
//]]>
|
42 |
-
</script>
|
43 |
-
<input type="text" id="region" name="region"
|
44 |
-
value="<?php echo $this->htmlEscape($this->getEstimateRegion()) ?>"
|
45 |
-
title="<?php echo $this->__('State/Province') ?>" class="input-text"
|
46 |
-
style="display:none;"/>
|
47 |
-
</div>
|
48 |
-
</li>
|
49 |
-
<?php //endif; ?>
|
50 |
-
<?php if ($this->getCityActive()): ?>
|
51 |
-
<li>
|
52 |
-
<label
|
53 |
-
for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
|
54 |
-
|
55 |
-
<div class="input-box">
|
56 |
-
<input
|
57 |
-
class="input-text<?php if ($this->isCityRequired()): ?> required-entry<?php endif; ?>"
|
58 |
-
id="city" type="text" name="estimate_city"
|
59 |
-
value="<?php echo $this->htmlEscape($this->getEstimateCity()) ?>"/>
|
60 |
-
</div>
|
61 |
-
</li>
|
62 |
-
<?php endif; ?>
|
63 |
-
<li>
|
64 |
-
<label
|
65 |
-
for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
|
66 |
-
|
67 |
-
<div class="input-box">
|
68 |
-
<input
|
69 |
-
class="input-text validate-postcode<?php if ($this->isZipCodeRequired()): ?> required-entry<?php endif; ?>"
|
70 |
-
type="text" id="postcode" name="estimate_postcode"
|
71 |
-
value="<?php echo $this->htmlEscape($this->getEstimatePostcode()) ?>"/>
|
72 |
-
</div>
|
73 |
-
</li>
|
74 |
-
</ul>
|
75 |
-
<div class="buttons-set">
|
76 |
-
<button type="button" title="<?php echo $this->__('Get a Quote') ?>"
|
77 |
-
onclick="coShippingMethodForm.submit()" class="button">
|
78 |
-
<span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
|
79 |
-
</div>
|
80 |
-
</form>
|
81 |
-
<script type="text/javascript">
|
82 |
-
//<![CDATA[
|
83 |
-
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
|
84 |
-
//]]>
|
85 |
-
</script>
|
86 |
-
|
87 |
-
<?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
|
88 |
-
<form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
|
89 |
-
<dl class="sp-methods">
|
90 |
-
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
91 |
-
<dt><?php echo $this->getCarrierName($code) ?></dt>
|
92 |
-
<dd>
|
93 |
-
<ul>
|
94 |
-
<?php foreach ($_rates as $_rate): ?>
|
95 |
-
<li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"'; ?>>
|
96 |
-
<?php if ($_rate->getErrorMessage()): ?>
|
97 |
-
<?php echo $_rate->getErrorMessage() ?>
|
98 |
-
<?php else: ?>
|
99 |
-
<input name="estimate_method" type="radio"
|
100 |
-
value="<?php echo $this->htmlEscape($_rate->getCode()) ?>"
|
101 |
-
id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?>
|
102 |
-
class="radio"/>
|
103 |
-
<label
|
104 |
-
for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
|
105 |
-
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
106 |
-
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
107 |
-
<?php echo $_excl; ?>
|
108 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
109 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
110 |
-
<?php endif; ?>
|
111 |
-
</label>
|
112 |
-
<?php endif ?>
|
113 |
-
</li>
|
114 |
-
<?php endforeach; ?>
|
115 |
-
</ul>
|
116 |
-
</dd>
|
117 |
-
<?php endforeach; ?>
|
118 |
-
</dl>
|
119 |
-
<div class="buttons-set">
|
120 |
-
<button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do"
|
121 |
-
value="<?php echo $this->__('Update Total') ?>">
|
122 |
-
<span><span><?php echo $this->__('Update Total') ?></span></span></button>
|
123 |
-
</div>
|
124 |
-
</form>
|
125 |
-
|
126 |
-
<?php echo $this->getChildHtml('ddp_service_fee'); ?>
|
127 |
-
|
128 |
-
<?php endif; ?>
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
<script type="text/javascript">
|
133 |
-
//<![CDATA[
|
134 |
-
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
135 |
-
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
136 |
-
|
137 |
-
coShippingMethodForm.submit = function () {
|
138 |
-
var country = $F('country');
|
139 |
-
var optionalZip = false;
|
140 |
-
|
141 |
-
for (i = 0; i < countriesWithOptionalZip.length; i++) {
|
142 |
-
if (countriesWithOptionalZip[i] == country) {
|
143 |
-
optionalZip = true;
|
144 |
-
}
|
145 |
-
}
|
146 |
-
if (optionalZip) {
|
147 |
-
$('postcode').removeClassName('required-entry');
|
148 |
-
}
|
149 |
-
else {
|
150 |
-
$('postcode').addClassName('required-entry');
|
151 |
-
}
|
152 |
-
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
|
153 |
-
}
|
154 |
-
//]]>
|
155 |
-
</script>
|
156 |
-
</div>
|
157 |
-
</div>
|
158 |
-
|
159 |
-
<?php
|
160 |
-
}// endif
|
161 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @see Mage_Checkout_Block_Cart_Shipping
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<?php
|
7 |
+
$_config = Mage::getModel('skyboxcore/config');
|
8 |
+
$cartSkybox = $_config->getSession()->getCartSkybox();
|
9 |
+
|
10 |
+
if ('USA' == $cartSkybox->CartCountryName && 1 == 0) {
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="shipping">
|
14 |
+
|
15 |
+
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
16 |
+
|
17 |
+
<div class="shipping-form">
|
18 |
+
<form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
|
19 |
+
<p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
|
20 |
+
<ul class="form-list">
|
21 |
+
<li>
|
22 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
23 |
+
|
24 |
+
<div class="input-box">
|
25 |
+
<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
<?php //if($this->getStateActive()): ?>
|
29 |
+
<li>
|
30 |
+
<label
|
31 |
+
for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
|
32 |
+
|
33 |
+
<div class="input-box">
|
34 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>"
|
35 |
+
style="display:none;"<?php echo($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
|
36 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
37 |
+
</select>
|
38 |
+
<script type="text/javascript">
|
39 |
+
//<![CDATA[
|
40 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
|
41 |
+
//]]>
|
42 |
+
</script>
|
43 |
+
<input type="text" id="region" name="region"
|
44 |
+
value="<?php echo $this->htmlEscape($this->getEstimateRegion()) ?>"
|
45 |
+
title="<?php echo $this->__('State/Province') ?>" class="input-text"
|
46 |
+
style="display:none;"/>
|
47 |
+
</div>
|
48 |
+
</li>
|
49 |
+
<?php //endif; ?>
|
50 |
+
<?php if ($this->getCityActive()): ?>
|
51 |
+
<li>
|
52 |
+
<label
|
53 |
+
for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
|
54 |
+
|
55 |
+
<div class="input-box">
|
56 |
+
<input
|
57 |
+
class="input-text<?php if ($this->isCityRequired()): ?> required-entry<?php endif; ?>"
|
58 |
+
id="city" type="text" name="estimate_city"
|
59 |
+
value="<?php echo $this->htmlEscape($this->getEstimateCity()) ?>"/>
|
60 |
+
</div>
|
61 |
+
</li>
|
62 |
+
<?php endif; ?>
|
63 |
+
<li>
|
64 |
+
<label
|
65 |
+
for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
|
66 |
+
|
67 |
+
<div class="input-box">
|
68 |
+
<input
|
69 |
+
class="input-text validate-postcode<?php if ($this->isZipCodeRequired()): ?> required-entry<?php endif; ?>"
|
70 |
+
type="text" id="postcode" name="estimate_postcode"
|
71 |
+
value="<?php echo $this->htmlEscape($this->getEstimatePostcode()) ?>"/>
|
72 |
+
</div>
|
73 |
+
</li>
|
74 |
+
</ul>
|
75 |
+
<div class="buttons-set">
|
76 |
+
<button type="button" title="<?php echo $this->__('Get a Quote') ?>"
|
77 |
+
onclick="coShippingMethodForm.submit()" class="button">
|
78 |
+
<span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
|
79 |
+
</div>
|
80 |
+
</form>
|
81 |
+
<script type="text/javascript">
|
82 |
+
//<![CDATA[
|
83 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
|
84 |
+
//]]>
|
85 |
+
</script>
|
86 |
+
|
87 |
+
<?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
|
88 |
+
<form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
|
89 |
+
<dl class="sp-methods">
|
90 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
91 |
+
<dt><?php echo $this->getCarrierName($code) ?></dt>
|
92 |
+
<dd>
|
93 |
+
<ul>
|
94 |
+
<?php foreach ($_rates as $_rate): ?>
|
95 |
+
<li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"'; ?>>
|
96 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
97 |
+
<?php echo $_rate->getErrorMessage() ?>
|
98 |
+
<?php else: ?>
|
99 |
+
<input name="estimate_method" type="radio"
|
100 |
+
value="<?php echo $this->htmlEscape($_rate->getCode()) ?>"
|
101 |
+
id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?>
|
102 |
+
class="radio"/>
|
103 |
+
<label
|
104 |
+
for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
|
105 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
106 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
107 |
+
<?php echo $_excl; ?>
|
108 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
109 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
110 |
+
<?php endif; ?>
|
111 |
+
</label>
|
112 |
+
<?php endif ?>
|
113 |
+
</li>
|
114 |
+
<?php endforeach; ?>
|
115 |
+
</ul>
|
116 |
+
</dd>
|
117 |
+
<?php endforeach; ?>
|
118 |
+
</dl>
|
119 |
+
<div class="buttons-set">
|
120 |
+
<button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do"
|
121 |
+
value="<?php echo $this->__('Update Total') ?>">
|
122 |
+
<span><span><?php echo $this->__('Update Total') ?></span></span></button>
|
123 |
+
</div>
|
124 |
+
</form>
|
125 |
+
|
126 |
+
<?php echo $this->getChildHtml('ddp_service_fee'); ?>
|
127 |
+
|
128 |
+
<?php endif; ?>
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
<script type="text/javascript">
|
133 |
+
//<![CDATA[
|
134 |
+
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
135 |
+
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
136 |
+
|
137 |
+
coShippingMethodForm.submit = function () {
|
138 |
+
var country = $F('country');
|
139 |
+
var optionalZip = false;
|
140 |
+
|
141 |
+
for (i = 0; i < countriesWithOptionalZip.length; i++) {
|
142 |
+
if (countriesWithOptionalZip[i] == country) {
|
143 |
+
optionalZip = true;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
if (optionalZip) {
|
147 |
+
$('postcode').removeClassName('required-entry');
|
148 |
+
}
|
149 |
+
else {
|
150 |
+
$('postcode').addClassName('required-entry');
|
151 |
+
}
|
152 |
+
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
|
153 |
+
}
|
154 |
+
//]]>
|
155 |
+
</script>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
|
159 |
+
<?php
|
160 |
+
}// endif
|
161 |
?>
|
app/design/frontend/base/default/template/skybox/checkout/cart/sidebar.phtml
CHANGED
@@ -1,80 +1,80 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Shoping cart sidebar
|
29 |
-
*
|
30 |
-
* @see Mage_Checkout_Block_Cart_Sidebar
|
31 |
-
*/
|
32 |
-
|
33 |
-
?>
|
34 |
-
<?php if ($this->getIsNeedToDisplaySideBar()):?>
|
35 |
-
<div class="block block-cart">
|
36 |
-
<?php $_cartQty = $this->getSummaryCount() ?>
|
37 |
-
<div class="block-title">
|
38 |
-
<strong><span><?php echo $this->__('My Cart') ?></span></strong>
|
39 |
-
</div>
|
40 |
-
<div class="block-content">
|
41 |
-
<?php if ($_cartQty>0): ?>
|
42 |
-
<div class="summary">
|
43 |
-
<?php if ($_cartQty==1): ?>
|
44 |
-
<p class="amount"><?php echo $this->__('There is <a href="%s">1 item</a> in your cart.', $this->getUrl('checkout/cart')) ?></p>
|
45 |
-
<?php else: ?>
|
46 |
-
<p class="amount"><?php echo $this->__('There are <a href="%s">%s items</a> in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?></p>
|
47 |
-
<?php endif ?>
|
48 |
-
<p class="subtotal">
|
49 |
-
<?php if ($this->canApplyMsrp()): ?>
|
50 |
-
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
|
51 |
-
<?php else: ?>
|
52 |
-
<span class="label"><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
|
53 |
-
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
|
54 |
-
<br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
|
55 |
-
<?php endif; ?>
|
56 |
-
<?php endif; ?>
|
57 |
-
</p>
|
58 |
-
</div>
|
59 |
-
<?php endif ?>
|
60 |
-
<?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
|
61 |
-
<div class="actions">
|
62 |
-
<?php echo $this->getChildHtml('extra_actions') ?>
|
63 |
-
<button type="button" title="<?php echo $this->__('Checkout') ?>" class="button" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')"><span><span><?php echo $this->__('Checkout') ?></span></span></button>
|
64 |
-
</div>
|
65 |
-
<?php endif ?>
|
66 |
-
<?php $_items = $this->getRecentItems() ?>
|
67 |
-
<?php if(count($_items)): ?>
|
68 |
-
<p class="block-subtitle"><?php echo $this->__('Recently added item(s)') ?></p>
|
69 |
-
<ol id="cart-sidebar" class="mini-products-list">
|
70 |
-
<?php foreach($_items as $_item): ?>
|
71 |
-
<?php echo $this->getItemHtml($_item) ?>
|
72 |
-
<?php endforeach; ?>
|
73 |
-
</ol>
|
74 |
-
<script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script>
|
75 |
-
<?php else: ?>
|
76 |
-
<p class="empty"><?php echo $this->__('You have no items in your shopping cart.') ?></p>
|
77 |
-
<?php endif ?>
|
78 |
-
</div>
|
79 |
-
</div>
|
80 |
-
<?php endif;?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shoping cart sidebar
|
29 |
+
*
|
30 |
+
* @see Mage_Checkout_Block_Cart_Sidebar
|
31 |
+
*/
|
32 |
+
|
33 |
+
?>
|
34 |
+
<?php if ($this->getIsNeedToDisplaySideBar()):?>
|
35 |
+
<div class="block block-cart">
|
36 |
+
<?php $_cartQty = $this->getSummaryCount() ?>
|
37 |
+
<div class="block-title">
|
38 |
+
<strong><span><?php echo $this->__('My Cart') ?></span></strong>
|
39 |
+
</div>
|
40 |
+
<div class="block-content">
|
41 |
+
<?php if ($_cartQty>0): ?>
|
42 |
+
<div class="summary">
|
43 |
+
<?php if ($_cartQty==1): ?>
|
44 |
+
<p class="amount"><?php echo $this->__('There is <a href="%s">1 item</a> in your cart.', $this->getUrl('checkout/cart')) ?></p>
|
45 |
+
<?php else: ?>
|
46 |
+
<p class="amount"><?php echo $this->__('There are <a href="%s">%s items</a> in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?></p>
|
47 |
+
<?php endif ?>
|
48 |
+
<p class="subtotal">
|
49 |
+
<?php if ($this->canApplyMsrp()): ?>
|
50 |
+
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
|
51 |
+
<?php else: ?>
|
52 |
+
<span class="label"><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
|
53 |
+
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
|
54 |
+
<br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
|
55 |
+
<?php endif; ?>
|
56 |
+
<?php endif; ?>
|
57 |
+
</p>
|
58 |
+
</div>
|
59 |
+
<?php endif ?>
|
60 |
+
<?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
|
61 |
+
<div class="actions">
|
62 |
+
<?php echo $this->getChildHtml('extra_actions') ?>
|
63 |
+
<button type="button" title="<?php echo $this->__('Checkout') ?>" class="button" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')"><span><span><?php echo $this->__('Checkout') ?></span></span></button>
|
64 |
+
</div>
|
65 |
+
<?php endif ?>
|
66 |
+
<?php $_items = $this->getRecentItems() ?>
|
67 |
+
<?php if(count($_items)): ?>
|
68 |
+
<p class="block-subtitle"><?php echo $this->__('Recently added item(s)') ?></p>
|
69 |
+
<ol id="cart-sidebar" class="mini-products-list">
|
70 |
+
<?php foreach($_items as $_item): ?>
|
71 |
+
<?php echo $this->getItemHtml($_item) ?>
|
72 |
+
<?php endforeach; ?>
|
73 |
+
</ol>
|
74 |
+
<script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script>
|
75 |
+
<?php else: ?>
|
76 |
+
<p class="empty"><?php echo $this->__('You have no items in your shopping cart.') ?></p>
|
77 |
+
<?php endif ?>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/skybox/checkout/cart/sidebar/default.phtml
CHANGED
@@ -1,146 +1,146 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
$_item = $this->getItem();
|
29 |
-
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
30 |
-
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
|
31 |
-
?>
|
32 |
-
<li class="item">
|
33 |
-
<?php if ($this->hasProductUrl()): ?>
|
34 |
-
<a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
|
35 |
-
<?php else: ?>
|
36 |
-
<span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
|
37 |
-
<?php endif; ?>
|
38 |
-
<div class="product-details">
|
39 |
-
<a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo $this->__('Remove This Item') ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
|
40 |
-
<?php if ($isVisibleProduct): ?>
|
41 |
-
<a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item') ?>" class="btn-edit"><?php echo $this->__('Edit item')?></a>
|
42 |
-
<?php endif ?>
|
43 |
-
<p class="product-name"><?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?><?php echo $this->escapeHtml($this->getProductName()) ?><?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
|
44 |
-
<strong><?php echo $this->getQty() ?></strong> x
|
45 |
-
|
46 |
-
<?php if ($canApplyMsrp): ?>
|
47 |
-
|
48 |
-
<span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
|
49 |
-
|
50 |
-
<?php else: ?>
|
51 |
-
|
52 |
-
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
53 |
-
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
54 |
-
<?php echo $this->__('Excl. Tax'); ?>:
|
55 |
-
<?php endif; ?>
|
56 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
|
57 |
-
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
58 |
-
<?php else: ?>
|
59 |
-
<?php //echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
|
60 |
-
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotalSkybox()) ?>
|
61 |
-
<?php endif; ?>
|
62 |
-
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
63 |
-
<br />
|
64 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
|
65 |
-
<small>
|
66 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
67 |
-
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
68 |
-
<?php endforeach; ?>
|
69 |
-
</small>
|
70 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
71 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
72 |
-
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
73 |
-
<?php endforeach; ?>
|
74 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
|
75 |
-
<small>
|
76 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
77 |
-
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
78 |
-
<?php endforeach; ?>
|
79 |
-
</small>
|
80 |
-
<?php endif; ?>
|
81 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
82 |
-
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
83 |
-
<?php endif; ?>
|
84 |
-
<?php endif; ?>
|
85 |
-
<?php endif; ?>
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
90 |
-
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
91 |
-
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
92 |
-
<br /><?php echo $this->__('Incl. Tax'); ?>:
|
93 |
-
<?php endif; ?>
|
94 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
|
95 |
-
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
|
96 |
-
<?php else: ?>
|
97 |
-
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
98 |
-
<?php endif; ?>
|
99 |
-
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
100 |
-
<br />
|
101 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
|
102 |
-
<small>
|
103 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
104 |
-
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
105 |
-
<?php endforeach; ?>
|
106 |
-
</small>
|
107 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
108 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
109 |
-
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
110 |
-
<?php endforeach; ?>
|
111 |
-
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
|
112 |
-
<small>
|
113 |
-
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
114 |
-
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
115 |
-
<?php endforeach; ?>
|
116 |
-
</small>
|
117 |
-
<?php endif; ?>
|
118 |
-
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
119 |
-
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
|
120 |
-
<?php endif; ?>
|
121 |
-
<?php endif; ?>
|
122 |
-
<?php endif; ?>
|
123 |
-
|
124 |
-
<?php endif; //Can apply MSRP ?>
|
125 |
-
|
126 |
-
<?php if ($_options = $this->getOptionList()):?>
|
127 |
-
<div class="truncated">
|
128 |
-
<div class="truncated_full_value">
|
129 |
-
<dl class="item-options">
|
130 |
-
<?php foreach ($_options as $_option) : ?>
|
131 |
-
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
132 |
-
<dd>
|
133 |
-
<?php if (is_array($_option['value'])): ?>
|
134 |
-
<?php echo nl2br(implode("\n", $_option['value'])) ?>
|
135 |
-
<?php else: ?>
|
136 |
-
<?php echo $_option['value'] ?>
|
137 |
-
<?php endif; ?>
|
138 |
-
</dd>
|
139 |
-
<?php endforeach; ?>
|
140 |
-
</dl>
|
141 |
-
</div>
|
142 |
-
<a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
|
143 |
-
</div>
|
144 |
-
<?php endif; ?>
|
145 |
-
</div>
|
146 |
-
</li>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
$_item = $this->getItem();
|
29 |
+
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
30 |
+
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
|
31 |
+
?>
|
32 |
+
<li class="item">
|
33 |
+
<?php if ($this->hasProductUrl()): ?>
|
34 |
+
<a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
|
35 |
+
<?php else: ?>
|
36 |
+
<span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
|
37 |
+
<?php endif; ?>
|
38 |
+
<div class="product-details">
|
39 |
+
<a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo $this->__('Remove This Item') ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
|
40 |
+
<?php if ($isVisibleProduct): ?>
|
41 |
+
<a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item') ?>" class="btn-edit"><?php echo $this->__('Edit item')?></a>
|
42 |
+
<?php endif ?>
|
43 |
+
<p class="product-name"><?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?><?php echo $this->escapeHtml($this->getProductName()) ?><?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
|
44 |
+
<strong><?php echo $this->getQty() ?></strong> x
|
45 |
+
|
46 |
+
<?php if ($canApplyMsrp): ?>
|
47 |
+
|
48 |
+
<span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
|
49 |
+
|
50 |
+
<?php else: ?>
|
51 |
+
|
52 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
53 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
54 |
+
<?php echo $this->__('Excl. Tax'); ?>:
|
55 |
+
<?php endif; ?>
|
56 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
|
57 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
58 |
+
<?php else: ?>
|
59 |
+
<?php //echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
|
60 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotalSkybox()) ?>
|
61 |
+
<?php endif; ?>
|
62 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
63 |
+
<br />
|
64 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
|
65 |
+
<small>
|
66 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
67 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
68 |
+
<?php endforeach; ?>
|
69 |
+
</small>
|
70 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
71 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
72 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
73 |
+
<?php endforeach; ?>
|
74 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
|
75 |
+
<small>
|
76 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
77 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
78 |
+
<?php endforeach; ?>
|
79 |
+
</small>
|
80 |
+
<?php endif; ?>
|
81 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
82 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
83 |
+
<?php endif; ?>
|
84 |
+
<?php endif; ?>
|
85 |
+
<?php endif; ?>
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
90 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
91 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
92 |
+
<br /><?php echo $this->__('Incl. Tax'); ?>:
|
93 |
+
<?php endif; ?>
|
94 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
|
95 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
|
96 |
+
<?php else: ?>
|
97 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
98 |
+
<?php endif; ?>
|
99 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
100 |
+
<br />
|
101 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
|
102 |
+
<small>
|
103 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
104 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
105 |
+
<?php endforeach; ?>
|
106 |
+
</small>
|
107 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
108 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
109 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
110 |
+
<?php endforeach; ?>
|
111 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
|
112 |
+
<small>
|
113 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
114 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
115 |
+
<?php endforeach; ?>
|
116 |
+
</small>
|
117 |
+
<?php endif; ?>
|
118 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
|
119 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
|
120 |
+
<?php endif; ?>
|
121 |
+
<?php endif; ?>
|
122 |
+
<?php endif; ?>
|
123 |
+
|
124 |
+
<?php endif; //Can apply MSRP ?>
|
125 |
+
|
126 |
+
<?php if ($_options = $this->getOptionList()):?>
|
127 |
+
<div class="truncated">
|
128 |
+
<div class="truncated_full_value">
|
129 |
+
<dl class="item-options">
|
130 |
+
<?php foreach ($_options as $_option) : ?>
|
131 |
+
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
132 |
+
<dd>
|
133 |
+
<?php if (is_array($_option['value'])): ?>
|
134 |
+
<?php echo nl2br(implode("\n", $_option['value'])) ?>
|
135 |
+
<?php else: ?>
|
136 |
+
<?php echo $_option['value'] ?>
|
137 |
+
<?php endif; ?>
|
138 |
+
</dd>
|
139 |
+
<?php endforeach; ?>
|
140 |
+
</dl>
|
141 |
+
</div>
|
142 |
+
<a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
|
143 |
+
</div>
|
144 |
+
<?php endif; ?>
|
145 |
+
</div>
|
146 |
+
</li>
|
app/design/frontend/base/default/template/skybox/checkout/cart_list.phtml
CHANGED
@@ -1,196 +1,196 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
/**
|
29 |
-
* Shopping cart template
|
30 |
-
*
|
31 |
-
* @see Mage_Checkout_Block_Cart
|
32 |
-
*/
|
33 |
-
?>
|
34 |
-
<div class="cart">
|
35 |
-
<div class="page-title title-buttons">
|
36 |
-
<h1><?php echo $this->__('Shopping Cart') ?></h1>
|
37 |
-
<?php if(!$this->hasError()): ?>
|
38 |
-
<ul class="checkout-types">
|
39 |
-
<?php foreach ($this->getMethods('top_methods') as $method): ?>
|
40 |
-
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
41 |
-
<li><?php echo $methodHtml; ?></li>
|
42 |
-
<?php endif; ?>
|
43 |
-
<?php endforeach; ?>
|
44 |
-
</ul>
|
45 |
-
<?php endif; ?>
|
46 |
-
</div>
|
47 |
-
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
48 |
-
<?php echo $this->getChildHtml('form_before') ?>
|
49 |
-
<div class="skx-cart-list-product">
|
50 |
-
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
|
51 |
-
<?php echo $this->getBlockHtml('formkey'); ?>
|
52 |
-
<table id="shopping-cart-table" class="data-table cart-table">
|
53 |
-
<col width="1" />
|
54 |
-
<col />
|
55 |
-
<col width="1" />
|
56 |
-
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
57 |
-
<col width="1" />
|
58 |
-
<?php endif ?>
|
59 |
-
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
60 |
-
<col width="1" />
|
61 |
-
<?php endif; ?>
|
62 |
-
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
63 |
-
<col width="1" />
|
64 |
-
<?php endif; ?>
|
65 |
-
<col width="1" />
|
66 |
-
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
67 |
-
<col width="1" />
|
68 |
-
<?php endif; ?>
|
69 |
-
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
70 |
-
<col width="1" />
|
71 |
-
<?php endif; ?>
|
72 |
-
<col width="1" />
|
73 |
-
|
74 |
-
<?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
|
75 |
-
<thead>
|
76 |
-
<tr>
|
77 |
-
<th rowspan="<?php echo $mergedCells; ?>"> </th>
|
78 |
-
<th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
|
79 |
-
<th rowspan="<?php echo $mergedCells; ?>"></th>
|
80 |
-
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
81 |
-
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
|
82 |
-
<?php endif ?>
|
83 |
-
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
|
84 |
-
<!--<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Customs') ?></th>
|
85 |
-
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Insurance') ?></th>
|
86 |
-
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Shipping') ?></th>
|
87 |
-
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Price') ?></th>-->
|
88 |
-
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
|
89 |
-
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
|
90 |
-
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"> </th>
|
91 |
-
</tr>
|
92 |
-
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
93 |
-
<tr>
|
94 |
-
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
95 |
-
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
96 |
-
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
97 |
-
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
98 |
-
</tr>
|
99 |
-
<?php endif; ?>
|
100 |
-
</thead>
|
101 |
-
<tfoot>
|
102 |
-
<tr>
|
103 |
-
<td colspan="50" class="a-right">
|
104 |
-
<?php if($this->getContinueShoppingUrl()): ?>
|
105 |
-
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
106 |
-
<?php endif; ?>
|
107 |
-
<button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
|
108 |
-
<button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
|
109 |
-
<!--[if lt IE 8]>
|
110 |
-
<input type="hidden" id="update_cart_action_container" />
|
111 |
-
<script type="text/javascript">
|
112 |
-
//<![CDATA[
|
113 |
-
Event.observe(window, 'load', function()
|
114 |
-
{
|
115 |
-
// Internet Explorer (lt 8) does not support value attribute in button elements
|
116 |
-
$emptyCartButton = $('empty_cart_button');
|
117 |
-
$cartActionContainer = $('update_cart_action_container');
|
118 |
-
if ($emptyCartButton && $cartActionContainer) {
|
119 |
-
Event.observe($emptyCartButton, 'click', function()
|
120 |
-
{
|
121 |
-
$emptyCartButton.setAttribute('name', 'update_cart_action_temp');
|
122 |
-
$cartActionContainer.setAttribute('name', 'update_cart_action');
|
123 |
-
$cartActionContainer.setValue('empty_cart');
|
124 |
-
});
|
125 |
-
}
|
126 |
-
|
127 |
-
});
|
128 |
-
//]]>
|
129 |
-
</script>
|
130 |
-
<![endif]-->
|
131 |
-
</td>
|
132 |
-
</tr>
|
133 |
-
</tfoot>
|
134 |
-
<tbody>
|
135 |
-
<?php foreach($this->getItems() as $_item): ?>
|
136 |
-
<?php echo $this->getItemHtml($_item) ?>
|
137 |
-
<?php endforeach ?>
|
138 |
-
</tbody>
|
139 |
-
</table>
|
140 |
-
<script type="text/javascript">decorateTable('shopping-cart-table')</script>
|
141 |
-
</form>
|
142 |
-
</div>
|
143 |
-
<div class="skx-cart-total-product">
|
144 |
-
<div class="cart-forms">
|
145 |
-
<?php echo $this->getChildHtml('crosssell') ?>
|
146 |
-
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
147 |
-
<?php echo $this->getChildHtml('coupon') ?>
|
148 |
-
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
|
149 |
-
</div>
|
150 |
-
<div class="cart-totals-wrapper">
|
151 |
-
<div class="cart-totals">
|
152 |
-
<?php echo $this->getChildHtml('totals'); ?>
|
153 |
-
<?php if(!$this->hasError()): ?>
|
154 |
-
<ul class="checkout-types">
|
155 |
-
<?php foreach ($this->getMethods('methods') as $method): ?>
|
156 |
-
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
157 |
-
<li><?php echo $methodHtml; ?></li>
|
158 |
-
<?php endif; ?>
|
159 |
-
<?php endforeach; ?>
|
160 |
-
</ul>
|
161 |
-
<?php endif; ?>
|
162 |
-
</div>
|
163 |
-
</div>
|
164 |
-
</div>
|
165 |
-
</div>
|
166 |
-
<style type="text/css">
|
167 |
-
/*@media (min-width:320px) */
|
168 |
-
.cart .cart-totals table tfoot strong span, .cart .cart-totals table tfoot span.price {
|
169 |
-
white-space: nowrap;
|
170 |
-
}
|
171 |
-
@media screen and (max-width: 320px) , screen and (max-height: 480px) {
|
172 |
-
.cart-table {
|
173 |
-
float: none;
|
174 |
-
width: 100%;
|
175 |
-
}
|
176 |
-
.cart-forms, .cart-totals-wrapper, .crosssell {
|
177 |
-
float: none;
|
178 |
-
width: 100%;
|
179 |
-
padding-left: 0;
|
180 |
-
}
|
181 |
-
|
182 |
-
.cart .button
|
183 |
-
{
|
184 |
-
display: block;
|
185 |
-
width: 100%;
|
186 |
-
margin: 5px;
|
187 |
-
float: none !important;
|
188 |
-
}
|
189 |
-
|
190 |
-
.cart-table tbody td.a-center {
|
191 |
-
display: block;
|
192 |
-
text-align: right;
|
193 |
-
}
|
194 |
-
|
195 |
-
}
|
196 |
</style>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Shopping cart template
|
30 |
+
*
|
31 |
+
* @see Mage_Checkout_Block_Cart
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<div class="cart">
|
35 |
+
<div class="page-title title-buttons">
|
36 |
+
<h1><?php echo $this->__('Shopping Cart') ?></h1>
|
37 |
+
<?php if(!$this->hasError()): ?>
|
38 |
+
<ul class="checkout-types">
|
39 |
+
<?php foreach ($this->getMethods('top_methods') as $method): ?>
|
40 |
+
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
41 |
+
<li><?php echo $methodHtml; ?></li>
|
42 |
+
<?php endif; ?>
|
43 |
+
<?php endforeach; ?>
|
44 |
+
</ul>
|
45 |
+
<?php endif; ?>
|
46 |
+
</div>
|
47 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
48 |
+
<?php echo $this->getChildHtml('form_before') ?>
|
49 |
+
<div class="skx-cart-list-product">
|
50 |
+
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
|
51 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
52 |
+
<table id="shopping-cart-table" class="data-table cart-table">
|
53 |
+
<col width="1" />
|
54 |
+
<col />
|
55 |
+
<col width="1" />
|
56 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
57 |
+
<col width="1" />
|
58 |
+
<?php endif ?>
|
59 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
60 |
+
<col width="1" />
|
61 |
+
<?php endif; ?>
|
62 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
63 |
+
<col width="1" />
|
64 |
+
<?php endif; ?>
|
65 |
+
<col width="1" />
|
66 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
67 |
+
<col width="1" />
|
68 |
+
<?php endif; ?>
|
69 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
70 |
+
<col width="1" />
|
71 |
+
<?php endif; ?>
|
72 |
+
<col width="1" />
|
73 |
+
|
74 |
+
<?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
|
75 |
+
<thead>
|
76 |
+
<tr>
|
77 |
+
<th rowspan="<?php echo $mergedCells; ?>"> </th>
|
78 |
+
<th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
|
79 |
+
<th rowspan="<?php echo $mergedCells; ?>"></th>
|
80 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
81 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
|
82 |
+
<?php endif ?>
|
83 |
+
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
|
84 |
+
<!--<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Customs') ?></th>
|
85 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Insurance') ?></th>
|
86 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Shipping') ?></th>
|
87 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Price') ?></th>-->
|
88 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
|
89 |
+
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
|
90 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"> </th>
|
91 |
+
</tr>
|
92 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
93 |
+
<tr>
|
94 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
95 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
96 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
97 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
98 |
+
</tr>
|
99 |
+
<?php endif; ?>
|
100 |
+
</thead>
|
101 |
+
<tfoot>
|
102 |
+
<tr>
|
103 |
+
<td colspan="50" class="a-right">
|
104 |
+
<?php if($this->getContinueShoppingUrl()): ?>
|
105 |
+
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
106 |
+
<?php endif; ?>
|
107 |
+
<button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
|
108 |
+
<button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
|
109 |
+
<!--[if lt IE 8]>
|
110 |
+
<input type="hidden" id="update_cart_action_container" />
|
111 |
+
<script type="text/javascript">
|
112 |
+
//<![CDATA[
|
113 |
+
Event.observe(window, 'load', function()
|
114 |
+
{
|
115 |
+
// Internet Explorer (lt 8) does not support value attribute in button elements
|
116 |
+
$emptyCartButton = $('empty_cart_button');
|
117 |
+
$cartActionContainer = $('update_cart_action_container');
|
118 |
+
if ($emptyCartButton && $cartActionContainer) {
|
119 |
+
Event.observe($emptyCartButton, 'click', function()
|
120 |
+
{
|
121 |
+
$emptyCartButton.setAttribute('name', 'update_cart_action_temp');
|
122 |
+
$cartActionContainer.setAttribute('name', 'update_cart_action');
|
123 |
+
$cartActionContainer.setValue('empty_cart');
|
124 |
+
});
|
125 |
+
}
|
126 |
+
|
127 |
+
});
|
128 |
+
//]]>
|
129 |
+
</script>
|
130 |
+
<![endif]-->
|
131 |
+
</td>
|
132 |
+
</tr>
|
133 |
+
</tfoot>
|
134 |
+
<tbody>
|
135 |
+
<?php foreach($this->getItems() as $_item): ?>
|
136 |
+
<?php echo $this->getItemHtml($_item) ?>
|
137 |
+
<?php endforeach ?>
|
138 |
+
</tbody>
|
139 |
+
</table>
|
140 |
+
<script type="text/javascript">decorateTable('shopping-cart-table')</script>
|
141 |
+
</form>
|
142 |
+
</div>
|
143 |
+
<div class="skx-cart-total-product">
|
144 |
+
<div class="cart-forms">
|
145 |
+
<?php echo $this->getChildHtml('crosssell') ?>
|
146 |
+
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
147 |
+
<?php echo $this->getChildHtml('coupon') ?>
|
148 |
+
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
|
149 |
+
</div>
|
150 |
+
<div class="cart-totals-wrapper">
|
151 |
+
<div class="cart-totals">
|
152 |
+
<?php echo $this->getChildHtml('totals'); ?>
|
153 |
+
<?php if(!$this->hasError()): ?>
|
154 |
+
<ul class="checkout-types">
|
155 |
+
<?php foreach ($this->getMethods('methods') as $method): ?>
|
156 |
+
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
157 |
+
<li><?php echo $methodHtml; ?></li>
|
158 |
+
<?php endif; ?>
|
159 |
+
<?php endforeach; ?>
|
160 |
+
</ul>
|
161 |
+
<?php endif; ?>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
<style type="text/css">
|
167 |
+
/*@media (min-width:320px) */
|
168 |
+
.cart .cart-totals table tfoot strong span, .cart .cart-totals table tfoot span.price {
|
169 |
+
white-space: nowrap;
|
170 |
+
}
|
171 |
+
@media screen and (max-width: 320px) , screen and (max-height: 480px) {
|
172 |
+
.cart-table {
|
173 |
+
float: none;
|
174 |
+
width: 100%;
|
175 |
+
}
|
176 |
+
.cart-forms, .cart-totals-wrapper, .crosssell {
|
177 |
+
float: none;
|
178 |
+
width: 100%;
|
179 |
+
padding-left: 0;
|
180 |
+
}
|
181 |
+
|
182 |
+
.cart .button
|
183 |
+
{
|
184 |
+
display: block;
|
185 |
+
width: 100%;
|
186 |
+
margin: 5px;
|
187 |
+
float: none !important;
|
188 |
+
}
|
189 |
+
|
190 |
+
.cart-table tbody td.a-center {
|
191 |
+
display: block;
|
192 |
+
text-align: right;
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
196 |
</style>
|
app/design/frontend/base/default/template/skybox/checkout/onepage.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl("skbcheckout/international"));
|
1 |
+
<?php
|
2 |
+
|
3 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl("skbcheckout/international"));
|
app/design/frontend/base/default/template/skybox/checkout/onepage/link.phtml
CHANGED
@@ -1,42 +1,42 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magento.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
$api = Mage::getModel('skyboxcatalog/api_product');
|
29 |
-
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
30 |
-
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
31 |
-
|
32 |
-
if (($api->getLocationAllow()==3) && $typeIntegration==3):
|
33 |
-
?>
|
34 |
-
<button type="button"
|
35 |
-
|
36 |
-
class="button btn-proceed-checkout btn-checkout"
|
37 |
-
onclick="window.location='<?php echo $this->getUrl('skbcheckout/international', array('_secure'=>true)) ?>';">
|
38 |
-
<span>
|
39 |
-
<span><?php echo $this->__('Checkout with SkyBOX Checkout') ?></span>
|
40 |
-
</span>
|
41 |
-
</button>
|
42 |
<?php endif;?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
$api = Mage::getModel('skyboxcatalog/api_product');
|
29 |
+
//$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
30 |
+
$typeIntegration = Mage::helper('skyboxinternational/data')->getSkyboxIntegration();
|
31 |
+
|
32 |
+
if (($api->getLocationAllow()==3) && $typeIntegration==3):
|
33 |
+
?>
|
34 |
+
<button type="button"
|
35 |
+
|
36 |
+
class="button btn-proceed-checkout btn-checkout"
|
37 |
+
onclick="window.location='<?php echo $this->getUrl('skbcheckout/international', array('_secure'=>true)) ?>';">
|
38 |
+
<span>
|
39 |
+
<span><?php echo $this->__('Checkout with SkyBOX Checkout') ?></span>
|
40 |
+
</span>
|
41 |
+
</button>
|
42 |
<?php endif;?>
|
app/design/frontend/base/default/template/skybox/checkout/pagecheckout.phtml
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Template for Mage_Page_Block_Html
|
4 |
-
*/
|
5 |
-
?>
|
6 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
7 |
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
|
8 |
-
<head>
|
9 |
-
<?php echo $this->getChildHtml('head') ?>
|
10 |
-
</head>
|
11 |
-
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
|
12 |
-
<?php echo $this->getChildHtml('after_body_start') ?>
|
13 |
-
<div class="wrapper">
|
14 |
-
<?php echo $this->getChildHtml('global_notices') ?>
|
15 |
-
<div class="page">
|
16 |
-
<?php echo $this->getChildHtml('headerskybox') ?>
|
17 |
-
<div class="main-container col1-layout">
|
18 |
-
<div class="main">
|
19 |
-
<div class="col-main">
|
20 |
-
<?php echo $this->getChildHtml('global_messages') ?>
|
21 |
-
<?php echo $this->getChildHtml('content') ?>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
-
</div>
|
25 |
-
<?php echo $this->getChildHtml('footer') ?>
|
26 |
-
<?php echo $this->getChildHtml('global_cookie_notice') ?>
|
27 |
-
<?php echo $this->getChildHtml('before_body_end') ?>
|
28 |
-
</div>
|
29 |
-
</div>
|
30 |
-
<?php echo $this->getAbsoluteFooter() ?>
|
31 |
-
</body>
|
32 |
</html>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Template for Mage_Page_Block_Html
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
7 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
|
8 |
+
<head>
|
9 |
+
<?php echo $this->getChildHtml('head') ?>
|
10 |
+
</head>
|
11 |
+
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
|
12 |
+
<?php echo $this->getChildHtml('after_body_start') ?>
|
13 |
+
<div class="wrapper">
|
14 |
+
<?php echo $this->getChildHtml('global_notices') ?>
|
15 |
+
<div class="page">
|
16 |
+
<?php echo $this->getChildHtml('headerskybox') ?>
|
17 |
+
<div class="main-container col1-layout">
|
18 |
+
<div class="main">
|
19 |
+
<div class="col-main">
|
20 |
+
<?php echo $this->getChildHtml('global_messages') ?>
|
21 |
+
<?php echo $this->getChildHtml('content') ?>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<?php echo $this->getChildHtml('footer') ?>
|
26 |
+
<?php echo $this->getChildHtml('global_cookie_notice') ?>
|
27 |
+
<?php echo $this->getChildHtml('before_body_end') ?>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
<?php echo $this->getAbsoluteFooter() ?>
|
31 |
+
</body>
|
32 |
</html>
|
app/design/frontend/base/default/template/skybox/checkout/skyboxcheckout.phtml
CHANGED
@@ -1,437 +1,399 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
$_model = Mage::getModel('skyboxcore/standard');
|
5 |
-
|
6 |
-
$
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
$
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$
|
19 |
-
|
20 |
-
$
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
var
|
174 |
-
var
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
var
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
}
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
$
|
326 |
-
|
327 |
-
|
328 |
-
$
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
$url .= "&UrlC=" . $urlConfirm;// "http://magento.skynet.com/magento192/skbcheckout/international";
|
401 |
-
$url .= "&paypal=" . $_GET["paypal"];
|
402 |
-
$url .= '&checkout=' . strip_tags(Mage::app()->getRequest()->getParam('checkout',''));
|
403 |
-
$url .= "&UrlR=" . $urlSuccess;
|
404 |
-
|
405 |
-
if($size == 0)
|
406 |
-
{
|
407 |
-
$cart = Mage::getSingleton('checkout/session')->getQuote();
|
408 |
-
foreach ($cart->getAllItems() as $item) {
|
409 |
-
$size = $size + 50;
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
|
414 |
-
if($size == 0)
|
415 |
-
$size = 100;
|
416 |
-
|
417 |
-
$height = (($UserTemporal == "1") ? 1400 : 900) + $size;
|
418 |
-
$height=2000;
|
419 |
-
?>
|
420 |
-
<style type="text/css">
|
421 |
-
#iframe_skybox_checkout {
|
422 |
-
width: 100%;
|
423 |
-
height: <?php echo $height; ?>px;
|
424 |
-
}
|
425 |
-
</style>
|
426 |
-
|
427 |
-
<?php
|
428 |
-
echo '<iframe id="iframe_skybox_checkout" src="' . $url . '" frameborder="0" scrolling="no" / >';
|
429 |
-
echo '<br/>$UserTemporal:' . $UserTemporal;
|
430 |
-
?>
|
431 |
-
<?php
|
432 |
-
// ----- Rogged -----
|
433 |
-
}else{
|
434 |
-
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl("checkout/onepage"));
|
435 |
-
}
|
436 |
-
// ----- ----- -----
|
437 |
-
?>
|
1 |
+
<?php
|
2 |
+
$_helper = Mage::helper('skyboxinternational/data');
|
3 |
+
|
4 |
+
$_model = Mage::getModel('skyboxcore/standard');
|
5 |
+
|
6 |
+
/** @var Skybox_Core_Model_Config $_config */
|
7 |
+
$_config = Mage::getModel('skyboxcore/config');
|
8 |
+
|
9 |
+
/** @var Skybox_Checkout_Model_Api_Checkout $_checkout */
|
10 |
+
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
11 |
+
|
12 |
+
/** @var Skybox_Core_Helper_Allow $allowHelper */
|
13 |
+
$allowHelper = Mage::helper('skyboxcore/allow');
|
14 |
+
|
15 |
+
$isCartEnabled = $allowHelper->isCartBarEnabled();
|
16 |
+
|
17 |
+
$_cartDataURL = "";
|
18 |
+
$_merchant = $_helper->getMerchantCode();
|
19 |
+
$template = "";
|
20 |
+
$cartId = $_helper->getCartId();
|
21 |
+
|
22 |
+
Mage::log("InitializeBarSkybox ", null, 'skyboxcheckout.log', true);
|
23 |
+
$_checkout->InitializeBarSkybox();
|
24 |
+
|
25 |
+
$change_country = false;
|
26 |
+
$request = $this->getRequest();
|
27 |
+
$module = $request->getModuleName();
|
28 |
+
$controller = $request->getControllerName();
|
29 |
+
$action = $request->getActionName();
|
30 |
+
$getHomeUrl = Mage::helper('core/url')->getHomeUrl();
|
31 |
+
$_url_check_cart = Mage::getUrl("checkout/cart");
|
32 |
+
|
33 |
+
$cart = $_config->getSession()->getCartSkybox();
|
34 |
+
/**
|
35 |
+
* Start Aditional we add a line debug with integration information
|
36 |
+
*/
|
37 |
+
echo '<script>
|
38 |
+
console.log("LocationAllowService: ' . $_checkout->getLocationAllow() . ' ");
|
39 |
+
</script>';
|
40 |
+
/**
|
41 |
+
* End Aditional we add a line debug with integration information
|
42 |
+
*/
|
43 |
+
//$template = "<a href='#' id='link_choise_country'> </a>";
|
44 |
+
// Load CSS & JS
|
45 |
+
$skybox_url = $_helper->getSkyboxUrlMain();// $_config->skyboxDefaultUrl;
|
46 |
+
$api_css_button_international = $skybox_url . 'widgets/api-button/css/api-button-international-css.ashx';
|
47 |
+
$api_css_button_international .= '?s=' . $_helper->getMerchantCode();
|
48 |
+
$api_css_button_international .= '&CssVersion=' . $_helper->getCssVersion();
|
49 |
+
$api_js_button_international = $skybox_url . 'Content/debug/API/js/api-button-tooltip.js';
|
50 |
+
|
51 |
+
if ($allowHelper->isCartBarEnabled()) :
|
52 |
+
$template = '';
|
53 |
+
$cart = $_config->getSession()->getCartSkybox();
|
54 |
+
if (!empty($cart)) :
|
55 |
+
$template = $cart->BarHtmlTemplate;
|
56 |
+
foreach ($cart as $key => $value) :
|
57 |
+
$template = str_replace('{' . $key . '}', $value, $template);
|
58 |
+
endforeach;
|
59 |
+
endif;
|
60 |
+
$_cartDataURL = $cart->CartDataURL;
|
61 |
+
echo $template;
|
62 |
+
endif;
|
63 |
+
?>
|
64 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $api_css_button_international; ?>"/>
|
65 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/skybox/style.css?v=' . $_helper->getCssVersion()); ?>"/>
|
66 |
+
<!-- <link rel="stylesheet" type="text/css" href="--><?php #echo $this->getSkinUrl('css/skybox/style.css?v=230120171122');?><!--"/>-->
|
67 |
+
<script type="text/javascript">
|
68 |
+
var URL_CHECK_CART = "<?php echo $_url_check_cart ?>";
|
69 |
+
var CART_ID = "<?php echo $cartId ?>";
|
70 |
+
var CART_DATA_URL = "<?php echo $_cartDataURL ?>";
|
71 |
+
var MERCHANT = "<?php echo $_merchant ?>";
|
72 |
+
var SKYBOX_URL = "<?php echo $skybox_url ?>";
|
73 |
+
var CHANGE_COUNTRY = "<?php echo $change_country ?>";
|
74 |
+
var ACTUAL_URI = "<?php echo 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] ?>";
|
75 |
+
var GET_HOME_URL = "<?php echo $getHomeUrl ?>";
|
76 |
+
jQuery(document).ready(function() {
|
77 |
+
jQuery(".skybox-price-set").each(function( index ) {
|
78 |
+
<?php
|
79 |
+
$skyBoxUrlClientBase= $_helper->getSkyBoxUrlAPI();
|
80 |
+
$codeShop = Mage::getModel('skyboxcatalog/api_product')->getStoreCode();
|
81 |
+
$skyBoxUrlClientGet = str_replace("apirest/", "", $skyBoxUrlClientBase);
|
82 |
+
$skyBoxUrlClient = $skyBoxUrlClientGet . "multiplecalculate/" . $codeShop . "/calc-";
|
83 |
+
?>
|
84 |
+
var SkyBoxUrlClient = "<?php echo $skyBoxUrlClient;?>";
|
85 |
+
var dataId = jQuery(this).attr("id");
|
86 |
+
var id = jQuery(this).attr("product-id");
|
87 |
+
var url = SkyBoxUrlClient + id + ".html";
|
88 |
+
var content = jQuery.get(url, function (data) {
|
89 |
+
jQuery("#" + dataId).html(data);
|
90 |
+
/*return data;*/
|
91 |
+
});
|
92 |
+
// console.log("URL SkyBoxUrlClient: " +url);
|
93 |
+
//console.log(url);
|
94 |
+
/*console.log(content);*/
|
95 |
+
});
|
96 |
+
});
|
97 |
+
|
98 |
+
(function ($) {
|
99 |
+
|
100 |
+
var widthPage = 0;
|
101 |
+
var heightPage = 0;
|
102 |
+
var popup = {};
|
103 |
+
var popupWidth = 540;
|
104 |
+
var popupHeight = 545;
|
105 |
+
var win = '';
|
106 |
+
|
107 |
+
function showPopup(name, t, url, w, h) {
|
108 |
+
//winCompare = new Window('popup', {className: 'alphacube', title: t, url: url, width: w, height: h, minimizable: false, maximizable: false, showEffectOptions: {duration: 0.4}, hideEffectOptions: {duration: 0.4} });
|
109 |
+
winCompare = new Window(name, {
|
110 |
+
className: 'alphacube',
|
111 |
+
title: t,
|
112 |
+
url: url,
|
113 |
+
width: w,
|
114 |
+
height: h,
|
115 |
+
minimizable: false,
|
116 |
+
maximizable: false,
|
117 |
+
showEffectOptions: {duration: 0.4},
|
118 |
+
hideEffectOptions: {duration: 0.4},
|
119 |
+
destroyOnClose: true,
|
120 |
+
draggable: false,
|
121 |
+
resizable: false
|
122 |
+
});
|
123 |
+
|
124 |
+
winCompare.setDestroyOnClose();
|
125 |
+
winCompare.setZIndex(9999);
|
126 |
+
winCompare.showCenter(true);
|
127 |
+
return winCompare;
|
128 |
+
}
|
129 |
+
|
130 |
+
function goToCart() {
|
131 |
+
document.location = URL_CHECK_CART;
|
132 |
+
}
|
133 |
+
|
134 |
+
function goToInitializeSession() {
|
135 |
+
var idCart = CART_ID;
|
136 |
+
var datos = CART_DATA_URL;
|
137 |
+
var merchant = MERCHANT;
|
138 |
+
var actualUri = ACTUAL_URI + "?LoadFrame=1";
|
139 |
+
var url = SKYBOX_URL + "WebForms/PublicSite/Tracking.aspx?" + datos + "&merchant=" + merchant + "&idCart=" + idCart + "&ReLoad=1&uri=" + actualUri;
|
140 |
+
var name = 'initSession' + Date.now();
|
141 |
+
callAlphacube();
|
142 |
+
showPopup(name, '', url, (widthPage - 50 ), ((heightPage < 800) ? heightPage - 50 : 800));
|
143 |
+
}
|
144 |
+
|
145 |
+
function callAlphacube(){
|
146 |
+
var alphacube_ = document.querySelectorAll('.alphacube_close');
|
147 |
+
if(alphacube_.length > 0){
|
148 |
+
var overlay_ = document.getElementById("overlay_modal");
|
149 |
+
|
150 |
+
if(overlay_ !== null) overlay_.style.display = '';
|
151 |
+
var id_modal = (alphacube_[1]) ? alphacube_[1].parentNode.getAttribute('id') : '';
|
152 |
+
try{
|
153 |
+
document.getElementById(id_modal).remove();
|
154 |
+
}
|
155 |
+
catch(e) {
|
156 |
+
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
function goToLocation() {
|
162 |
+
win = 'resync';
|
163 |
+
var datos = CART_DATA_URL;
|
164 |
+
var process_url = GET_HOME_URL + "skbcheckout/process";
|
165 |
+
var return_url = getReturnUrl();
|
166 |
+
// var return_url = document.URL;
|
167 |
+
var change_country_status = CHANGE_COUNTRY;
|
168 |
+
var url = SKYBOX_URL + "Webforms/PublicSite/ReSync.aspx?" + datos;
|
169 |
+
url += "&process_url=" + process_url;
|
170 |
+
url += "&return_url=" + return_url;
|
171 |
+
url += "&change_country=" + change_country_status;
|
172 |
+
|
173 |
+
var _size = getSizeForPopup();
|
174 |
+
var name = 'selectLocation' + Date.now();
|
175 |
+
callAlphacube();
|
176 |
+
popup = showPopup(name, '', url, _size.width, _size.height);
|
177 |
+
}
|
178 |
+
|
179 |
+
function goToTrackingLocation() {
|
180 |
+
var url = SKYBOX_URL + "Webforms/PublicSite/Tracking.aspx?" + CART_DATA_URL + "&idCart=" + CART_ID;
|
181 |
+
var name = 'tracking' + Date.now();
|
182 |
+
showPopup(name, '', url, (widthPage - 50 ), ((heightPage < 800) ? heightPage - 50 : 800));
|
183 |
+
}
|
184 |
+
|
185 |
+
function loadIframe() {
|
186 |
+
var actualUri = ACTUAL_URI;
|
187 |
+
var flgLoadIframe = "<?php echo (isset($_GET['LoadFrame'])) ? $_GET['LoadFrame'] : 0; ?>";
|
188 |
+
if (flgLoadIframe === "1") {
|
189 |
+
if (actualUri.indexOf("skbcheckout/international") === -1) goToInitializeSession();
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
var createCookie = function(name, value, days) {
|
194 |
+
var expires;
|
195 |
+
if (days) {
|
196 |
+
var date = new Date();
|
197 |
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
198 |
+
expires = "; expires=" + date.toGMTString();
|
199 |
+
} else {
|
200 |
+
expires = "";
|
201 |
+
}
|
202 |
+
document.cookie = name + "=" + value + expires + "; path=/";
|
203 |
+
};
|
204 |
+
|
205 |
+
function getCookie(c_name) {
|
206 |
+
if (document.cookie.length > 0) {
|
207 |
+
c_start = document.cookie.indexOf(c_name + "=");
|
208 |
+
if (c_start !== -1) {
|
209 |
+
c_start = c_start + c_name.length + 1;
|
210 |
+
c_end = document.cookie.indexOf(";", c_start);
|
211 |
+
if (c_end === -1) {
|
212 |
+
c_end = document.cookie.length;
|
213 |
+
}
|
214 |
+
return unescape(document.cookie.substring(c_start, c_end));
|
215 |
+
}
|
216 |
+
}
|
217 |
+
return "";
|
218 |
+
}
|
219 |
+
|
220 |
+
function postMessageIframe() {
|
221 |
+
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
|
222 |
+
var eventer = window[eventMethod];
|
223 |
+
var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message";
|
224 |
+
eventer(messageEvent,function(e) {
|
225 |
+
// if(e.origin == 'https://www.skyboxcheckout.com'){
|
226 |
+
recalculateHeightIframe(e.data);
|
227 |
+
// }
|
228 |
+
},false);
|
229 |
+
}
|
230 |
+
|
231 |
+
function recalculateHeightIframe(data) {
|
232 |
+
if (data.win === 'resync') {
|
233 |
+
popupHeight = data.height;
|
234 |
+
var _size = getSizeForPopup();
|
235 |
+
try{
|
236 |
+
popup.setSize(_size.width, _size.height);
|
237 |
+
}
|
238 |
+
catch (e) {
|
239 |
+
// console.log("not calculate popup:::: ", e);
|
240 |
+
}
|
241 |
+
// popup.showCenter(true);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
function recalculateHeight() {
|
245 |
+
if(!jQuery.isEmptyObject(popup) && win === 'resync'){
|
246 |
+
var iFrameDOM = $("iframe#selectLocation_content").contents();
|
247 |
+
popupHeight = iFrameDOM.find("body").height()+30;
|
248 |
+
console.log(popupHeight);
|
249 |
+
var _size = getSizeForPopup();
|
250 |
+
popup.setSize(_size.width, _size.height)
|
251 |
+
// popup.updateHeight()s
|
252 |
+
// var fh = document.getElementById('selectLocation_content').contentWindow.document.getElementById('form1')
|
253 |
+
}
|
254 |
+
win = '';
|
255 |
+
}
|
256 |
+
|
257 |
+
function browserResize() {
|
258 |
+
jQuery(window).resize(function() {
|
259 |
+
if(!jQuery.isEmptyObject(popup)){
|
260 |
+
var _size = getSizeForPopup();
|
261 |
+
popup.setSize(_size.width, _size.height)
|
262 |
+
}
|
263 |
+
});
|
264 |
+
}
|
265 |
+
|
266 |
+
function getSizeForPopup() {
|
267 |
+
var _width = jQuery(window).width();
|
268 |
+
var _height = jQuery(window).height();
|
269 |
+
_width = (_width < popupWidth) ? _width - 30 : popupWidth ;
|
270 |
+
return {width: _width, height: popupHeight};
|
271 |
+
}
|
272 |
+
|
273 |
+
$(".skx_position_option_country").unbind().click(function(){
|
274 |
+
goToLocation();
|
275 |
+
});
|
276 |
+
$(".skx_banner_image_account").unbind().click(function(){
|
277 |
+
goToInitializeSession();
|
278 |
+
});
|
279 |
+
|
280 |
+
$(document).ready(function () {
|
281 |
+
widthPage = $(window).width();
|
282 |
+
heightPage = $(window).height();
|
283 |
+
$(".skx_banner_image_car").click(goToCart);
|
284 |
+
// $(".skx_position_option_country").click(goToLocation);
|
285 |
+
// $(".skx_banner_image_account").click(goToInitializeSession);
|
286 |
+
$(".skx_banner_image_tracking").click(goToTrackingLocation);
|
287 |
+
$("#link_choise_country").click(goToCart);
|
288 |
+
postMessageIframe();
|
289 |
+
loadIframe();
|
290 |
+
browserResize();
|
291 |
+
|
292 |
+
<?php if(Mage::getBlockSingleton('page/html_header')->getIsHomePage() && $change_country == true) : ?>
|
293 |
+
if ( !getCookie('tivoli_latam_homepage') ) {
|
294 |
+
createCookie('tivoli_latam_homepage', 1);
|
295 |
+
//goToLocation();
|
296 |
+
}
|
297 |
+
<?php endif; ?>
|
298 |
+
});
|
299 |
+
})(jQuery);
|
300 |
+
</script>
|
301 |
+
|
302 |
+
<script type="text/javascript">
|
303 |
+
//<![CDATA[
|
304 |
+
var SKYBOX_OPTIONS_PRICE_URL = '<?php echo Mage::getUrl(); ?>skbcheckout/calculate';
|
305 |
+
//]]>
|
306 |
+
</script>
|
307 |
+
|
308 |
+
<script type="text/javascript" src="<?php echo $api_js_button_international; ?>"></script>
|
309 |
+
|
310 |
+
<?php
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Integration 3 start, show bar*
|
314 |
+
*/
|
315 |
+
if (!$_checkout->getErrorAuthenticate() && $_checkout->getLocationAllow()) : // Rogged
|
316 |
+
// Calculate height
|
317 |
+
$size = 0;
|
318 |
+
|
319 |
+
$UserTemporal = "1";
|
320 |
+
$CartItemCount = 0;
|
321 |
+
|
322 |
+
if (!$_checkout->getErrorAuthenticate() && $_checkout->getLocationAllow()) :
|
323 |
+
$cart = $_config->getSession()->getCartSkybox();
|
324 |
+
if (!empty($cart)) :
|
325 |
+
$UserTemporal = $cart->{'UserTemporal'};
|
326 |
+
$CartItemCount = intval($cart->{'CartItemCount'});
|
327 |
+
for ($i = 1; $i <= $CartItemCount; $i++) :
|
328 |
+
$size = $size + 50;
|
329 |
+
endfor;
|
330 |
+
endif;
|
331 |
+
endif;
|
332 |
+
|
333 |
+
|
334 |
+
$merchant = $_helper->getMerchantCode();
|
335 |
+
$storeId = $_helper->getStoreId();
|
336 |
+
$cartId = $_helper->getCartId();
|
337 |
+
$guid = $_model->getGuidApi();
|
338 |
+
$urlSuccess = Mage::getUrl("skbcheckout/international/success");
|
339 |
+
$urlConfirm = Mage::getUrl("skbcheckout/international");
|
340 |
+
$token = $_model->AuthenticateService()->getAuthorizedToken();
|
341 |
+
|
342 |
+
$url = $_helper->getSkyboxUrlMain() . "WebForms/Checkout/APICheckout.aspx"; //$_config->skyboxDefaultUrl . "WebForms/Checkout/APICheckout.aspx";
|
343 |
+
$url .= "?token=" . $token;
|
344 |
+
$url .= "&GuiId=" . $guid;
|
345 |
+
$url .= "&merchant=" . $merchant;
|
346 |
+
$url .= "&idCart=" . $cartId;
|
347 |
+
$url .= "&idStore=" . $storeId;
|
348 |
+
$url .= "&UrlC=" . $urlConfirm;// "http://magento.skynet.com/magento192/skbcheckout/international";
|
349 |
+
$url .= "&paypal=" . $_GET["paypal"];
|
350 |
+
$url .= '&checkout=' . strip_tags(Mage::app()->getRequest()->getParam('checkout',''));
|
351 |
+
$url .= "&UrlR=" . $urlSuccess;
|
352 |
+
|
353 |
+
if($size == 0):
|
354 |
+
$cart = Mage::getSingleton('checkout/session')->getQuote();
|
355 |
+
foreach ($cart->getAllItems() as $item) :
|
356 |
+
$size = $size + 50;
|
357 |
+
endforeach;
|
358 |
+
endif;
|
359 |
+
|
360 |
+
if($size == 0) $size = 100;
|
361 |
+
|
362 |
+
$height = (($UserTemporal == "1") ? 1400 : 900) + $size;
|
363 |
+
$height = 2500;
|
364 |
+
?>
|
365 |
+
<iframe id="iframe_skybox_checkout" src="<?php echo $url; ?>" frameborder="0" scrolling="no"></iframe>
|
366 |
+
<script type="text/javascript">
|
367 |
+
jQuery(document).ready(function() {
|
368 |
+
var height = <?php echo $height; ?>;
|
369 |
+
var isMobile = /Mobi/.test(navigator.userAgent);
|
370 |
+
console.log("isMobile ::: " + isMobile);
|
371 |
+
if (isMobile) {
|
372 |
+
height = jQuery(window).height();
|
373 |
+
height = height * 5;
|
374 |
+
}
|
375 |
+
console.log("height ::: " + height);
|
376 |
+
jQuery('#iframe_skybox_checkout').attr('height', height);
|
377 |
+
});
|
378 |
+
</script>
|
379 |
+
<?php
|
380 |
+
// ----- Rogged -----
|
381 |
+
else:
|
382 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl("checkout/onepage"));
|
383 |
+
endif;
|
384 |
+
// ----- ----- -----
|
385 |
+
?>
|
386 |
+
<script>
|
387 |
+
setTimeout(function(){
|
388 |
+
var location_pathname = window.location.pathname.split('/');
|
389 |
+
var skx_bar = document.getElementsByClassName('skx-bar-text');
|
390 |
+
console.log("location_pathname::::", location_pathname);
|
391 |
+
try{
|
392 |
+
if(location_pathname[2] === "international") skx_bar[0].style.display = "none";
|
393 |
+
}
|
394 |
+
catch(e) {
|
395 |
+
|
396 |
+
}
|
397 |
+
}, 300);
|
398 |
+
|
399 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/skybox/checkout/skyboxsuccess.phtml
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<div>
|
2 |
-
<?php
|
3 |
-
$message = Mage::getSingleton('core/session')->getSkyboxSuccessMsg();
|
4 |
-
if (isset($message)) {
|
5 |
-
echo $message;
|
6 |
-
}
|
7 |
-
echo "<br/><br/>";
|
8 |
-
/*echo $_POST["STATUS"] . "<br/>";
|
9 |
-
echo $_POST["STATUS_DESCRIPTION"] . "<br/>";
|
10 |
-
echo $_POST["ORDER_NUMBER"] . "<br/>";
|
11 |
-
echo $_POST["CUSTOMER_EMAIL"] . "<br/>";
|
12 |
-
echo $_POST["CUSTOMER_NAME"] . "<br/>";
|
13 |
-
echo $_POST["CUSTOMER_ID"] . "<br/>";
|
14 |
-
echo $_POST["CUSTOMER_ADDRESS"] . "<br/>";
|
15 |
-
echo $_POST["CUSTOMER_COUNTRY"] . "<br/>";
|
16 |
-
echo $_POST["CUSTOMER_REGION"] . "<br/>";
|
17 |
-
echo $_POST["CUSTOMER_CITY"] . "<br/>";
|
18 |
-
echo $_POST["CUSTOMER_ZIPCODE"] . "<br/>";
|
19 |
-
echo $_POST["ORDER_CURRENCY"] . "<br/>";
|
20 |
-
echo $_POST["ORDER_AMOUNT"] . "<br/>";
|
21 |
-
echo $_POST["ORDER_PAYMENT_METHOD"] . "<br/>";
|
22 |
-
echo $_POST["ORDER_CONCEPTS"] . "<br/><br/>";*/
|
23 |
-
|
24 |
-
echo $_POST["INVOICE_HTML"] . "<br/>";
|
25 |
-
/*if (isset($_POST['ORDER_CONCEPTS'])
|
26 |
-
foreach ($_POST['ORDER_CONCEPTS'] as $value)
|
27 |
-
echo $value . "<br/>";*/
|
28 |
-
?>
|
29 |
</div>
|
1 |
+
<div>
|
2 |
+
<?php
|
3 |
+
$message = Mage::getSingleton('core/session')->getSkyboxSuccessMsg();
|
4 |
+
if (isset($message)) {
|
5 |
+
echo $message;
|
6 |
+
}
|
7 |
+
echo "<br/><br/>";
|
8 |
+
/*echo $_POST["STATUS"] . "<br/>";
|
9 |
+
echo $_POST["STATUS_DESCRIPTION"] . "<br/>";
|
10 |
+
echo $_POST["ORDER_NUMBER"] . "<br/>";
|
11 |
+
echo $_POST["CUSTOMER_EMAIL"] . "<br/>";
|
12 |
+
echo $_POST["CUSTOMER_NAME"] . "<br/>";
|
13 |
+
echo $_POST["CUSTOMER_ID"] . "<br/>";
|
14 |
+
echo $_POST["CUSTOMER_ADDRESS"] . "<br/>";
|
15 |
+
echo $_POST["CUSTOMER_COUNTRY"] . "<br/>";
|
16 |
+
echo $_POST["CUSTOMER_REGION"] . "<br/>";
|
17 |
+
echo $_POST["CUSTOMER_CITY"] . "<br/>";
|
18 |
+
echo $_POST["CUSTOMER_ZIPCODE"] . "<br/>";
|
19 |
+
echo $_POST["ORDER_CURRENCY"] . "<br/>";
|
20 |
+
echo $_POST["ORDER_AMOUNT"] . "<br/>";
|
21 |
+
echo $_POST["ORDER_PAYMENT_METHOD"] . "<br/>";
|
22 |
+
echo $_POST["ORDER_CONCEPTS"] . "<br/><br/>";*/
|
23 |
+
|
24 |
+
echo $_POST["INVOICE_HTML"] . "<br/>";
|
25 |
+
/*if (isset($_POST['ORDER_CONCEPTS'])
|
26 |
+
foreach ($_POST['ORDER_CONCEPTS'] as $value)
|
27 |
+
echo $value . "<br/>";*/
|
28 |
+
?>
|
29 |
</div>
|
app/etc/modules/Skybox_All.xml
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Skybox_Core>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Skybox_Core>
|
8 |
-
<Skybox_International>
|
9 |
-
<active>true</active>
|
10 |
-
<codePool>community</codePool>
|
11 |
-
</Skybox_International>
|
12 |
-
<Skybox_Services>
|
13 |
-
<active>true</active>
|
14 |
-
<codePool>community</codePool>
|
15 |
-
</Skybox_Services>
|
16 |
-
<Skybox_Checkout>
|
17 |
-
<active>true</active>
|
18 |
-
<codePool>community</codePool>
|
19 |
-
<depends>
|
20 |
-
<Mage_Core/>
|
21 |
-
<Mage_Checkout/>
|
22 |
-
<Mage_Shipping />
|
23 |
-
<!--Skybox_Core /-->
|
24 |
-
</depends>
|
25 |
-
</Skybox_Checkout>
|
26 |
-
<Skybox_Catalog>
|
27 |
-
<active>true</active>
|
28 |
-
<codePool>community</codePool>
|
29 |
-
<depends>
|
30 |
-
<Mage_Core/>
|
31 |
-
<Mage_Catalog/>
|
32 |
-
<!--Skybox_Core /-->
|
33 |
-
</depends>
|
34 |
-
</Skybox_Catalog>
|
35 |
-
</modules>
|
36 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Skybox_Core>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Skybox_Core>
|
8 |
+
<Skybox_International>
|
9 |
+
<active>true</active>
|
10 |
+
<codePool>community</codePool>
|
11 |
+
</Skybox_International>
|
12 |
+
<Skybox_Services>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Skybox_Services>
|
16 |
+
<Skybox_Checkout>
|
17 |
+
<active>true</active>
|
18 |
+
<codePool>community</codePool>
|
19 |
+
<depends>
|
20 |
+
<Mage_Core/>
|
21 |
+
<Mage_Checkout/>
|
22 |
+
<Mage_Shipping />
|
23 |
+
<!--Skybox_Core /-->
|
24 |
+
</depends>
|
25 |
+
</Skybox_Checkout>
|
26 |
+
<Skybox_Catalog>
|
27 |
+
<active>true</active>
|
28 |
+
<codePool>community</codePool>
|
29 |
+
<depends>
|
30 |
+
<Mage_Core/>
|
31 |
+
<Mage_Catalog/>
|
32 |
+
<!--Skybox_Core /-->
|
33 |
+
</depends>
|
34 |
+
</Skybox_Catalog>
|
35 |
+
</modules>
|
36 |
</config>
|
js/skybox/adminhtml.category.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
// Adminhtml Category
|
2 |
-
|
3 |
-
function categorySubmit2(url, useAjax) {
|
4 |
-
document.getElementById('apply_button').value = 'all_products';
|
5 |
-
categorySubmit(url, useAjax);
|
6 |
-
}
|
7 |
-
|
8 |
-
function categorySubmit3(url, useAjax) {
|
9 |
-
document.getElementById('apply_button').value = 'all_products_without_commoditites';
|
10 |
-
categorySubmit(url, useAjax);
|
11 |
}
|
1 |
+
// Adminhtml Category
|
2 |
+
|
3 |
+
function categorySubmit2(url, useAjax) {
|
4 |
+
document.getElementById('apply_button').value = 'all_products';
|
5 |
+
categorySubmit(url, useAjax);
|
6 |
+
}
|
7 |
+
|
8 |
+
function categorySubmit3(url, useAjax) {
|
9 |
+
document.getElementById('apply_button').value = 'all_products_without_commoditites';
|
10 |
+
categorySubmit(url, useAjax);
|
11 |
}
|
js/skybox/jquery.ba-resize.min.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery resize event - v1.1 - 3/14/2010
|
3 |
-
* http://benalman.com/projects/jquery-resize-plugin/
|
4 |
-
*
|
5 |
-
* Copyright (c) 2010 "Cowboy" Ben Alman
|
6 |
-
* Dual licensed under the MIT and GPL licenses.
|
7 |
-
* http://benalman.com/about/license/
|
8 |
-
*/
|
9 |
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
1 |
+
/*
|
2 |
+
* jQuery resize event - v1.1 - 3/14/2010
|
3 |
+
* http://benalman.com/projects/jquery-resize-plugin/
|
4 |
+
*
|
5 |
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
6 |
+
* Dual licensed under the MIT and GPL licenses.
|
7 |
+
* http://benalman.com/about/license/
|
8 |
+
*/
|
9 |
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
js/skybox/jquery.fancybox.js
ADDED
@@ -0,0 +1,2020 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* fancyBox - jQuery Plugin
|
3 |
+
* version: 2.1.5 (Fri, 14 Jun 2013)
|
4 |
+
* @requires jQuery v1.6 or later
|
5 |
+
*
|
6 |
+
* Examples at http://fancyapps.com/fancybox/
|
7 |
+
* License: www.fancyapps.com/fancybox/#license
|
8 |
+
*
|
9 |
+
* Copyright 2012 Janis Skarnelis - janis@fancyapps.com
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
|
13 |
+
(function (window, document, $, undefined) {
|
14 |
+
"use strict";
|
15 |
+
|
16 |
+
var H = $("html"),
|
17 |
+
W = $(window),
|
18 |
+
D = $(document),
|
19 |
+
F = $.fancybox = function () {
|
20 |
+
F.open.apply( this, arguments );
|
21 |
+
},
|
22 |
+
IE = navigator.userAgent.match(/msie/i),
|
23 |
+
didUpdate = null,
|
24 |
+
isTouch = document.createTouch !== undefined,
|
25 |
+
|
26 |
+
isQuery = function(obj) {
|
27 |
+
return obj && obj.hasOwnProperty && obj instanceof $;
|
28 |
+
},
|
29 |
+
isString = function(str) {
|
30 |
+
return str && $.type(str) === "string";
|
31 |
+
},
|
32 |
+
isPercentage = function(str) {
|
33 |
+
return isString(str) && str.indexOf('%') > 0;
|
34 |
+
},
|
35 |
+
isScrollable = function(el) {
|
36 |
+
return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
|
37 |
+
},
|
38 |
+
getScalar = function(orig, dim) {
|
39 |
+
var value = parseInt(orig, 10) || 0;
|
40 |
+
|
41 |
+
if (dim && isPercentage(orig)) {
|
42 |
+
value = F.getViewport()[ dim ] / 100 * value;
|
43 |
+
}
|
44 |
+
|
45 |
+
return Math.ceil(value);
|
46 |
+
},
|
47 |
+
getValue = function(value, dim) {
|
48 |
+
return getScalar(value, dim) + 'px';
|
49 |
+
};
|
50 |
+
|
51 |
+
$.extend(F, {
|
52 |
+
// The current version of fancyBox
|
53 |
+
version: '2.1.5',
|
54 |
+
|
55 |
+
defaults: {
|
56 |
+
padding : 15,
|
57 |
+
margin : 20,
|
58 |
+
|
59 |
+
width : 800,
|
60 |
+
height : 600,
|
61 |
+
minWidth : 100,
|
62 |
+
minHeight : 100,
|
63 |
+
maxWidth : 9999,
|
64 |
+
maxHeight : 9999,
|
65 |
+
pixelRatio: 1, // Set to 2 for retina display support
|
66 |
+
|
67 |
+
autoSize : true,
|
68 |
+
autoHeight : false,
|
69 |
+
autoWidth : false,
|
70 |
+
|
71 |
+
autoResize : true,
|
72 |
+
autoCenter : !isTouch,
|
73 |
+
fitToView : true,
|
74 |
+
aspectRatio : false,
|
75 |
+
topRatio : 0.5,
|
76 |
+
leftRatio : 0.5,
|
77 |
+
|
78 |
+
scrolling : 'auto', // 'auto', 'yes' or 'no'
|
79 |
+
wrapCSS : '',
|
80 |
+
|
81 |
+
arrows : true,
|
82 |
+
closeBtn : true,
|
83 |
+
closeClick : false,
|
84 |
+
nextClick : false,
|
85 |
+
mouseWheel : true,
|
86 |
+
autoPlay : false,
|
87 |
+
playSpeed : 3000,
|
88 |
+
preload : 3,
|
89 |
+
modal : false,
|
90 |
+
loop : true,
|
91 |
+
|
92 |
+
ajax : {
|
93 |
+
dataType : 'html',
|
94 |
+
headers : { 'X-fancyBox': true }
|
95 |
+
},
|
96 |
+
iframe : {
|
97 |
+
scrolling : 'auto',
|
98 |
+
preload : true
|
99 |
+
},
|
100 |
+
swf : {
|
101 |
+
wmode: 'transparent',
|
102 |
+
allowfullscreen : 'true',
|
103 |
+
allowscriptaccess : 'always'
|
104 |
+
},
|
105 |
+
|
106 |
+
keys : {
|
107 |
+
next : {
|
108 |
+
13 : 'left', // enter
|
109 |
+
34 : 'up', // page down
|
110 |
+
39 : 'left', // right arrow
|
111 |
+
40 : 'up' // down arrow
|
112 |
+
},
|
113 |
+
prev : {
|
114 |
+
8 : 'right', // backspace
|
115 |
+
33 : 'down', // page up
|
116 |
+
37 : 'right', // left arrow
|
117 |
+
38 : 'down' // up arrow
|
118 |
+
},
|
119 |
+
close : [27], // escape key
|
120 |
+
play : [32], // space - start/stop slideshow
|
121 |
+
toggle : [70] // letter "f" - toggle fullscreen
|
122 |
+
},
|
123 |
+
|
124 |
+
direction : {
|
125 |
+
next : 'left',
|
126 |
+
prev : 'right'
|
127 |
+
},
|
128 |
+
|
129 |
+
scrollOutside : true,
|
130 |
+
|
131 |
+
// Override some properties
|
132 |
+
index : 0,
|
133 |
+
type : null,
|
134 |
+
href : null,
|
135 |
+
content : null,
|
136 |
+
title : null,
|
137 |
+
|
138 |
+
// HTML templates
|
139 |
+
tpl: {
|
140 |
+
wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
|
141 |
+
image : '<img class="fancybox-image" src="{href}" alt="" />',
|
142 |
+
iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
|
143 |
+
error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
|
144 |
+
closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
|
145 |
+
next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
|
146 |
+
prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
|
147 |
+
},
|
148 |
+
|
149 |
+
// Properties for each animation type
|
150 |
+
// Opening fancyBox
|
151 |
+
openEffect : 'fade', // 'elastic', 'fade' or 'none'
|
152 |
+
openSpeed : 250,
|
153 |
+
openEasing : 'swing',
|
154 |
+
openOpacity : true,
|
155 |
+
openMethod : 'zoomIn',
|
156 |
+
|
157 |
+
// Closing fancyBox
|
158 |
+
closeEffect : 'fade', // 'elastic', 'fade' or 'none'
|
159 |
+
closeSpeed : 250,
|
160 |
+
closeEasing : 'swing',
|
161 |
+
closeOpacity : true,
|
162 |
+
closeMethod : 'zoomOut',
|
163 |
+
|
164 |
+
// Changing next gallery item
|
165 |
+
nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
|
166 |
+
nextSpeed : 250,
|
167 |
+
nextEasing : 'swing',
|
168 |
+
nextMethod : 'changeIn',
|
169 |
+
|
170 |
+
// Changing previous gallery item
|
171 |
+
prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
|
172 |
+
prevSpeed : 250,
|
173 |
+
prevEasing : 'swing',
|
174 |
+
prevMethod : 'changeOut',
|
175 |
+
|
176 |
+
// Enable default helpers
|
177 |
+
helpers : {
|
178 |
+
overlay : true,
|
179 |
+
title : true
|
180 |
+
},
|
181 |
+
|
182 |
+
// Callbacks
|
183 |
+
onCancel : $.noop, // If canceling
|
184 |
+
beforeLoad : $.noop, // Before loading
|
185 |
+
afterLoad : $.noop, // After loading
|
186 |
+
beforeShow : $.noop, // Before changing in current item
|
187 |
+
afterShow : $.noop, // After opening
|
188 |
+
beforeChange : $.noop, // Before changing gallery item
|
189 |
+
beforeClose : $.noop, // Before closing
|
190 |
+
afterClose : $.noop // After closing
|
191 |
+
},
|
192 |
+
|
193 |
+
//Current state
|
194 |
+
group : {}, // Selected group
|
195 |
+
opts : {}, // Group options
|
196 |
+
previous : null, // Previous element
|
197 |
+
coming : null, // Element being loaded
|
198 |
+
current : null, // Currently loaded element
|
199 |
+
isActive : false, // Is activated
|
200 |
+
isOpen : false, // Is currently open
|
201 |
+
isOpened : false, // Have been fully opened at least once
|
202 |
+
|
203 |
+
wrap : null,
|
204 |
+
skin : null,
|
205 |
+
outer : null,
|
206 |
+
inner : null,
|
207 |
+
|
208 |
+
player : {
|
209 |
+
timer : null,
|
210 |
+
isActive : false
|
211 |
+
},
|
212 |
+
|
213 |
+
// Loaders
|
214 |
+
ajaxLoad : null,
|
215 |
+
imgPreload : null,
|
216 |
+
|
217 |
+
// Some collections
|
218 |
+
transitions : {},
|
219 |
+
helpers : {},
|
220 |
+
|
221 |
+
/*
|
222 |
+
* Static methods
|
223 |
+
*/
|
224 |
+
|
225 |
+
open: function (group, opts) {
|
226 |
+
if (!group) {
|
227 |
+
return;
|
228 |
+
}
|
229 |
+
|
230 |
+
if (!$.isPlainObject(opts)) {
|
231 |
+
opts = {};
|
232 |
+
}
|
233 |
+
|
234 |
+
// Close if already active
|
235 |
+
if (false === F.close(true)) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
// Normalize group
|
240 |
+
if (!$.isArray(group)) {
|
241 |
+
group = isQuery(group) ? $(group).get() : [group];
|
242 |
+
}
|
243 |
+
|
244 |
+
// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
|
245 |
+
$.each(group, function(i, element) {
|
246 |
+
var obj = {},
|
247 |
+
href,
|
248 |
+
title,
|
249 |
+
content,
|
250 |
+
type,
|
251 |
+
rez,
|
252 |
+
hrefParts,
|
253 |
+
selector;
|
254 |
+
|
255 |
+
if ($.type(element) === "object") {
|
256 |
+
// Check if is DOM element
|
257 |
+
if (element.nodeType) {
|
258 |
+
element = $(element);
|
259 |
+
}
|
260 |
+
|
261 |
+
if (isQuery(element)) {
|
262 |
+
obj = {
|
263 |
+
href : element.data('fancybox-href') || element.attr('href'),
|
264 |
+
title : element.data('fancybox-title') || element.attr('title'),
|
265 |
+
isDom : true,
|
266 |
+
element : element
|
267 |
+
};
|
268 |
+
|
269 |
+
if ($.metadata) {
|
270 |
+
$.extend(true, obj, element.metadata());
|
271 |
+
}
|
272 |
+
|
273 |
+
} else {
|
274 |
+
obj = element;
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
href = opts.href || obj.href || (isString(element) ? element : null);
|
279 |
+
title = opts.title !== undefined ? opts.title : obj.title || '';
|
280 |
+
|
281 |
+
content = opts.content || obj.content;
|
282 |
+
type = content ? 'html' : (opts.type || obj.type);
|
283 |
+
|
284 |
+
if (!type && obj.isDom) {
|
285 |
+
type = element.data('fancybox-type');
|
286 |
+
|
287 |
+
if (!type) {
|
288 |
+
rez = element.prop('class').match(/fancybox\.(\w+)/);
|
289 |
+
type = rez ? rez[1] : null;
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
if (isString(href)) {
|
294 |
+
// Try to guess the content type
|
295 |
+
if (!type) {
|
296 |
+
if (F.isImage(href)) {
|
297 |
+
type = 'image';
|
298 |
+
|
299 |
+
} else if (F.isSWF(href)) {
|
300 |
+
type = 'swf';
|
301 |
+
|
302 |
+
} else if (href.charAt(0) === '#') {
|
303 |
+
type = 'inline';
|
304 |
+
|
305 |
+
} else if (isString(element)) {
|
306 |
+
type = 'html';
|
307 |
+
content = element;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
// Split url into two pieces with source url and content selector, e.g,
|
312 |
+
// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
|
313 |
+
if (type === 'ajax') {
|
314 |
+
hrefParts = href.split(/\s+/, 2);
|
315 |
+
href = hrefParts.shift();
|
316 |
+
selector = hrefParts.shift();
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
if (!content) {
|
321 |
+
if (type === 'inline') {
|
322 |
+
if (href) {
|
323 |
+
content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
|
324 |
+
|
325 |
+
} else if (obj.isDom) {
|
326 |
+
content = element;
|
327 |
+
}
|
328 |
+
|
329 |
+
} else if (type === 'html') {
|
330 |
+
content = href;
|
331 |
+
|
332 |
+
} else if (!type && !href && obj.isDom) {
|
333 |
+
type = 'inline';
|
334 |
+
content = element;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
$.extend(obj, {
|
339 |
+
href : href,
|
340 |
+
type : type,
|
341 |
+
content : content,
|
342 |
+
title : title,
|
343 |
+
selector : selector
|
344 |
+
});
|
345 |
+
|
346 |
+
group[ i ] = obj;
|
347 |
+
});
|
348 |
+
|
349 |
+
// Extend the defaults
|
350 |
+
F.opts = $.extend(true, {}, F.defaults, opts);
|
351 |
+
|
352 |
+
// All options are merged recursive except keys
|
353 |
+
if (opts.keys !== undefined) {
|
354 |
+
F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
|
355 |
+
}
|
356 |
+
|
357 |
+
F.group = group;
|
358 |
+
|
359 |
+
return F._start(F.opts.index);
|
360 |
+
},
|
361 |
+
|
362 |
+
// Cancel image loading or abort ajax request
|
363 |
+
cancel: function () {
|
364 |
+
var coming = F.coming;
|
365 |
+
|
366 |
+
if (!coming || false === F.trigger('onCancel')) {
|
367 |
+
return;
|
368 |
+
}
|
369 |
+
|
370 |
+
F.hideLoading();
|
371 |
+
|
372 |
+
if (F.ajaxLoad) {
|
373 |
+
F.ajaxLoad.abort();
|
374 |
+
}
|
375 |
+
|
376 |
+
F.ajaxLoad = null;
|
377 |
+
|
378 |
+
if (F.imgPreload) {
|
379 |
+
F.imgPreload.onload = F.imgPreload.onerror = null;
|
380 |
+
}
|
381 |
+
|
382 |
+
if (coming.wrap) {
|
383 |
+
coming.wrap.stop(true, true).trigger('onReset').remove();
|
384 |
+
}
|
385 |
+
|
386 |
+
F.coming = null;
|
387 |
+
|
388 |
+
// If the first item has been canceled, then clear everything
|
389 |
+
if (!F.current) {
|
390 |
+
F._afterZoomOut( coming );
|
391 |
+
}
|
392 |
+
},
|
393 |
+
|
394 |
+
// Start closing animation if is open; remove immediately if opening/closing
|
395 |
+
close: function (event) {
|
396 |
+
F.cancel();
|
397 |
+
|
398 |
+
if (false === F.trigger('beforeClose')) {
|
399 |
+
return;
|
400 |
+
}
|
401 |
+
|
402 |
+
F.unbindEvents();
|
403 |
+
|
404 |
+
if (!F.isActive) {
|
405 |
+
return;
|
406 |
+
}
|
407 |
+
|
408 |
+
if (!F.isOpen || event === true) {
|
409 |
+
$('.fancybox-wrap').stop(true).trigger('onReset').remove();
|
410 |
+
|
411 |
+
F._afterZoomOut();
|
412 |
+
|
413 |
+
} else {
|
414 |
+
F.isOpen = F.isOpened = false;
|
415 |
+
F.isClosing = true;
|
416 |
+
|
417 |
+
$('.fancybox-item, .fancybox-nav').remove();
|
418 |
+
|
419 |
+
F.wrap.stop(true, true).removeClass('fancybox-opened');
|
420 |
+
|
421 |
+
F.transitions[ F.current.closeMethod ]();
|
422 |
+
}
|
423 |
+
},
|
424 |
+
|
425 |
+
// Manage slideshow:
|
426 |
+
// $.fancybox.play(); - toggle slideshow
|
427 |
+
// $.fancybox.play( true ); - start
|
428 |
+
// $.fancybox.play( false ); - stop
|
429 |
+
play: function ( action ) {
|
430 |
+
var clear = function () {
|
431 |
+
clearTimeout(F.player.timer);
|
432 |
+
},
|
433 |
+
set = function () {
|
434 |
+
clear();
|
435 |
+
|
436 |
+
if (F.current && F.player.isActive) {
|
437 |
+
F.player.timer = setTimeout(F.next, F.current.playSpeed);
|
438 |
+
}
|
439 |
+
},
|
440 |
+
stop = function () {
|
441 |
+
clear();
|
442 |
+
|
443 |
+
D.unbind('.player');
|
444 |
+
|
445 |
+
F.player.isActive = false;
|
446 |
+
|
447 |
+
F.trigger('onPlayEnd');
|
448 |
+
},
|
449 |
+
start = function () {
|
450 |
+
if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
|
451 |
+
F.player.isActive = true;
|
452 |
+
|
453 |
+
D.bind({
|
454 |
+
'onCancel.player beforeClose.player' : stop,
|
455 |
+
'onUpdate.player' : set,
|
456 |
+
'beforeLoad.player' : clear
|
457 |
+
});
|
458 |
+
|
459 |
+
set();
|
460 |
+
|
461 |
+
F.trigger('onPlayStart');
|
462 |
+
}
|
463 |
+
};
|
464 |
+
|
465 |
+
if (action === true || (!F.player.isActive && action !== false)) {
|
466 |
+
start();
|
467 |
+
} else {
|
468 |
+
stop();
|
469 |
+
}
|
470 |
+
},
|
471 |
+
|
472 |
+
// Navigate to next gallery item
|
473 |
+
next: function ( direction ) {
|
474 |
+
var current = F.current;
|
475 |
+
|
476 |
+
if (current) {
|
477 |
+
if (!isString(direction)) {
|
478 |
+
direction = current.direction.next;
|
479 |
+
}
|
480 |
+
|
481 |
+
F.jumpto(current.index + 1, direction, 'next');
|
482 |
+
}
|
483 |
+
},
|
484 |
+
|
485 |
+
// Navigate to previous gallery item
|
486 |
+
prev: function ( direction ) {
|
487 |
+
var current = F.current;
|
488 |
+
|
489 |
+
if (current) {
|
490 |
+
if (!isString(direction)) {
|
491 |
+
direction = current.direction.prev;
|
492 |
+
}
|
493 |
+
|
494 |
+
F.jumpto(current.index - 1, direction, 'prev');
|
495 |
+
}
|
496 |
+
},
|
497 |
+
|
498 |
+
// Navigate to gallery item by index
|
499 |
+
jumpto: function ( index, direction, router ) {
|
500 |
+
var current = F.current;
|
501 |
+
|
502 |
+
if (!current) {
|
503 |
+
return;
|
504 |
+
}
|
505 |
+
|
506 |
+
index = getScalar(index);
|
507 |
+
|
508 |
+
F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
|
509 |
+
F.router = router || 'jumpto';
|
510 |
+
|
511 |
+
if (current.loop) {
|
512 |
+
if (index < 0) {
|
513 |
+
index = current.group.length + (index % current.group.length);
|
514 |
+
}
|
515 |
+
|
516 |
+
index = index % current.group.length;
|
517 |
+
}
|
518 |
+
|
519 |
+
if (current.group[ index ] !== undefined) {
|
520 |
+
F.cancel();
|
521 |
+
|
522 |
+
F._start(index);
|
523 |
+
}
|
524 |
+
},
|
525 |
+
|
526 |
+
// Center inside viewport and toggle position type to fixed or absolute if needed
|
527 |
+
reposition: function (e, onlyAbsolute) {
|
528 |
+
var current = F.current,
|
529 |
+
wrap = current ? current.wrap : null,
|
530 |
+
pos;
|
531 |
+
|
532 |
+
if (wrap) {
|
533 |
+
pos = F._getPosition(onlyAbsolute);
|
534 |
+
|
535 |
+
if (e && e.type === 'scroll') {
|
536 |
+
delete pos.position;
|
537 |
+
|
538 |
+
wrap.stop(true, true).animate(pos, 200);
|
539 |
+
|
540 |
+
} else {
|
541 |
+
wrap.css(pos);
|
542 |
+
|
543 |
+
current.pos = $.extend({}, current.dim, pos);
|
544 |
+
}
|
545 |
+
}
|
546 |
+
},
|
547 |
+
|
548 |
+
update: function (e) {
|
549 |
+
var type = (e && e.type),
|
550 |
+
anyway = !type || type === 'orientationchange';
|
551 |
+
|
552 |
+
if (anyway) {
|
553 |
+
clearTimeout(didUpdate);
|
554 |
+
|
555 |
+
didUpdate = null;
|
556 |
+
}
|
557 |
+
|
558 |
+
if (!F.isOpen || didUpdate) {
|
559 |
+
return;
|
560 |
+
}
|
561 |
+
|
562 |
+
didUpdate = setTimeout(function() {
|
563 |
+
var current = F.current;
|
564 |
+
|
565 |
+
if (!current || F.isClosing) {
|
566 |
+
return;
|
567 |
+
}
|
568 |
+
|
569 |
+
F.wrap.removeClass('fancybox-tmp');
|
570 |
+
|
571 |
+
if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
|
572 |
+
F._setDimension();
|
573 |
+
}
|
574 |
+
|
575 |
+
if (!(type === 'scroll' && current.canShrink)) {
|
576 |
+
F.reposition(e);
|
577 |
+
}
|
578 |
+
|
579 |
+
F.trigger('onUpdate');
|
580 |
+
|
581 |
+
didUpdate = null;
|
582 |
+
|
583 |
+
}, (anyway && !isTouch ? 0 : 300));
|
584 |
+
},
|
585 |
+
|
586 |
+
// Shrink content to fit inside viewport or restore if resized
|
587 |
+
toggle: function ( action ) {
|
588 |
+
if (F.isOpen) {
|
589 |
+
F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
|
590 |
+
|
591 |
+
// Help browser to restore document dimensions
|
592 |
+
if (isTouch) {
|
593 |
+
F.wrap.removeAttr('style').addClass('fancybox-tmp');
|
594 |
+
|
595 |
+
F.trigger('onUpdate');
|
596 |
+
}
|
597 |
+
|
598 |
+
F.update();
|
599 |
+
}
|
600 |
+
},
|
601 |
+
|
602 |
+
hideLoading: function () {
|
603 |
+
D.unbind('.loading');
|
604 |
+
|
605 |
+
$('#fancybox-loading').remove();
|
606 |
+
},
|
607 |
+
|
608 |
+
showLoading: function () {
|
609 |
+
var el, viewport;
|
610 |
+
|
611 |
+
F.hideLoading();
|
612 |
+
|
613 |
+
el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
|
614 |
+
|
615 |
+
// If user will press the escape-button, the request will be canceled
|
616 |
+
D.bind('keydown.loading', function(e) {
|
617 |
+
if ((e.which || e.keyCode) === 27) {
|
618 |
+
e.preventDefault();
|
619 |
+
|
620 |
+
F.cancel();
|
621 |
+
}
|
622 |
+
});
|
623 |
+
|
624 |
+
if (!F.defaults.fixed) {
|
625 |
+
viewport = F.getViewport();
|
626 |
+
|
627 |
+
el.css({
|
628 |
+
position : 'absolute',
|
629 |
+
top : (viewport.h * 0.5) + viewport.y,
|
630 |
+
left : (viewport.w * 0.5) + viewport.x
|
631 |
+
});
|
632 |
+
}
|
633 |
+
},
|
634 |
+
|
635 |
+
getViewport: function () {
|
636 |
+
var locked = (F.current && F.current.locked) || false,
|
637 |
+
rez = {
|
638 |
+
x: W.scrollLeft(),
|
639 |
+
y: W.scrollTop()
|
640 |
+
};
|
641 |
+
|
642 |
+
if (locked) {
|
643 |
+
rez.w = locked[0].clientWidth;
|
644 |
+
rez.h = locked[0].clientHeight;
|
645 |
+
|
646 |
+
} else {
|
647 |
+
// See http://bugs.jquery.com/ticket/6724
|
648 |
+
rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
|
649 |
+
rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
|
650 |
+
}
|
651 |
+
|
652 |
+
return rez;
|
653 |
+
},
|
654 |
+
|
655 |
+
// Unbind the keyboard / clicking actions
|
656 |
+
unbindEvents: function () {
|
657 |
+
if (F.wrap && isQuery(F.wrap)) {
|
658 |
+
F.wrap.unbind('.fb');
|
659 |
+
}
|
660 |
+
|
661 |
+
D.unbind('.fb');
|
662 |
+
W.unbind('.fb');
|
663 |
+
},
|
664 |
+
|
665 |
+
bindEvents: function () {
|
666 |
+
var current = F.current,
|
667 |
+
keys;
|
668 |
+
|
669 |
+
if (!current) {
|
670 |
+
return;
|
671 |
+
}
|
672 |
+
|
673 |
+
// Changing document height on iOS devices triggers a 'resize' event,
|
674 |
+
// that can change document height... repeating infinitely
|
675 |
+
W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
|
676 |
+
|
677 |
+
keys = current.keys;
|
678 |
+
|
679 |
+
if (keys) {
|
680 |
+
D.bind('keydown.fb', function (e) {
|
681 |
+
var code = e.which || e.keyCode,
|
682 |
+
target = e.target || e.srcElement;
|
683 |
+
|
684 |
+
// Skip esc key if loading, because showLoading will cancel preloading
|
685 |
+
if (code === 27 && F.coming) {
|
686 |
+
return false;
|
687 |
+
}
|
688 |
+
|
689 |
+
// Ignore key combinations and key events within form elements
|
690 |
+
if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
|
691 |
+
$.each(keys, function(i, val) {
|
692 |
+
if (current.group.length > 1 && val[ code ] !== undefined) {
|
693 |
+
F[ i ]( val[ code ] );
|
694 |
+
|
695 |
+
e.preventDefault();
|
696 |
+
return false;
|
697 |
+
}
|
698 |
+
|
699 |
+
if ($.inArray(code, val) > -1) {
|
700 |
+
F[ i ] ();
|
701 |
+
|
702 |
+
e.preventDefault();
|
703 |
+
return false;
|
704 |
+
}
|
705 |
+
});
|
706 |
+
}
|
707 |
+
});
|
708 |
+
}
|
709 |
+
|
710 |
+
if ($.fn.mousewheel && current.mouseWheel) {
|
711 |
+
F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
|
712 |
+
var target = e.target || null,
|
713 |
+
parent = $(target),
|
714 |
+
canScroll = false;
|
715 |
+
|
716 |
+
while (parent.length) {
|
717 |
+
if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
|
718 |
+
break;
|
719 |
+
}
|
720 |
+
|
721 |
+
canScroll = isScrollable( parent[0] );
|
722 |
+
parent = $(parent).parent();
|
723 |
+
}
|
724 |
+
|
725 |
+
if (delta !== 0 && !canScroll) {
|
726 |
+
if (F.group.length > 1 && !current.canShrink) {
|
727 |
+
if (deltaY > 0 || deltaX > 0) {
|
728 |
+
F.prev( deltaY > 0 ? 'down' : 'left' );
|
729 |
+
|
730 |
+
} else if (deltaY < 0 || deltaX < 0) {
|
731 |
+
F.next( deltaY < 0 ? 'up' : 'right' );
|
732 |
+
}
|
733 |
+
|
734 |
+
e.preventDefault();
|
735 |
+
}
|
736 |
+
}
|
737 |
+
});
|
738 |
+
}
|
739 |
+
},
|
740 |
+
|
741 |
+
trigger: function (event, o) {
|
742 |
+
var ret, obj = o || F.coming || F.current;
|
743 |
+
|
744 |
+
if (!obj) {
|
745 |
+
return;
|
746 |
+
}
|
747 |
+
|
748 |
+
if ($.isFunction( obj[event] )) {
|
749 |
+
ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
|
750 |
+
}
|
751 |
+
|
752 |
+
if (ret === false) {
|
753 |
+
return false;
|
754 |
+
}
|
755 |
+
|
756 |
+
if (obj.helpers) {
|
757 |
+
$.each(obj.helpers, function (helper, opts) {
|
758 |
+
if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
|
759 |
+
F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
|
760 |
+
}
|
761 |
+
});
|
762 |
+
}
|
763 |
+
|
764 |
+
D.trigger(event);
|
765 |
+
},
|
766 |
+
|
767 |
+
isImage: function (str) {
|
768 |
+
return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
|
769 |
+
},
|
770 |
+
|
771 |
+
isSWF: function (str) {
|
772 |
+
return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
|
773 |
+
},
|
774 |
+
|
775 |
+
_start: function (index) {
|
776 |
+
var coming = {},
|
777 |
+
obj,
|
778 |
+
href,
|
779 |
+
type,
|
780 |
+
margin,
|
781 |
+
padding;
|
782 |
+
|
783 |
+
index = getScalar( index );
|
784 |
+
obj = F.group[ index ] || null;
|
785 |
+
|
786 |
+
if (!obj) {
|
787 |
+
return false;
|
788 |
+
}
|
789 |
+
|
790 |
+
coming = $.extend(true, {}, F.opts, obj);
|
791 |
+
|
792 |
+
// Convert margin and padding properties to array - top, right, bottom, left
|
793 |
+
margin = coming.margin;
|
794 |
+
padding = coming.padding;
|
795 |
+
|
796 |
+
if ($.type(margin) === 'number') {
|
797 |
+
coming.margin = [margin, margin, margin, margin];
|
798 |
+
}
|
799 |
+
|
800 |
+
if ($.type(padding) === 'number') {
|
801 |
+
coming.padding = [padding, padding, padding, padding];
|
802 |
+
}
|
803 |
+
|
804 |
+
// 'modal' propery is just a shortcut
|
805 |
+
if (coming.modal) {
|
806 |
+
$.extend(true, coming, {
|
807 |
+
closeBtn : false,
|
808 |
+
closeClick : false,
|
809 |
+
nextClick : false,
|
810 |
+
arrows : false,
|
811 |
+
mouseWheel : false,
|
812 |
+
keys : null,
|
813 |
+
helpers: {
|
814 |
+
overlay : {
|
815 |
+
closeClick : false
|
816 |
+
}
|
817 |
+
}
|
818 |
+
});
|
819 |
+
}
|
820 |
+
|
821 |
+
// 'autoSize' property is a shortcut, too
|
822 |
+
if (coming.autoSize) {
|
823 |
+
coming.autoWidth = coming.autoHeight = true;
|
824 |
+
}
|
825 |
+
|
826 |
+
if (coming.width === 'auto') {
|
827 |
+
coming.autoWidth = true;
|
828 |
+
}
|
829 |
+
|
830 |
+
if (coming.height === 'auto') {
|
831 |
+
coming.autoHeight = true;
|
832 |
+
}
|
833 |
+
|
834 |
+
/*
|
835 |
+
* Add reference to the group, so it`s possible to access from callbacks, example:
|
836 |
+
* afterLoad : function() {
|
837 |
+
* this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
|
838 |
+
* }
|
839 |
+
*/
|
840 |
+
|
841 |
+
coming.group = F.group;
|
842 |
+
coming.index = index;
|
843 |
+
|
844 |
+
// Give a chance for callback or helpers to update coming item (type, title, etc)
|
845 |
+
F.coming = coming;
|
846 |
+
|
847 |
+
if (false === F.trigger('beforeLoad')) {
|
848 |
+
F.coming = null;
|
849 |
+
|
850 |
+
return;
|
851 |
+
}
|
852 |
+
|
853 |
+
type = coming.type;
|
854 |
+
href = coming.href;
|
855 |
+
|
856 |
+
if (!type) {
|
857 |
+
F.coming = null;
|
858 |
+
|
859 |
+
//If we can not determine content type then drop silently or display next/prev item if looping through gallery
|
860 |
+
if (F.current && F.router && F.router !== 'jumpto') {
|
861 |
+
F.current.index = index;
|
862 |
+
|
863 |
+
return F[ F.router ]( F.direction );
|
864 |
+
}
|
865 |
+
|
866 |
+
return false;
|
867 |
+
}
|
868 |
+
|
869 |
+
F.isActive = true;
|
870 |
+
|
871 |
+
if (type === 'image' || type === 'swf') {
|
872 |
+
coming.autoHeight = coming.autoWidth = false;
|
873 |
+
coming.scrolling = 'visible';
|
874 |
+
}
|
875 |
+
|
876 |
+
if (type === 'image') {
|
877 |
+
coming.aspectRatio = true;
|
878 |
+
}
|
879 |
+
|
880 |
+
if (type === 'iframe' && isTouch) {
|
881 |
+
coming.scrolling = 'scroll';
|
882 |
+
}
|
883 |
+
|
884 |
+
// Build the neccessary markup
|
885 |
+
coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
|
886 |
+
|
887 |
+
$.extend(coming, {
|
888 |
+
skin : $('.fancybox-skin', coming.wrap),
|
889 |
+
outer : $('.fancybox-outer', coming.wrap),
|
890 |
+
inner : $('.fancybox-inner', coming.wrap)
|
891 |
+
});
|
892 |
+
|
893 |
+
$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
|
894 |
+
coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
|
895 |
+
});
|
896 |
+
|
897 |
+
F.trigger('onReady');
|
898 |
+
|
899 |
+
// Check before try to load; 'inline' and 'html' types need content, others - href
|
900 |
+
if (type === 'inline' || type === 'html') {
|
901 |
+
if (!coming.content || !coming.content.length) {
|
902 |
+
return F._error( 'content' );
|
903 |
+
}
|
904 |
+
|
905 |
+
} else if (!href) {
|
906 |
+
return F._error( 'href' );
|
907 |
+
}
|
908 |
+
|
909 |
+
if (type === 'image') {
|
910 |
+
F._loadImage();
|
911 |
+
|
912 |
+
} else if (type === 'ajax') {
|
913 |
+
F._loadAjax();
|
914 |
+
|
915 |
+
} else if (type === 'iframe') {
|
916 |
+
F._loadIframe();
|
917 |
+
|
918 |
+
} else {
|
919 |
+
F._afterLoad();
|
920 |
+
}
|
921 |
+
},
|
922 |
+
|
923 |
+
_error: function ( type ) {
|
924 |
+
$.extend(F.coming, {
|
925 |
+
type : 'html',
|
926 |
+
autoWidth : true,
|
927 |
+
autoHeight : true,
|
928 |
+
minWidth : 0,
|
929 |
+
minHeight : 0,
|
930 |
+
scrolling : 'no',
|
931 |
+
hasError : type,
|
932 |
+
content : F.coming.tpl.error
|
933 |
+
});
|
934 |
+
|
935 |
+
F._afterLoad();
|
936 |
+
},
|
937 |
+
|
938 |
+
_loadImage: function () {
|
939 |
+
// Reset preload image so it is later possible to check "complete" property
|
940 |
+
var img = F.imgPreload = new Image();
|
941 |
+
|
942 |
+
img.onload = function () {
|
943 |
+
this.onload = this.onerror = null;
|
944 |
+
|
945 |
+
F.coming.width = this.width / F.opts.pixelRatio;
|
946 |
+
F.coming.height = this.height / F.opts.pixelRatio;
|
947 |
+
|
948 |
+
F._afterLoad();
|
949 |
+
};
|
950 |
+
|
951 |
+
img.onerror = function () {
|
952 |
+
this.onload = this.onerror = null;
|
953 |
+
|
954 |
+
F._error( 'image' );
|
955 |
+
};
|
956 |
+
|
957 |
+
img.src = F.coming.href;
|
958 |
+
|
959 |
+
if (img.complete !== true) {
|
960 |
+
F.showLoading();
|
961 |
+
}
|
962 |
+
},
|
963 |
+
|
964 |
+
_loadAjax: function () {
|
965 |
+
var coming = F.coming;
|
966 |
+
|
967 |
+
F.showLoading();
|
968 |
+
|
969 |
+
F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
|
970 |
+
url: coming.href,
|
971 |
+
error: function (jqXHR, textStatus) {
|
972 |
+
if (F.coming && textStatus !== 'abort') {
|
973 |
+
F._error( 'ajax', jqXHR );
|
974 |
+
|
975 |
+
} else {
|
976 |
+
F.hideLoading();
|
977 |
+
}
|
978 |
+
},
|
979 |
+
success: function (data, textStatus) {
|
980 |
+
if (textStatus === 'success') {
|
981 |
+
coming.content = data;
|
982 |
+
|
983 |
+
F._afterLoad();
|
984 |
+
}
|
985 |
+
}
|
986 |
+
}));
|
987 |
+
},
|
988 |
+
|
989 |
+
_loadIframe: function() {
|
990 |
+
var coming = F.coming,
|
991 |
+
iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
|
992 |
+
.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
|
993 |
+
.attr('src', coming.href);
|
994 |
+
|
995 |
+
// This helps IE
|
996 |
+
$(coming.wrap).bind('onReset', function () {
|
997 |
+
try {
|
998 |
+
$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
|
999 |
+
} catch (e) {}
|
1000 |
+
});
|
1001 |
+
|
1002 |
+
if (coming.iframe.preload) {
|
1003 |
+
F.showLoading();
|
1004 |
+
|
1005 |
+
iframe.one('load', function() {
|
1006 |
+
$(this).data('ready', 1);
|
1007 |
+
|
1008 |
+
// iOS will lose scrolling if we resize
|
1009 |
+
if (!isTouch) {
|
1010 |
+
$(this).bind('load.fb', F.update);
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
// Without this trick:
|
1014 |
+
// - iframe won't scroll on iOS devices
|
1015 |
+
// - IE7 sometimes displays empty iframe
|
1016 |
+
$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
|
1017 |
+
|
1018 |
+
F._afterLoad();
|
1019 |
+
});
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
coming.content = iframe.appendTo( coming.inner );
|
1023 |
+
|
1024 |
+
if (!coming.iframe.preload) {
|
1025 |
+
F._afterLoad();
|
1026 |
+
}
|
1027 |
+
},
|
1028 |
+
|
1029 |
+
_preloadImages: function() {
|
1030 |
+
var group = F.group,
|
1031 |
+
current = F.current,
|
1032 |
+
len = group.length,
|
1033 |
+
cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
|
1034 |
+
item,
|
1035 |
+
i;
|
1036 |
+
|
1037 |
+
for (i = 1; i <= cnt; i += 1) {
|
1038 |
+
item = group[ (current.index + i ) % len ];
|
1039 |
+
|
1040 |
+
if (item.type === 'image' && item.href) {
|
1041 |
+
new Image().src = item.href;
|
1042 |
+
}
|
1043 |
+
}
|
1044 |
+
},
|
1045 |
+
|
1046 |
+
_afterLoad: function () {
|
1047 |
+
var coming = F.coming,
|
1048 |
+
previous = F.current,
|
1049 |
+
placeholder = 'fancybox-placeholder',
|
1050 |
+
current,
|
1051 |
+
content,
|
1052 |
+
type,
|
1053 |
+
scrolling,
|
1054 |
+
href,
|
1055 |
+
embed;
|
1056 |
+
|
1057 |
+
F.hideLoading();
|
1058 |
+
|
1059 |
+
if (!coming || F.isActive === false) {
|
1060 |
+
return;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
if (false === F.trigger('afterLoad', coming, previous)) {
|
1064 |
+
coming.wrap.stop(true).trigger('onReset').remove();
|
1065 |
+
|
1066 |
+
F.coming = null;
|
1067 |
+
|
1068 |
+
return;
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
if (previous) {
|
1072 |
+
F.trigger('beforeChange', previous);
|
1073 |
+
|
1074 |
+
previous.wrap.stop(true).removeClass('fancybox-opened')
|
1075 |
+
.find('.fancybox-item, .fancybox-nav')
|
1076 |
+
.remove();
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
F.unbindEvents();
|
1080 |
+
|
1081 |
+
current = coming;
|
1082 |
+
content = coming.content;
|
1083 |
+
type = coming.type;
|
1084 |
+
scrolling = coming.scrolling;
|
1085 |
+
|
1086 |
+
$.extend(F, {
|
1087 |
+
wrap : current.wrap,
|
1088 |
+
skin : current.skin,
|
1089 |
+
outer : current.outer,
|
1090 |
+
inner : current.inner,
|
1091 |
+
current : current,
|
1092 |
+
previous : previous
|
1093 |
+
});
|
1094 |
+
|
1095 |
+
href = current.href;
|
1096 |
+
|
1097 |
+
switch (type) {
|
1098 |
+
case 'inline':
|
1099 |
+
case 'ajax':
|
1100 |
+
case 'html':
|
1101 |
+
if (current.selector) {
|
1102 |
+
content = $('<div>').html(content).find(current.selector);
|
1103 |
+
|
1104 |
+
} else if (isQuery(content)) {
|
1105 |
+
if (!content.data(placeholder)) {
|
1106 |
+
content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
content = content.show().detach();
|
1110 |
+
|
1111 |
+
current.wrap.bind('onReset', function () {
|
1112 |
+
if ($(this).find(content).length) {
|
1113 |
+
content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
|
1114 |
+
}
|
1115 |
+
});
|
1116 |
+
}
|
1117 |
+
break;
|
1118 |
+
|
1119 |
+
case 'image':
|
1120 |
+
content = current.tpl.image.replace('{href}', href);
|
1121 |
+
break;
|
1122 |
+
|
1123 |
+
case 'swf':
|
1124 |
+
content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
|
1125 |
+
embed = '';
|
1126 |
+
|
1127 |
+
$.each(current.swf, function(name, val) {
|
1128 |
+
content += '<param name="' + name + '" value="' + val + '"></param>';
|
1129 |
+
embed += ' ' + name + '="' + val + '"';
|
1130 |
+
});
|
1131 |
+
|
1132 |
+
content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
|
1133 |
+
break;
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
if (!(isQuery(content) && content.parent().is(current.inner))) {
|
1137 |
+
current.inner.append( content );
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
// Give a chance for helpers or callbacks to update elements
|
1141 |
+
F.trigger('beforeShow');
|
1142 |
+
|
1143 |
+
// Set scrolling before calculating dimensions
|
1144 |
+
current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
|
1145 |
+
|
1146 |
+
// Set initial dimensions and start position
|
1147 |
+
F._setDimension();
|
1148 |
+
|
1149 |
+
F.reposition();
|
1150 |
+
|
1151 |
+
F.isOpen = false;
|
1152 |
+
F.coming = null;
|
1153 |
+
|
1154 |
+
F.bindEvents();
|
1155 |
+
|
1156 |
+
if (!F.isOpened) {
|
1157 |
+
$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
|
1158 |
+
|
1159 |
+
} else if (previous.prevMethod) {
|
1160 |
+
F.transitions[ previous.prevMethod ]();
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
|
1164 |
+
|
1165 |
+
F._preloadImages();
|
1166 |
+
},
|
1167 |
+
|
1168 |
+
_setDimension: function () {
|
1169 |
+
var viewport = F.getViewport(),
|
1170 |
+
steps = 0,
|
1171 |
+
canShrink = false,
|
1172 |
+
canExpand = false,
|
1173 |
+
wrap = F.wrap,
|
1174 |
+
skin = F.skin,
|
1175 |
+
inner = F.inner,
|
1176 |
+
current = F.current,
|
1177 |
+
width = current.width,
|
1178 |
+
height = current.height,
|
1179 |
+
minWidth = current.minWidth,
|
1180 |
+
minHeight = current.minHeight,
|
1181 |
+
maxWidth = current.maxWidth,
|
1182 |
+
maxHeight = current.maxHeight,
|
1183 |
+
scrolling = current.scrolling,
|
1184 |
+
scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
|
1185 |
+
margin = current.margin,
|
1186 |
+
wMargin = getScalar(margin[1] + margin[3]),
|
1187 |
+
hMargin = getScalar(margin[0] + margin[2]),
|
1188 |
+
wPadding,
|
1189 |
+
hPadding,
|
1190 |
+
wSpace,
|
1191 |
+
hSpace,
|
1192 |
+
origWidth,
|
1193 |
+
origHeight,
|
1194 |
+
origMaxWidth,
|
1195 |
+
origMaxHeight,
|
1196 |
+
ratio,
|
1197 |
+
width_,
|
1198 |
+
height_,
|
1199 |
+
maxWidth_,
|
1200 |
+
maxHeight_,
|
1201 |
+
iframe,
|
1202 |
+
body;
|
1203 |
+
|
1204 |
+
// Reset dimensions so we could re-check actual size
|
1205 |
+
wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
|
1206 |
+
|
1207 |
+
wPadding = getScalar(skin.outerWidth(true) - skin.width());
|
1208 |
+
hPadding = getScalar(skin.outerHeight(true) - skin.height());
|
1209 |
+
|
1210 |
+
// Any space between content and viewport (margin, padding, border, title)
|
1211 |
+
wSpace = wMargin + wPadding;
|
1212 |
+
hSpace = hMargin + hPadding;
|
1213 |
+
|
1214 |
+
origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
|
1215 |
+
origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
|
1216 |
+
|
1217 |
+
if (current.type === 'iframe') {
|
1218 |
+
iframe = current.content;
|
1219 |
+
|
1220 |
+
if (current.autoHeight && iframe.data('ready') === 1) {
|
1221 |
+
try {
|
1222 |
+
if (iframe[0].contentWindow.document.location) {
|
1223 |
+
inner.width( origWidth ).height(9999);
|
1224 |
+
|
1225 |
+
body = iframe.contents().find('body');
|
1226 |
+
|
1227 |
+
if (scrollOut) {
|
1228 |
+
body.css('overflow-x', 'hidden');
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
origHeight = body.outerHeight(true);
|
1232 |
+
}
|
1233 |
+
|
1234 |
+
} catch (e) {}
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
} else if (current.autoWidth || current.autoHeight) {
|
1238 |
+
inner.addClass( 'fancybox-tmp' );
|
1239 |
+
|
1240 |
+
// Set width or height in case we need to calculate only one dimension
|
1241 |
+
if (!current.autoWidth) {
|
1242 |
+
inner.width( origWidth );
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
if (!current.autoHeight) {
|
1246 |
+
inner.height( origHeight );
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
if (current.autoWidth) {
|
1250 |
+
origWidth = inner.width();
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
if (current.autoHeight) {
|
1254 |
+
origHeight = inner.height();
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
inner.removeClass( 'fancybox-tmp' );
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
width = getScalar( origWidth );
|
1261 |
+
height = getScalar( origHeight );
|
1262 |
+
|
1263 |
+
ratio = origWidth / origHeight;
|
1264 |
+
|
1265 |
+
// Calculations for the content
|
1266 |
+
minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
|
1267 |
+
maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
|
1268 |
+
|
1269 |
+
minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
|
1270 |
+
maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
|
1271 |
+
|
1272 |
+
// These will be used to determine if wrap can fit in the viewport
|
1273 |
+
origMaxWidth = maxWidth;
|
1274 |
+
origMaxHeight = maxHeight;
|
1275 |
+
|
1276 |
+
if (current.fitToView) {
|
1277 |
+
maxWidth = Math.min(viewport.w - wSpace, maxWidth);
|
1278 |
+
maxHeight = Math.min(viewport.h - hSpace, maxHeight);
|
1279 |
+
}
|
1280 |
+
|
1281 |
+
maxWidth_ = viewport.w - wMargin;
|
1282 |
+
maxHeight_ = viewport.h - hMargin;
|
1283 |
+
|
1284 |
+
if (current.aspectRatio) {
|
1285 |
+
if (width > maxWidth) {
|
1286 |
+
width = maxWidth;
|
1287 |
+
height = getScalar(width / ratio);
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
if (height > maxHeight) {
|
1291 |
+
height = maxHeight;
|
1292 |
+
width = getScalar(height * ratio);
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
if (width < minWidth) {
|
1296 |
+
width = minWidth;
|
1297 |
+
height = getScalar(width / ratio);
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
if (height < minHeight) {
|
1301 |
+
height = minHeight;
|
1302 |
+
width = getScalar(height * ratio);
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
} else {
|
1306 |
+
width = Math.max(minWidth, Math.min(width, maxWidth));
|
1307 |
+
|
1308 |
+
if (current.autoHeight && current.type !== 'iframe') {
|
1309 |
+
inner.width( width );
|
1310 |
+
|
1311 |
+
height = inner.height();
|
1312 |
+
}
|
1313 |
+
|
1314 |
+
height = Math.max(minHeight, Math.min(height, maxHeight));
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
// Try to fit inside viewport (including the title)
|
1318 |
+
if (current.fitToView) {
|
1319 |
+
inner.width( width ).height( height );
|
1320 |
+
|
1321 |
+
wrap.width( width + wPadding );
|
1322 |
+
|
1323 |
+
// Real wrap dimensions
|
1324 |
+
width_ = wrap.width();
|
1325 |
+
height_ = wrap.height();
|
1326 |
+
|
1327 |
+
if (current.aspectRatio) {
|
1328 |
+
while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
|
1329 |
+
if (steps++ > 19) {
|
1330 |
+
break;
|
1331 |
+
}
|
1332 |
+
|
1333 |
+
height = Math.max(minHeight, Math.min(maxHeight, height - 10));
|
1334 |
+
width = getScalar(height * ratio);
|
1335 |
+
|
1336 |
+
if (width < minWidth) {
|
1337 |
+
width = minWidth;
|
1338 |
+
height = getScalar(width / ratio);
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
if (width > maxWidth) {
|
1342 |
+
width = maxWidth;
|
1343 |
+
height = getScalar(width / ratio);
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
inner.width( width ).height( height );
|
1347 |
+
|
1348 |
+
wrap.width( width + wPadding );
|
1349 |
+
|
1350 |
+
width_ = wrap.width();
|
1351 |
+
height_ = wrap.height();
|
1352 |
+
}
|
1353 |
+
|
1354 |
+
} else {
|
1355 |
+
width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_)));
|
1356 |
+
height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
|
1361 |
+
width += scrollOut;
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
inner.width( width ).height( height );
|
1365 |
+
|
1366 |
+
wrap.width( width + wPadding );
|
1367 |
+
|
1368 |
+
width_ = wrap.width();
|
1369 |
+
height_ = wrap.height();
|
1370 |
+
|
1371 |
+
canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
|
1372 |
+
canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
|
1373 |
+
|
1374 |
+
$.extend(current, {
|
1375 |
+
dim : {
|
1376 |
+
width : getValue( width_ ),
|
1377 |
+
height : getValue( height_ )
|
1378 |
+
},
|
1379 |
+
origWidth : origWidth,
|
1380 |
+
origHeight : origHeight,
|
1381 |
+
canShrink : canShrink,
|
1382 |
+
canExpand : canExpand,
|
1383 |
+
wPadding : wPadding,
|
1384 |
+
hPadding : hPadding,
|
1385 |
+
wrapSpace : height_ - skin.outerHeight(true),
|
1386 |
+
skinSpace : skin.height() - height
|
1387 |
+
});
|
1388 |
+
|
1389 |
+
if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
|
1390 |
+
inner.height('auto');
|
1391 |
+
}
|
1392 |
+
},
|
1393 |
+
|
1394 |
+
_getPosition: function (onlyAbsolute) {
|
1395 |
+
var current = F.current,
|
1396 |
+
viewport = F.getViewport(),
|
1397 |
+
margin = current.margin,
|
1398 |
+
width = F.wrap.width() + margin[1] + margin[3],
|
1399 |
+
height = F.wrap.height() + margin[0] + margin[2],
|
1400 |
+
rez = {
|
1401 |
+
position: 'absolute',
|
1402 |
+
top : margin[0],
|
1403 |
+
left : margin[3]
|
1404 |
+
};
|
1405 |
+
|
1406 |
+
if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
|
1407 |
+
rez.position = 'fixed';
|
1408 |
+
|
1409 |
+
} else if (!current.locked) {
|
1410 |
+
rez.top += viewport.y;
|
1411 |
+
rez.left += viewport.x;
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
|
1415 |
+
rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
|
1416 |
+
|
1417 |
+
return rez;
|
1418 |
+
},
|
1419 |
+
|
1420 |
+
_afterZoomIn: function () {
|
1421 |
+
var current = F.current;
|
1422 |
+
|
1423 |
+
if (!current) {
|
1424 |
+
return;
|
1425 |
+
}
|
1426 |
+
|
1427 |
+
F.isOpen = F.isOpened = true;
|
1428 |
+
|
1429 |
+
F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
|
1430 |
+
|
1431 |
+
F.update();
|
1432 |
+
|
1433 |
+
// Assign a click event
|
1434 |
+
if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
|
1435 |
+
F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
|
1436 |
+
if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
|
1437 |
+
e.preventDefault();
|
1438 |
+
|
1439 |
+
F[ current.closeClick ? 'close' : 'next' ]();
|
1440 |
+
}
|
1441 |
+
});
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
// Create a close button
|
1445 |
+
if (current.closeBtn) {
|
1446 |
+
$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
|
1447 |
+
e.preventDefault();
|
1448 |
+
|
1449 |
+
F.close();
|
1450 |
+
});
|
1451 |
+
}
|
1452 |
+
|
1453 |
+
// Create navigation arrows
|
1454 |
+
if (current.arrows && F.group.length > 1) {
|
1455 |
+
if (current.loop || current.index > 0) {
|
1456 |
+
$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
if (current.loop || current.index < F.group.length - 1) {
|
1460 |
+
$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
|
1461 |
+
}
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
F.trigger('afterShow');
|
1465 |
+
|
1466 |
+
// Stop the slideshow if this is the last item
|
1467 |
+
if (!current.loop && current.index === current.group.length - 1) {
|
1468 |
+
F.play( false );
|
1469 |
+
|
1470 |
+
} else if (F.opts.autoPlay && !F.player.isActive) {
|
1471 |
+
F.opts.autoPlay = false;
|
1472 |
+
|
1473 |
+
F.play();
|
1474 |
+
}
|
1475 |
+
},
|
1476 |
+
|
1477 |
+
_afterZoomOut: function ( obj ) {
|
1478 |
+
obj = obj || F.current;
|
1479 |
+
|
1480 |
+
$('.fancybox-wrap').trigger('onReset').remove();
|
1481 |
+
|
1482 |
+
$.extend(F, {
|
1483 |
+
group : {},
|
1484 |
+
opts : {},
|
1485 |
+
router : false,
|
1486 |
+
current : null,
|
1487 |
+
isActive : false,
|
1488 |
+
isOpened : false,
|
1489 |
+
isOpen : false,
|
1490 |
+
isClosing : false,
|
1491 |
+
wrap : null,
|
1492 |
+
skin : null,
|
1493 |
+
outer : null,
|
1494 |
+
inner : null
|
1495 |
+
});
|
1496 |
+
|
1497 |
+
F.trigger('afterClose', obj);
|
1498 |
+
}
|
1499 |
+
});
|
1500 |
+
|
1501 |
+
/*
|
1502 |
+
* Default transitions
|
1503 |
+
*/
|
1504 |
+
|
1505 |
+
F.transitions = {
|
1506 |
+
getOrigPosition: function () {
|
1507 |
+
var current = F.current,
|
1508 |
+
element = current.element,
|
1509 |
+
orig = current.orig,
|
1510 |
+
pos = {},
|
1511 |
+
width = 50,
|
1512 |
+
height = 50,
|
1513 |
+
hPadding = current.hPadding,
|
1514 |
+
wPadding = current.wPadding,
|
1515 |
+
viewport = F.getViewport();
|
1516 |
+
|
1517 |
+
if (!orig && current.isDom && element.is(':visible')) {
|
1518 |
+
orig = element.find('img:first');
|
1519 |
+
|
1520 |
+
if (!orig.length) {
|
1521 |
+
orig = element;
|
1522 |
+
}
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
if (isQuery(orig)) {
|
1526 |
+
pos = orig.offset();
|
1527 |
+
|
1528 |
+
if (orig.is('img')) {
|
1529 |
+
width = orig.outerWidth();
|
1530 |
+
height = orig.outerHeight();
|
1531 |
+
}
|
1532 |
+
|
1533 |
+
} else {
|
1534 |
+
pos.top = viewport.y + (viewport.h - height) * current.topRatio;
|
1535 |
+
pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
if (F.wrap.css('position') === 'fixed' || current.locked) {
|
1539 |
+
pos.top -= viewport.y;
|
1540 |
+
pos.left -= viewport.x;
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
pos = {
|
1544 |
+
top : getValue(pos.top - hPadding * current.topRatio),
|
1545 |
+
left : getValue(pos.left - wPadding * current.leftRatio),
|
1546 |
+
width : getValue(width + wPadding),
|
1547 |
+
height : getValue(height + hPadding)
|
1548 |
+
};
|
1549 |
+
|
1550 |
+
return pos;
|
1551 |
+
},
|
1552 |
+
|
1553 |
+
step: function (now, fx) {
|
1554 |
+
var ratio,
|
1555 |
+
padding,
|
1556 |
+
value,
|
1557 |
+
prop = fx.prop,
|
1558 |
+
current = F.current,
|
1559 |
+
wrapSpace = current.wrapSpace,
|
1560 |
+
skinSpace = current.skinSpace;
|
1561 |
+
|
1562 |
+
if (prop === 'width' || prop === 'height') {
|
1563 |
+
ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
|
1564 |
+
|
1565 |
+
if (F.isClosing) {
|
1566 |
+
ratio = 1 - ratio;
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
padding = prop === 'width' ? current.wPadding : current.hPadding;
|
1570 |
+
value = now - padding;
|
1571 |
+
|
1572 |
+
F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) );
|
1573 |
+
F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
|
1574 |
+
}
|
1575 |
+
},
|
1576 |
+
|
1577 |
+
zoomIn: function () {
|
1578 |
+
var current = F.current,
|
1579 |
+
startPos = current.pos,
|
1580 |
+
effect = current.openEffect,
|
1581 |
+
elastic = effect === 'elastic',
|
1582 |
+
endPos = $.extend({opacity : 1}, startPos);
|
1583 |
+
|
1584 |
+
// Remove "position" property that breaks older IE
|
1585 |
+
delete endPos.position;
|
1586 |
+
|
1587 |
+
if (elastic) {
|
1588 |
+
startPos = this.getOrigPosition();
|
1589 |
+
|
1590 |
+
if (current.openOpacity) {
|
1591 |
+
startPos.opacity = 0.1;
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
} else if (effect === 'fade') {
|
1595 |
+
startPos.opacity = 0.1;
|
1596 |
+
}
|
1597 |
+
|
1598 |
+
F.wrap.css(startPos).animate(endPos, {
|
1599 |
+
duration : effect === 'none' ? 0 : current.openSpeed,
|
1600 |
+
easing : current.openEasing,
|
1601 |
+
step : elastic ? this.step : null,
|
1602 |
+
complete : F._afterZoomIn
|
1603 |
+
});
|
1604 |
+
},
|
1605 |
+
|
1606 |
+
zoomOut: function () {
|
1607 |
+
var current = F.current,
|
1608 |
+
effect = current.closeEffect,
|
1609 |
+
elastic = effect === 'elastic',
|
1610 |
+
endPos = {opacity : 0.1};
|
1611 |
+
|
1612 |
+
if (elastic) {
|
1613 |
+
endPos = this.getOrigPosition();
|
1614 |
+
|
1615 |
+
if (current.closeOpacity) {
|
1616 |
+
endPos.opacity = 0.1;
|
1617 |
+
}
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
F.wrap.animate(endPos, {
|
1621 |
+
duration : effect === 'none' ? 0 : current.closeSpeed,
|
1622 |
+
easing : current.closeEasing,
|
1623 |
+
step : elastic ? this.step : null,
|
1624 |
+
complete : F._afterZoomOut
|
1625 |
+
});
|
1626 |
+
},
|
1627 |
+
|
1628 |
+
changeIn: function () {
|
1629 |
+
var current = F.current,
|
1630 |
+
effect = current.nextEffect,
|
1631 |
+
startPos = current.pos,
|
1632 |
+
endPos = { opacity : 1 },
|
1633 |
+
direction = F.direction,
|
1634 |
+
distance = 200,
|
1635 |
+
field;
|
1636 |
+
|
1637 |
+
startPos.opacity = 0.1;
|
1638 |
+
|
1639 |
+
if (effect === 'elastic') {
|
1640 |
+
field = direction === 'down' || direction === 'up' ? 'top' : 'left';
|
1641 |
+
|
1642 |
+
if (direction === 'down' || direction === 'right') {
|
1643 |
+
startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
|
1644 |
+
endPos[ field ] = '+=' + distance + 'px';
|
1645 |
+
|
1646 |
+
} else {
|
1647 |
+
startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
|
1648 |
+
endPos[ field ] = '-=' + distance + 'px';
|
1649 |
+
}
|
1650 |
+
}
|
1651 |
+
|
1652 |
+
// Workaround for http://bugs.jquery.com/ticket/12273
|
1653 |
+
if (effect === 'none') {
|
1654 |
+
F._afterZoomIn();
|
1655 |
+
|
1656 |
+
} else {
|
1657 |
+
F.wrap.css(startPos).animate(endPos, {
|
1658 |
+
duration : current.nextSpeed,
|
1659 |
+
easing : current.nextEasing,
|
1660 |
+
complete : F._afterZoomIn
|
1661 |
+
});
|
1662 |
+
}
|
1663 |
+
},
|
1664 |
+
|
1665 |
+
changeOut: function () {
|
1666 |
+
var previous = F.previous,
|
1667 |
+
effect = previous.prevEffect,
|
1668 |
+
endPos = { opacity : 0.1 },
|
1669 |
+
direction = F.direction,
|
1670 |
+
distance = 200;
|
1671 |
+
|
1672 |
+
if (effect === 'elastic') {
|
1673 |
+
endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
|
1674 |
+
}
|
1675 |
+
|
1676 |
+
previous.wrap.animate(endPos, {
|
1677 |
+
duration : effect === 'none' ? 0 : previous.prevSpeed,
|
1678 |
+
easing : previous.prevEasing,
|
1679 |
+
complete : function () {
|
1680 |
+
$(this).trigger('onReset').remove();
|
1681 |
+
}
|
1682 |
+
});
|
1683 |
+
}
|
1684 |
+
};
|
1685 |
+
|
1686 |
+
/*
|
1687 |
+
* Overlay helper
|
1688 |
+
*/
|
1689 |
+
|
1690 |
+
F.helpers.overlay = {
|
1691 |
+
defaults : {
|
1692 |
+
closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
|
1693 |
+
speedOut : 200, // duration of fadeOut animation
|
1694 |
+
showEarly : true, // indicates if should be opened immediately or wait until the content is ready
|
1695 |
+
css : {}, // custom CSS properties
|
1696 |
+
locked : !isTouch, // if true, the content will be locked into overlay
|
1697 |
+
fixed : true // if false, the overlay CSS position property will not be set to "fixed"
|
1698 |
+
},
|
1699 |
+
|
1700 |
+
overlay : null, // current handle
|
1701 |
+
fixed : false, // indicates if the overlay has position "fixed"
|
1702 |
+
el : $('html'), // element that contains "the lock"
|
1703 |
+
|
1704 |
+
// Public methods
|
1705 |
+
create : function(opts) {
|
1706 |
+
opts = $.extend({}, this.defaults, opts);
|
1707 |
+
|
1708 |
+
if (this.overlay) {
|
1709 |
+
this.close();
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
|
1713 |
+
this.fixed = false;
|
1714 |
+
|
1715 |
+
if (opts.fixed && F.defaults.fixed) {
|
1716 |
+
this.overlay.addClass('fancybox-overlay-fixed');
|
1717 |
+
|
1718 |
+
this.fixed = true;
|
1719 |
+
}
|
1720 |
+
},
|
1721 |
+
|
1722 |
+
open : function(opts) {
|
1723 |
+
var that = this;
|
1724 |
+
|
1725 |
+
opts = $.extend({}, this.defaults, opts);
|
1726 |
+
|
1727 |
+
if (this.overlay) {
|
1728 |
+
this.overlay.unbind('.overlay').width('auto').height('auto');
|
1729 |
+
|
1730 |
+
} else {
|
1731 |
+
this.create(opts);
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
if (!this.fixed) {
|
1735 |
+
W.bind('resize.overlay', $.proxy( this.update, this) );
|
1736 |
+
|
1737 |
+
this.update();
|
1738 |
+
}
|
1739 |
+
|
1740 |
+
if (opts.closeClick) {
|
1741 |
+
this.overlay.bind('click.overlay', function(e) {
|
1742 |
+
if ($(e.target).hasClass('fancybox-overlay')) {
|
1743 |
+
if (F.isActive) {
|
1744 |
+
F.close();
|
1745 |
+
} else {
|
1746 |
+
that.close();
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
return false;
|
1750 |
+
}
|
1751 |
+
});
|
1752 |
+
}
|
1753 |
+
|
1754 |
+
this.overlay.css( opts.css ).show();
|
1755 |
+
},
|
1756 |
+
|
1757 |
+
close : function() {
|
1758 |
+
var scrollV, scrollH;
|
1759 |
+
|
1760 |
+
W.unbind('resize.overlay');
|
1761 |
+
|
1762 |
+
if (this.el.hasClass('fancybox-lock')) {
|
1763 |
+
$('.fancybox-margin').removeClass('fancybox-margin');
|
1764 |
+
|
1765 |
+
scrollV = W.scrollTop();
|
1766 |
+
scrollH = W.scrollLeft();
|
1767 |
+
|
1768 |
+
this.el.removeClass('fancybox-lock');
|
1769 |
+
|
1770 |
+
W.scrollTop( scrollV ).scrollLeft( scrollH );
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
$('.fancybox-overlay').remove().hide();
|
1774 |
+
|
1775 |
+
$.extend(this, {
|
1776 |
+
overlay : null,
|
1777 |
+
fixed : false
|
1778 |
+
});
|
1779 |
+
},
|
1780 |
+
|
1781 |
+
// Private, callbacks
|
1782 |
+
|
1783 |
+
update : function () {
|
1784 |
+
var width = '100%', offsetWidth;
|
1785 |
+
|
1786 |
+
// Reset width/height so it will not mess
|
1787 |
+
this.overlay.width(width).height('100%');
|
1788 |
+
|
1789 |
+
// jQuery does not return reliable result for IE
|
1790 |
+
if (IE) {
|
1791 |
+
offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
|
1792 |
+
|
1793 |
+
if (D.width() > offsetWidth) {
|
1794 |
+
width = D.width();
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
} else if (D.width() > W.width()) {
|
1798 |
+
width = D.width();
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
this.overlay.width(width).height(D.height());
|
1802 |
+
},
|
1803 |
+
|
1804 |
+
// This is where we can manipulate DOM, because later it would cause iframes to reload
|
1805 |
+
onReady : function (opts, obj) {
|
1806 |
+
var overlay = this.overlay;
|
1807 |
+
|
1808 |
+
$('.fancybox-overlay').stop(true, true);
|
1809 |
+
|
1810 |
+
if (!overlay) {
|
1811 |
+
this.create(opts);
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
if (opts.locked && this.fixed && obj.fixed) {
|
1815 |
+
if (!overlay) {
|
1816 |
+
this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
obj.locked = this.overlay.append( obj.wrap );
|
1820 |
+
obj.fixed = false;
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
if (opts.showEarly === true) {
|
1824 |
+
this.beforeShow.apply(this, arguments);
|
1825 |
+
}
|
1826 |
+
},
|
1827 |
+
|
1828 |
+
beforeShow : function(opts, obj) {
|
1829 |
+
var scrollV, scrollH;
|
1830 |
+
|
1831 |
+
if (obj.locked) {
|
1832 |
+
if (this.margin !== false) {
|
1833 |
+
$('*').filter(function(){
|
1834 |
+
return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
|
1835 |
+
}).addClass('fancybox-margin');
|
1836 |
+
|
1837 |
+
this.el.addClass('fancybox-margin');
|
1838 |
+
}
|
1839 |
+
|
1840 |
+
scrollV = W.scrollTop();
|
1841 |
+
scrollH = W.scrollLeft();
|
1842 |
+
|
1843 |
+
this.el.addClass('fancybox-lock');
|
1844 |
+
|
1845 |
+
W.scrollTop( scrollV ).scrollLeft( scrollH );
|
1846 |
+
}
|
1847 |
+
|
1848 |
+
this.open(opts);
|
1849 |
+
},
|
1850 |
+
|
1851 |
+
onUpdate : function() {
|
1852 |
+
if (!this.fixed) {
|
1853 |
+
this.update();
|
1854 |
+
}
|
1855 |
+
},
|
1856 |
+
|
1857 |
+
afterClose: function (opts) {
|
1858 |
+
// Remove overlay if exists and fancyBox is not opening
|
1859 |
+
// (e.g., it is not being open using afterClose callback)
|
1860 |
+
//if (this.overlay && !F.isActive) {
|
1861 |
+
if (this.overlay && !F.coming) {
|
1862 |
+
this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
|
1863 |
+
}
|
1864 |
+
}
|
1865 |
+
};
|
1866 |
+
|
1867 |
+
/*
|
1868 |
+
* Title helper
|
1869 |
+
*/
|
1870 |
+
|
1871 |
+
F.helpers.title = {
|
1872 |
+
defaults : {
|
1873 |
+
type : 'float', // 'float', 'inside', 'outside' or 'over',
|
1874 |
+
position : 'bottom' // 'top' or 'bottom'
|
1875 |
+
},
|
1876 |
+
|
1877 |
+
beforeShow: function (opts) {
|
1878 |
+
var current = F.current,
|
1879 |
+
text = current.title,
|
1880 |
+
type = opts.type,
|
1881 |
+
title,
|
1882 |
+
target;
|
1883 |
+
|
1884 |
+
if ($.isFunction(text)) {
|
1885 |
+
text = text.call(current.element, current);
|
1886 |
+
}
|
1887 |
+
|
1888 |
+
if (!isString(text) || $.trim(text) === '') {
|
1889 |
+
return;
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
|
1893 |
+
|
1894 |
+
switch (type) {
|
1895 |
+
case 'inside':
|
1896 |
+
target = F.skin;
|
1897 |
+
break;
|
1898 |
+
|
1899 |
+
case 'outside':
|
1900 |
+
target = F.wrap;
|
1901 |
+
break;
|
1902 |
+
|
1903 |
+
case 'over':
|
1904 |
+
target = F.inner;
|
1905 |
+
break;
|
1906 |
+
|
1907 |
+
default: // 'float'
|
1908 |
+
target = F.skin;
|
1909 |
+
|
1910 |
+
title.appendTo('body');
|
1911 |
+
|
1912 |
+
if (IE) {
|
1913 |
+
title.width( title.width() );
|
1914 |
+
}
|
1915 |
+
|
1916 |
+
title.wrapInner('<span class="child"></span>');
|
1917 |
+
|
1918 |
+
//Increase bottom margin so this title will also fit into viewport
|
1919 |
+
F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
|
1920 |
+
break;
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target);
|
1924 |
+
}
|
1925 |
+
};
|
1926 |
+
|
1927 |
+
// jQuery plugin initialization
|
1928 |
+
$.fn.fancybox = function (options) {
|
1929 |
+
var index,
|
1930 |
+
that = $(this),
|
1931 |
+
selector = this.selector || '',
|
1932 |
+
run = function(e) {
|
1933 |
+
var what = $(this).blur(), idx = index, relType, relVal;
|
1934 |
+
|
1935 |
+
if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
|
1936 |
+
relType = options.groupAttr || 'data-fancybox-group';
|
1937 |
+
relVal = what.attr(relType);
|
1938 |
+
|
1939 |
+
if (!relVal) {
|
1940 |
+
relType = 'rel';
|
1941 |
+
relVal = what.get(0)[ relType ];
|
1942 |
+
}
|
1943 |
+
|
1944 |
+
if (relVal && relVal !== '' && relVal !== 'nofollow') {
|
1945 |
+
what = selector.length ? $(selector) : that;
|
1946 |
+
what = what.filter('[' + relType + '="' + relVal + '"]');
|
1947 |
+
idx = what.index(this);
|
1948 |
+
}
|
1949 |
+
|
1950 |
+
options.index = idx;
|
1951 |
+
|
1952 |
+
// Stop an event from bubbling if everything is fine
|
1953 |
+
if (F.open(what, options) !== false) {
|
1954 |
+
e.preventDefault();
|
1955 |
+
}
|
1956 |
+
}
|
1957 |
+
};
|
1958 |
+
|
1959 |
+
options = options || {};
|
1960 |
+
index = options.index || 0;
|
1961 |
+
|
1962 |
+
if (!selector || options.live === false) {
|
1963 |
+
that.unbind('click.fb-start').bind('click.fb-start', run);
|
1964 |
+
|
1965 |
+
} else {
|
1966 |
+
D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
|
1967 |
+
}
|
1968 |
+
|
1969 |
+
this.filter('[data-fancybox-start=1]').trigger('click');
|
1970 |
+
|
1971 |
+
return this;
|
1972 |
+
};
|
1973 |
+
|
1974 |
+
// Tests that need a body at doc ready
|
1975 |
+
D.ready(function() {
|
1976 |
+
var w1, w2;
|
1977 |
+
|
1978 |
+
if ( $.scrollbarWidth === undefined ) {
|
1979 |
+
// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
|
1980 |
+
$.scrollbarWidth = function() {
|
1981 |
+
var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
|
1982 |
+
child = parent.children(),
|
1983 |
+
width = child.innerWidth() - child.height( 99 ).innerWidth();
|
1984 |
+
|
1985 |
+
parent.remove();
|
1986 |
+
|
1987 |
+
return width;
|
1988 |
+
};
|
1989 |
+
}
|
1990 |
+
|
1991 |
+
if ( $.support.fixedPosition === undefined ) {
|
1992 |
+
$.support.fixedPosition = (function() {
|
1993 |
+
var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
|
1994 |
+
fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
|
1995 |
+
|
1996 |
+
elem.remove();
|
1997 |
+
|
1998 |
+
return fixed;
|
1999 |
+
}());
|
2000 |
+
}
|
2001 |
+
|
2002 |
+
$.extend(F.defaults, {
|
2003 |
+
scrollbarWidth : $.scrollbarWidth(),
|
2004 |
+
fixed : $.support.fixedPosition,
|
2005 |
+
parent : $('body')
|
2006 |
+
});
|
2007 |
+
|
2008 |
+
//Get real width of page scroll-bar
|
2009 |
+
w1 = $(window).width();
|
2010 |
+
|
2011 |
+
H.addClass('fancybox-lock-test');
|
2012 |
+
|
2013 |
+
w2 = $(window).width();
|
2014 |
+
|
2015 |
+
H.removeClass('fancybox-lock-test');
|
2016 |
+
|
2017 |
+
$("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
|
2018 |
+
});
|
2019 |
+
|
2020 |
+
}(window, document, jQuery));
|
js/skybox/jquery.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
|
2 |
-
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
|
3 |
-
a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&
|
|
|
|
|
|