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.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.1
- app/code/community/Skybox/Catalog/Block/Bundle/Price.php +1 -0
- app/code/community/Skybox/Catalog/Block/Product/List.php +456 -0
- app/code/community/Skybox/Catalog/Block/Product/Price.php +74 -19
- app/code/community/Skybox/Catalog/Model/Api/Product.php +436 -45
- app/code/community/Skybox/Catalog/Model/Observer.php +31 -3
- app/code/community/Skybox/Catalog/etc/config.xml +7 -0
- app/code/community/Skybox/Checkout/Block/Cart/Totals.php +147 -0
- app/code/community/Skybox/Checkout/Block/Checkout/Cart.php +45 -0
- app/code/community/Skybox/Checkout/Block/Checkout/Cart/Sidebar.php +16 -0
- app/code/community/Skybox/Checkout/Block/Checkout/Links.php +26 -0
- app/code/community/Skybox/Checkout/Block/Checkout/Onepage/Link.php +29 -0
- app/code/community/Skybox/Checkout/Block/Sales/Order/Total.php +24 -12
- app/code/community/Skybox/Checkout/Helper/Data.php +55 -10
- app/code/community/Skybox/Checkout/Helper/Url.php +59 -0
- app/code/community/Skybox/Checkout/Model/Api/Checkout.php +48 -4
- app/code/community/Skybox/Checkout/Model/Carrier.php +37 -0
- app/code/community/Skybox/Checkout/Model/Cart.php +71 -3
- app/code/community/Skybox/Checkout/Model/Observer.php +23 -3
- app/code/community/Skybox/Checkout/Model/Pay.php +12 -0
- app/code/community/Skybox/Checkout/Model/Quote/Address/Total/Rmt.php +6 -2
- app/code/community/Skybox/Checkout/Model/Quote/Total.php +20 -3
- app/code/community/Skybox/Checkout/controllers/CalculateController.php +1 -1
- app/code/community/Skybox/Checkout/controllers/InternationalController.php +4 -1
- app/code/community/Skybox/Checkout/controllers/ProcessController.php +37 -16
- app/code/community/Skybox/Checkout/etc/config.xml +56 -0
- app/code/community/Skybox/Checkout/etc/system.xml +127 -0
- app/code/community/Skybox/Core/Model/Api/Restful.php +26 -0
- app/code/community/Skybox/Core/Model/Config.php +1 -0
- app/code/community/Skybox/Core/Model/Standard.php +19 -1
- app/code/community/Skybox/Core/sql/skyboxcore_setup/mysql4-install-0.1.0.php +38 -25
- app/code/community/Skybox/International/Helper/Data.php +7 -1
- app/code/community/Skybox/International/etc/config.xml +6 -3
- app/code/community/Skybox/International/etc/system.xml +21 -1
- app/code/community/Skybox/Services/Model/Api.php +159 -8
- app/code/community/Skybox/Services/etc/api.xml +5 -0
- app/code/community/Skybox/Services/etc/wsdl.xml +37 -0
- app/code/community/Skybox/Services/etc/wsi.xml +1 -0
- app/design/frontend/base/default/layout/skyboxcheckout.xml +32 -10
- app/design/frontend/base/default/template/skybox/checkout/cart.phtml +206 -23
- app/design/frontend/base/default/template/skybox/checkout/onepage/link.phtml +41 -0
- app/design/frontend/base/default/template/skybox/checkout/skyboxcheckout.phtml +1 -0
- app/design/frontend/base/default/template/skybox/product/price.phtml +1 -0
- app/etc/modules/Skybox_All.xml +1 -0
- package.xml +4 -4
- skin/frontend/base/default/js/skybox/catalog.product.configurable.js +13 -5
app/code/community/Skybox/Catalog/Block/Bundle/Price.php
CHANGED
@@ -114,6 +114,7 @@ class Skybox_Catalog_Block_Bundle_Price extends Mage_Bundle_Block_Catalog_Produc
|
|
114 |
*/
|
115 |
protected function calculatePrice($product, $bundleType = 'bundle')
|
116 |
{
|
|
|
117 |
$stockItem = $product->getStockItem();
|
118 |
if (!$stockItem->getIsInStock()) {
|
119 |
return ''; // Out of Stock
|
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
|
app/code/community/Skybox/Catalog/Block/Product/List.php
ADDED
@@ -0,0 +1,456 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
//var_export($resultObjectMultiCurl);
|
199 |
+
$time_elapsed_secs = microtime(true) - $start;
|
200 |
+
/*echo "<div style='position: absolute;
|
201 |
+
background: lightgreen;
|
202 |
+
font-weight: bolder;
|
203 |
+
z-index: 1111;'>Tiempo de respuesta (Multiple): {$time_elapsed_secs}</div>"."<br/>";*/
|
204 |
+
|
205 |
+
$dataMultiCurl = array();
|
206 |
+
$resultObjectMultiCurl = json_decode($resultObjectMultiCurl);
|
207 |
+
$resultObjectMultiCurlArray = json_decode(json_encode($resultObjectMultiCurl), true);
|
208 |
+
|
209 |
+
foreach($resultObjectMultiCurlArray['listCalculateResponse'] as $value) {
|
210 |
+
$dataMultiCurl[$value["HtmlObjectId"]] = $this->getTemplateServicio($value, $template);
|
211 |
+
}
|
212 |
+
|
213 |
+
/*$dataMultiCurlVal = array();
|
214 |
+
$cont = 0;
|
215 |
+
foreach($products as $key => $prod) {
|
216 |
+
$dataMultiCurlVal[$prod->getId()] = $dataMultiCurl[$cont];
|
217 |
+
$cont++;
|
218 |
+
}*/
|
219 |
+
$session->setData("skyBox", $dataMultiCurl);
|
220 |
+
/*end Load all product of catalog*/
|
221 |
+
|
222 |
+
|
223 |
+
$toolbar = $this->getToolbarBlock();
|
224 |
+
|
225 |
+
// called prepare sortable parameters
|
226 |
+
$collection = $this->_getProductCollection();
|
227 |
+
|
228 |
+
// use sortable parameters
|
229 |
+
if ($orders = $this->getAvailableOrders()) {
|
230 |
+
$toolbar->setAvailableOrders($orders);
|
231 |
+
}
|
232 |
+
if ($sort = $this->getSortBy()) {
|
233 |
+
$toolbar->setDefaultOrder($sort);
|
234 |
+
}
|
235 |
+
if ($dir = $this->getDefaultDirection()) {
|
236 |
+
$toolbar->setDefaultDirection($dir);
|
237 |
+
}
|
238 |
+
if ($modes = $this->getModes()) {
|
239 |
+
$toolbar->setModes($modes);
|
240 |
+
}
|
241 |
+
|
242 |
+
// set collection to toolbar and apply sort
|
243 |
+
$toolbar->setCollection($collection);
|
244 |
+
|
245 |
+
$this->setChild('toolbar', $toolbar);
|
246 |
+
Mage::dispatchEvent('catalog_block_product_list_collection', array(
|
247 |
+
'collection' => $this->_getProductCollection()
|
248 |
+
));
|
249 |
+
|
250 |
+
$this->_getProductCollection()->load();
|
251 |
+
|
252 |
+
return parent::_beforeToHtml();
|
253 |
+
}
|
254 |
+
|
255 |
+
public function getTemplateServicio($objectProduct,$template)
|
256 |
+
{
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
|
262 |
+
|
263 |
+
/*2step execute get button template*/
|
264 |
+
|
265 |
+
/*var_dump($a->getHtmlTemplateButton());exit;*/
|
266 |
+
|
267 |
+
/*3 step call calculate*/;
|
268 |
+
if (1) {
|
269 |
+
|
270 |
+
/*$objectProduct = json_decode($objectProduct);
|
271 |
+
$objectProduct = json_decode(json_encode($objectProduct), true);*/
|
272 |
+
//var_dump($objectProduct);exit;
|
273 |
+
foreach ($objectProduct as $key => $value) {
|
274 |
+
/*echo "==>".$key."<====";
|
275 |
+
echo "==>".$value."<====";exit;-*/
|
276 |
+
$template = str_replace('{' . $key . '}', $value, $template);
|
277 |
+
}
|
278 |
+
|
279 |
+
// Just for {Block} crap
|
280 |
+
$template = str_replace('{Block}', '', $template);
|
281 |
+
/*echo "<hit>";
|
282 |
+
echo($template); exit;
|
283 |
+
echo "</hit>";*/
|
284 |
+
/*echo $template; exit;*/
|
285 |
+
return $template;
|
286 |
+
}
|
287 |
+
//exit("debug si es que llega");
|
288 |
+
/*var_dump($a); exit;
|
289 |
+
var_dump(Mage::getSingleton('skyboxcore/session')); exit;--*/
|
290 |
+
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
function file_multi_get_contents_curl($url, $data)
|
295 |
+
{
|
296 |
+
|
297 |
+
/*var_export($data); exit;*/
|
298 |
+
if (!function_exists("curl_init")) die("cURL extension is not installed");
|
299 |
+
$ch = curl_init();
|
300 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
301 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
302 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
303 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
304 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
305 |
+
$response = curl_exec($ch);
|
306 |
+
|
307 |
+
/*var_export($response); exit;*/
|
308 |
+
// Will dump a beauty json :3
|
309 |
+
//var_dump(json_decode($result, true));
|
310 |
+
return $response;
|
311 |
+
/*
|
312 |
+
$node_count = count($nodes);
|
313 |
+
$curl_arr = array();
|
314 |
+
$master = curl_multi_init();
|
315 |
+
//curl_setopt($master, CURLOPT_SSL_VERIFYPEER, false);
|
316 |
+
// Will return the response, if false it print the response
|
317 |
+
//curl_setopt($master, CURLOPT_RETURNTRANSFER, true);
|
318 |
+
|
319 |
+
for($i = 0; $i < count($nodes); $i++)
|
320 |
+
{
|
321 |
+
$start = microtime(true);
|
322 |
+
$url =$nodes[$i];
|
323 |
+
$curl_arr[$i] = curl_init($url);
|
324 |
+
curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
|
325 |
+
curl_multi_add_handle($master, $curl_arr[$i]);
|
326 |
+
$total_time = round(microtime(true)-$start, 4);
|
327 |
+
echo "Request #".($i+1).": send {$start} ; delay: {$total_time}"."<br/>";
|
328 |
+
}
|
329 |
+
|
330 |
+
$start = microtime(true);
|
331 |
+
do
|
332 |
+
{
|
333 |
+
$startMultiExec = microtime(true);
|
334 |
+
$curl_multi_exec = curl_multi_exec($master,$running);
|
335 |
+
$totalMultiExec = round(microtime(true)-$startMultiExec, 4);
|
336 |
+
//echo "Request MultiExec: send {$startMultiExec} ; delay: {$totalMultiExec}"."<br/>";
|
337 |
+
}
|
338 |
+
while($running > 0);
|
339 |
+
$total_time = round(microtime(true)-$start, 4);
|
340 |
+
echo "Request All: send {$start} ; delay: {$total_time}"."<br/>";
|
341 |
+
|
342 |
+
echo 'results: '."<br/>";
|
343 |
+
$results = array();
|
344 |
+
for($i = 0; $i < $node_count; $i++)
|
345 |
+
{
|
346 |
+
$preresult = curl_multi_getcontent ( $curl_arr[$i] );
|
347 |
+
$results[] = $preresult;
|
348 |
+
echo "<pre>".var_export($results)."</pre>";
|
349 |
+
echo( $i . '\n' . $results . '\n');
|
350 |
+
}
|
351 |
+
echo "<pre>".var_dump($results)."</pre>";
|
352 |
+
|
353 |
+
echo 'done'."<br/>";*/
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Retrieve Toolbar block
|
358 |
+
*
|
359 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
360 |
+
*/
|
361 |
+
public function getToolbarBlock()
|
362 |
+
{
|
363 |
+
if ($blockName = $this->getToolbarBlockName()) {
|
364 |
+
if ($block = $this->getLayout()->getBlock($blockName)) {
|
365 |
+
return $block;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
$block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
|
369 |
+
return $block;
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Retrieve additional blocks html
|
374 |
+
*
|
375 |
+
* @return string
|
376 |
+
*/
|
377 |
+
public function getAdditionalHtml()
|
378 |
+
{
|
379 |
+
return $this->getChildHtml('additional');
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Retrieve list toolbar HTML
|
384 |
+
*
|
385 |
+
* @return string
|
386 |
+
*/
|
387 |
+
public function getToolbarHtml()
|
388 |
+
{
|
389 |
+
return $this->getChildHtml('toolbar');
|
390 |
+
}
|
391 |
+
|
392 |
+
public function setCollection($collection)
|
393 |
+
{
|
394 |
+
$this->_productCollection = $collection;
|
395 |
+
return $this;
|
396 |
+
}
|
397 |
+
|
398 |
+
public function addAttribute($code)
|
399 |
+
{
|
400 |
+
$this->_getProductCollection()->addAttributeToSelect($code);
|
401 |
+
return $this;
|
402 |
+
}
|
403 |
+
|
404 |
+
public function getPriceBlockTemplate()
|
405 |
+
{
|
406 |
+
return $this->_getData('price_block_template');
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Retrieve Catalog Config object
|
411 |
+
*
|
412 |
+
* @return Mage_Catalog_Model_Config
|
413 |
+
*/
|
414 |
+
protected function _getConfig()
|
415 |
+
{
|
416 |
+
return Mage::getSingleton('catalog/config');
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Prepare Sort By fields from Category Data
|
421 |
+
*
|
422 |
+
* @param Mage_Catalog_Model_Category $category
|
423 |
+
* @return Mage_Catalog_Block_Product_List
|
424 |
+
*/
|
425 |
+
public function prepareSortableFieldsByCategory($category) {
|
426 |
+
if (!$this->getAvailableOrders()) {
|
427 |
+
$this->setAvailableOrders($category->getAvailableSortByOptions());
|
428 |
+
}
|
429 |
+
$availableOrders = $this->getAvailableOrders();
|
430 |
+
if (!$this->getSortBy()) {
|
431 |
+
if ($categorySortBy = $category->getDefaultSortBy()) {
|
432 |
+
if (!$availableOrders) {
|
433 |
+
$availableOrders = $this->_getConfig()->getAttributeUsedForSortByArray();
|
434 |
+
}
|
435 |
+
if (isset($availableOrders[$categorySortBy])) {
|
436 |
+
$this->setSortBy($categorySortBy);
|
437 |
+
}
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
return $this;
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Retrieve block cache tags based on product collection
|
446 |
+
*
|
447 |
+
* @return array
|
448 |
+
*/
|
449 |
+
public function getCacheTags()
|
450 |
+
{
|
451 |
+
return array_merge(
|
452 |
+
parent::getCacheTags(),
|
453 |
+
$this->getItemsTags($this->_getProductCollection())
|
454 |
+
);
|
455 |
+
}
|
456 |
+
}
|
app/code/community/Skybox/Catalog/Block/Product/Price.php
CHANGED
@@ -76,13 +76,22 @@ class Skybox_Catalog_Block_Product_Price extends Mage_Catalog_Block_Product_Pric
|
|
76 |
*/
|
77 |
public function _toHtml()
|
78 |
{
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 '
|
|
|
86 |
}
|
87 |
|
88 |
/* @var $product Mage_Catalog_Model_Product */
|
@@ -90,20 +99,28 @@ class Skybox_Catalog_Block_Product_Price extends Mage_Catalog_Block_Product_Pric
|
|
90 |
$type = $product->getTypeId();
|
91 |
$route_name = Mage::app()->getRequest()->getRouteName();
|
92 |
|
|
|
|
|
93 |
// Simple Product
|
94 |
if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $this->getTemplate() == 'catalog/product/price.phtml') {
|
95 |
return $this->calculatePrice($product);
|
96 |
}
|
97 |
|
|
|
98 |
if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $this->getTemplate() == 'catalog/product/view/price_clone.phtml') {
|
99 |
return '';
|
100 |
}
|
101 |
|
102 |
// Configurable Product
|
103 |
if ($type == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && $this->getTemplate() == 'catalog/product/price.phtml') {
|
104 |
-
if ($route_name == 'catalog') {
|
105 |
return '';
|
|
|
|
|
|
|
|
|
106 |
}
|
|
|
107 |
return $this->calculatePrice($product);
|
108 |
}
|
109 |
|
@@ -125,27 +142,65 @@ class Skybox_Catalog_Block_Product_Price extends Mage_Catalog_Block_Product_Pric
|
|
125 |
*/
|
126 |
protected function calculatePrice($product)
|
127 |
{
|
|
|
128 |
$stockItem = $product->getStockItem();
|
129 |
-
if (!$stockItem->getIsInStock()) {
|
130 |
-
|
131 |
-
|
|
|
132 |
|
133 |
$type = $product->getTypeId();
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
->
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
$extraHtml = ''
|
150 |
. '<div class="price-box">'
|
151 |
. '<p class="label" id="skybox-configurable-price-from-'
|
76 |
*/
|
77 |
public function _toHtml()
|
78 |
{
|
79 |
+
// $activation = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
80 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
81 |
+
|
82 |
+
if (!$activation) {
|
83 |
+
return '';
|
84 |
+
}
|
85 |
+
$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
86 |
+
//Mage::log(print_r('product\Price::_toHtml', true), null, 'tracer.log', true);
|
87 |
+
if($this->_getApi()->getLocationAllow() && ($typeIntegration!=3)){ // Rogged
|
88 |
if ($this->_getApi()->getErrorAuthenticate() && !$this->_getApi()->getLocationAllow() && $this->_getApi()->HasError()) {
|
89 |
return '';
|
90 |
} elseif ($this->_getApi()->HasError()) {
|
91 |
//$error_code = $this->_getApi()->getStatusCode();
|
92 |
$message = $this->_getApi()->getStatusMessage();
|
93 |
+
return '';
|
94 |
+
// return '<div style="color:#FF0000;">' . $message . '</div>';
|
95 |
}
|
96 |
|
97 |
/* @var $product Mage_Catalog_Model_Product */
|
99 |
$type = $product->getTypeId();
|
100 |
$route_name = Mage::app()->getRequest()->getRouteName();
|
101 |
|
102 |
+
// Mage::log(print_r('$route_name: '. $route_name, true), null, 'tracer.log', true);
|
103 |
+
|
104 |
// Simple Product
|
105 |
if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $this->getTemplate() == 'catalog/product/price.phtml') {
|
106 |
return $this->calculatePrice($product);
|
107 |
}
|
108 |
|
109 |
+
|
110 |
if ($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE && $this->getTemplate() == 'catalog/product/view/price_clone.phtml') {
|
111 |
return '';
|
112 |
}
|
113 |
|
114 |
// Configurable Product
|
115 |
if ($type == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && $this->getTemplate() == 'catalog/product/price.phtml') {
|
116 |
+
/*if ($route_name == 'catalog') {
|
117 |
return '';
|
118 |
+
}*/
|
119 |
+
|
120 |
+
if(Mage::registry('current_product')) {
|
121 |
+
return "";
|
122 |
}
|
123 |
+
|
124 |
return $this->calculatePrice($product);
|
125 |
}
|
126 |
|
142 |
*/
|
143 |
protected function calculatePrice($product)
|
144 |
{
|
145 |
+
//Mage::log('Entro calcular producto', null, 'tracer.log', true);
|
146 |
$stockItem = $product->getStockItem();
|
147 |
+
// if (!$stockItem->getIsInStock()) {
|
148 |
+
// Mage::log('sin stock', null, 'tracer.log', true);
|
149 |
+
// return ''; // Out of Stock
|
150 |
+
// }
|
151 |
|
152 |
$type = $product->getTypeId();
|
153 |
+
//Mage::log(print_r('product\Price: '.$type, true), null, 'tracer.log', true);
|
154 |
+
|
155 |
+
if (Mage::registry('current_category')){
|
156 |
+
/*Async Ini*/
|
157 |
+
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
158 |
+
$skyboxPrecio = $session->getData("skyBox");
|
159 |
+
/*
|
160 |
+
if($product->getTypeId() == "simple"){
|
161 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
|
162 |
+
if(!$parentIds)
|
163 |
+
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
164 |
+
if(isset($parentIds[0])){
|
165 |
+
$parent = Mage::getModel('catalog/product')->load($parentIds[0]);
|
166 |
+
// do stuff here
|
167 |
+
}
|
168 |
+
}*/
|
169 |
+
$template = $skyboxPrecio[$product->getId()];
|
170 |
+
$template = '<div class="skybox-price-set" product-id="' . $product->getId() . '" id="product-' . $product->getId() . '"></div>';
|
171 |
+
/*Async End*/
|
172 |
+
} else {
|
173 |
+
switch ($type) {
|
174 |
+
case 'simple':
|
175 |
+
$template = $this->_getApi()->CalculatePrice($product->getId(), null, $product->getFinalPrice(), $product->getTypeId())
|
176 |
+
->GetTemplateProduct();
|
177 |
+
break;
|
178 |
+
case 'configurable':
|
179 |
+
$template = $this->_getApi()->CalculatePrice($product->getId(), null, $product->getFinalPrice(), $product->getTypeId())
|
180 |
+
->GetTemplateProduct();
|
181 |
+
break;
|
182 |
+
case 'bundle':
|
183 |
+
$template = $this->_getApi()->CalculatePrice($product, null, $product->getFinalPrice(), 'simple')
|
184 |
+
->GetTemplateProduct();
|
185 |
+
break;
|
186 |
+
}
|
187 |
}
|
188 |
|
189 |
+
// Mage::log(print_r('##Product template##', true), null, 'tracer.log', true);
|
190 |
+
// Mage::log(print_r($template, true), null, 'tracer.log', true);
|
191 |
+
/*
|
192 |
+
$extraHtml = ''
|
193 |
+
. '<div class="price-box">'
|
194 |
+
. '<p class="label" id="skybox-configurable-price-from-'
|
195 |
+
. $product->getId()
|
196 |
+
. $this->getIdSuffix()
|
197 |
+
. '">'
|
198 |
+
. $template
|
199 |
+
. '</p>'
|
200 |
+
. '</div>'
|
201 |
+
. '<div style="clear:both"></div>';
|
202 |
+
|
203 |
+
*/
|
204 |
$extraHtml = ''
|
205 |
. '<div class="price-box">'
|
206 |
. '<p class="label" id="skybox-configurable-price-from-'
|
app/code/community/Skybox/Catalog/Model/Api/Product.php
CHANGED
@@ -68,13 +68,16 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
68 |
{
|
69 |
Mage::log("ApiProductCatalog ", null, 'orden.log', true);
|
70 |
|
|
|
|
|
71 |
//if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
72 |
if (!$this->getLocationAllow()) {
|
73 |
return $this;
|
74 |
}
|
75 |
|
76 |
if (!is_object($product)) {
|
77 |
-
$
|
|
|
78 |
}
|
79 |
|
80 |
$productId = $product->getId();
|
@@ -84,11 +87,13 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
84 |
$type = $product->getTypeId();
|
85 |
}
|
86 |
|
|
|
87 |
switch ($type) {
|
88 |
case 'simple':
|
89 |
$finalPrice = isset($finalPrice) ? $finalPrice : $product->getFinalPrice();
|
90 |
$category_id = $product->getSkyboxCategoryId();
|
91 |
$category_id = isset($category_id) ? $product->getSkyboxCategoryId() : 0;
|
|
|
92 |
|
93 |
$_data = array(
|
94 |
'object_id' => 1,
|
@@ -96,11 +101,13 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
96 |
'sku' => $product->getSku(),
|
97 |
'category_id' => $category_id,
|
98 |
'final_price' => $finalPrice,
|
99 |
-
'weight' => $product->getWeight(),
|
100 |
'image_url' => $product->getImageUrl(),
|
101 |
-
'typeProduct' => $type
|
|
|
|
|
102 |
);
|
103 |
-
$this->_calculatePrice($_data);
|
104 |
break;
|
105 |
|
106 |
case 'configurable':
|
@@ -146,6 +153,33 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
146 |
Mage::log("CalculatePrice candidate FIN", null, 'skyboxcheckout.log', false);
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
$_data = array(
|
150 |
'object_id' => 1,
|
151 |
'name' => $product->getName(),
|
@@ -153,14 +187,14 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
153 |
'sku' => $sku,
|
154 |
'category_id' => $product->getSkyboxCategoryId(),
|
155 |
'final_price' => $finalPrice,
|
156 |
-
|
157 |
-
'weight' => $weight,
|
158 |
-
'weight' => 1,
|
159 |
'image_url' => $product->getImageUrl(),
|
160 |
-
'typeProduct' => $type
|
|
|
|
|
161 |
);
|
162 |
|
163 |
-
$this->_calculatePrice($_data);
|
164 |
break;
|
165 |
|
166 |
case 'bundle':
|
@@ -208,18 +242,20 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
208 |
//Mage::log("weight: " . $weight, null, 'cart.log', true);
|
209 |
//Mage::log("sku: " . $sku, null, 'cart.log', true);
|
210 |
|
|
|
211 |
$_data = array(
|
212 |
'object_id' => 1,
|
213 |
'name' => $product->getName(),
|
214 |
'sku' => $sku,
|
215 |
'category_id' => $product->getSkyboxCategoryId(),
|
216 |
'final_price' => $finalPrice,
|
217 |
-
|
218 |
-
'weight' => $weight,
|
219 |
'image_url' => $product->getImageUrl(),
|
220 |
-
'typeProduct' => $type
|
|
|
|
|
221 |
);
|
222 |
-
$this->_calculatePrice($_data);
|
223 |
break;
|
224 |
|
225 |
case 'bundle_fixed':
|
@@ -266,27 +302,64 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
266 |
Mage::log("weight: " . $weight, null, 'cart.log', true);
|
267 |
Mage::log("sku: " . $sku, null, 'cart.log', true);*/
|
268 |
|
|
|
269 |
$_data = array(
|
270 |
'object_id' => 1,
|
271 |
'name' => $product->getName(),
|
272 |
'sku' => $sku,
|
273 |
'category_id' => $skyboxCategoryId,
|
274 |
'final_price' => $finalPrice,
|
275 |
-
|
276 |
-
'weight' => $weight,
|
277 |
'image_url' => $product->getImageUrl(),
|
278 |
-
'typeProduct' => $type
|
|
|
|
|
279 |
);
|
280 |
|
281 |
-
$this->_calculatePrice($_data);
|
282 |
break;
|
283 |
|
284 |
default:
|
285 |
Mage::log("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice", null, 'skyboxcheckout.log', false);
|
286 |
trigger_error("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice");
|
|
|
287 |
break;
|
288 |
}
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
Mage::log("Product Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
291 |
Mage::log("Product Type: " . $type, null, 'skyboxcheckout.log', false);
|
292 |
Mage::log(print_r($_data, true), null, 'skyboxcheckout.log', false);
|
@@ -320,9 +393,10 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
320 |
'storeproductcategory' => $data['category_id'],
|
321 |
'storeproductprice' => $data['final_price'],
|
322 |
//'storeproductprice' => $product->getFinalPrice(),
|
323 |
-
'weight' => $data['weight'],
|
324 |
'weightunit' => $this->getWeightUnit(),
|
325 |
-
'storeproductimgurl' => $data['image_url']
|
|
|
326 |
);
|
327 |
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_CALCULATE, $params);
|
328 |
}
|
@@ -348,32 +422,35 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
348 |
if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow() && !$this->_getApi()->ErrorServiceNotController()) {
|
349 |
//if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow() && !$this->_getApi()->ErrorService()) {
|
350 |
$_productResult = $this->getResponse();
|
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 |
} else {
|
378 |
$template = '<div class="skx_content_button"></div>';
|
379 |
return $template;
|
@@ -469,4 +546,318 @@ class Skybox_Catalog_Model_Api_Product extends Skybox_Core_Model_Standard
|
|
469 |
{
|
470 |
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_LABEL_ADJUST, "");
|
471 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
}
|
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();
|
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) ? $product->getSkyboxCategoryId() : 0;
|
96 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
97 |
|
98 |
$_data = array(
|
99 |
'object_id' => 1,
|
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':
|
153 |
Mage::log("CalculatePrice candidate FIN", null, 'skyboxcheckout.log', false);
|
154 |
}
|
155 |
|
156 |
+
/* Weight start*/
|
157 |
+
/*
|
158 |
+
$options = array();
|
159 |
+
// Get any super_attribute settings we need
|
160 |
+
$productAttributesOptions = $product->getTypeInstance(true)->getConfigurableOptions($product);
|
161 |
+
foreach ($productAttributesOptions as $productAttributeOption) {
|
162 |
+
$options[$product->getId()] = array();
|
163 |
+
foreach ($productAttributeOption as $optionValues) {
|
164 |
+
$val = ($optionValues['option_title']);
|
165 |
+
$options[$product->getId()][] = array (
|
166 |
+
$optionValues['sku'] => $optionValues['attribute_code']."=".$val
|
167 |
+
|
168 |
+
) ;
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
172 |
+
$prod_weight = 1;
|
173 |
+
if(!empty($optionValues)) {
|
174 |
+
$a = Mage::getModel('catalog/product')->loadByAttribute('sku',$optionValues['sku']);
|
175 |
+
//$product->load($product->getIdBySku($optionValues['sku']));
|
176 |
+
$prod_weight = $a->getWeight();
|
177 |
+
echo ":::".$prod_weight."::";
|
178 |
+
}
|
179 |
+
*/
|
180 |
+
/* Weight end*/
|
181 |
+
|
182 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
183 |
$_data = array(
|
184 |
'object_id' => 1,
|
185 |
'name' => $product->getName(),
|
187 |
'sku' => $sku,
|
188 |
'category_id' => $product->getSkyboxCategoryId(),
|
189 |
'final_price' => $finalPrice,
|
190 |
+
'weight' => $weight?$weight:1,
|
|
|
|
|
191 |
'image_url' => $product->getImageUrl(),
|
192 |
+
'typeProduct' => $type,
|
193 |
+
'VolWeight' => $volWeight,
|
194 |
+
'merchantproductid' => $productId
|
195 |
);
|
196 |
|
197 |
+
// $this->_calculatePrice($_data);
|
198 |
break;
|
199 |
|
200 |
case 'bundle':
|
242 |
//Mage::log("weight: " . $weight, null, 'cart.log', true);
|
243 |
//Mage::log("sku: " . $sku, null, 'cart.log', true);
|
244 |
|
245 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
246 |
$_data = array(
|
247 |
'object_id' => 1,
|
248 |
'name' => $product->getName(),
|
249 |
'sku' => $sku,
|
250 |
'category_id' => $product->getSkyboxCategoryId(),
|
251 |
'final_price' => $finalPrice,
|
252 |
+
'weight' => ($weight)?$weight:1,
|
|
|
253 |
'image_url' => $product->getImageUrl(),
|
254 |
+
'typeProduct' => $type,
|
255 |
+
'VolWeight' => $volWeight,
|
256 |
+
'merchantproductid' => $productId
|
257 |
);
|
258 |
+
// $this->_calculatePrice($_data);
|
259 |
break;
|
260 |
|
261 |
case 'bundle_fixed':
|
302 |
Mage::log("weight: " . $weight, null, 'cart.log', true);
|
303 |
Mage::log("sku: " . $sku, null, 'cart.log', true);*/
|
304 |
|
305 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
306 |
$_data = array(
|
307 |
'object_id' => 1,
|
308 |
'name' => $product->getName(),
|
309 |
'sku' => $sku,
|
310 |
'category_id' => $skyboxCategoryId,
|
311 |
'final_price' => $finalPrice,
|
312 |
+
'weight' => ($weight)?$weight:1,
|
|
|
313 |
'image_url' => $product->getImageUrl(),
|
314 |
+
'typeProduct' => $type,
|
315 |
+
'VolWeight' => $volWeight,
|
316 |
+
'merchantproductid' => $productId
|
317 |
);
|
318 |
|
319 |
+
// $this->_calculatePrice($_data);
|
320 |
break;
|
321 |
|
322 |
default:
|
323 |
Mage::log("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice", null, 'skyboxcheckout.log', false);
|
324 |
trigger_error("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice");
|
325 |
+
$defaultSwitch = true;
|
326 |
break;
|
327 |
}
|
328 |
|
329 |
+
if(!$defaultSwitch){
|
330 |
+
//Mage::log(print_r('EnableTax: ', true), null, 'tracer.log', true);
|
331 |
+
//Mage::log(print_r($this->getEnabledAddSumTaxToPrice(), true), null, 'tracer.log', true);
|
332 |
+
if($this->getEnabledAddSumTaxToPrice()) {
|
333 |
+
$store = Mage::app()->getStore('default');
|
334 |
+
$taxCalculation = Mage::getModel('tax/calculation');
|
335 |
+
$request = $taxCalculation->getRateRequest(null, null, null, $store);
|
336 |
+
// $product = Mage::registry('current_product');
|
337 |
+
$taxClassId = $product->getTaxClassId();
|
338 |
+
$percentTax = $taxCalculation->getRate($request->setProductClassId($taxClassId));
|
339 |
+
|
340 |
+
$taxPrice = $_data['final_price'] * ($percentTax / 100);
|
341 |
+
|
342 |
+
//Mage::log(print_r('Id product: ' . $product->getId(), true), null, 'tracer.log', true);
|
343 |
+
//Mage::log(print_r('$taxPrice: ' . $taxPrice, true), null, 'tracer.log', true);
|
344 |
+
//Mage::log(print_r('price: ' . $_data['final_price'], true), null, 'tracer.log', true);
|
345 |
+
//Mage::log(print_r('$taxPrice+price: ' . ($taxPrice + $_data['final_price']), true), null, 'tracer.log', true);
|
346 |
+
$comissionSkybox = $_data['final_price'] * (10 / 100);
|
347 |
+
//Mage::log(print_r('comision skybox: ' . ($comissionSkybox), true), null, 'tracer.log', true);
|
348 |
+
//Mage::log(print_r('price+comision skybox: ' . ($_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
349 |
+
//Mage::log(print_r('$taxPrice+price+comision: ' . ($taxPrice + $_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
350 |
+
//Mage::log(print_r('comision true: ' . (($taxPrice + $_data['final_price']) * (10 / 100)), true), null, 'tracer.log', true);
|
351 |
+
$priceReally = ($taxPrice + $_data['final_price']) + ($taxPrice + $_data['final_price']) * (10 / 100);
|
352 |
+
//Mage::log(print_r('$taxPrice+price+comision true: ' . ($priceReally), true), null, 'tracer.log', true);
|
353 |
+
|
354 |
+
|
355 |
+
$_data['final_price'] = $_data['final_price'] + $taxPrice;
|
356 |
+
}
|
357 |
+
|
358 |
+
//Mage::log(print_r('####################### Data produc params #######################', true), null, 'tracer.log', true);
|
359 |
+
//Mage::log(print_r($_data, true), null, 'tracer.log', true);
|
360 |
+
$this->_calculatePrice($_data);
|
361 |
+
}
|
362 |
+
|
363 |
Mage::log("Product Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
364 |
Mage::log("Product Type: " . $type, null, 'skyboxcheckout.log', false);
|
365 |
Mage::log(print_r($_data, true), null, 'skyboxcheckout.log', false);
|
393 |
'storeproductcategory' => $data['category_id'],
|
394 |
'storeproductprice' => $data['final_price'],
|
395 |
//'storeproductprice' => $product->getFinalPrice(),
|
396 |
+
'weight' => ($data['weight'])?$data['weight']:1,
|
397 |
'weightunit' => $this->getWeightUnit(),
|
398 |
+
'storeproductimgurl' => $data['image_url'],
|
399 |
+
'merchantproductid' => $data['merchantproductid']
|
400 |
);
|
401 |
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_CALCULATE, $params);
|
402 |
}
|
422 |
if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow() && !$this->_getApi()->ErrorServiceNotController()) {
|
423 |
//if (!$this->getErrorAuthenticate() && $this->_getApi()->getLocationAllow() && !$this->_getApi()->ErrorService()) {
|
424 |
$_productResult = $this->getResponse();
|
425 |
+
$template = $_productResult->TooltipButtonTemplate;
|
426 |
+
return $template;
|
427 |
+
// $templateButton = $this->getHtmlTemplateButton();
|
428 |
+
// if (empty($templateButton))
|
429 |
+
// $this->HtmlTemplateButton();
|
430 |
+
//
|
431 |
+
// /*if($_productResult->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_BUTTONERROR})
|
432 |
+
// {*/
|
433 |
+
// //Mage::log("_productResult--->" . json_decode($_productResult));
|
434 |
+
// $templateButton = $this->getHtmlTemplateButton();
|
435 |
+
// if (!empty($templateButton)) {
|
436 |
+
// $template = $this->getHtmlTemplateButton();
|
437 |
+
//// Mage::log(print_r('response template buttom', true), null, 'tracer.log', true);
|
438 |
+
//// Mage::log(print_r($_productResult, true), null, 'tracer.log', true);
|
439 |
+
// foreach ($_productResult as $key => $value) {
|
440 |
+
// $template = str_replace('{' . $key . '}', $value, $template);
|
441 |
+
// }
|
442 |
+
//
|
443 |
+
// // Just for {Block} crap
|
444 |
+
// $template = str_replace('{Block}', '', $template);
|
445 |
+
//
|
446 |
+
// return $template;
|
447 |
+
// }
|
448 |
+
//
|
449 |
+
// $displayUSD = "''"; //CartCountryIso
|
450 |
+
// /*}else{
|
451 |
+
// return "Plantilla de error";
|
452 |
+
// }*/
|
453 |
+
// //Mage::log(get_class($this) . " GetTemplateProduct() ", null, 'cart.log', true);
|
454 |
} else {
|
455 |
$template = '<div class="skx_content_button"></div>';
|
456 |
return $template;
|
546 |
{
|
547 |
return $this->getParameter(Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_PRODUCT_LABEL_ADJUST, "");
|
548 |
}
|
549 |
+
|
550 |
+
/*Async Ini*/
|
551 |
+
|
552 |
+
public function getUrl($product, $request, $finalPrice = null, $type = null, $objectId = 1)
|
553 |
+
{
|
554 |
+
Mage::log("ApiProductCatalog ", null, 'orden.log', true);
|
555 |
+
|
556 |
+
//Mage::log(print_r('Product', true), null, 'tracer.log', true);
|
557 |
+
|
558 |
+
//if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
559 |
+
if (!$this->getLocationAllow()) {
|
560 |
+
return $this;
|
561 |
+
}
|
562 |
+
|
563 |
+
if (!is_object($product)) {
|
564 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
565 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($product);
|
566 |
+
}
|
567 |
+
|
568 |
+
$productId = $product->getId();
|
569 |
+
$_data = null;
|
570 |
+
|
571 |
+
if ($type == null) {
|
572 |
+
$type = $product->getTypeId();
|
573 |
+
}
|
574 |
+
|
575 |
+
$defaultSwitch = true;
|
576 |
+
switch ($type) {
|
577 |
+
case 'simple':
|
578 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $product->getFinalPrice();
|
579 |
+
$category_id = $product->getSkyboxCategoryId();
|
580 |
+
$category_id = isset($category_id) ? $product->getSkyboxCategoryId() : 0;
|
581 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
582 |
+
|
583 |
+
$_data = array(
|
584 |
+
'object_id' => $product->getId(),
|
585 |
+
'name' => $product->getName(),
|
586 |
+
'sku' => $product->getSku(),
|
587 |
+
'category_id' => $category_id,
|
588 |
+
'final_price' => $finalPrice,
|
589 |
+
'weight' => ($product->getWeight())?$product->getWeight():1,
|
590 |
+
'image_url' => $product->getImageUrl(),
|
591 |
+
'typeProduct' => $type,
|
592 |
+
'VolWeight' => $volWeight,
|
593 |
+
'merchantproductid' => $productId
|
594 |
+
);
|
595 |
+
// $this->_calculatePrice($_data);
|
596 |
+
break;
|
597 |
+
|
598 |
+
case 'configurable':
|
599 |
+
|
600 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
601 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
602 |
+
$sku = $product->getSku();
|
603 |
+
|
604 |
+
Mage::log("CalculatePrice configurable : " . $finalPrice, null, 'skyboxcheckout.log', false);
|
605 |
+
|
606 |
+
if ($request) {
|
607 |
+
$childProduct = Mage::getModel('catalog/product_type_configurable')
|
608 |
+
->getProductByAttributes($request->getData('super_attribute'), $product);
|
609 |
+
|
610 |
+
$productId = $childProduct->getId();
|
611 |
+
$sku = $childProduct->getSku();
|
612 |
+
|
613 |
+
}
|
614 |
+
|
615 |
+
$parentItem = null;
|
616 |
+
|
617 |
+
if (isset($request) && !$finalPrice) {
|
618 |
+
Mage::log("CalculatePrice candidate INI", null, 'skyboxcheckout.log', false);
|
619 |
+
$_finalPrice = 0;
|
620 |
+
|
621 |
+
$cartCandidates = $product->getTypeInstance(true)
|
622 |
+
->prepareForCartAdvanced($request, $product, 'full');
|
623 |
+
|
624 |
+
foreach ($cartCandidates as $candidate) {
|
625 |
+
// Child items can be sticked together only within their parent
|
626 |
+
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
627 |
+
$candidate->setStickWithinParent($stickWithinParent);
|
628 |
+
|
629 |
+
$candidate_getFinalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(), $product);
|
630 |
+
Mage::log("CalculatePrice candidate getFinalPrice: " . $candidate_getFinalPrice, null, 'skyboxcheckout.log', false);
|
631 |
+
|
632 |
+
$_finalPrice = $_finalPrice + $candidate_getFinalPrice;
|
633 |
+
if ($_finalPrice) {
|
634 |
+
break;
|
635 |
+
}
|
636 |
+
}
|
637 |
+
$finalPrice = $_finalPrice;
|
638 |
+
Mage::log("CalculatePrice candidate FIN", null, 'skyboxcheckout.log', false);
|
639 |
+
}
|
640 |
+
|
641 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
642 |
+
$_data = array(
|
643 |
+
'object_id' => $product->getId(),
|
644 |
+
'name' => $product->getName(),
|
645 |
+
//'sku' => $product->getSku(),
|
646 |
+
'sku' => $sku,
|
647 |
+
'category_id' => $product->getSkyboxCategoryId(),
|
648 |
+
'final_price' => $finalPrice,
|
649 |
+
'weight' => $weight?$weight:1,
|
650 |
+
'image_url' => $product->getImageUrl(),
|
651 |
+
'typeProduct' => $type,
|
652 |
+
'VolWeight' => $volWeight,
|
653 |
+
'merchantproductid' => $productId
|
654 |
+
);
|
655 |
+
|
656 |
+
// $this->_calculatePrice($_data);
|
657 |
+
break;
|
658 |
+
|
659 |
+
case 'bundle':
|
660 |
+
//$_finalPrice = $product->getTotalBundleItemsPrice($product, $request->getQty());
|
661 |
+
//$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
662 |
+
|
663 |
+
//Mage::log(print_r($product, true), null, 'cart.log', true);
|
664 |
+
//Mage::log("Product: [" . $product->getId() . "] - Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
665 |
+
|
666 |
+
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
667 |
+
|
668 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
669 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
670 |
+
$sku = $product->getSku();
|
671 |
+
|
672 |
+
//if (isset($request) && !$finalPrice) {
|
673 |
+
if (isset($request)) {
|
674 |
+
|
675 |
+
$parentItem = null;
|
676 |
+
$_finalPrice = null;
|
677 |
+
$_weight = 0;
|
678 |
+
|
679 |
+
$cartCandidates = $product->getTypeInstance(true)
|
680 |
+
->prepareForCartAdvanced($request, $product, 'full');
|
681 |
+
|
682 |
+
foreach ($cartCandidates as $candidate) {
|
683 |
+
// Child items can be sticked together only within their parent
|
684 |
+
$stickWithinParent = $candidate->getParentProductId() ? $parentItem : null;
|
685 |
+
$candidate->setStickWithinParent($stickWithinParent);
|
686 |
+
|
687 |
+
if (!$_finalPrice) {
|
688 |
+
$_finalPrice = $candidate->getPriceModel()->getFinalPrice($request->getQty(), $product);
|
689 |
+
//break;
|
690 |
+
}
|
691 |
+
//$_weight = $_weight + $candidate->getPriceModel()->getWeight();
|
692 |
+
$_weight = $_weight + $candidate->getWeight();
|
693 |
+
}
|
694 |
+
|
695 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
696 |
+
if ($_weight > 0) {
|
697 |
+
$weight = $_weight;
|
698 |
+
}
|
699 |
+
}
|
700 |
+
|
701 |
+
//Mage::log("weight: " . $weight, null, 'cart.log', true);
|
702 |
+
//Mage::log("sku: " . $sku, null, 'cart.log', true);
|
703 |
+
|
704 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
705 |
+
$_data = array(
|
706 |
+
'object_id' => $product->getId(),
|
707 |
+
'name' => $product->getName(),
|
708 |
+
'sku' => $sku,
|
709 |
+
'category_id' => $product->getSkyboxCategoryId(),
|
710 |
+
'final_price' => $finalPrice,
|
711 |
+
'weight' => ($weight)?$weight:1,
|
712 |
+
'image_url' => $product->getImageUrl(),
|
713 |
+
'typeProduct' => $type,
|
714 |
+
'VolWeight' => $volWeight,
|
715 |
+
'merchantproductid' => $productId
|
716 |
+
);
|
717 |
+
// $this->_calculatePrice($_data);
|
718 |
+
break;
|
719 |
+
|
720 |
+
case 'bundle_fixed':
|
721 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : null;
|
722 |
+
$skyboxCategoryId = $product->getSkyboxCategoryId();
|
723 |
+
$weight = $product->getTypeInstance(true)->getWeight($product);
|
724 |
+
$sku = $product->getSku();
|
725 |
+
|
726 |
+
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
727 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
728 |
+
);
|
729 |
+
|
730 |
+
$_finalPrice = null;
|
731 |
+
$_weight = 0;
|
732 |
+
$_skyboxCategoryId = null;
|
733 |
+
|
734 |
+
foreach ($selectionCollection as $option) {
|
735 |
+
//if ($option->getData('is_default') == 0) continue;
|
736 |
+
|
737 |
+
$product_simple = Mage::getModel('catalog/product')
|
738 |
+
->load($option->getId());
|
739 |
+
|
740 |
+
$_finalPrice = $_finalPrice + $product_simple->getFinalPrice();
|
741 |
+
$_weight = $_weight + $product_simple->getWeight();
|
742 |
+
|
743 |
+
if (!$_skyboxCategoryId) { // Set SkyboxCategory from the first Simple Product
|
744 |
+
$_skyboxCategoryId = $product_simple->getSkyboxCategoryId();
|
745 |
+
}
|
746 |
+
}
|
747 |
+
|
748 |
+
$finalPrice = isset($finalPrice) ? $finalPrice : $_finalPrice;
|
749 |
+
|
750 |
+
if (!$weight) {
|
751 |
+
$weight = $_weight;
|
752 |
+
}
|
753 |
+
|
754 |
+
if (!$skyboxCategoryId) {
|
755 |
+
$skyboxCategoryId = $_skyboxCategoryId;
|
756 |
+
}
|
757 |
+
|
758 |
+
/*Mage::log("-------------------------", null, 'cart.log', true);
|
759 |
+
Mage::log("Product: " . $product->getName(), null, 'cart.log', true);
|
760 |
+
Mage::log("Price: " . $finalPrice, null, 'cart.log', true);
|
761 |
+
Mage::log("weight: " . $weight, null, 'cart.log', true);
|
762 |
+
Mage::log("sku: " . $sku, null, 'cart.log', true);*/
|
763 |
+
|
764 |
+
$volWeight = !empty(trim($product->getDimensionalWeight()))?$product->getDimensionalWeight():0;
|
765 |
+
$_data = array(
|
766 |
+
'object_id' => $product->getId(),
|
767 |
+
'name' => $product->getName(),
|
768 |
+
'sku' => $sku,
|
769 |
+
'category_id' => $skyboxCategoryId,
|
770 |
+
'final_price' => $finalPrice,
|
771 |
+
'weight' => ($weight)?$weight:1,
|
772 |
+
'image_url' => $product->getImageUrl(),
|
773 |
+
'typeProduct' => $type,
|
774 |
+
'VolWeight' => $volWeight,
|
775 |
+
'merchantproductid' => $productId
|
776 |
+
);
|
777 |
+
|
778 |
+
// $this->_calculatePrice($_data);
|
779 |
+
break;
|
780 |
+
|
781 |
+
default:
|
782 |
+
Mage::log("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice", null, 'skyboxcheckout.log', false);
|
783 |
+
trigger_error("CalculatePrice:: Product Type (" . $type . ") is invalid or not supported at SkyboxCheckout CalculatePrice");
|
784 |
+
$defaultSwitch = true;
|
785 |
+
break;
|
786 |
+
}
|
787 |
+
|
788 |
+
if(!$defaultSwitch){
|
789 |
+
//Mage::log(print_r('EnableTax: ', true), null, 'tracer.log', true);
|
790 |
+
//Mage::log(print_r($this->getEnabledAddSumTaxToPrice(), true), null, 'tracer.log', true);
|
791 |
+
if($this->getEnabledAddSumTaxToPrice()) {
|
792 |
+
$store = Mage::app()->getStore('default');
|
793 |
+
$taxCalculation = Mage::getModel('tax/calculation');
|
794 |
+
$request = $taxCalculation->getRateRequest(null, null, null, $store);
|
795 |
+
// $product = Mage::registry('current_product');
|
796 |
+
$taxClassId = $product->getTaxClassId();
|
797 |
+
$percentTax = $taxCalculation->getRate($request->setProductClassId($taxClassId));
|
798 |
+
|
799 |
+
$taxPrice = $_data['final_price'] * ($percentTax / 100);
|
800 |
+
|
801 |
+
//Mage::log(print_r('Id product: ' . $product->getId(), true), null, 'tracer.log', true);
|
802 |
+
//Mage::log(print_r('$taxPrice: ' . $taxPrice, true), null, 'tracer.log', true);
|
803 |
+
//Mage::log(print_r('price: ' . $_data['final_price'], true), null, 'tracer.log', true);
|
804 |
+
//Mage::log(print_r('$taxPrice+price: ' . ($taxPrice + $_data['final_price']), true), null, 'tracer.log', true);
|
805 |
+
$comissionSkybox = $_data['final_price'] * (10 / 100);
|
806 |
+
//Mage::log(print_r('comision skybox: ' . ($comissionSkybox), true), null, 'tracer.log', true);
|
807 |
+
//Mage::log(print_r('price+comision skybox: ' . ($_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
808 |
+
//Mage::log(print_r('$taxPrice+price+comision: ' . ($taxPrice + $_data['final_price'] + $comissionSkybox), true), null, 'tracer.log', true);
|
809 |
+
//Mage::log(print_r('comision true: ' . (($taxPrice + $_data['final_price']) * (10 / 100)), true), null, 'tracer.log', true);
|
810 |
+
$priceReally = ($taxPrice + $_data['final_price']) + ($taxPrice + $_data['final_price']) * (10 / 100);
|
811 |
+
//Mage::log(print_r('$taxPrice+price+comision true: ' . ($priceReally), true), null, 'tracer.log', true);
|
812 |
+
$_data['final_price'] = $_data['final_price'] + $taxPrice;
|
813 |
+
}
|
814 |
+
|
815 |
+
//Mage::log(print_r('####################### Data produc params #######################', true), null, 'tracer.log', true);
|
816 |
+
//Mage::log(print_r($_data, true), null, 'tracer.log', true);
|
817 |
+
$this->_calculatePrice($_data);
|
818 |
+
}
|
819 |
+
|
820 |
+
Mage::log("Product Class: " . get_class($product), null, 'skyboxcheckout.log', false);
|
821 |
+
Mage::log("Product Type: " . $type, null, 'skyboxcheckout.log', false);
|
822 |
+
Mage::log(print_r($_data, true), null, 'skyboxcheckout.log', false);
|
823 |
+
|
824 |
+
$data = $this->_callServiceSky($_data);
|
825 |
+
/*var_dump($this); exit;
|
826 |
+
$this->_product_data = $_data;
|
827 |
+
$this->_product_id = $productId;
|
828 |
+
$apiData = $this->_api;
|
829 |
+
var_dump($apiData); exit;*/
|
830 |
+
return $data;
|
831 |
+
}
|
832 |
+
|
833 |
+
private function _callServiceSky($data)
|
834 |
+
{
|
835 |
+
$msg = sprintf("CalculatePrice: [%s] - [%s] - [%s] - [Category_id: %s] - [Price: %s] - [weight: %s] - [typeProduct: %s]",
|
836 |
+
$data['object_id'],
|
837 |
+
$data['sku'],
|
838 |
+
$data['name'],
|
839 |
+
$data['category_id'],
|
840 |
+
$data['final_price'],
|
841 |
+
$data['weight'],
|
842 |
+
$data['typeProduct']
|
843 |
+
);
|
844 |
+
|
845 |
+
$params = array(
|
846 |
+
'htmlobjectid' => $data['object_id'],
|
847 |
+
'code' => $data['sku'],
|
848 |
+
'name' => $data['name'],
|
849 |
+
'category' => $data['category_id'],
|
850 |
+
'price' => $data['final_price'],
|
851 |
+
//'storeproductprice' => $product->getFinalPrice(),
|
852 |
+
'weight' => ($data['weight'])?$data['weight']:1,
|
853 |
+
'weightunit' => $this->getWeightUnit(),
|
854 |
+
'imgurl' => $data['image_url'],
|
855 |
+
/*'volweight' => $data['VolWeight'],
|
856 |
+
'merchantproductid' => $data['merchantproductid']*/
|
857 |
+
);
|
858 |
+
//var_dump($params); exit;
|
859 |
+
return $params;
|
860 |
+
}
|
861 |
+
|
862 |
+
/*Async End*/
|
863 |
}
|
app/code/community/Skybox/Catalog/Model/Observer.php
CHANGED
@@ -16,22 +16,44 @@
|
|
16 |
*/
|
17 |
class Skybox_Catalog_Model_Observer
|
18 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
public function hookToControllerActionPreDispatch($observer)
|
20 |
{
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
Mage::dispatchEvent("add_to_cart_before", array('request' => $observer->getControllerAction()->getRequest()));
|
23 |
}
|
24 |
}
|
25 |
|
26 |
public function hookToControllerActionPostDispatch($observer)
|
27 |
{
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
Mage::dispatchEvent("add_to_cart_after", array('request' => $observer->getControllerAction()->getRequest()));
|
30 |
}
|
31 |
}
|
32 |
|
33 |
public function hookToAddToCartBefore($observer)
|
34 |
{
|
|
|
|
|
|
|
|
|
35 |
$key = Mage::getSingleton('core/session')->getFormKey();
|
36 |
$observer->getEvent()->getRequest()->setParam('form_key', $key);
|
37 |
$request = $observer->getEvent()->getRequest()->getParams();
|
@@ -39,12 +61,18 @@ class Skybox_Catalog_Model_Observer
|
|
39 |
|
40 |
public function hookToAddToCartAfter($observer)
|
41 |
{
|
|
|
|
|
|
|
42 |
$request = $observer->getEvent()->getRequest()->getParams();
|
43 |
-
|
44 |
}
|
45 |
|
46 |
public function injectTab(Varien_Event_Observer $observer)
|
47 |
{
|
|
|
|
|
|
|
48 |
// core_block_abstract_prepare_layout_after
|
49 |
|
50 |
/* $block Mage_Adminhtml_Block_Catalog_Category_Tabs */
|
16 |
*/
|
17 |
class Skybox_Catalog_Model_Observer
|
18 |
{
|
19 |
+
private function getActive() {
|
20 |
+
// $value = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
21 |
+
$value = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
22 |
+
return $value;
|
23 |
+
}
|
24 |
+
|
25 |
public function hookToControllerActionPreDispatch($observer)
|
26 |
{
|
27 |
+
$active = $this->getActive();
|
28 |
+
if (!$active) { return; }
|
29 |
+
|
30 |
+
//Mage::log('router tivoli: '.$observer->getEvent()->getControllerAction()->getFullActionName(), null, 'tracer.log', true);
|
31 |
+
if (($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add')) {
|
32 |
+
|
33 |
+
//Mage::log('hookToControllerActionPreDispatch '.$observer->getEvent()->getControllerAction()->getFullActionName(),null, 'tracer.log', true);
|
34 |
Mage::dispatchEvent("add_to_cart_before", array('request' => $observer->getControllerAction()->getRequest()));
|
35 |
}
|
36 |
}
|
37 |
|
38 |
public function hookToControllerActionPostDispatch($observer)
|
39 |
{
|
40 |
+
$active = $this->getActive();
|
41 |
+
if (!$active) { return; }
|
42 |
+
|
43 |
+
//Mage::log('router tivoli: '.$observer->getEvent()->getControllerAction()->getFullActionName(), null, 'tracer.log', true);
|
44 |
+
if (($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add')) {
|
45 |
+
|
46 |
+
//Mage::log('hookToControllerActionPostDispatch: '.$observer->getEvent()->getControllerAction()->getFullActionName(),null, 'tracer.log', true);
|
47 |
Mage::dispatchEvent("add_to_cart_after", array('request' => $observer->getControllerAction()->getRequest()));
|
48 |
}
|
49 |
}
|
50 |
|
51 |
public function hookToAddToCartBefore($observer)
|
52 |
{
|
53 |
+
$active = $this->getActive();
|
54 |
+
if (!$active) { return; }
|
55 |
+
|
56 |
+
//Mage::log('function hookToAddToCartBefore: ',null, 'tracer.log', true);
|
57 |
$key = Mage::getSingleton('core/session')->getFormKey();
|
58 |
$observer->getEvent()->getRequest()->setParam('form_key', $key);
|
59 |
$request = $observer->getEvent()->getRequest()->getParams();
|
61 |
|
62 |
public function hookToAddToCartAfter($observer)
|
63 |
{
|
64 |
+
$active = $this->getActive();
|
65 |
+
if (!$active) { return; }
|
66 |
+
|
67 |
$request = $observer->getEvent()->getRequest()->getParams();
|
68 |
+
Mage::log("hookToAddToCartAfter ".print_r($request,true)." is added to cart.", null, 'cart.log', true);
|
69 |
}
|
70 |
|
71 |
public function injectTab(Varien_Event_Observer $observer)
|
72 |
{
|
73 |
+
// $active = $this->getActive();
|
74 |
+
// if (!$active) { return; }
|
75 |
+
|
76 |
// core_block_abstract_prepare_layout_after
|
77 |
|
78 |
/* $block Mage_Adminhtml_Block_Catalog_Category_Tabs */
|
app/code/community/Skybox/Catalog/etc/config.xml
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
<?xml version="1.0" encoding="utf-8"?>
|
2 |
<config>
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<modules>
|
4 |
<Skybox_Catalog>
|
5 |
<version>0.1.0</version>
|
@@ -16,6 +22,7 @@
|
|
16 |
<rewrite>
|
17 |
<product_price>Skybox_Catalog_Block_Product_Price</product_price>
|
18 |
<product_widget_new>Skybox_Catalog_Block_Product_Widget_New</product_widget_new>
|
|
|
19 |
</rewrite>
|
20 |
</catalog>
|
21 |
<bundle>
|
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>
|
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>
|
app/code/community/Skybox/Checkout/Block/Cart/Totals.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Checkout
|
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 |
+
class Skybox_Checkout_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Abstract
|
28 |
+
{
|
29 |
+
protected $_totalRenderers;
|
30 |
+
protected $_defaultRenderer = 'checkout/total_default';
|
31 |
+
protected $_totals = null;
|
32 |
+
|
33 |
+
public function getTotals()
|
34 |
+
{
|
35 |
+
if (is_null($this->_totals)) {
|
36 |
+
return parent::getTotals();
|
37 |
+
}
|
38 |
+
return $this->_totals;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function setTotals($value)
|
42 |
+
{
|
43 |
+
$this->_totals = $value;
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function _getTotalRenderer($code)
|
48 |
+
{
|
49 |
+
$blockName = $code.'_total_renderer';
|
50 |
+
$block = $this->getLayout()->getBlock($blockName);
|
51 |
+
if (!$block) {
|
52 |
+
$block = $this->_defaultRenderer;
|
53 |
+
$config = Mage::getConfig()->getNode("global/sales/quote/totals/{$code}/renderer");
|
54 |
+
if ($config) {
|
55 |
+
$block = (string) $config;
|
56 |
+
}
|
57 |
+
|
58 |
+
$block = $this->getLayout()->createBlock($block, $blockName);
|
59 |
+
}
|
60 |
+
/**
|
61 |
+
* Transfer totals to renderer
|
62 |
+
*/
|
63 |
+
$block->setTotals($this->getTotals());
|
64 |
+
return $block;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function renderTotal($total, $area = null, $colspan = 1)
|
68 |
+
{
|
69 |
+
$code = $total->getCode();
|
70 |
+
if($code!="subtotal") {
|
71 |
+
|
72 |
+
if ($total->getAs()) {
|
73 |
+
$code = $total->getAs();
|
74 |
+
}
|
75 |
+
return $this->_getTotalRenderer($code)
|
76 |
+
->setTotal($total)
|
77 |
+
->setColspan($colspan)
|
78 |
+
->setRenderingArea(is_null($area) ? -1 : $area)
|
79 |
+
->toHtml();
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Render totals html for specific totals area (footer, body)
|
85 |
+
*
|
86 |
+
* @param null|string $area
|
87 |
+
* @param int $colspan
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
public function renderTotals($area = null, $colspan = 1)
|
91 |
+
{
|
92 |
+
$html = '';
|
93 |
+
foreach($this->getTotals() as $total) {
|
94 |
+
if ($total->getArea() != $area && $area != -1) {
|
95 |
+
continue;
|
96 |
+
}
|
97 |
+
$html .= $this->renderTotal($total, $area, $colspan);
|
98 |
+
}
|
99 |
+
return $html;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Check if we have display grand total in base currency
|
104 |
+
*
|
105 |
+
* @return bool
|
106 |
+
*/
|
107 |
+
public function needDisplayBaseGrandtotal()
|
108 |
+
{
|
109 |
+
$quote = $this->getQuote();
|
110 |
+
if ($quote->getBaseCurrencyCode() != $quote->getQuoteCurrencyCode()) {
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get formated in base currency base grand total value
|
118 |
+
*
|
119 |
+
* @return string
|
120 |
+
*/
|
121 |
+
public function displayBaseGrandtotal()
|
122 |
+
{
|
123 |
+
$firstTotal = reset($this->_totals);
|
124 |
+
if ($firstTotal) {
|
125 |
+
$total = $firstTotal->getAddress()->getBaseGrandTotal();
|
126 |
+
return Mage::app()->getStore()->getBaseCurrency()->format($total, array(), true);
|
127 |
+
}
|
128 |
+
return '-';
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Get active or custom quote
|
133 |
+
*
|
134 |
+
* @return Mage_Sales_Model_Quote
|
135 |
+
*/
|
136 |
+
public function getQuote()
|
137 |
+
{
|
138 |
+
if ($this->getCustomQuote()) {
|
139 |
+
return $this->getCustomQuote();
|
140 |
+
}
|
141 |
+
|
142 |
+
if (null === $this->_quote) {
|
143 |
+
$this->_quote = $this->getCheckout()->getQuote();
|
144 |
+
}
|
145 |
+
return $this->_quote;
|
146 |
+
}
|
147 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Cart.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Cart/Sidebar.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Links.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Skybox/Checkout/Block/Checkout/Onepage/Link.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
if($isEnabled) {
|
12 |
+
return $this->getUrl('skbcheckout/international', array('_secure'=>true));
|
13 |
+
}
|
14 |
+
/*
|
15 |
+
if (Mage::helper('onestepcheckout')->isRewriteCheckoutLinksEnabled()){
|
16 |
+
return $this->getUrl('onestepcheckout', array('_secure'=>true));
|
17 |
+
}
|
18 |
+
*/
|
19 |
+
/*
|
20 |
+
Mage::log('get getCheckoutUrl skybox', null, 'tracer.log', true);
|
21 |
+
if (!$this->helper('checkout')->isRewriteCheckoutLinksEnabled()){
|
22 |
+
return parent::getCheckoutUrl();
|
23 |
+
}
|
24 |
+
*/
|
25 |
+
|
26 |
+
return parent::getCheckoutUrl();
|
27 |
+
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Skybox/Checkout/Block/Sales/Order/Total.php
CHANGED
@@ -14,20 +14,32 @@ class Skybox_Checkout_Block_Sales_Order_Total extends Mage_Sales_Block_Order_Tot
|
|
14 |
|
15 |
parent::_initTotals();
|
16 |
$order= $this->getOrder();
|
|
|
|
|
|
|
|
|
17 |
$ConceptsSkyboxjson=json_decode($order->getConceptsSkybox());
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
}
|
33 |
}
|
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
@@ -9,6 +9,7 @@
|
|
9 |
*/
|
10 |
class Skybox_Checkout_Helper_Data extends Mage_Checkout_Helper_Data
|
11 |
{
|
|
|
12 |
protected function _getApi()
|
13 |
{
|
14 |
if (null === $this->_api) {
|
@@ -18,19 +19,23 @@ class Skybox_Checkout_Helper_Data extends Mage_Checkout_Helper_Data
|
|
18 |
}
|
19 |
public function formatPrice($price)
|
20 |
{
|
|
|
|
|
|
|
21 |
/* @var $config Skybox_Core_Model_Config */
|
22 |
/*$config = Mage::getModel("skyboxcore/config");
|
23 |
$skybox_user = $config->getSession()->getSkyboxUser();
|
24 |
$currency = $skybox_user->CartCurrencySymbol;
|
25 |
//return '<span class="price">' . $currency . ' ' . number_format($price, 2) . '</span>';
|
26 |
return '<span class="price">' . $currency . ' ' . $price . '</span>';*/
|
27 |
-
/* @var $config Skybox_Core_Model_Config */
|
28 |
-
|
29 |
|
30 |
|
31 |
$config = Mage::getModel("skyboxcore/config");
|
32 |
-
$skybox_user = $config->getSession()->getSkyboxUser();
|
33 |
-
|
|
|
|
|
34 |
$currency = $skybox_user->CartCurrencySymbol; // Rogged
|
35 |
}else{ // Rogged
|
36 |
$currency = Mage::app()->getLocale()->currency( $currency_code )->getSymbol(); // Rogged
|
@@ -40,26 +45,66 @@ class Skybox_Checkout_Helper_Data extends Mage_Checkout_Helper_Data
|
|
40 |
$price=str_replace(',', '', $price);
|
41 |
//Mage::log("precio".$price, null, 'cartlabels.log', true);
|
42 |
$price=Mage::getModel('directory/currency')->setData("currency_code",
|
43 |
-
|
44 |
-
|
45 |
|
46 |
if ($price < 0) return '<span class="price">('.$currency." ".-1*$price.')</span>';
|
47 |
return '<span class="price">'.$currency." ".$price.'</span>';
|
48 |
|
49 |
}
|
|
|
50 |
/**
|
51 |
-
*
|
52 |
-
*
|
53 |
-
* @return Skybox_Catalog_Model_Api_Product
|
54 |
*/
|
55 |
-
|
56 |
public function getLayoutCheckoutSkybox(){ // Rogged
|
57 |
$page_layout = Mage::getStoreConfig('customize_your_own');
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
if($this->_getApi()->getLocationAllow()){
|
59 |
$page_layout = 'skybox/checkout/onepage.phtml';
|
60 |
}else{
|
61 |
$page_layout = 'checkout/onepage.phtml';
|
62 |
}
|
|
|
|
|
|
|
63 |
return $page_layout;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
9 |
*/
|
10 |
class Skybox_Checkout_Helper_Data extends Mage_Checkout_Helper_Data
|
11 |
{
|
12 |
+
protected $_api = null;
|
13 |
protected function _getApi()
|
14 |
{
|
15 |
if (null === $this->_api) {
|
19 |
}
|
20 |
public function formatPrice($price)
|
21 |
{
|
22 |
+
if(!$this->isRewriteCheckoutLinksEnabled()){
|
23 |
+
return parent::formatPrice($price);
|
24 |
+
}
|
25 |
/* @var $config Skybox_Core_Model_Config */
|
26 |
/*$config = Mage::getModel("skyboxcore/config");
|
27 |
$skybox_user = $config->getSession()->getSkyboxUser();
|
28 |
$currency = $skybox_user->CartCurrencySymbol;
|
29 |
//return '<span class="price">' . $currency . ' ' . number_format($price, 2) . '</span>';
|
30 |
return '<span class="price">' . $currency . ' ' . $price . '</span>';*/
|
31 |
+
/* @var $config Skybox_Core_Model_Config */
|
|
|
32 |
|
33 |
|
34 |
$config = Mage::getModel("skyboxcore/config");
|
35 |
+
$skybox_user = $config->getSession()->getSkyboxUser();
|
36 |
+
/*LocationAllow3*/
|
37 |
+
$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
38 |
+
if($this->_getApi()->getLocationAllow() && ($typeIntegration!=3)){ // Rogged
|
39 |
$currency = $skybox_user->CartCurrencySymbol; // Rogged
|
40 |
}else{ // Rogged
|
41 |
$currency = Mage::app()->getLocale()->currency( $currency_code )->getSymbol(); // Rogged
|
45 |
$price=str_replace(',', '', $price);
|
46 |
//Mage::log("precio".$price, null, 'cartlabels.log', true);
|
47 |
$price=Mage::getModel('directory/currency')->setData("currency_code",
|
48 |
+
Mage::app()->getStore(null)->getCurrentCurrency()->getCode())->format(
|
49 |
+
$price, array('display' =>Zend_Currency::NO_SYMBOL), false);
|
50 |
|
51 |
if ($price < 0) return '<span class="price">('.$currency." ".-1*$price.')</span>';
|
52 |
return '<span class="price">'.$currency." ".$price.'</span>';
|
53 |
|
54 |
}
|
55 |
+
|
56 |
/**
|
57 |
+
* @deprecated
|
|
|
|
|
58 |
*/
|
|
|
59 |
public function getLayoutCheckoutSkybox(){ // Rogged
|
60 |
$page_layout = Mage::getStoreConfig('customize_your_own');
|
61 |
+
|
62 |
+
/*LocationAllow3*/
|
63 |
+
$active = 0;
|
64 |
+
if(isset($_GET['v'])) {
|
65 |
+
$active = 1;
|
66 |
+
}
|
67 |
if($this->_getApi()->getLocationAllow()){
|
68 |
$page_layout = 'skybox/checkout/onepage.phtml';
|
69 |
}else{
|
70 |
$page_layout = 'checkout/onepage.phtml';
|
71 |
}
|
72 |
+
if($active) {
|
73 |
+
$page_layout = 'checkout/onepage.phtml';
|
74 |
+
}
|
75 |
return $page_layout;
|
76 |
}
|
77 |
+
|
78 |
+
public function isRewriteCheckoutLinksEnabled()
|
79 |
+
{
|
80 |
+
// return (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
81 |
+
return Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
82 |
+
}
|
83 |
+
|
84 |
+
public function concatNameDetailProduct($product, $sku = null)
|
85 |
+
{
|
86 |
+
Mage::log('concatNameDetailProduct', null, 'tracer.log');
|
87 |
+
$attributesConcat = '';
|
88 |
+
if($product->getData('type_id') == 'configurable'){
|
89 |
+
$options = $this->getAllAttributesVariantConfigurableProducts($product);
|
90 |
+
$attributesData = $options[$product->getId()][$sku];
|
91 |
+
$attributesConcat = implode(', ', $attributesData);
|
92 |
+
}
|
93 |
+
return $attributesConcat;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getAllAttributesVariantConfigurableProducts($configurableProduct)
|
97 |
+
{
|
98 |
+
$attributes = array();
|
99 |
+
$productAttributesOptions = $configurableProduct->getTypeInstance(true)->getConfigurableOptions($configurableProduct);
|
100 |
+
foreach ($productAttributesOptions as $productAttributeOption) {
|
101 |
+
$attributes[$configurableProduct->getId()] = array();
|
102 |
+
foreach ($productAttributeOption as $optionValues) {
|
103 |
+
$val = ($optionValues['option_title']);
|
104 |
+
$attributes[$configurableProduct->getId()][$optionValues['sku']][] = $optionValues['attribute_code'].'-'.$val;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
Mage::log(print_r($attributes, true), null, 'tracer.log');
|
108 |
+
return $attributes;
|
109 |
+
}
|
110 |
}
|
app/code/community/Skybox/Checkout/Helper/Url.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Skybox/Checkout/Model/Api/Checkout.php
CHANGED
@@ -16,6 +16,8 @@ class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
|
16 |
*/
|
17 |
protected $_product = null;
|
18 |
|
|
|
|
|
19 |
protected $_typeProduct = "catalog/product";
|
20 |
|
21 |
public function getProduct()
|
@@ -55,14 +57,28 @@ class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
|
55 |
//}
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
public function AddProductOfCart($data, $quantity)
|
59 |
{
|
|
|
|
|
|
|
60 |
if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
61 |
return $this;
|
62 |
}
|
63 |
|
64 |
Mage::log("AddProductOfCart: " . print_r($data, true), null, 'skyboxcheckout.log', true);
|
65 |
|
|
|
|
|
66 |
$params = array(
|
67 |
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
68 |
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
@@ -70,12 +86,14 @@ class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
|
70 |
'productid' => "0",
|
71 |
'quantity' => $quantity,
|
72 |
'storeproductcode' => $data['sku'],
|
73 |
-
'storeproductname' => $
|
74 |
'storeproductcategory' => $data['category_id'],
|
75 |
'storeproductprice' => $data['final_price'],
|
76 |
-
'weight' => $data['weight'],
|
77 |
'weightunit' => $this->getWeightUnit(),
|
78 |
-
'storeproductimgurl' => $data['image_url']
|
|
|
|
|
79 |
);
|
80 |
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_ADD_PRODUCT_CART, $params);
|
81 |
|
@@ -95,7 +113,7 @@ class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
|
95 |
);
|
96 |
|
97 |
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TOTAL_SHOPINGCART, $params);
|
98 |
-
|
99 |
return $this;
|
100 |
}
|
101 |
|
@@ -144,6 +162,10 @@ class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
|
144 |
return "";
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
147 |
/*
|
148 |
* Get Categories
|
149 |
*
|
@@ -162,4 +184,26 @@ class Skybox_Checkout_Model_Api_Checkout extends Skybox_Core_Model_Standard
|
|
162 |
$jsonData = $response->getResponse()->{'Categories'};
|
163 |
return $jsonData;
|
164 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
16 |
*/
|
17 |
protected $_product = null;
|
18 |
|
19 |
+
protected $_currentProduct = null;
|
20 |
+
|
21 |
protected $_typeProduct = "catalog/product";
|
22 |
|
23 |
public function getProduct()
|
57 |
//}
|
58 |
}
|
59 |
|
60 |
+
public function setCurrentProduct($product)
|
61 |
+
{
|
62 |
+
$this->_currentProduct = $product;
|
63 |
+
}
|
64 |
+
public function getCurrentProduct()
|
65 |
+
{
|
66 |
+
return $this->_currentProduct;
|
67 |
+
}
|
68 |
+
|
69 |
public function AddProductOfCart($data, $quantity)
|
70 |
{
|
71 |
+
$detailProduct = Mage::helper('checkout')->concatNameDetailProduct($this->getCurrentProduct(), $data['sku']);
|
72 |
+
|
73 |
+
//Mage::log("entro AddProductOfCart", null, 'tracer.log', true);
|
74 |
if ($this->getErrorAuthenticate() && !$this->getLocationAllow()) {
|
75 |
return $this;
|
76 |
}
|
77 |
|
78 |
Mage::log("AddProductOfCart: " . print_r($data, true), null, 'skyboxcheckout.log', true);
|
79 |
|
80 |
+
$storeProductName = $data['name'].' '.$detailProduct;
|
81 |
+
|
82 |
$params = array(
|
83 |
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
84 |
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
86 |
'productid' => "0",
|
87 |
'quantity' => $quantity,
|
88 |
'storeproductcode' => $data['sku'],
|
89 |
+
'storeproductname' => $storeProductName,
|
90 |
'storeproductcategory' => $data['category_id'],
|
91 |
'storeproductprice' => $data['final_price'],
|
92 |
+
'weight' => ($data['weight'])?($data['weight']):1,
|
93 |
'weightunit' => $this->getWeightUnit(),
|
94 |
+
'storeproductimgurl' => $data['image_url'],
|
95 |
+
'VolWeight' => $data['VolWeight'],
|
96 |
+
'merchantproductid' => $data['merchantproductid']
|
97 |
);
|
98 |
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_ADD_PRODUCT_CART, $params);
|
99 |
|
113 |
);
|
114 |
|
115 |
$this->CallApiRest(Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TOTAL_SHOPINGCART, $params);
|
116 |
+
|
117 |
return $this;
|
118 |
}
|
119 |
|
162 |
return "";
|
163 |
}
|
164 |
|
165 |
+
public function getStoreCode() {
|
166 |
+
return 77;
|
167 |
+
}
|
168 |
+
|
169 |
/*
|
170 |
* Get Categories
|
171 |
*
|
184 |
$jsonData = $response->getResponse()->{'Categories'};
|
185 |
return $jsonData;
|
186 |
}
|
187 |
+
|
188 |
+
public function getValueAccessService()
|
189 |
+
{
|
190 |
+
$params = array(
|
191 |
+
"merchantCode" => $this->getMerchant(),
|
192 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_TOKEN => $this->getAuthorizedToken(),
|
193 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_GUID => $this->getGuidApi(),
|
194 |
+
|
195 |
+
Skybox_Core_Model_Config::SKYBOX_PARAMETER_MERCHANT => $this->getMerchant(),
|
196 |
+
'customeriplocal' => $this->_getConfig()->getHost(),
|
197 |
+
'customeripremote' => $this->_getConfig()->getRemoteAddr(),
|
198 |
+
'customeripproxy' => $this->_getConfig()->getProxy(),
|
199 |
+
'customerbrowser' => $this->_getConfig()->getUserAgent(),
|
200 |
+
'customerlanguages' => $this->_getConfig()->getLanguage()
|
201 |
+
|
202 |
+
|
203 |
+
);
|
204 |
+
|
205 |
+
|
206 |
+
return $params;
|
207 |
+
|
208 |
+
}
|
209 |
}
|
app/code/community/Skybox/Checkout/Model/Carrier.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Skybox/Checkout/Model/Cart.php
CHANGED
@@ -11,6 +11,7 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
11 |
{
|
12 |
protected $_api = null;
|
13 |
protected $_product = null;
|
|
|
14 |
|
15 |
/* @return Skybox_Checkout_Model_Api_Checkout */
|
16 |
protected function _getApi()
|
@@ -21,6 +22,16 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
21 |
return $this->_api;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
/**
|
25 |
* Return Skybox API Product
|
26 |
*
|
@@ -39,6 +50,7 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
39 |
*/
|
40 |
public function addGroupedProduct($productInfo, $requestInfo = null)
|
41 |
{
|
|
|
42 |
$product = $this->_getProduct($productInfo);
|
43 |
$request = $this->_getProductRequest($requestInfo);
|
44 |
|
@@ -101,6 +113,7 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
101 |
*/
|
102 |
public function addBundleProduct($productInfo, $requestInfo = null)
|
103 |
{
|
|
|
104 |
$product = $this->_getProduct($productInfo);
|
105 |
$request = $this->_getProductRequest($requestInfo);
|
106 |
|
@@ -153,11 +166,15 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
153 |
*/
|
154 |
public function addProduct($productInfo, $requestInfo = null)
|
155 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
$product = $this->_getProduct($productInfo);
|
157 |
$request = $this->_getProductRequest($requestInfo);
|
158 |
|
159 |
-
//Mage::log(print_r($request, true), null, 'cart.log', true);
|
160 |
-
|
161 |
if ($product->isGrouped()) {
|
162 |
Mage::log("Product: " . $product->getName() . " is Grouped", null, 'cart.log', true);
|
163 |
return $this->addGroupedProduct($productInfo, $requestInfo);
|
@@ -172,6 +189,7 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
172 |
$this->_getProductApi()->CalculatePrice($product, $request);
|
173 |
|
174 |
if ($this->_getProductApi()->HasError()) {
|
|
|
175 |
Mage::throwException(
|
176 |
Mage::helper('sales')->__('[sales] Failed to add the product to the cart.')
|
177 |
);
|
@@ -202,6 +220,7 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
202 |
|
203 |
$_data = $this->_getProductApi()->getProductData();
|
204 |
Mage::log("product=Cart=".print_r($_data, true), null, 'cart.log', true);
|
|
|
205 |
$this->_getApi()->AddProductOfCart($_data, $request->getQty());
|
206 |
|
207 |
if ($this->_getApi()->HasError()) {
|
@@ -217,6 +236,33 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
217 |
return $quote;
|
218 |
}
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
private function _updateQuoteItem($productId, $productIdSkybox)
|
221 |
{
|
222 |
Mage::log('pas x aqui2', null, 'minicars.log', true);
|
@@ -261,7 +307,10 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
261 |
|
262 |
//$item->setOriginalCustomPrice($this->_getProductApi()->getTotalPriceUSD());
|
263 |
//$item->setOriginalCustomPrice($total);
|
264 |
-
$item->setOriginalCustomPrice($this->_getProductApi()->getPrice());
|
|
|
|
|
|
|
265 |
//$skybox_total = str_replace(",", "", $this->_getProductApi()->getTotalPrice());
|
266 |
$skybox_total = str_replace(",", "", $this->_getProductApi()->getPrice());
|
267 |
$row_total = floatval($skybox_total) * $item->getQty();
|
@@ -281,6 +330,11 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
281 |
*/
|
282 |
public function removeItem($itemId)
|
283 |
{
|
|
|
|
|
|
|
|
|
|
|
284 |
$quoteItem = $this->getQuote()->getItemById($itemId);
|
285 |
|
286 |
if (!$quoteItem) {
|
@@ -308,14 +362,25 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
308 |
*/
|
309 |
public function updateItems($data)
|
310 |
{
|
|
|
|
|
|
|
|
|
|
|
311 |
Mage::log('pas x aqui5', null, 'minicars.log', true);
|
|
|
312 |
//Mage::log("Skybox_Checkout_Checkout_Model_Cart updateItem");
|
313 |
//return parent::updateItems($data);
|
314 |
// Mage::dispatchEvent('checkout_cart_update_items_before', array('cart'=>$this, 'info'=>$data));
|
315 |
|
316 |
foreach ($data as $itemId => $itemInfo) {
|
317 |
$item = $this->getQuote()->getItemById($itemId);
|
|
|
|
|
|
|
|
|
318 |
if (!$item) {
|
|
|
319 |
continue;
|
320 |
}
|
321 |
|
@@ -334,6 +399,7 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
334 |
}
|
335 |
|
336 |
$qty = isset($itemInfo['qty']) ? (float)$itemInfo['qty'] : false;
|
|
|
337 |
if ($qty > 0) {
|
338 |
|
339 |
$idProductSkybox = $item->getIdProductSkybox();
|
@@ -348,6 +414,8 @@ class Skybox_Checkout_Model_Cart extends Mage_Checkout_Model_Cart
|
|
348 |
|
349 |
$row_total = floatval($skybox_total) * $item->getQty();
|
350 |
$item->setRowTotalSkybox($row_total);
|
|
|
|
|
351 |
}
|
352 |
}
|
353 |
|
11 |
{
|
12 |
protected $_api = null;
|
13 |
protected $_product = null;
|
14 |
+
protected $_enable = null;
|
15 |
|
16 |
/* @return Skybox_Checkout_Model_Api_Checkout */
|
17 |
protected function _getApi()
|
22 |
return $this->_api;
|
23 |
}
|
24 |
|
25 |
+
private function isEnable()
|
26 |
+
{
|
27 |
+
if (null === $this->_enable) {
|
28 |
+
// $value = (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
29 |
+
$value = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
30 |
+
$this->_enable = $value;
|
31 |
+
}
|
32 |
+
return $this->_enable;
|
33 |
+
}
|
34 |
+
|
35 |
/**
|
36 |
* Return Skybox API Product
|
37 |
*
|
50 |
*/
|
51 |
public function addGroupedProduct($productInfo, $requestInfo = null)
|
52 |
{
|
53 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter addBundleProduct', null, 'tracer.log', true);
|
54 |
$product = $this->_getProduct($productInfo);
|
55 |
$request = $this->_getProductRequest($requestInfo);
|
56 |
|
113 |
*/
|
114 |
public function addBundleProduct($productInfo, $requestInfo = null)
|
115 |
{
|
116 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter addBundleProduct', null, 'tracer.log', true);
|
117 |
$product = $this->_getProduct($productInfo);
|
118 |
$request = $this->_getProductRequest($requestInfo);
|
119 |
|
166 |
*/
|
167 |
public function addProduct($productInfo, $requestInfo = null)
|
168 |
{
|
169 |
+
if (!$this->isEnable()) {
|
170 |
+
parent::addProduct($productInfo, $requestInfo);
|
171 |
+
return $this;
|
172 |
+
}
|
173 |
+
|
174 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter addProduct', null, 'tracer.log', true);
|
175 |
$product = $this->_getProduct($productInfo);
|
176 |
$request = $this->_getProductRequest($requestInfo);
|
177 |
|
|
|
|
|
178 |
if ($product->isGrouped()) {
|
179 |
Mage::log("Product: " . $product->getName() . " is Grouped", null, 'cart.log', true);
|
180 |
return $this->addGroupedProduct($productInfo, $requestInfo);
|
189 |
$this->_getProductApi()->CalculatePrice($product, $request);
|
190 |
|
191 |
if ($this->_getProductApi()->HasError()) {
|
192 |
+
//Mage::log('error en el calculate price skybox', null, 'tracer.log', true);
|
193 |
Mage::throwException(
|
194 |
Mage::helper('sales')->__('[sales] Failed to add the product to the cart.')
|
195 |
);
|
220 |
|
221 |
$_data = $this->_getProductApi()->getProductData();
|
222 |
Mage::log("product=Cart=".print_r($_data, true), null, 'cart.log', true);
|
223 |
+
$this->_getApi()->setCurrentProduct($product);
|
224 |
$this->_getApi()->AddProductOfCart($_data, $request->getQty());
|
225 |
|
226 |
if ($this->_getApi()->HasError()) {
|
236 |
return $quote;
|
237 |
}
|
238 |
|
239 |
+
// protected function _getProduct($productInfo){
|
240 |
+
// Mage::log('Entro skybox _getProduct', null, 'tracer.log', true);
|
241 |
+
// Mage::log(print_r($productInfo,true), null, 'tracer.log', true);
|
242 |
+
// $product = parent::_getProduct($productInfo);
|
243 |
+
// return $product;
|
244 |
+
// }
|
245 |
+
|
246 |
+
public function addProductsByIds($productIds)
|
247 |
+
{
|
248 |
+
if (!$this->isEnable()) {
|
249 |
+
parent::addProductsByIds($productIds);
|
250 |
+
return $this;
|
251 |
+
}
|
252 |
+
|
253 |
+
//Mage::log('Entro skybox addProductsByIds', null, 'tracer.log', true);
|
254 |
+
//Mage::log(print_r($productIds,true), null, 'tracer.log', true);
|
255 |
+
if(count($productIds)>0){
|
256 |
+
foreach ($productIds as $idproduct){
|
257 |
+
$idproduct = trim($idproduct);
|
258 |
+
if(empty($idproduct)) continue;
|
259 |
+
$this->addProduct($idproduct);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
// $quote = parent::addProductsByIds($productIds);
|
263 |
+
return $this;
|
264 |
+
}
|
265 |
+
|
266 |
private function _updateQuoteItem($productId, $productIdSkybox)
|
267 |
{
|
268 |
Mage::log('pas x aqui2', null, 'minicars.log', true);
|
307 |
|
308 |
//$item->setOriginalCustomPrice($this->_getProductApi()->getTotalPriceUSD());
|
309 |
//$item->setOriginalCustomPrice($total);
|
310 |
+
// $item->setOriginalCustomPrice($this->_getProductApi()->getPrice());
|
311 |
+
$prices = str_replace(',','',$this->_getProductApi()->getPrice());
|
312 |
+
$prices = number_format((float)($prices),2, ',', '.');
|
313 |
+
$item->setOriginalCustomPrice($prices);
|
314 |
//$skybox_total = str_replace(",", "", $this->_getProductApi()->getTotalPrice());
|
315 |
$skybox_total = str_replace(",", "", $this->_getProductApi()->getPrice());
|
316 |
$row_total = floatval($skybox_total) * $item->getQty();
|
330 |
*/
|
331 |
public function removeItem($itemId)
|
332 |
{
|
333 |
+
if (!$this->isEnable()) {
|
334 |
+
parent::removeItem($itemId);
|
335 |
+
return $this;
|
336 |
+
}
|
337 |
+
|
338 |
$quoteItem = $this->getQuote()->getItemById($itemId);
|
339 |
|
340 |
if (!$quoteItem) {
|
362 |
*/
|
363 |
public function updateItems($data)
|
364 |
{
|
365 |
+
if (!$this->isEnable()) {
|
366 |
+
parent::updateItems($data);
|
367 |
+
return $this;
|
368 |
+
}
|
369 |
+
|
370 |
Mage::log('pas x aqui5', null, 'minicars.log', true);
|
371 |
+
//Mage::log(print_r($data, true), null, 'tracer.log', true);
|
372 |
//Mage::log("Skybox_Checkout_Checkout_Model_Cart updateItem");
|
373 |
//return parent::updateItems($data);
|
374 |
// Mage::dispatchEvent('checkout_cart_update_items_before', array('cart'=>$this, 'info'=>$data));
|
375 |
|
376 |
foreach ($data as $itemId => $itemInfo) {
|
377 |
$item = $this->getQuote()->getItemById($itemId);
|
378 |
+
//Mage::log('item:', null, 'tracer.log', true);
|
379 |
+
//Mage::log(print_r($item->debug(), true), null, 'tracer.log', true);
|
380 |
+
//Mage::log(print_r($itemInfo, true), null, 'tracer.log', true);
|
381 |
+
//Mage::log('updateItems foreach', null, 'tracer.log', true);
|
382 |
if (!$item) {
|
383 |
+
//Mage::log('no item', null, 'tracer.log', true);
|
384 |
continue;
|
385 |
}
|
386 |
|
399 |
}
|
400 |
|
401 |
$qty = isset($itemInfo['qty']) ? (float)$itemInfo['qty'] : false;
|
402 |
+
//Mage::log('cantidad: '.$qty, null, 'tracer.log', true);
|
403 |
if ($qty > 0) {
|
404 |
|
405 |
$idProductSkybox = $item->getIdProductSkybox();
|
414 |
|
415 |
$row_total = floatval($skybox_total) * $item->getQty();
|
416 |
$item->setRowTotalSkybox($row_total);
|
417 |
+
|
418 |
+
//Mage::log('fin qty', null, 'tracer.log', true);
|
419 |
}
|
420 |
}
|
421 |
|
app/code/community/Skybox/Checkout/Model/Observer.php
CHANGED
@@ -27,6 +27,7 @@ class Skybox_Checkout_Model_Observer
|
|
27 |
|
28 |
protected $_typeProduct = 'skyboxcatalog/api_product';
|
29 |
protected $_product = null;
|
|
|
30 |
|
31 |
protected function _getProduct()
|
32 |
{
|
@@ -36,6 +37,15 @@ class Skybox_Checkout_Model_Observer
|
|
36 |
return $this->_product;
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* Metodo inicializador de Skybox Checkout
|
41 |
*/
|
@@ -48,6 +58,10 @@ class Skybox_Checkout_Model_Observer
|
|
48 |
|
49 |
public function RemoveTax(Varien_Event_Observer $observer)
|
50 |
{
|
|
|
|
|
|
|
|
|
51 |
Mage::log('RemoveTax->ini', null, 'SkyObserver.log', true);
|
52 |
$customer_id = Mage::getSingleton('customer/session')->getId();
|
53 |
$customer = Mage::getModel("customer/customer")->load($customer_id);
|
@@ -64,6 +78,9 @@ class Skybox_Checkout_Model_Observer
|
|
64 |
|
65 |
public function CalculatePriceQuoteItem(Varien_Event_Observer $observer)
|
66 |
{
|
|
|
|
|
|
|
67 |
Mage::log('Observer->CalculatePriceQuoteItem->ini', null, 'cart.log', true);
|
68 |
|
69 |
$event = $observer->getEvent();
|
@@ -146,6 +163,9 @@ class Skybox_Checkout_Model_Observer
|
|
146 |
|
147 |
public function changeQuoteAddressSkybox(Varien_Event_Observer $observer)
|
148 |
{
|
|
|
|
|
|
|
149 |
if($this->_getApi()->getLocationAllow()){
|
150 |
Mage::log('Observer->changeQuoteAddressSkybox : ini', null, 'TotalSales.log', true);
|
151 |
/* $quote Mage_Sales_Model_Quote */
|
@@ -182,8 +202,8 @@ class Skybox_Checkout_Model_Observer
|
|
182 |
//$totalTax1= $address->getTaxAmount();
|
183 |
|
184 |
//Estas lineas se agregaron para elimnar el Tax del Carrito
|
185 |
-
|
186 |
-
|
187 |
|
188 |
$applied_taxes = array();
|
189 |
|
@@ -229,7 +249,7 @@ class Skybox_Checkout_Model_Observer
|
|
229 |
$address->setPriceInclTax($totals);
|
230 |
$address->setBasePriceInclTax($baseTotals);
|
231 |
|
232 |
-
|
233 |
//$address->setGrandTotal($totals+$totalTax);
|
234 |
$address->setGrandTotal($totals+$totalTax);
|
235 |
$address->setBaseGrandTotal($baseTotals+$totalTax);
|
27 |
|
28 |
protected $_typeProduct = 'skyboxcatalog/api_product';
|
29 |
protected $_product = null;
|
30 |
+
protected $_enable = null;
|
31 |
|
32 |
protected function _getProduct()
|
33 |
{
|
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 |
*/
|
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);
|
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();
|
163 |
|
164 |
public function changeQuoteAddressSkybox(Varien_Event_Observer $observer)
|
165 |
{
|
166 |
+
if(!$this->isEnable()) {
|
167 |
+
return $this;
|
168 |
+
}
|
169 |
if($this->_getApi()->getLocationAllow()){
|
170 |
Mage::log('Observer->changeQuoteAddressSkybox : ini', null, 'TotalSales.log', true);
|
171 |
/* $quote Mage_Sales_Model_Quote */
|
202 |
//$totalTax1= $address->getTaxAmount();
|
203 |
|
204 |
//Estas lineas se agregaron para elimnar el Tax del Carrito
|
205 |
+
$address->setTaxAmount(0);
|
206 |
+
$address->setBaseTaxAmount(0);
|
207 |
|
208 |
$applied_taxes = array();
|
209 |
|
249 |
$address->setPriceInclTax($totals);
|
250 |
$address->setBasePriceInclTax($baseTotals);
|
251 |
|
252 |
+
$totals = floatval(preg_replace("/[^-0-9\.]/","",$totals));
|
253 |
//$address->setGrandTotal($totals+$totalTax);
|
254 |
$address->setGrandTotal($totals+$totalTax);
|
255 |
$address->setBaseGrandTotal($baseTotals+$totalTax);
|
app/code/community/Skybox/Checkout/Model/Pay.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Skybox/Checkout/Model/Quote/Address/Total/Rmt.php
CHANGED
@@ -38,8 +38,12 @@ class Skybox_Checkout_Model_Quote_Address_Total_Rmt extends Mage_Sales_Model_Quo
|
|
38 |
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
39 |
* simplemente retornar el valor formateado y que Magento lo muestre.
|
40 |
*/
|
41 |
-
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
parent::fetch($address);
|
44 |
|
45 |
$quote= $address->getQuote();
|
38 |
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
39 |
* simplemente retornar el valor formateado y que Magento lo muestre.
|
40 |
*/
|
41 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
42 |
+
{
|
43 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
44 |
+
if(!$activation) {
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
parent::fetch($address);
|
48 |
|
49 |
$quote= $address->getQuote();
|
app/code/community/Skybox/Checkout/Model/Quote/Total.php
CHANGED
@@ -40,6 +40,10 @@ class Skybox_Checkout_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_T
|
|
40 |
* su parte)
|
41 |
**/
|
42 |
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
|
|
|
|
|
|
|
|
43 |
if($this->_getApi()->getLocationAllow()){ // Rogged
|
44 |
|
45 |
|
@@ -52,6 +56,15 @@ class Skybox_Checkout_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_T
|
|
52 |
}
|
53 |
|
54 |
$quote= $address->getQuote();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
if(!$quote->isVirtual() && $address->getAddressType() == 'billing'){
|
56 |
return $this;
|
57 |
}
|
@@ -186,7 +199,11 @@ class Skybox_Checkout_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_T
|
|
186 |
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
187 |
* simplemente retornar el valor formateado y que Magento lo muestre.
|
188 |
*/
|
189 |
-
public function fetch(Mage_Sales_Model_Quote_Address $address) {
|
|
|
|
|
|
|
|
|
190 |
if($this->_getApi()->getLocationAllow()){ // Rogged
|
191 |
parent::fetch($address); //Comentado por verificar
|
192 |
|
@@ -215,7 +232,7 @@ class Skybox_Checkout_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_T
|
|
215 |
*/
|
216 |
$i=0;
|
217 |
foreach ($ConceptsSkyboxjson as $item) {
|
218 |
-
if($item->
|
219 |
{
|
220 |
$i+=1;
|
221 |
$address->addTotal(array(
|
@@ -224,7 +241,7 @@ class Skybox_Checkout_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_T
|
|
224 |
'value' => $item->Value
|
225 |
));
|
226 |
Mage::log("quote->address->fetch(Concepts)->" . $item->Concept . "=" . $item->Value, null, 'TotalSales.log', true);
|
227 |
-
}
|
228 |
}
|
229 |
Mage::log("quote->address->fetch : fin", null, 'TotalSales.log', true);
|
230 |
// Retornamos el total con su título
|
40 |
* su parte)
|
41 |
**/
|
42 |
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
43 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
44 |
+
if(!$activation) {
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
if($this->_getApi()->getLocationAllow()){ // Rogged
|
48 |
|
49 |
|
56 |
}
|
57 |
|
58 |
$quote= $address->getQuote();
|
59 |
+
|
60 |
+
// $quote = Mage::helper('checkout/cart')->getCart()->getQuote();
|
61 |
+
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();
|
62 |
+
if($shippingMethod){
|
63 |
+
Mage::log('set shipping method null',null,'tracer.log',true);
|
64 |
+
$quote->getShippingAddress()->setShippingMethod(null); //setting method to null
|
65 |
+
$quote->save();
|
66 |
+
}
|
67 |
+
|
68 |
if(!$quote->isVirtual() && $address->getAddressType() == 'billing'){
|
69 |
return $this;
|
70 |
}
|
199 |
* El cálculo ya se habrá hecho y deberíamos guardarlo en algún sitio para aquí,
|
200 |
* simplemente retornar el valor formateado y que Magento lo muestre.
|
201 |
*/
|
202 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address) {
|
203 |
+
$activation = Mage::getModel('skyboxcore/api_restful')->isModuleEnable();
|
204 |
+
if(!$activation) {
|
205 |
+
return $this;
|
206 |
+
}
|
207 |
if($this->_getApi()->getLocationAllow()){ // Rogged
|
208 |
parent::fetch($address); //Comentado por verificar
|
209 |
|
232 |
*/
|
233 |
$i=0;
|
234 |
foreach ($ConceptsSkyboxjson as $item) {
|
235 |
+
if($item->Visible != 0)
|
236 |
{
|
237 |
$i+=1;
|
238 |
$address->addTotal(array(
|
241 |
'value' => $item->Value
|
242 |
));
|
243 |
Mage::log("quote->address->fetch(Concepts)->" . $item->Concept . "=" . $item->Value, null, 'TotalSales.log', true);
|
244 |
+
}
|
245 |
}
|
246 |
Mage::log("quote->address->fetch : fin", null, 'TotalSales.log', true);
|
247 |
// Retornamos el total con su título
|
app/code/community/Skybox/Checkout/controllers/CalculateController.php
CHANGED
@@ -43,7 +43,7 @@ class Skybox_Checkout_CalculateController extends Mage_Core_Controller_Front_Act
|
|
43 |
$product = Mage::getModel('catalog/product')->load($productId);
|
44 |
$type = $product->getTypeId();
|
45 |
$template = null;
|
46 |
-
|
47 |
switch ($type) {
|
48 |
case 'simple':
|
49 |
$template = $productAPI->CalculatePrice($product->getId(), null, $product->getFinalPrice(), 'simple')
|
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')
|
app/code/community/Skybox/Checkout/controllers/InternationalController.php
CHANGED
@@ -29,6 +29,8 @@ class Skybox_Checkout_InternationalController extends Mage_Core_Controller_Front
|
|
29 |
|
30 |
public function successAction()
|
31 |
{
|
|
|
|
|
32 |
$_config = Mage::getModel('skyboxcore/config');
|
33 |
$cart = $_config->getSession()->getCartSkybox();
|
34 |
$id = $cart->{'LanguageId'};
|
@@ -48,7 +50,8 @@ class Skybox_Checkout_InternationalController extends Mage_Core_Controller_Front
|
|
48 |
$languages = array(
|
49 |
0 => "Thanks for your purchase, We have received your order and we will contact you. We will send you a confirmation email.",
|
50 |
1 => "Thanks for your purchase, We have received your order and we will contact you. We will send you a confirmation email.",
|
51 |
-
2 => "!Gracias por su compra
|
|
|
52 |
3 => "'Obrigado por sua compra, Recebemos seu pedido e entraremos em contato com você. Nós lhe enviaremos um e-mail de confirmação.",
|
53 |
);
|
54 |
if (isset($languages[$id])) {
|
29 |
|
30 |
public function successAction()
|
31 |
{
|
32 |
+
Mage::getSingleton('checkout/cart')->truncate()->save();
|
33 |
+
|
34 |
$_config = Mage::getModel('skyboxcore/config');
|
35 |
$cart = $_config->getSession()->getCartSkybox();
|
36 |
$id = $cart->{'LanguageId'};
|
50 |
$languages = array(
|
51 |
0 => "Thanks for your purchase, We have received your order and we will contact you. We will send you a confirmation email.",
|
52 |
1 => "Thanks for your purchase, We have received your order and we will contact you. We will send you a confirmation email.",
|
53 |
+
// 2 => "!Gracias por su compra! Hemos recibido su orden y nos pondremos en contacto contigo. Le enviaremos un correo electrónico de confirmación",
|
54 |
+
2 => "Gracias por su compra! Le enviaremos un correo electrónico de confirmación.",
|
55 |
3 => "'Obrigado por sua compra, Recebemos seu pedido e entraremos em contato com você. Nós lhe enviaremos um e-mail de confirmação.",
|
56 |
);
|
57 |
if (isset($languages[$id])) {
|
app/code/community/Skybox/Checkout/controllers/ProcessController.php
CHANGED
@@ -11,9 +11,10 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
11 |
{
|
12 |
public function indexAction()
|
13 |
{
|
|
|
14 |
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
15 |
$_checkout->InitializeBarSkybox();
|
16 |
-
|
17 |
$return_url = ($this->getRequest()->getParam('return_url')) ?
|
18 |
$this->getRequest()->getParam('return_url') :
|
19 |
Mage::helper('core/url')->getHomeUrl();
|
@@ -31,7 +32,9 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
31 |
# check if local skybox shopping cart and skybox-checkout match
|
32 |
$differentqty=0;
|
33 |
$api_mproduct=Mage::getModel('skyboxcatalog/api_product');
|
34 |
-
|
|
|
|
|
35 |
$differentqty=1;
|
36 |
}
|
37 |
/*-----------------------------------------*/
|
@@ -41,10 +44,23 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
41 |
/*---------------- Rogged ------------------*/
|
42 |
if($differentqty==1){
|
43 |
$cart = Mage::getModel('skyboxcheckout/cart');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
if ($item->getProductType() === 'simple' && $parentItem) {
|
45 |
$paramsRequest=array();
|
46 |
$productParentId=Mage::getModel('catalog/product_type_configurable')
|
47 |
-
->getParentIdsByChild($item->getProductId());
|
48 |
$productParentId=$productParentId[0];
|
49 |
$productModel = Mage::getModel('catalog/product')->load($productParentId);
|
50 |
$_typeInstance = $productModel->getTypeInstance(true);
|
@@ -64,23 +80,23 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
64 |
$cart->removeItem($parentItemId);
|
65 |
$cart->addProduct($productModel,$paramsRequest);
|
66 |
}
|
67 |
-
if ($item->getProductType() === 'simple' && !$parentItem && $item->getPriceSkybox()) {
|
68 |
-
$productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
69 |
-
$paramsRequest=array();
|
70 |
-
$paramsRequest['product']=$item->getProductId();
|
71 |
-
$paramsRequest['qty']=$item->getQty();
|
72 |
-
$cart->removeItem($item->getItemId());
|
73 |
-
$cart->addProduct($productModel,$paramsRequest);
|
74 |
-
}
|
75 |
}
|
76 |
/*----------------------------------------*/
|
77 |
|
78 |
|
79 |
-
|
80 |
//Mage::log("ITEM Class: " . get_class($item), null, 'cart.log', true);
|
81 |
//Mage::log("ITEM Id: " . $item->getProductId(), null, 'cart.log', true);
|
82 |
|
83 |
-
|
84 |
|
85 |
/*if ($item->getProductType() === 'configurable') continue;
|
86 |
if ($item->getProductType() === 'simple' && $parentItem && !$item->getPriceSkybox()) continue;
|
@@ -107,12 +123,15 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
107 |
/* Cuando se cambia de country no allow a otro country allow, no hay precio en skybox registrado, por eso tomamos el precio de tienda */
|
108 |
|
109 |
if($api_mproduct->getLocationAllow() && !$item->getPriceSkybox()){
|
110 |
-
|
111 |
}
|
112 |
/* -- ----- --*/
|
113 |
|
114 |
#echo $item->getPrice()." - ".$item->getPriceSkybox()."<br>";
|
115 |
|
|
|
|
|
|
|
116 |
if ($item->getProductType() === 'configurable'){
|
117 |
|
118 |
$product_api->CalculatePrice($item->getProductId(),NULL,$item->getPriceUsdSkybox(),$item->getProductType(),NULL);
|
@@ -135,7 +154,7 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
135 |
if ($item->getProductType() === 'simple' && $parentItem) {
|
136 |
|
137 |
$item = $parentItem;
|
138 |
-
$product_api->CalculatePrice($item->getProductId(), null, $
|
139 |
Mage::log("simple3", null, 'processcontroller.log', true);
|
140 |
}
|
141 |
|
@@ -182,7 +201,9 @@ class Skybox_Checkout_ProcessController extends Mage_Core_Controller_Front_Actio
|
|
182 |
*/
|
183 |
//$item->setOriginalCustomPrice($product_api->getTotalPriceUSD());
|
184 |
//$item->setOriginalCustomPrice($total);
|
185 |
-
$
|
|
|
|
|
186 |
//$item->setOriginalCustomPrice($product_api->getPrice());
|
187 |
//$skybox_total = str_replace(",", "", $product_api->getTotalPrice());
|
188 |
$skybox_total = str_replace(",", "", $product_api->getPrice());
|
11 |
{
|
12 |
public function indexAction()
|
13 |
{
|
14 |
+
//Mage::log(__FILE__.' # '.__LINE__.' ~ '. __METHOD__.' => enter index', null, 'tracer.log', true);
|
15 |
$_checkout = Mage::getModel('skyboxcheckout/api_checkout');
|
16 |
$_checkout->InitializeBarSkybox();
|
17 |
+
|
18 |
$return_url = ($this->getRequest()->getParam('return_url')) ?
|
19 |
$this->getRequest()->getParam('return_url') :
|
20 |
Mage::helper('core/url')->getHomeUrl();
|
32 |
# check if local skybox shopping cart and skybox-checkout match
|
33 |
$differentqty=0;
|
34 |
$api_mproduct=Mage::getModel('skyboxcatalog/api_product');
|
35 |
+
// Mage::log('entro getAllItems $CartItemCount',null,'tracer.log',true);
|
36 |
+
// Mage::log((int)$quote->getItemsQty() .'-'.$CartItemCount,null,'tracer.log',true);
|
37 |
+
if((int)$quote->getItemsQty() != $CartItemCount && $api_mproduct->getLocationAllow()){
|
38 |
$differentqty=1;
|
39 |
}
|
40 |
/*-----------------------------------------*/
|
44 |
/*---------------- Rogged ------------------*/
|
45 |
if($differentqty==1){
|
46 |
$cart = Mage::getModel('skyboxcheckout/cart');
|
47 |
+
|
48 |
+
/* NOTE: Skip - Change country */
|
49 |
+
|
50 |
+
if ($item->getProductType() === 'simple' && !$parentItem) {
|
51 |
+
$productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
52 |
+
$paramsRequest=array();
|
53 |
+
$paramsRequest['product']=$item->getProductId();
|
54 |
+
$paramsRequest['qty']=$item->getQty();
|
55 |
+
$cart->removeItem($item->getItemId());
|
56 |
+
$cart->addProduct($productModel,$paramsRequest);
|
57 |
+
}
|
58 |
+
/* end */
|
59 |
+
|
60 |
if ($item->getProductType() === 'simple' && $parentItem) {
|
61 |
$paramsRequest=array();
|
62 |
$productParentId=Mage::getModel('catalog/product_type_configurable')
|
63 |
+
->getParentIdsByChild($item->getProductId());
|
64 |
$productParentId=$productParentId[0];
|
65 |
$productModel = Mage::getModel('catalog/product')->load($productParentId);
|
66 |
$_typeInstance = $productModel->getTypeInstance(true);
|
80 |
$cart->removeItem($parentItemId);
|
81 |
$cart->addProduct($productModel,$paramsRequest);
|
82 |
}
|
83 |
+
// if ($item->getProductType() === 'simple' && !$parentItem && $item->getPriceSkybox()) {
|
84 |
+
// $productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
85 |
+
// $paramsRequest=array();
|
86 |
+
// $paramsRequest['product']=$item->getProductId();
|
87 |
+
// $paramsRequest['qty']=$item->getQty();
|
88 |
+
// $cart->removeItem($item->getItemId());
|
89 |
+
// $cart->addProduct($productModel,$paramsRequest);
|
90 |
+
// }
|
91 |
}
|
92 |
/*----------------------------------------*/
|
93 |
|
94 |
|
95 |
+
Mage::log("process", null, 'process.log', true);
|
96 |
//Mage::log("ITEM Class: " . get_class($item), null, 'cart.log', true);
|
97 |
//Mage::log("ITEM Id: " . $item->getProductId(), null, 'cart.log', true);
|
98 |
|
99 |
+
|
100 |
|
101 |
/*if ($item->getProductType() === 'configurable') continue;
|
102 |
if ($item->getProductType() === 'simple' && $parentItem && !$item->getPriceSkybox()) continue;
|
123 |
/* Cuando se cambia de country no allow a otro country allow, no hay precio en skybox registrado, por eso tomamos el precio de tienda */
|
124 |
|
125 |
if($api_mproduct->getLocationAllow() && !$item->getPriceSkybox()){
|
126 |
+
$item->setPriceSkybox($item->getPrice());
|
127 |
}
|
128 |
/* -- ----- --*/
|
129 |
|
130 |
#echo $item->getPrice()." - ".$item->getPriceSkybox()."<br>";
|
131 |
|
132 |
+
$productModel = Mage::getModel('catalog/product')->load($item->getProductId());
|
133 |
+
// Mage::log(print_r($productModel->getFinalPrice(), true), null, 'processcontroller.log', true);
|
134 |
+
|
135 |
if ($item->getProductType() === 'configurable'){
|
136 |
|
137 |
$product_api->CalculatePrice($item->getProductId(),NULL,$item->getPriceUsdSkybox(),$item->getProductType(),NULL);
|
154 |
if ($item->getProductType() === 'simple' && $parentItem) {
|
155 |
|
156 |
$item = $parentItem;
|
157 |
+
$product_api->CalculatePrice($item->getProductId(), null, $productModel->getFinalPrice());
|
158 |
Mage::log("simple3", null, 'processcontroller.log', true);
|
159 |
}
|
160 |
|
201 |
*/
|
202 |
//$item->setOriginalCustomPrice($product_api->getTotalPriceUSD());
|
203 |
//$item->setOriginalCustomPrice($total);
|
204 |
+
$prices = str_replace(',','',$product_api->getPrice());
|
205 |
+
$prices = number_format((float)($prices),2, ',', '.');
|
206 |
+
$item->setOriginalCustomPrice($prices);
|
207 |
//$item->setOriginalCustomPrice($product_api->getPrice());
|
208 |
//$skybox_total = str_replace(",", "", $product_api->getTotalPrice());
|
209 |
$skybox_total = str_replace(",", "", $product_api->getPrice());
|
app/code/community/Skybox/Checkout/etc/config.xml
CHANGED
@@ -172,6 +172,33 @@
|
|
172 |
</rewrite>
|
173 |
</checkout>
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
</blocks>
|
176 |
<resources>
|
177 |
<!--skyboxcheckout_setup>
|
@@ -342,6 +369,14 @@
|
|
342 |
<data>Skybox_Checkout_Helper_Data</data>
|
343 |
</rewrite>
|
344 |
</checkout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
</helpers>
|
346 |
|
347 |
</global>
|
@@ -395,6 +430,27 @@
|
|
395 |
</events>
|
396 |
</frontend>
|
397 |
<default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
<config_vars/>
|
399 |
<!--Eliminar-->
|
400 |
<!--<sales>
|
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>
|
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>
|
430 |
</events>
|
431 |
</frontend>
|
432 |
<default>
|
433 |
+
<carriers>
|
434 |
+
<skyboxcheckout_shipping>
|
435 |
+
<active>1</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>
|
app/code/community/Skybox/Checkout/etc/system.xml
ADDED
@@ -0,0 +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>
|
app/code/community/Skybox/Core/Model/Api/Restful.php
CHANGED
@@ -117,11 +117,25 @@ class Skybox_Core_Model_Api_Restful extends Skybox_Core_Model_Api_Abstract
|
|
117 |
return $this;
|
118 |
}
|
119 |
|
|
|
|
|
120 |
public function getLocationAllow()
|
121 |
{
|
122 |
return $this->_config->getSession()->getLocationAllow();
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
/**
|
126 |
* Seteamos error del servicio
|
127 |
* @param string $value
|
@@ -146,6 +160,8 @@ class Skybox_Core_Model_Api_Restful extends Skybox_Core_Model_Api_Abstract
|
|
146 |
public function setAuthorizedToken($value = null)
|
147 |
{
|
148 |
$token = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_TOKEN};
|
|
|
|
|
149 |
$this->_config->getSession()->setTokenApiRest($token);
|
150 |
return $this;
|
151 |
}
|
@@ -235,6 +251,7 @@ class Skybox_Core_Model_Api_Restful extends Skybox_Core_Model_Api_Abstract
|
|
235 |
$this->setGuidApi();
|
236 |
}
|
237 |
$this->setLocationAllow();
|
|
|
238 |
$this->setHtmlTemplateBar();
|
239 |
break;
|
240 |
case Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TEMPLATE_BUTTON:
|
@@ -317,4 +334,13 @@ class Skybox_Core_Model_Api_Restful extends Skybox_Core_Model_Api_Abstract
|
|
317 |
//var_dump(json_decode($result, true));
|
318 |
return $result;
|
319 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
117 |
return $this;
|
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 |
+
public function getStoreCode()
|
135 |
+
{
|
136 |
+
return $this->_config->getSession()->getStoreCode();
|
137 |
+
}
|
138 |
+
|
139 |
/**
|
140 |
* Seteamos error del servicio
|
141 |
* @param string $value
|
160 |
public function setAuthorizedToken($value = null)
|
161 |
{
|
162 |
$token = $this->getResponseJson()->{Skybox_Core_Model_Config::SKYBOX_PARAMETER_RESPONSE_TOKEN};
|
163 |
+
Mage::log('setAuthorizedToken token skybox: ' . $token);
|
164 |
+
// $token = urlencode($token);
|
165 |
$this->_config->getSession()->setTokenApiRest($token);
|
166 |
return $this;
|
167 |
}
|
251 |
$this->setGuidApi();
|
252 |
}
|
253 |
$this->setLocationAllow();
|
254 |
+
$this->setStoreCode();
|
255 |
$this->setHtmlTemplateBar();
|
256 |
break;
|
257 |
case Skybox_Core_Model_Config::SKYBOX_ACTION_GET_TEMPLATE_BUTTON:
|
334 |
//var_dump(json_decode($result, true));
|
335 |
return $result;
|
336 |
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Validad que el módulo de skybox este habilitado para la tienda
|
340 |
+
* @return bool
|
341 |
+
*/
|
342 |
+
public function isModuleEnable()
|
343 |
+
{
|
344 |
+
return (bool)Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
345 |
+
}
|
346 |
}
|
app/code/community/Skybox/Core/Model/Config.php
CHANGED
@@ -79,6 +79,7 @@ class Skybox_Core_Model_Config
|
|
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_BUTTONHTML = "HtmlTemplate";
|
83 |
const SKYBOX_PARAMETER_RESPONSE_BUTTONERRORHTML = "HtmlTemplateError";
|
84 |
const SKYBOX_PARAMETER_RESPONSE_BUTTONERROR = "CalcErrorCode";
|
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";
|
app/code/community/Skybox/Core/Model/Standard.php
CHANGED
@@ -90,6 +90,11 @@ class Skybox_Core_Model_Standard
|
|
90 |
return $this->_getHelper()->getMerchantKey();
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
93 |
public function getWeightUnit()
|
94 |
{
|
95 |
return $this->_getHelper()->getWeightUnit();
|
@@ -121,7 +126,13 @@ class Skybox_Core_Model_Standard
|
|
121 |
|
122 |
public function getLocationAllow()
|
123 |
{
|
124 |
-
return $this->_api->getLocationAllow() == "1";
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
public function getErrorAuthenticate()
|
@@ -199,6 +210,9 @@ class Skybox_Core_Model_Standard
|
|
199 |
|
200 |
public function CallApiRest($action, $params)
|
201 |
{
|
|
|
|
|
|
|
202 |
Mage::log("CallApiRest ", null, 'standart.log', true);
|
203 |
|
204 |
$successService = false;
|
@@ -250,6 +264,10 @@ class Skybox_Core_Model_Standard
|
|
250 |
//Mage::helper('skyboxcore/email')->sendAPIError($e->getMessage());
|
251 |
}
|
252 |
|
|
|
|
|
|
|
|
|
253 |
return $this;
|
254 |
}
|
255 |
|
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();
|
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()
|
210 |
|
211 |
public function CallApiRest($action, $params)
|
212 |
{
|
213 |
+
|
214 |
+
$start = microtime(true);
|
215 |
+
|
216 |
Mage::log("CallApiRest ", null, 'standart.log', true);
|
217 |
|
218 |
$successService = false;
|
264 |
//Mage::helper('skyboxcore/email')->sendAPIError($e->getMessage());
|
265 |
}
|
266 |
|
267 |
+
|
268 |
+
$total_time = round(microtime(true)-$start, 4);
|
269 |
+
Mage::log('Servicio generado ['.$action.']: '.$total_time.' segundos.', null, 'timer.log',true);
|
270 |
+
|
271 |
return $this;
|
272 |
}
|
273 |
|
app/code/community/Skybox/Core/sql/skyboxcore_setup/mysql4-install-0.1.0.php
CHANGED
@@ -27,30 +27,43 @@ die("Exit for now");
|
|
27 |
$installer = $this;
|
28 |
$installer->startSetup();
|
29 |
|
30 |
-
|
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 |
|
55 |
-
$installer->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
$installer->endSetup();
|
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
@@ -26,7 +26,8 @@ class Skybox_International_Helper_Data extends Mage_Core_Helper_Abstract
|
|
26 |
|
27 |
public function getActive()
|
28 |
{
|
29 |
-
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxactive', Mage::app()->getStore());
|
|
|
30 |
}
|
31 |
|
32 |
public function getSkyboxLog()
|
@@ -49,6 +50,11 @@ class Skybox_International_Helper_Data extends Mage_Core_Helper_Abstract
|
|
49 |
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxurlmain', Mage::app()->getStore());
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
public function getStoreId()
|
53 |
{
|
54 |
//return $this->helper('core')->getStoreId();
|
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()
|
50 |
return Mage::getStoreConfig('skyboxinternational/skyboxsettings/skyboxurlmain', Mage::app()->getStore());
|
51 |
}
|
52 |
|
53 |
+
public function getEnabledAddSumTaxToPrice()
|
54 |
+
{
|
55 |
+
return Mage::getStoreConfig('skyboxinternational/skyboxproduct/skyboxaddtaxtopriceenable', Mage::app()->getStore());
|
56 |
+
}
|
57 |
+
|
58 |
public function getStoreId()
|
59 |
{
|
60 |
//return $this->helper('core')->getStoreId();
|
app/code/community/Skybox/International/etc/config.xml
CHANGED
@@ -49,10 +49,13 @@
|
|
49 |
</adminhtml>
|
50 |
<default>
|
51 |
<skyboxinternational>
|
52 |
-
<
|
53 |
<!--host><![CDATA[localhost]]></host-->
|
54 |
-
<skyboxactive>
|
55 |
-
</
|
|
|
|
|
|
|
56 |
</skyboxinternational>
|
57 |
</default>
|
58 |
</config>
|
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
@@ -17,7 +17,7 @@
|
|
17 |
<skyboxsettings translate="label" module="skyboxinternational">
|
18 |
<label>Merchant Settings</label>
|
19 |
<frontend_type>text</frontend_type>
|
20 |
-
<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>
|
@@ -98,6 +98,26 @@
|
|
98 |
</skyboxurlmain>
|
99 |
</fields>
|
100 |
</skyboxsettings>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
</groups>
|
102 |
</skyboxinternational>
|
103 |
</sections>
|
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>
|
98 |
</skyboxurlmain>
|
99 |
</fields>
|
100 |
</skyboxsettings>
|
101 |
+
<skyboxproduct translate="label" module="skyboxinternational">
|
102 |
+
<label>Tax Product</label>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<!--<comment>Tax + Price product</comment>-->
|
105 |
+
<sort_order>20</sort_order>
|
106 |
+
<show_in_default>1</show_in_default>
|
107 |
+
<show_in_website>1</show_in_website>
|
108 |
+
<show_in_store>1</show_in_store>
|
109 |
+
<fields>
|
110 |
+
<skyboxaddtaxtopriceenable translate="label">
|
111 |
+
<label>Add Tax to Price</label>
|
112 |
+
<frontend_type>select</frontend_type>
|
113 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
114 |
+
<sort_order>1</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>1</show_in_store>
|
118 |
+
</skyboxaddtaxtopriceenable>
|
119 |
+
</fields>
|
120 |
+
</skyboxproduct>
|
121 |
</groups>
|
122 |
</skyboxinternational>
|
123 |
</sections>
|
app/code/community/Skybox/Services/Model/Api.php
CHANGED
@@ -17,6 +17,8 @@
|
|
17 |
|
18 |
class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
19 |
{
|
|
|
|
|
20 |
|
21 |
public function __construct()
|
22 |
{
|
@@ -36,8 +38,12 @@ class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
|
36 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
37 |
$order->setData('state', $status); //complete
|
38 |
$order->setStatus($status);
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
$order->save();
|
42 |
return true;
|
43 |
} catch (Exception $e) {
|
@@ -67,7 +73,7 @@ class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
|
67 |
* @params many
|
68 |
* @return integer Quote ID
|
69 |
*/
|
70 |
-
public function generateOrder($IdCart, $IdStore, $CustomerName, $CustomerLasName, $CustomerEmail, $CustomerAdresss, $CustomerPhone, $CustomerZipCode, $CityName, $CountryId, $RegionId)
|
71 |
{
|
72 |
|
73 |
Mage::log("API generateOrder started " . date('m/d/Y h:i:s a', time()));
|
@@ -76,7 +82,17 @@ class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
|
76 |
|
77 |
/* @var $quote Mage_Sales_Model_Quote */
|
78 |
$quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteId);
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
/*
|
82 |
// Bug: When a customer is already registered as guest,
|
@@ -103,6 +119,14 @@ class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
|
103 |
$quote->setCustomerIsGuest(true);
|
104 |
$quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
// Just for Guest User
|
107 |
$CustomerLasName = ($CustomerLasName != null) ? $CustomerLasName : $CustomerName;
|
108 |
|
@@ -115,22 +139,31 @@ class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
|
115 |
'telephone' => $CustomerPhone,
|
116 |
'country_id' => $CountryId,
|
117 |
'region_id' => $RegionId,
|
|
|
118 |
'is_default_billing' => '1',
|
119 |
);
|
120 |
|
121 |
$billingAddress = $quote->getBillingAddress()->addData($addressData);
|
122 |
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
|
123 |
|
|
|
|
|
|
|
|
|
|
|
124 |
$shippingAddress->setCollectShippingRates(true)
|
125 |
->collectShippingRates()
|
126 |
-
->setShippingMethod(
|
127 |
-
->setPaymentMethod(
|
128 |
|
129 |
-
$quote->getPayment()->importData(array('method' =>
|
130 |
-
$quote->getPayment()->importData(array('method' => 'checkmo'));
|
131 |
|
132 |
$quote->collectTotals()->save();
|
133 |
|
|
|
|
|
|
|
134 |
$service = Mage::getModel('sales/service_quote', $quote);
|
135 |
$service->submitAll();
|
136 |
|
@@ -156,4 +189,122 @@ class Skybox_Services_Model_Api extends Mage_Api_Model_Resource_Abstract
|
|
156 |
Mage::log($e->getMessage());
|
157 |
}
|
158 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
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 |
{
|
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) {
|
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()));
|
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,
|
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 |
|
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 |
|
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/etc/api.xml
CHANGED
@@ -21,6 +21,11 @@
|
|
21 |
<method>generateOrder</method>
|
22 |
<acl>services/generateOrder</acl>
|
23 |
</generateOrder>
|
|
|
|
|
|
|
|
|
|
|
24 |
</methods>
|
25 |
</services>
|
26 |
</resources>
|
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>
|
app/code/community/Skybox/Services/etc/wsdl.xml
CHANGED
@@ -39,12 +39,33 @@
|
|
39 |
<part name="CityName" type="xsd:string" />
|
40 |
<part name="CountryId" type="xsd:string" />
|
41 |
<part name="RegionId" type="xsd:string" />
|
|
|
42 |
</message>
|
43 |
|
44 |
<message name="servicesGenerateOrderResponse">
|
45 |
<part name="result" type="xsd:string" />
|
46 |
</message>
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
<portType name="{{var wsdl.handler}}PortType">
|
50 |
|
@@ -66,6 +87,12 @@
|
|
66 |
<output message="typens:servicesGenerateOrderResponse" />
|
67 |
</operation>
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
</portType>
|
71 |
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
|
@@ -101,5 +128,15 @@
|
|
101 |
</output>
|
102 |
</operation>
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</binding>
|
105 |
</definitions>
|
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 |
|
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">
|
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
@@ -60,6 +60,7 @@
|
|
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:sequence>
|
64 |
</xsd:complexType>
|
65 |
</xsd:element>
|
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>
|
app/design/frontend/base/default/layout/skyboxcheckout.xml
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
<skyboxcheckout_international_index>
|
|
|
4 |
<reference name="content">
|
5 |
<block type="core/template" name="skyboxcheckout.international.index" template="skybox/checkout/skyboxcheckout.phtml"></block>
|
6 |
</reference>
|
@@ -24,7 +25,11 @@
|
|
24 |
|
25 |
<checkout_cart_index>
|
26 |
<!-- Rogged he quitado la invocación de cart -->
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
<reference name="checkout.cart.shipping">
|
29 |
<action method="setTemplate"><template>skybox/checkout/cart/shipping.phtml</template></action>
|
30 |
</reference>
|
@@ -82,13 +87,15 @@
|
|
82 |
<default>
|
83 |
<reference name="head">
|
84 |
<!--<block type="directory/currency" name="custom_currency_selector" template="currency/currency.phtml"/>-->
|
85 |
-
<action method="addJs"><script>prototype/window.js</script></action>
|
86 |
-
<action method="addJs"><script>prototype/debug.js</script></action>
|
87 |
-
<action method="addJs"><script>prototype/effects.js</script></action>
|
88 |
-
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
89 |
-
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/alphacube.css</name></action>
|
90 |
-
|
91 |
-
<action method="addJs"
|
|
|
|
|
92 |
|
93 |
<!-- jQuery ver. 1.7.2 -->
|
94 |
<!--
|
@@ -114,12 +121,27 @@
|
|
114 |
</block>
|
115 |
-->
|
116 |
|
117 |
-
<action method="addItem"
|
|
|
|
|
118 |
</reference>
|
119 |
|
120 |
-
|
|
|
121 |
<block type="core/template" name="skyboxcheckout.top.container.cart" before="-" template="skybox/checkout/cart.phtml"/>
|
122 |
</reference>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
<reference name="right">
|
125 |
<remove name="checkout/cart_sidebar"/>
|
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>
|
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" 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>
|
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 |
<!--
|
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"/>
|
app/design/frontend/base/default/template/skybox/checkout/cart.phtml
CHANGED
@@ -11,22 +11,51 @@ Mage::log("InitializeBarSkybox ", null, 'cartphtml.log', true);
|
|
11 |
|
12 |
$_checkout->InitializeBarSkybox();
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
if (!$_checkout->getErrorAuthenticate()) { // Si es correcta la authenticación en api
|
15 |
-
|
16 |
-
|
17 |
-
if
|
18 |
-
$
|
19 |
-
|
20 |
-
$template =
|
|
|
|
|
|
|
21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
-
$_cartDataURL = $cart->CartDataURL;
|
24 |
-
}else{ // Si country no está disponible
|
25 |
-
$cart = $_config->getSession()->getCartSkybox(); // Rogged
|
26 |
-
$_cartDataURL = $cart->CartDataURL; // Rogged
|
27 |
-
//$template = "<a href='#' id='link_choise_country'> </a>";
|
28 |
-
$template = "<a href='#' class='skx_position_option_country'>Change country</a>"; // Rogged
|
29 |
}
|
|
|
30 |
}
|
31 |
//echo '<script>console.log("'.$_cartDataURL.'")</script>';
|
32 |
//$template = "<a href='#' id='link_choise_country'> </a>";
|
@@ -43,18 +72,69 @@ $api_js_button_international = $skybox_url . 'Content/debug/API/js/api-button-to
|
|
43 |
<?php
|
44 |
echo $template; // Skybox Bar
|
45 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
(function ($) {
|
48 |
|
49 |
var widthPage = 0;
|
50 |
var heightPage = 0;
|
|
|
|
|
|
|
|
|
51 |
|
52 |
function showPopup(name, t, url, w, h) {
|
53 |
//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} });
|
54 |
-
winCompare = new Window(name, {className: 'alphacube', title: t, url: url, width: w, height: h, minimizable: false, maximizable: false, showEffectOptions: {duration: 0.4}, hideEffectOptions: {duration: 0.4}, destroyOnClose: true });
|
55 |
winCompare.setDestroyOnClose();
|
56 |
winCompare.setZIndex(9999);
|
57 |
winCompare.showCenter(true);
|
|
|
58 |
}
|
59 |
|
60 |
function goToCart() {
|
@@ -68,22 +148,27 @@ echo $template; // Skybox Bar
|
|
68 |
var actualUri = "<?php echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'] ?>"
|
69 |
actualUri = actualUri + "?LoadFrame=1";
|
70 |
//console.log(actualUri);
|
71 |
-
var url = "<?php echo $skybox_url ?>" + "APILoginCustomer.aspx?" + datos + "&merchant=" + merchant + "&idCart=" + idCart + "&ReLoad=1&uri=" + actualUri;
|
|
|
|
|
72 |
showPopup('initSession', '', url, (widthPage - 50 ), ((heightPage < 800) ? heightPage - 50 : 800));
|
73 |
}
|
74 |
|
75 |
function goToLocation() {
|
|
|
76 |
var datos = "<?php echo $_cartDataURL ?>";
|
77 |
var process_url = "<?php echo Mage::helper('core/url')->getHomeUrl(); ?>" + "skbcheckout/process";
|
78 |
var return_url = document.URL;
|
79 |
var url = "<?php echo $skybox_url ?>" + "Webforms/PublicSite/ReSync.aspx?" + datos;
|
|
|
80 |
url += "&process_url=" + process_url;
|
81 |
url += "&return_url=" + return_url;
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
85 |
}
|
86 |
-
|
87 |
function goToTrackingLocation() {
|
88 |
var idCart = "<?php echo $cartId ?>";
|
89 |
var datos = "<?php echo $_cartDataURL ?>";
|
@@ -104,6 +189,90 @@ echo $template; // Skybox Bar
|
|
104 |
}
|
105 |
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$(document).ready(function () {
|
108 |
widthPage = $(window).width();
|
109 |
heightPage = $(window).height();
|
@@ -112,14 +281,28 @@ echo $template; // Skybox Bar
|
|
112 |
$(".skx_banner_image_account").click(goToInitializeSession);
|
113 |
$(".skx_banner_image_tracking").click(goToTrackingLocation);
|
114 |
$("#link_choise_country").click(goToCart);
|
|
|
115 |
loadIframe();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
});
|
117 |
|
118 |
-
Windows.close = function (id, event) {
|
119 |
-
var actualUri = "<?php echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI']
|
120 |
-
indexParams = actualUri.indexOf('?');
|
121 |
-
|
122 |
-
|
|
|
123 |
|
124 |
})(jQuery);
|
125 |
|
11 |
|
12 |
$_checkout->InitializeBarSkybox();
|
13 |
|
14 |
+
$change_country = false;
|
15 |
+
/*LocationAllow3 start*/
|
16 |
+
/*Dectect checkout start*/
|
17 |
+
$checkoutCurrent = true;
|
18 |
+
/*enciendo si esta en 3*/
|
19 |
+
$locationAllow3 = false;
|
20 |
+
$allowBar = true;
|
21 |
+
|
22 |
+
|
23 |
+
$request = $this->getRequest();
|
24 |
+
$module = $request->getModuleName();
|
25 |
+
$controller = $request->getControllerName();
|
26 |
+
$action = $request->getActionName();
|
27 |
+
$typeIntegration = Mage::getStoreConfig('settings/typeIntegration');
|
28 |
+
if($typeIntegration == 3) {
|
29 |
+
if($module != 'checkout' && $controller != 'cart' && $action != 'index') {
|
30 |
+
$allowBar = false;
|
31 |
+
}
|
32 |
+
if(!$_checkout->getLocationAllow()) {
|
33 |
+
$allowBar = false;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/*LocationAllow3 end*/
|
38 |
if (!$_checkout->getErrorAuthenticate()) { // Si es correcta la authenticación en api
|
39 |
+
|
40 |
+
if($allowBar) {
|
41 |
+
if($_checkout->getLocationAllow()){ // Si country esta disponible
|
42 |
+
$cart = $_config->getSession()->getCartSkybox();
|
43 |
+
if (!empty($cart)) {
|
44 |
+
$template = $cart->BarHtmlTemplate;
|
45 |
+
foreach ($cart as $key => $value) {
|
46 |
+
$template = str_replace('{' . $key . '}', $value, $template);
|
47 |
+
}
|
48 |
}
|
49 |
+
$_cartDataURL = $cart->CartDataURL;
|
50 |
+
}else{ // Si country no está disponible
|
51 |
+
$cart = $_config->getSession()->getCartSkybox(); // Rogged
|
52 |
+
$_cartDataURL = $cart->CartDataURL; // Rogged
|
53 |
+
//$template = "<a href='#' id='link_choise_country'> </a>";
|
54 |
+
$template = "<a href='#' class='skx_position_option_country'>Change country</a>"; // Rogged
|
55 |
+
$change_country = true;
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
+
|
59 |
}
|
60 |
//echo '<script>console.log("'.$_cartDataURL.'")</script>';
|
61 |
//$template = "<a href='#' id='link_choise_country'> </a>";
|
72 |
<?php
|
73 |
echo $template; // Skybox Bar
|
74 |
?>
|
75 |
+
|
76 |
+
<style type="text/css">
|
77 |
+
#selectLocation iframe {
|
78 |
+
width: 1px;
|
79 |
+
min-width: 100%;
|
80 |
+
*width: 100%;
|
81 |
+
}
|
82 |
+
#selectLocation.dialog, #initSession.dialog {
|
83 |
+
background: transparent !important;
|
84 |
+
-webkit-box-shadow: none;
|
85 |
+
-moz-box-shadow: none;
|
86 |
+
box-shadow: none;
|
87 |
+
}
|
88 |
+
</style>
|
89 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/skybox/style.css?v=230120171122');?>"/>
|
90 |
<script type="text/javascript">
|
91 |
+
|
92 |
+
jQuery(document).ready(function() {
|
93 |
+
jQuery(".skybox-price-set").each(function( index ) {
|
94 |
+
<?php
|
95 |
+
$skyBoxUrlClientBase = Mage::helper('skyboxinternational/data')->getSkyBoxUrlAPI();
|
96 |
+
//$codeShop = Mage::getStoreConfig('settings/codeShop');
|
97 |
+
//$codeShop = $_config->getSession()->getStoreCode();
|
98 |
+
$codeShop = Mage::getModel('skyboxcatalog/api_product')->getStoreCode();
|
99 |
+
$skyBoxUrlClientGet = str_replace("apirest/", "", $skyBoxUrlClientBase);
|
100 |
+
$skyBoxUrlClient = $skyBoxUrlClientGet . ("multiplecalculate/") . $codeShop ."/calc-";
|
101 |
+
|
102 |
+
//http://beta.skyboxcheckout.com/testapi/multiplecalculate/" + merchantId + "/calc-
|
103 |
+
?>
|
104 |
+
|
105 |
+
var dataId = jQuery(this).attr("id");
|
106 |
+
var id = jQuery(this).attr("product-id");
|
107 |
+
var url = "<?php echo $skyBoxUrlClient;?>" + id + ".html";
|
108 |
+
console.log("URL refresh: " +url);
|
109 |
+
//console.log(url);
|
110 |
+
var content = jQuery.get(url, function( data ) {
|
111 |
+
jQuery("#" + dataId).html(data);
|
112 |
+
/*return data;*/
|
113 |
+
});
|
114 |
+
|
115 |
+
/*console.log(content);*/
|
116 |
+
});
|
117 |
+
|
118 |
+
});
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
(function ($) {
|
123 |
|
124 |
var widthPage = 0;
|
125 |
var heightPage = 0;
|
126 |
+
var popup = {};
|
127 |
+
var popupWidth = 540;
|
128 |
+
var popupHeight = 545;
|
129 |
+
var win = '';
|
130 |
|
131 |
function showPopup(name, t, url, w, h) {
|
132 |
//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} });
|
133 |
+
winCompare = new Window(name, {className: 'alphacube', title: t, url: url, width: w, height: h, minimizable: false, maximizable: false, showEffectOptions: {duration: 0.4}, hideEffectOptions: {duration: 0.4}, destroyOnClose: true, draggable: false, resizable: false });
|
134 |
winCompare.setDestroyOnClose();
|
135 |
winCompare.setZIndex(9999);
|
136 |
winCompare.showCenter(true);
|
137 |
+
return winCompare;
|
138 |
}
|
139 |
|
140 |
function goToCart() {
|
148 |
var actualUri = "<?php echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'] ?>"
|
149 |
actualUri = actualUri + "?LoadFrame=1";
|
150 |
//console.log(actualUri);
|
151 |
+
// var url = "<?php echo $skybox_url ?>" + "APILoginCustomer.aspx?" + datos + "&merchant=" + merchant + "&idCart=" + idCart + "&ReLoad=1&uri=" + actualUri;
|
152 |
+
|
153 |
+
var url = "<?php echo $skybox_url ?>" + "WebForms/PublicSite/Tracking.aspx?" + datos + "&merchant=" + merchant + "&idCart=" + idCart + "&ReLoad=1&uri=" + actualUri;
|
154 |
showPopup('initSession', '', url, (widthPage - 50 ), ((heightPage < 800) ? heightPage - 50 : 800));
|
155 |
}
|
156 |
|
157 |
function goToLocation() {
|
158 |
+
win = 'resync';
|
159 |
var datos = "<?php echo $_cartDataURL ?>";
|
160 |
var process_url = "<?php echo Mage::helper('core/url')->getHomeUrl(); ?>" + "skbcheckout/process";
|
161 |
var return_url = document.URL;
|
162 |
var url = "<?php echo $skybox_url ?>" + "Webforms/PublicSite/ReSync.aspx?" + datos;
|
163 |
+
var change_country_status = "<?php echo $change_country ?>";
|
164 |
url += "&process_url=" + process_url;
|
165 |
url += "&return_url=" + return_url;
|
166 |
+
url += "&change_country=" + change_country_status;
|
167 |
+
|
168 |
+
var _size = getSizeForPopup();
|
169 |
+
popup = showPopup('selectLocation', '', url, _size.width, _size.height);
|
170 |
}
|
171 |
+
|
172 |
function goToTrackingLocation() {
|
173 |
var idCart = "<?php echo $cartId ?>";
|
174 |
var datos = "<?php echo $_cartDataURL ?>";
|
189 |
}
|
190 |
}
|
191 |
|
192 |
+
var createCookie = function(name, value, days) {
|
193 |
+
var expires;
|
194 |
+
if (days) {
|
195 |
+
var date = new Date();
|
196 |
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
197 |
+
expires = "; expires=" + date.toGMTString();
|
198 |
+
} else {
|
199 |
+
expires = "";
|
200 |
+
}
|
201 |
+
document.cookie = name + "=" + value + expires + "; path=/";
|
202 |
+
}
|
203 |
+
|
204 |
+
function getCookie(c_name) {
|
205 |
+
if (document.cookie.length > 0) {
|
206 |
+
c_start = document.cookie.indexOf(c_name + "=");
|
207 |
+
if (c_start != -1) {
|
208 |
+
c_start = c_start + c_name.length + 1;
|
209 |
+
c_end = document.cookie.indexOf(";", c_start);
|
210 |
+
if (c_end == -1) {
|
211 |
+
c_end = document.cookie.length;
|
212 |
+
}
|
213 |
+
return unescape(document.cookie.substring(c_start, c_end));
|
214 |
+
}
|
215 |
+
}
|
216 |
+
return "";
|
217 |
+
}
|
218 |
+
|
219 |
+
function postMessageIframe()
|
220 |
+
{
|
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 |
+
function recalculateHeightIframe(data)
|
231 |
+
{
|
232 |
+
console.log('recalculateHeightIframe',data);
|
233 |
+
if(data.win == 'resync'){
|
234 |
+
popupHeight = data.height;
|
235 |
+
console.log('popupHeight',popupHeight);
|
236 |
+
var _size = getSizeForPopup();
|
237 |
+
popup.setSize(_size.width, _size.height);
|
238 |
+
// popup.showCenter(true);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
function recalculateHeight()
|
242 |
+
{
|
243 |
+
if(!jQuery.isEmptyObject(popup) && win == 'resync'){
|
244 |
+
var iFrameDOM = $("iframe#selectLocation_content").contents();
|
245 |
+
popupHeight = iFrameDOM.find("body").height()+30;
|
246 |
+
console.log(popupHeight);
|
247 |
+
var _size = getSizeForPopup();
|
248 |
+
popup.setSize(_size.width, _size.height)
|
249 |
+
// popup.updateHeight()s
|
250 |
+
// var fh = document.getElementById('selectLocation_content').contentWindow.document.getElementById('form1')
|
251 |
+
}
|
252 |
+
win = '';
|
253 |
+
}
|
254 |
+
function browserResize()
|
255 |
+
{
|
256 |
+
jQuery(window).resize(function() {
|
257 |
+
if(!jQuery.isEmptyObject(popup)){
|
258 |
+
var _size = getSizeForPopup();
|
259 |
+
popup.setSize(_size.width, _size.height)
|
260 |
+
}
|
261 |
+
});
|
262 |
+
}
|
263 |
+
|
264 |
+
function getSizeForPopup()
|
265 |
+
{
|
266 |
+
var _width = jQuery(window).width();
|
267 |
+
var _height = jQuery(window).height();
|
268 |
+
if(_width < popupWidth){
|
269 |
+
_width = _width - 30;
|
270 |
+
}else{
|
271 |
+
_width = popupWidth;
|
272 |
+
}
|
273 |
+
return {width: _width, height: popupHeight};
|
274 |
+
}
|
275 |
+
|
276 |
$(document).ready(function () {
|
277 |
widthPage = $(window).width();
|
278 |
heightPage = $(window).height();
|
281 |
$(".skx_banner_image_account").click(goToInitializeSession);
|
282 |
$(".skx_banner_image_tracking").click(goToTrackingLocation);
|
283 |
$("#link_choise_country").click(goToCart);
|
284 |
+
postMessageIframe()
|
285 |
loadIframe();
|
286 |
+
browserResize();
|
287 |
+
<?php
|
288 |
+
if(Mage::getBlockSingleton('page/html_header')->getIsHomePage() && $change_country == true) {
|
289 |
+
?>
|
290 |
+
|
291 |
+
if ( !getCookie('tivoli_latam_homepage') ) {
|
292 |
+
createCookie('tivoli_latam_homepage', 1);
|
293 |
+
//goToLocation();
|
294 |
+
}
|
295 |
+
<?php
|
296 |
+
}
|
297 |
+
?>
|
298 |
});
|
299 |
|
300 |
+
// Windows.close = function (id, event) {
|
301 |
+
// var actualUri = "<?php //echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'] ?>//";
|
302 |
+
// indexParams = actualUri.indexOf('?');
|
303 |
+
// popup = {};
|
304 |
+
// top.location = actualUri.substring(0, indexParams);
|
305 |
+
// }
|
306 |
|
307 |
})(jQuery);
|
308 |
|
app/design/frontend/base/default/template/skybox/checkout/onepage/link.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
31 |
+
if ($api->getLocationAllow() && $typeIntegration==3):
|
32 |
+
?>
|
33 |
+
<button type="button"
|
34 |
+
|
35 |
+
class="button btn-proceed-checkout btn-checkout"
|
36 |
+
onclick="window.location='<?php echo Mage::getBaseUrl()."/checkout/onepage?v=1" ?>';">
|
37 |
+
<span>
|
38 |
+
<span><?php echo $this->__('Proceed') ?></span>
|
39 |
+
</span>
|
40 |
+
</button>
|
41 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/skybox/checkout/skyboxcheckout.phtml
CHANGED
@@ -40,6 +40,7 @@ if (!$_checkout->getErrorAuthenticate() && $_checkout->getLocationAllow()) { //
|
|
40 |
$url .= "&idStore=" . $storeId;
|
41 |
$url .= "&UrlC=" . $urlConfirm;// "http://magento.skynet.com/magento192/skbcheckout/international";
|
42 |
$url .= "&paypal=" . $_GET["paypal"];
|
|
|
43 |
$url .= "&UrlR=" . $urlSuccess;
|
44 |
|
45 |
if($size == 0)
|
40 |
$url .= "&idStore=" . $storeId;
|
41 |
$url .= "&UrlC=" . $urlConfirm;// "http://magento.skynet.com/magento192/skbcheckout/international";
|
42 |
$url .= "&paypal=" . $_GET["paypal"];
|
43 |
+
$url .= '&checkout=' . strip_tags(Mage::app()->getRequest()->getParam('checkout',''));
|
44 |
$url .= "&UrlR=" . $urlSuccess;
|
45 |
|
46 |
if($size == 0)
|
app/design/frontend/base/default/template/skybox/product/price.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $this->calculatePrice($this->getProduct()); ?>
|
app/etc/modules/Skybox_All.xml
CHANGED
@@ -19,6 +19,7 @@
|
|
19 |
<depends>
|
20 |
<Mage_Core/>
|
21 |
<Mage_Checkout/>
|
|
|
22 |
<!--Skybox_Core /-->
|
23 |
</depends>
|
24 |
</Skybox_Checkout>
|
19 |
<depends>
|
20 |
<Mage_Core/>
|
21 |
<Mage_Checkout/>
|
22 |
+
<Mage_Shipping />
|
23 |
<!--Skybox_Core /-->
|
24 |
</depends>
|
25 |
</Skybox_Checkout>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SKYBOZ456</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license>Open</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Skybox Checkout enables a Magento ecommerce site to sell instantly to 180 countries &amp; territories and accept payment in 140 local currencies. SkyBOX Checkout is a combination of technology tools &amp; 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 &amp; international payments while providing competitive international shipping with full tracking via its proprietary logistics network.</description>
|
11 |
<notes>Skybox Checkout enables a Magento ecommerce site to sell instantly to 180 countries &amp; territories and accept payment in 140 local currencies. SkyBOX Checkout is a combination of technology tools &amp; 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 &amp; international payments while providing competitive international shipping with full tracking via its proprietary logistics network.</notes>
|
12 |
<authors><author><name>Emilio Lizarraga</name><user>Emilio</user><email>emilio@skynet.net</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Skybox"><dir name="Catalog"><dir name="Block"><dir name="Bundle"><file name="Price.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.25</min><max>7.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SKYBOZ456</name>
|
4 |
+
<version>1.2.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Open</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Skybox Checkout enables a Magento ecommerce site to sell instantly to 180 countries &amp; territories and accept payment in 140 local currencies. SkyBOX Checkout is a combination of technology tools &amp; 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 &amp; international payments while providing competitive international shipping with full tracking via its proprietary logistics network.</description>
|
11 |
<notes>Skybox Checkout enables a Magento ecommerce site to sell instantly to 180 countries &amp; territories and accept payment in 140 local currencies. SkyBOX Checkout is a combination of technology tools &amp; 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 &amp; international payments while providing competitive international shipping with full tracking via its proprietary logistics network.</notes>
|
12 |
<authors><author><name>Emilio Lizarraga</name><user>Emilio</user><email>emilio@skynet.net</email></author></authors>
|
13 |
+
<date>2017-03-14</date>
|
14 |
+
<time>01:16:49</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Skybox"><dir name="Catalog"><dir name="Block"><dir name="Bundle"><file name="Price.php" hash="31c6ebe925bfae33bbfd2c7478ea11bf"/></dir><dir name="Catalog"><dir name="Category"><dir name="Tab"><file name="Skyboxcheckout.php" hash="e6bf9aa85573776b8b00fa289e6e394f"/></dir></dir></dir><dir name="Product"><file name="List.php" hash="221db330faa5e520cd8610eee0100ef0"/><file name="Price.php" hash="65e6a3c6712b7ddc05938d6f65ee3f4b"/><dir name="Widget"><file name="New.php" hash="6308953f846a3145759c915cc437b787"/></dir></dir></dir><dir name="Model"><dir name="Api"><file name="Product.php" hash="d94d5d4baf7ab032a1ed3dcd6998e0fb"/></dir><file name="Observer.php" hash="0e9c29ace9ff899c4651e26b2f942283"/><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Categories.php" hash="ac17eace9f5a95f4fca167b99d68f864"/></dir></dir><dir name="Type"><file name="Price.php" hash="f019331d0f2b1bfeaf0314d47d1a180e"/></dir></dir><dir name="Resource"><file name="Setup.php" hash="226264104625eddbe9787724d8b263dd"/></dir></dir><dir name="etc"><file name="config.xml" hash="6d65673ef869e90a3e9028f9d0265e14"/></dir><dir name="sql"><dir name="skyboxcatalog_setup"><file name="mysql4-install-0.1.0.php" hash="2189b412c726cfae19fceb48481520fb"/></dir></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Cart"><dir name="Item"><file name="Renderer.php" hash="3893a033bfe8c033fdbd510b8a88253e"/></dir><file name="Sidebar.php" hash="ba611cdecb734283a950d6bfed37db4a"/><file name="Totals.php" hash="e3653e5a21692c04e99011bb411c1e1d"/></dir><dir name="Checkout"><dir name="Cart"><file name="Sidebar.php" hash="4f1232cd9c47aba9d06adb6f15454842"/></dir><file name="Cart.php" hash="5067c5812f95fc97e873ac40243846f7"/><file name="Links.php" hash="36fd9d06b868015f2c92aca411370712"/><dir name="Onepage"><file name="Link.php" hash="81a2674647cf91eed70296aa8216f2f8"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Total.php" hash="ae5d76a40e8384561f1069ae8d721214"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f3d1df3e0de2d8068156882b19bd8bfe"/><file name="Url.php" hash="4591aecdbe5c37f7f163a5898a32cdc6"/></dir><dir name="Model"><dir name="Api"><file name="Checkout.php" hash="8479e3854da068369af39543ac74f3b6"/></dir><file name="Carrier.php" hash="6b983efce0c01b5f73363262adfbbdfd"/><file name="Cart.php" hash="e7dc2b1165e7ab73499fc6944ecba2c9"/><dir name="Creditmemo"><file name="Total.php" hash="c9446e107737ad38a78f324dd1b525bb"/></dir><dir name="Invoice"><file name="Total.php" hash="425b32e1028036aa7f05825eb2bb38a9"/></dir><file name="Observer.php" hash="828666c3ee77360e2dac33f9aab50eba"/><file name="Pay.php" hash="d785f21cd599740a60a27cac0efa7e0c"/><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Rmt.php" hash="f7fed2b74bde33d0b3fee364b4b53c9d"/><file name="Tax.php" hash="a9bf923a5e22211a471e7daa913e1128"/></dir></dir><file name="SubTotal.php" hash="ddac90af6c883d3ceaca3dd5f70e829a"/><file name="Total.php" hash="c747e1195855790865102ad085f22a21"/><file name="Total2.php" hash="79886fc381e331fc1e5d95357de4210c"/><file name="Total3.php" hash="f41d2405f0cf41f273a2f82e0ee0af4e"/><file name="Total4.php" hash="14fe5acf7a543a5088badd5f41352ea9"/><file name="Total5.php" hash="74f52a56832c204735b8b513ad5b7303"/><file name="Total6.php" hash="a2e9e0da0c4a344d6c71cfa7434aa8f7"/><file name="Total7.php" hash="75e0f2f098e7e95fbaee47e7bf21ae8a"/><file name="Total8.php" hash="8d91c044230327ac9c362f31664c9712"/></dir></dir><dir name="controllers"><file name="CalculateController.php" hash="92b07c396b041e18a2562bd5d7630c57"/><file name="InternationalController.php" hash="446428f2e079b5e3180079cf50aed0b0"/><file name="ProcessController.php" hash="ebab9d88c9a8bb509e3210b4e97d8857"/></dir><dir name="etc"><file name="config.xml" hash="5343d7a335b68be55683ec563af84bdb"/><file name="system.xml" hash="dce562f5c882bbfa0a66529ee9158225"/></dir><dir name="sql"><dir name="skyboxcheckout_setup"><file name="mysql4-install-0.1.0.php" hash="577e24a913fe0944051b6658eb981a2a"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="e369b8f1d84c7ebf3f827e719fc74b14"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="d90cf48ab36345816e46e906c2614f4d"/></dir></dir></dir><dir name="Core"><file name="Exception.php" hash="2096fb74760deeee3fb5da1301d231d2"/><dir name="Helper"><file name="Data.php" hash="efaaf08bf426b39ced1aab92f207c6c6"/><file name="Email.php" hash="a1608eae1a6e3a47c60e1b965fb12b11"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="9de6e882bfa341944420cc5a5360e8b2"/><file name="Restful.php" hash="5a3669e4629ef791852a7310cc24d554"/></dir><file name="Config.php" hash="b2dcf73b0c7c3d0a2a39ea01319ca97c"/><file name="Logservice.php" hash="5b7f38cb4afaae2e8497343d9f2132e3"/><dir name="Mysql4"><dir name="Logservice"><file name="Collection.php" hash="6651933f9b5da3057677a4fecc122b67"/></dir><file name="Logservice.php" hash="64322561323d5f2b55955acfaec7a0fb"/></dir><file name="Mysql4.php" hash="41b0e4c9c3105b9677daae39c60aabda"/><file name="Session.php" hash="2611705e885899f26a585979339020e5"/><file name="Standard.php" hash="f8c3125a51ef5756fbf4d087bc7aa242"/></dir><dir name="etc"><file name="config.xml" hash="f129bd18e0e219dabf9d3b53f51f4216"/></dir><dir name="sql"><dir name="skyboxcore_setup"><file name="mysql4-install-0.1.0.php" hash="13cd660544b3fc8705e426d7099dd674"/></dir></dir></dir><dir name="International"><dir name="Helper"><file name="Data.php" hash="6c09c9ff790985617a62beb056baed21"/></dir><dir name="Model"><file name="Config.php" hash="064f4a476e1edbb6dc3e6f3351a3b31d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2354e61b8c7845346685901034afcbb3"/><file name="config.xml" hash="f5913d13eca1ec32f725a17710d05f09"/><file name="system.xml" hash="acd5381b821ee8146f2b6712bb95e6c3"/></dir></dir><dir name="Services"><dir name="Model"><dir name="Api"><file name="V2.php" hash="7856a4a5a80782c5535380d70770e6ed"/></dir><file name="Api.php" hash="4035b27fc010cdfdfcb4ebee7cf3bc36"/></dir><dir name="etc"><file name="api.xml" hash="829dde691c2043f356c8469714940ad2"/><file name="config.xml" hash="c7c8562db82b5a4d648a325b9ee6f0fe"/><file name="wsdl.xml" hash="f28d1c15365e6fd7389ce6eddc960cba"/><file name="wsi.xml" hash="89fc03a62c5958e6c266dd15b30c8acd"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="skyboxcatalog.xml" hash="d82d2d107a9dd31197488e9abe050cee"/><file name="skyboxinternational.xml" hash="2d63152dba1b9f9dd4097b7e228226e2"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="skyboxcheckout.xml" hash="d40735b46c58165c6dabf76e2b0b31fa"/></dir><dir name="template"><dir name="skybox"><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="1b2f22c4694c36adb216e22d0710ed77"/></dir><file name="shipping.phtml" hash="5b4beb8b69d6f2bfac7d034aa012636b"/><dir name="sidebar"><file name="default.phtml" hash="1bdfb0802b1f75e045f90713676fe213"/></dir><file name="sidebar.phtml" hash="36d3a7a5faa130f1d5ad4bb5d47b3fd8"/></dir><file name="cart.phtml" hash="002a7e06e0c974fd3e75d56345691243"/><file name="cart_list.phtml" hash="232b08ca9b25d06a2d6c973d8799a3d5"/><file name="headerskybox.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="onepage"><file name="link.phtml" hash="f5048530666e10f192f00712ec12fe7b"/></dir><file name="onepage.phtml" hash="b515fd2a3f40232483f90a5b32f4181f"/><file name="pagecheckout.phtml" hash="90fe4eca6a69d90b9b99c96e416144c7"/><file name="skyboxcheckout.phtml" hash="91d3faf1cc4ecba3a778b333c4c23a7e"/><file name="skyboxsuccess.phtml" hash="eadbbb9ec62b345f78ea358b538230c8"/></dir><dir name="product"><file name="price.phtml" hash="22d109303a7e71cedd65f130ba64377d"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Skybox_All.xml" hash="09b5bc1d3c26fd792af6d89d1c8242c0"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="skybox"><file name="catalog.product.configurable.js" hash="650eaf78df0af1b2238972b254b96de0"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="skybox"><file name="adminhtml.category.js" hash="5443d7ea41a3f45c45c6f333069f0b9d"/><file name="jquery.ba-resize.min.js" hash="bfc0e056668557eea0c0fd40d4d00f30"/><file name="jquery.min.js" hash="a13f7f208ba534681deadb1ec7a2e54a"/><file name="load-jquery.js" hash="2f6da228c0d5213a8e9b3a555899da1b"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.25</min><max>7.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/frontend/base/default/js/skybox/catalog.product.configurable.js
CHANGED
@@ -53,16 +53,16 @@ if (typeof Product != 'undefined') {
|
|
53 |
|
54 |
if (price_box) {
|
55 |
//console.log('price-box');
|
56 |
-
|
57 |
}
|
58 |
if (price_box_bundle) {
|
59 |
//console.log('price-box-bundle');
|
60 |
-
|
61 |
}
|
62 |
|
63 |
if (price_info) {
|
64 |
//console.log('price-info');
|
65 |
-
|
66 |
}
|
67 |
|
68 |
jqueryButton();
|
@@ -101,9 +101,15 @@ if (typeof Product != 'undefined') {
|
|
101 |
price = optionPrices + parseFloat(_productPrice);
|
102 |
_priceInclTax += parseFloat(_productPrice) * (100 + this.currentTax) / 100;
|
103 |
|
|
|
|
|
104 |
var tax = price * (this.currentTax / 100);
|
|
|
105 |
var excl = price;
|
106 |
-
|
|
|
|
|
|
|
107 |
var finalPrice = parseFloat(incl);
|
108 |
|
109 |
this.url = SKYBOX_OPTIONS_PRICE_URL;
|
@@ -114,4 +120,6 @@ if (typeof Product != 'undefined') {
|
|
114 |
});
|
115 |
|
116 |
Product.OptionsPrice = SkyboxOptionsPrice;
|
117 |
-
}
|
|
|
|
53 |
|
54 |
if (price_box) {
|
55 |
//console.log('price-box');
|
56 |
+
//$$('.price-box')[0].innerHTML = response;
|
57 |
}
|
58 |
if (price_box_bundle) {
|
59 |
//console.log('price-box-bundle');
|
60 |
+
//$$('.price-box-bundle')[0].innerHTML = response;
|
61 |
}
|
62 |
|
63 |
if (price_info) {
|
64 |
//console.log('price-info');
|
65 |
+
//$$('.price-info')[0].innerHTML = response;
|
66 |
}
|
67 |
|
68 |
jqueryButton();
|
101 |
price = optionPrices + parseFloat(_productPrice);
|
102 |
_priceInclTax += parseFloat(_productPrice) * (100 + this.currentTax) / 100;
|
103 |
|
104 |
+
console.log('Price incl tax: '+_priceInclTax);
|
105 |
+
console.log('Origin Tax: '+this.currentTax);
|
106 |
var tax = price * (this.currentTax / 100);
|
107 |
+
console.log('Tax: '+tax);
|
108 |
var excl = price;
|
109 |
+
console.log('price reload: '+price);
|
110 |
+
// var incl = excl + tax;
|
111 |
+
var incl = excl;
|
112 |
+
console.log('Price + Tax: '+incl);
|
113 |
var finalPrice = parseFloat(incl);
|
114 |
|
115 |
this.url = SKYBOX_OPTIONS_PRICE_URL;
|
120 |
});
|
121 |
|
122 |
Product.OptionsPrice = SkyboxOptionsPrice;
|
123 |
+
}
|
124 |
+
|
125 |
+
|