Version Notes
Notes
Download this release
Release Info
Developer | Oct8ne |
Extension | LetsSyncroLLC_Oct8ne |
Version | 1.1.8 |
Comparing to | |
See all releases |
Code changes from version 1.1.5 to 1.1.8
- app/code/community/LetsSyncroLLC/Oct8ne/Block/Accountconfig.php +16 -2
- app/code/community/LetsSyncroLLC/Oct8ne/Helper/Data.php +152 -125
- app/code/community/LetsSyncroLLC/Oct8ne/Helper/Url.php +8 -2
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Package.php +74 -0
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Request.php +38 -0
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Rewrite.php +19 -0
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Mysql4/Quoteproducts.php +8 -0
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Mysql4/Quoteproducts/Collection.php +9 -0
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Observer.php +185 -125
- app/code/community/LetsSyncroLLC/Oct8ne/Model/Quoteproducts.php +9 -0
- app/code/community/LetsSyncroLLC/Oct8ne/controllers/AccountController.php +131 -122
- app/code/community/LetsSyncroLLC/Oct8ne/controllers/FrameController.php +810 -679
- app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml +257 -229
- app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-1.1.6-1.1.7.php +37 -0
- app/design/frontend/base/default/layout/oct8ne.xml +223 -240
- app/design/frontend/base/default/template/oct8ne/frame/getreportdata.phtml +1 -0
- app/design/frontend/base/default/template/oct8ne/frame/json-page.phtml +1 -1
- app/design/frontend/base/default/template/oct8ne/letssyncro.phtml +4 -2
- app/etc/modules/LetsSyncroLLC_Oct8ne.xml +1 -1
- package.xml +13 -3
app/code/community/LetsSyncroLLC/Oct8ne/Block/Accountconfig.php
CHANGED
@@ -223,6 +223,12 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
|
|
223 |
|
224 |
if($letssyncro_enabled == '1' && ($letssyncro_licenseid == '' || strlen($letssyncro_licenseid) != 32))
|
225 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
return $letssyncromodel->setEnabled($letssyncro_enabled);
|
228 |
}
|
@@ -317,7 +323,7 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
|
|
317 |
return $response;
|
318 |
}
|
319 |
|
320 |
-
public function createXML_Logon($letssyncro_useremail, $letssyncro_password)
|
321 |
{
|
322 |
$DOM = new DOMDocument('1.0','UTF-8');
|
323 |
$XML = $DOM->createElement('User');
|
@@ -333,6 +339,9 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
|
|
333 |
// $currency = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
|
334 |
$platform = $DOM->createElement('Platform', 'MAGENTO');
|
335 |
$domain = $DOM->createElement('UrlDomain', str_replace("index.php/", "", Mage::getBaseUrl()));
|
|
|
|
|
|
|
336 |
|
337 |
$XML->appendChild($baseurl);
|
338 |
$XML->appendChild($checkouturl);
|
@@ -341,8 +350,13 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
|
|
341 |
$XML->appendChild($loginurl);
|
342 |
$XML->appendChild($Pass);
|
343 |
$XML->appendChild($platform);
|
344 |
-
|
|
|
|
|
345 |
|
|
|
|
|
|
|
346 |
return $DOM->saveXML($DOM->documentElement);
|
347 |
}
|
348 |
|
223 |
|
224 |
if($letssyncro_enabled == '1' && ($letssyncro_licenseid == '' || strlen($letssyncro_licenseid) != 32))
|
225 |
return false;
|
226 |
+
|
227 |
+
$letssyncro_useremail = $letssyncrooptions['email'];
|
228 |
+
$letssyncro_password = $letssyncrooptions['password'];
|
229 |
+
|
230 |
+
$xmlData = $this->createXML_Logon($letssyncro_useremail, $letssyncro_password, $letssyncro_enabled ? 1: 0);
|
231 |
+
$this->sendRequest($xmlData, 'logon', $letssyncrooptions['urlapi']);
|
232 |
|
233 |
return $letssyncromodel->setEnabled($letssyncro_enabled);
|
234 |
}
|
323 |
return $response;
|
324 |
}
|
325 |
|
326 |
+
public function createXML_Logon($letssyncro_useremail, $letssyncro_password, $status_platform = null)
|
327 |
{
|
328 |
$DOM = new DOMDocument('1.0','UTF-8');
|
329 |
$XML = $DOM->createElement('User');
|
339 |
// $currency = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
|
340 |
$platform = $DOM->createElement('Platform', 'MAGENTO');
|
341 |
$domain = $DOM->createElement('UrlDomain', str_replace("index.php/", "", Mage::getBaseUrl()));
|
342 |
+
|
343 |
+
if(!is_null($status_platform))
|
344 |
+
$StatusPlatform = $DOM->createElement('StatusPlatform', $status_platform);
|
345 |
|
346 |
$XML->appendChild($baseurl);
|
347 |
$XML->appendChild($checkouturl);
|
350 |
$XML->appendChild($loginurl);
|
351 |
$XML->appendChild($Pass);
|
352 |
$XML->appendChild($platform);
|
353 |
+
|
354 |
+
if(!is_null($status_platform))
|
355 |
+
$XML->appendChild($StatusPlatform);
|
356 |
|
357 |
+
|
358 |
+
$XML->appendChild($domain);
|
359 |
+
|
360 |
return $DOM->saveXML($DOM->documentElement);
|
361 |
}
|
362 |
|
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Data.php
CHANGED
@@ -1,125 +1,152 @@
|
|
1 |
-
<?php
|
2 |
-
class LetsSyncroLLC_Oct8ne_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
-
|
4 |
-
static public function getProductFullUrl( $product ) {
|
5 |
-
$categories = $product->getCategoryIds();
|
6 |
-
$category = Mage::getModel('catalog/category')->load( $categories[0] );
|
7 |
-
//$url = Mage::getUrl( $category->getUrlPath() ).basename( $product->getProductUrl() );
|
8 |
-
$url = Mage::getUrl( basename( $product->getProductUrl() ) );
|
9 |
-
return $url;
|
10 |
-
}
|
11 |
-
|
12 |
-
static public function getProductImagesUrl( $product ) {
|
13 |
-
$v = array();
|
14 |
-
$gallery_data = $product->getData( 'media_gallery' );
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
$
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
'
|
62 |
-
'
|
63 |
-
'
|
64 |
-
'
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
//
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LetsSyncroLLC_Oct8ne_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
static public function getProductFullUrl( $product ) {
|
5 |
+
$categories = $product->getCategoryIds();
|
6 |
+
$category = Mage::getModel('catalog/category')->load( $categories[0] );
|
7 |
+
//$url = Mage::getUrl( $category->getUrlPath() ).basename( $product->getProductUrl() );
|
8 |
+
$url = Mage::getUrl( basename( $product->getProductUrl() ) );
|
9 |
+
return $url;
|
10 |
+
}
|
11 |
+
|
12 |
+
static public function getProductImagesUrl( $product ) {
|
13 |
+
$v = array();
|
14 |
+
$gallery_data = $product->getData( 'media_gallery' );
|
15 |
+
|
16 |
+
// $url = parse_url(self::_remove_http(Mage::getUrl('oct8ne/frame/image'));
|
17 |
+
// $url['query']['file'] = 'catalog/product'.$image['file'];
|
18 |
+
$url = Mage::getUrl('oct8ne/frame/image');
|
19 |
+
$join = (strstr($url, "?") === FALSE) ? '?' : '&';
|
20 |
+
|
21 |
+
foreach( $gallery_data['images'] as $image )
|
22 |
+
$v[] = array(
|
23 |
+
// 'url' => Mage::getBaseUrl('media').'catalog/product'.$image['file']
|
24 |
+
// 'url' => Mage::getUrl('oct8ne/frame/image', array('file' => 'catalog/product'.$image['file']))
|
25 |
+
'url' => self::_remove_http($url . $join . 'file=' . 'catalog/product'.$image['file'])
|
26 |
+
);
|
27 |
+
|
28 |
+
return $v;
|
29 |
+
}
|
30 |
+
|
31 |
+
static protected $_productThumbnail = array();
|
32 |
+
static public function getProductThumbnail($product, $width = null)
|
33 |
+
{
|
34 |
+
$id = $product->getId();
|
35 |
+
if (array_key_exists($id, self::$_productThumbnail)) {
|
36 |
+
return self::$_productThumbnail[$id];
|
37 |
+
}
|
38 |
+
$thumb = Mage::helper('catalog/image')->init($product, 'thumbnail');
|
39 |
+
|
40 |
+
if(!is_null($width))
|
41 |
+
$thumb->resize($width);
|
42 |
+
|
43 |
+
$file = (string)$thumb;
|
44 |
+
|
45 |
+
self::$_productThumbnail[$id] = $file;
|
46 |
+
|
47 |
+
return $file;
|
48 |
+
}
|
49 |
+
|
50 |
+
static public function getProductInfo($product_id, $qty = null)
|
51 |
+
{
|
52 |
+
$product = Mage::getModel('catalog/product')->load( $product_id );
|
53 |
+
// $description = str_replace( array("\r\n", "\n", "\r"), "\\n", htmlentities ($product->getDescription()) );
|
54 |
+
$description = htmlspecialchars($product->getDescription(), ENT_QUOTES, "UTF-8");
|
55 |
+
$description = trim($description, "\r\n\t ");
|
56 |
+
$description = str_replace("\r", "", $description);
|
57 |
+
$description = str_replace("\t", "", $description);
|
58 |
+
$description = str_replace("\n", "<br/>", $description);
|
59 |
+
$tmp = is_null($qty) ? array() : array('qty' => $qty);
|
60 |
+
return array_merge($tmp, array(
|
61 |
+
'id' => $product->getId(),
|
62 |
+
'title' => htmlspecialchars($product->getName(), ENT_QUOTES, "UTF-8"), // htmlentities( $product->getName() ),
|
63 |
+
// 'price' => sprintf( "%.02f$currency", is_numeric($product->getSpecialPrice()) ? $product->getSpecialPrice() : $product->getPrice() ),
|
64 |
+
//'price' => Mage::helper('core')->currency(number_format($product->getFinalPrice(), '2', '.', ',')),
|
65 |
+
'original_price' => number_format(
|
66 |
+
Mage::helper('core')->currency( $product->getPrice(), false, false ),
|
67 |
+
'2', '.', ','
|
68 |
+
),
|
69 |
+
'price' => number_format( Mage::helper('core')->currency($product->getFinalPrice(), false, false), '2', '.', ',' ),
|
70 |
+
'description' => $description,
|
71 |
+
'url' => self::_remove_http(Mage::helper('oct8ne')->getProductFullUrl( $product )),
|
72 |
+
'imgs' => Mage::helper('oct8ne')->getProductImagesUrl( $product ),
|
73 |
+
'thumbnail' => self::_remove_http(Mage::helper('oct8ne')->getProductThumbnail( $product, 120 )),
|
74 |
+
'rating' => self::getProductRating($product_id)
|
75 |
+
));
|
76 |
+
}
|
77 |
+
|
78 |
+
static public function getProductRating($productId)
|
79 |
+
{
|
80 |
+
// Obtener la colección de reviews
|
81 |
+
$reviews = Mage::getModel('review/review')
|
82 |
+
->getResourceCollection()
|
83 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
84 |
+
->addEntityFilter('product', $productId)
|
85 |
+
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
|
86 |
+
->setDateOrder()
|
87 |
+
->addRateVotes();
|
88 |
+
// Calcular la media de ratings/reviews
|
89 |
+
$avg = 0;
|
90 |
+
$ratings = array();
|
91 |
+
if (count($reviews) > 0) {
|
92 |
+
foreach ($reviews->getItems() as $review) {
|
93 |
+
foreach( $review->getRatingVotes() as $vote ) {
|
94 |
+
$ratings[] = $vote->getPercent();
|
95 |
+
}
|
96 |
+
}
|
97 |
+
$avg = array_sum($ratings)/count($ratings);
|
98 |
+
}
|
99 |
+
else
|
100 |
+
{
|
101 |
+
return 'no-rating';
|
102 |
+
}
|
103 |
+
return $avg;
|
104 |
+
}
|
105 |
+
|
106 |
+
static public function getRelatedProducts($productId)
|
107 |
+
{
|
108 |
+
// obtener categorias del producto $productId
|
109 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
110 |
+
$cats = $product->getCategoryIds();
|
111 |
+
|
112 |
+
// buscar todos los productos de las categorias obtenidas
|
113 |
+
$productsInfo = array();
|
114 |
+
$productIds = array();
|
115 |
+
foreach ($cats as $category_id) {
|
116 |
+
$cat = Mage::getModel('catalog/category')->load($category_id) ;
|
117 |
+
|
118 |
+
$collection = $cat->getProductCollection();
|
119 |
+
$collection->addAttributeToFilter('visibility', 4);
|
120 |
+
|
121 |
+
|
122 |
+
//get all products in this category
|
123 |
+
foreach ($collection as $product){
|
124 |
+
if(!in_array($product->getId(), $productIds) && $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED){
|
125 |
+
$productIds[$product->getId()] = $product->getId();
|
126 |
+
$productsInfo[] = self::getProductInfo($product->getId());
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
// retornar array de getProductInfo();
|
132 |
+
return $productsInfo;
|
133 |
+
}
|
134 |
+
|
135 |
+
public function getExtensionVersion() {
|
136 |
+
return (string) Mage::getConfig()->getNode()->modules->LetsSyncroLLC_Oct8ne->version;
|
137 |
+
}
|
138 |
+
|
139 |
+
protected function _remove_http($str)
|
140 |
+
{
|
141 |
+
return preg_replace('#^https?:#', '', $str);
|
142 |
+
}
|
143 |
+
|
144 |
+
/*
|
145 |
+
static public function getOrderReport($from, $to)
|
146 |
+
{
|
147 |
+
// obtener categorias del producto $productId
|
148 |
+
$items = Mage::getModel('oct8ne/orderproducts')->getCollection();
|
149 |
+
return $productsInfo;
|
150 |
+
}
|
151 |
+
*/
|
152 |
+
};
|
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Url.php
CHANGED
@@ -18,9 +18,15 @@
|
|
18 |
}
|
19 |
|
20 |
|
21 |
-
return
|
22 |
-
$this->_getUrl( 'oct8ne/frame/add2cart', $route_params )
|
|
|
23 |
}
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
};
|
26 |
|
18 |
}
|
19 |
|
20 |
|
21 |
+
return $this->_remove_http(
|
22 |
+
$this->_getUrl( 'oct8ne/frame/add2cart', $route_params )
|
23 |
+
);
|
24 |
}
|
25 |
+
|
26 |
+
protected function _remove_http($str)
|
27 |
+
{
|
28 |
+
return preg_replace('#^https?:#', '', $str);
|
29 |
+
}
|
30 |
|
31 |
};
|
32 |
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Package.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Core
|
23 |
+
* @copyright Copyright (c) 2012 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 |
+
class LetsSyncroLLC_Oct8ne_Model_Mage_Package extends Mage_Core_Model_Design_Package
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Declare design package theme params
|
32 |
+
* Polymorph method:
|
33 |
+
* 1) if 1 parameter specified, sets everything to this value
|
34 |
+
* 2) if 2 parameters, treats 1st as key and 2nd as value
|
35 |
+
*
|
36 |
+
* @return Mage_Core_Model_Design_Package
|
37 |
+
*/
|
38 |
+
public function setTheme()
|
39 |
+
{
|
40 |
+
if(Mage::registry('oct8ne') === 1)
|
41 |
+
return $this;
|
42 |
+
|
43 |
+
switch (func_num_args()) {
|
44 |
+
case 1:
|
45 |
+
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
|
46 |
+
$this->_theme[$type] = func_get_arg(0);
|
47 |
+
}
|
48 |
+
break;
|
49 |
+
|
50 |
+
case 2:
|
51 |
+
$this->_theme[func_get_arg(0)] = func_get_arg(1);
|
52 |
+
break;
|
53 |
+
|
54 |
+
default:
|
55 |
+
throw Mage::exception(Mage::helper('core')->__('Wrong number of arguments for %s', __METHOD__));
|
56 |
+
}
|
57 |
+
return $this;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Set package name
|
62 |
+
* In case of any problem, the default will be set.
|
63 |
+
*
|
64 |
+
* @param string $name
|
65 |
+
* @return Mage_Core_Model_Design_Package
|
66 |
+
*/
|
67 |
+
public function setPackageName($name = '')
|
68 |
+
{
|
69 |
+
if(Mage::registry('oct8ne') === 1)
|
70 |
+
return $this;
|
71 |
+
|
72 |
+
return parent::setPackageName($name);
|
73 |
+
}
|
74 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Request.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LetsSyncroLLC_Oct8ne_Model_Mage_Request extends Mage_Core_Model_Url_Rewrite_Request
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Add location header and disable browser page caching
|
6 |
+
*
|
7 |
+
* @param string $url
|
8 |
+
* @param bool $isPermanent
|
9 |
+
*/
|
10 |
+
/*
|
11 |
+
protected function _sendRedirectHeaders($url, $isPermanent = false)
|
12 |
+
{
|
13 |
+
/ *
|
14 |
+
if ($isPermanent) {
|
15 |
+
header('HTTP/1.1 301 Moved Permanently');
|
16 |
+
}
|
17 |
+
|
18 |
+
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
|
19 |
+
header('Pragma: no-cache');
|
20 |
+
header('Location: ' . $url);
|
21 |
+
exit;
|
22 |
+
* /
|
23 |
+
|
24 |
+
if(Mage::registry('oct8ne_rewrite') === 1)
|
25 |
+
return false;
|
26 |
+
|
27 |
+
return parent::_sendRedirectHeaders($url, $isPermanent);
|
28 |
+
}
|
29 |
+
*/
|
30 |
+
|
31 |
+
public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Controller_Response_Http $response=null)
|
32 |
+
{
|
33 |
+
if(Mage::registry('oct8ne_rewrite') === 1)
|
34 |
+
return false;
|
35 |
+
|
36 |
+
return parent::rewrite($request, $response);
|
37 |
+
}
|
38 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Mage/Rewrite.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class LetsSyncroLLC_Oct8ne_Model_Mage_Rewrite extends Mage_Core_Model_Url_Rewrite
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Implement logic of custom rewrites
|
7 |
+
*
|
8 |
+
* @param Zend_Controller_Request_Http $request
|
9 |
+
* @param Zend_Controller_Response_Http $response
|
10 |
+
* @return Mage_Core_Model_Url
|
11 |
+
*/
|
12 |
+
public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Controller_Response_Http $response=null)
|
13 |
+
{
|
14 |
+
if(Mage::registry('oct8ne_rewrite') === 1)
|
15 |
+
return false;
|
16 |
+
|
17 |
+
return parent::rewrite($request, $response);
|
18 |
+
}
|
19 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Mysql4/Quoteproducts.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LetsSyncroLLC_Oct8ne_Model_Mysql4_Quoteproducts extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('oct8ne/quoteproducts', 'quoteproducts_id');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Mysql4/Quoteproducts/Collection.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LetsSyncroLLC_Oct8ne_Model_Mysql4_Quoteproducts_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
//parent::__construct();
|
7 |
+
$this->_init('oct8ne/quoteproducts');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Observer.php
CHANGED
@@ -1,125 +1,185 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class LetsSyncroLLC_Oct8ne_Model_Observer
|
4 |
-
{
|
5 |
-
public function interceptMethod($observer)
|
6 |
-
{
|
7 |
-
$request = $observer->getEvent()->getData('front')->getRequest();
|
8 |
-
|
9 |
-
if(isset($request->oct8ne))
|
10 |
-
{
|
11 |
-
$package = Mage::getStoreConfig('design/oct8nedesign/package');
|
12 |
-
$theme = Mage::getStoreConfig('design/oct8nedesign/theme');
|
13 |
-
|
14 |
-
if(empty($package))
|
15 |
-
$package = "default";
|
16 |
-
|
17 |
-
if(empty($theme))
|
18 |
-
$theme = "oct8ne";
|
19 |
-
|
20 |
-
Mage::getDesign()->setPackageName($package);
|
21 |
-
Mage::getDesign()->setTheme($theme);
|
22 |
-
Mage::register('oct8ne', 1);
|
23 |
-
// Mage::getModel('core/url')->setRouteParam('oct8ne', 1);
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
$
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
);
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
$
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
|
106 |
-
|
107 |
-
$
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
$
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class LetsSyncroLLC_Oct8ne_Model_Observer
|
4 |
+
{
|
5 |
+
public function interceptMethod($observer)
|
6 |
+
{
|
7 |
+
$request = $observer->getEvent()->getData('front')->getRequest();
|
8 |
+
|
9 |
+
if(isset($request->oct8ne))
|
10 |
+
{
|
11 |
+
$package = Mage::getStoreConfig('design/oct8nedesign/package');
|
12 |
+
$theme = Mage::getStoreConfig('design/oct8nedesign/theme');
|
13 |
+
|
14 |
+
if(empty($package))
|
15 |
+
$package = "default";
|
16 |
+
|
17 |
+
if(empty($theme))
|
18 |
+
$theme = "oct8ne";
|
19 |
+
|
20 |
+
Mage::getDesign()->setPackageName($package);
|
21 |
+
Mage::getDesign()->setTheme($theme);
|
22 |
+
Mage::register('oct8ne', 1);
|
23 |
+
// Mage::getModel('core/url')->setRouteParam('oct8ne', 1);
|
24 |
+
}
|
25 |
+
|
26 |
+
if(strpos($request->getPathInfo(), '/oct8ne/frame') !== FALSE)
|
27 |
+
{
|
28 |
+
Mage::register('oct8ne_rewrite', 1); // lo usamos para deshabilitar el redirect
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
public function layoutRenderBefore($observer)
|
33 |
+
{
|
34 |
+
$session = Mage::getSingleton('core/session');
|
35 |
+
$logged_in = $session->getData("notify_oct8ne", null);
|
36 |
+
if(!is_null($logged_in))
|
37 |
+
{
|
38 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
39 |
+
|
40 |
+
$session->unsetData("notify_oct8ne");
|
41 |
+
$layout = Mage::getSingleton('core/layout');
|
42 |
+
|
43 |
+
$head = $layout->getBlock('root')->getChild('head');
|
44 |
+
if (is_object($head)) {
|
45 |
+
$head->addItem("script", "oct8ne-notify", <<<EOT
|
46 |
+
function lookForOct8neIFrameLoaded() {
|
47 |
+
var iframe = document.getElementById( 'oct8ne-iframe-return' );
|
48 |
+
if ( iframe == null )
|
49 |
+
setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
|
50 |
+
else {
|
51 |
+
var post_data = {
|
52 |
+
user: {
|
53 |
+
id: {$customer->getId()},
|
54 |
+
firstName: "{$customer->getFirstname()}",
|
55 |
+
lastName: "{$customer->getLastname()}",
|
56 |
+
email: "{$customer->getEmail()}"
|
57 |
+
}
|
58 |
+
};
|
59 |
+
iframe.contentWindow.postMessage( JSON.stringify(post_data), '*' );
|
60 |
+
}
|
61 |
+
};
|
62 |
+
lookForOct8neIFrameLoaded();
|
63 |
+
EOT
|
64 |
+
);
|
65 |
+
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
$logged_out = $session->getData("notify_oct8ne_logout", null);
|
70 |
+
if(!is_null($logged_out))
|
71 |
+
{
|
72 |
+
// $customer = Mage::getSingleton('customer/session')->getCustomer();
|
73 |
+
|
74 |
+
$session->unsetData("notify_oct8ne_logout");
|
75 |
+
$layout = Mage::getSingleton('core/layout');
|
76 |
+
|
77 |
+
$head = $layout->getBlock('root')->getChild('head');
|
78 |
+
if (is_object($head)) {
|
79 |
+
$head->addItem("script", "oct8ne-notify", <<<EOT
|
80 |
+
function lookForOct8neIFrameLoaded() {
|
81 |
+
var iframe = document.getElementById( 'oct8ne-iframe-return' );
|
82 |
+
if ( iframe == null )
|
83 |
+
setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
|
84 |
+
else
|
85 |
+
iframe.contentWindow.postMessage( 'logout', '*' );
|
86 |
+
}
|
87 |
+
lookForOct8neIFrameLoaded();
|
88 |
+
EOT
|
89 |
+
);
|
90 |
+
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get checkout session model instance
|
97 |
+
*
|
98 |
+
* @return Mage_Checkout_Model_Session
|
99 |
+
*/
|
100 |
+
protected function _getSession() { return Mage::getSingleton('checkout/session'); }
|
101 |
+
|
102 |
+
public function placeOrderBefore($observer)
|
103 |
+
{
|
104 |
+
$order = $observer->getEvent()->getOrder();
|
105 |
+
$oct8ne_products = $this->_getSession()->getOct8neProducts();
|
106 |
+
if(!is_array($oct8ne_products))
|
107 |
+
$oct8ne_products = array();
|
108 |
+
|
109 |
+
$items = $order->getAllItems();
|
110 |
+
foreach($items as $item)
|
111 |
+
{
|
112 |
+
$product = $item->getProduct();
|
113 |
+
$qty = $item->getQtyOrdered();
|
114 |
+
/*
|
115 |
+
foreach($oct8ne_products as $op)
|
116 |
+
{
|
117 |
+
$found = false;
|
118 |
+
if($op->getId() == $product->getId())
|
119 |
+
$found = true;
|
120 |
+
}
|
121 |
+
*/
|
122 |
+
$found = in_array($product->getId(), $oct8ne_products);
|
123 |
+
$session = Mage::getModel('core/cookie')->get('oct8ne-session');
|
124 |
+
|
125 |
+
$model = Mage::getModel('oct8ne/orderproducts');
|
126 |
+
$model->setOrderId($order->getId());
|
127 |
+
$model->setCustomerId($order->getCustomerId());
|
128 |
+
$model->setProductId($product->getId());
|
129 |
+
$model->setProductPrice($product->getPrice());
|
130 |
+
$model->setOrderPrice($order->getGrandTotal());
|
131 |
+
$model->setCreatedAt($order->getCreatedAt());
|
132 |
+
// $model->setOct8ne($found?'Y':'N');
|
133 |
+
$model->setOct8ne($session);
|
134 |
+
$model->setQty($qty);
|
135 |
+
$model->setCurrency($order->getOrderCurrency()->getCode());
|
136 |
+
$model->save();
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
public function saveQuoteAfter($observer)
|
141 |
+
{
|
142 |
+
$quote = $observer->getEvent()->getQuote();
|
143 |
+
// Eliminar los datos anteriores
|
144 |
+
foreach (Mage::getModel('oct8ne/quoteproducts')->getCollection()->addFilter('quote_id', $quote->getId()) as $ccitem) {
|
145 |
+
$ccitem->delete();
|
146 |
+
}
|
147 |
+
|
148 |
+
// Añadir los nuevos
|
149 |
+
$items = $quote->getAllItems();
|
150 |
+
foreach($items as $item)
|
151 |
+
{
|
152 |
+
$product = $item->getProduct();
|
153 |
+
$qty = $item->getQty();
|
154 |
+
|
155 |
+
$session = Mage::getModel('core/cookie')->get('oct8ne-session');
|
156 |
+
|
157 |
+
$model = Mage::getModel('oct8ne/quoteproducts');
|
158 |
+
$model->setQuoteId($quote->getId());
|
159 |
+
$model->setCustomerId($quote->getCustomerId());
|
160 |
+
$model->setProductId($product->getId());
|
161 |
+
$model->setProductPrice($product->getPrice());
|
162 |
+
$model->setQuotePrice($quote->getGrandTotal());
|
163 |
+
$model->setCreatedAt($quote->getCreatedAt());
|
164 |
+
$model->setOct8ne($session);
|
165 |
+
$model->setQty($qty);
|
166 |
+
$model->setCurrency($quote->getQuoteCurrencyCode());
|
167 |
+
$model->save();
|
168 |
+
|
169 |
+
// echo $order->getOrderCurrency()->getCode(); /* $item['oct8ne']; */
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
public function checkDomainPolicyHeader($observer)
|
174 |
+
{
|
175 |
+
if(Mage::registry('oct8ne') === 1 || Mage::registry('oct8ne_rewrite') === 1)
|
176 |
+
{
|
177 |
+
$action = $observer->getControllerAction();
|
178 |
+
|
179 |
+
$response = $action->getResponse();
|
180 |
+
$response->setHeader('X-Frame-Options', null, true);
|
181 |
+
}
|
182 |
+
|
183 |
+
return $this;
|
184 |
+
}
|
185 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/Model/Quoteproducts.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LetsSyncroLLC_Oct8ne_Model_Quoteproducts extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('oct8ne/quoteproducts');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/controllers/AccountController.php
CHANGED
@@ -1,122 +1,131 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(Mage::getModuleDir('controllers','Mage_Customer').DS.'AccountController.php');
|
3 |
-
class LetsSyncroLLC_Oct8ne_AccountController extends Mage_Customer_AccountController
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Define target URL and redirect customer after logging in
|
7 |
-
*/
|
8 |
-
protected function _loginPostRedirect()
|
9 |
-
{
|
10 |
-
if(!is_null(Mage::registry('oct8ne')))
|
11 |
-
{
|
12 |
-
/*
|
13 |
-
// die("login!!!");
|
14 |
-
|
15 |
-
*/
|
16 |
-
if(Mage::getSingleton('customer/session')->isLoggedIn())
|
17 |
-
{
|
18 |
-
echo <<< EOT
|
19 |
-
<h2 class="add2cart-msg">Logged in</h2>
|
20 |
-
|
21 |
-
<script type="text/javascript">
|
22 |
-
parent.postMessage("loginOK", "*");
|
23 |
-
</script>
|
24 |
-
EOT;
|
25 |
-
die();
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once(Mage::getModuleDir('controllers','Mage_Customer').DS.'AccountController.php');
|
3 |
+
class LetsSyncroLLC_Oct8ne_AccountController extends Mage_Customer_AccountController
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Define target URL and redirect customer after logging in
|
7 |
+
*/
|
8 |
+
protected function _loginPostRedirect()
|
9 |
+
{
|
10 |
+
if(!is_null(Mage::registry('oct8ne')))
|
11 |
+
{
|
12 |
+
/*
|
13 |
+
// die("login!!!");
|
14 |
+
|
15 |
+
*/
|
16 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn())
|
17 |
+
{
|
18 |
+
echo <<< EOT
|
19 |
+
<h2 class="add2cart-msg">Logged in</h2>
|
20 |
+
|
21 |
+
<script type="text/javascript">
|
22 |
+
parent.postMessage("loginOK", "*");
|
23 |
+
</script>
|
24 |
+
EOT;
|
25 |
+
die();
|
26 |
+
} else {
|
27 |
+
echo <<< EOT
|
28 |
+
<h2 class="add2cart-msg">Login failed</h2>
|
29 |
+
|
30 |
+
<script type="text/javascript">
|
31 |
+
parent.postMessage("loginFAIL", "*");
|
32 |
+
</script>
|
33 |
+
EOT;
|
34 |
+
die();
|
35 |
+
}
|
36 |
+
|
37 |
+
// en caso de que no se haga login
|
38 |
+
$this->loadLayout();
|
39 |
+
$this->renderLayout();
|
40 |
+
}
|
41 |
+
else
|
42 |
+
{
|
43 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
44 |
+
|
45 |
+
$session = Mage::getSingleton('core/session');
|
46 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
47 |
+
$url = $session->getBeforeAuthUrl();
|
48 |
+
// if(substr($url, -24) == '/checkout/onepage/index/') <<------------------ activar esto para notificar sólamente en el checkout
|
49 |
+
//Mage::register("notify_oct8ne", $customerData->getId());
|
50 |
+
$session->setData("notify_oct8ne", $customerData->getId());
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
parent::_loginPostRedirect();
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Add welcome message and send new account email.
|
60 |
+
* Returns success URL
|
61 |
+
*
|
62 |
+
* @param Mage_Customer_Model_Customer $customer
|
63 |
+
* @param bool $isJustConfirmed
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
|
67 |
+
{
|
68 |
+
if(!is_null(Mage::registry('oct8ne')))
|
69 |
+
{
|
70 |
+
/*
|
71 |
+
// die("login!!!");
|
72 |
+
|
73 |
+
*/
|
74 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn())
|
75 |
+
{
|
76 |
+
echo <<< EOT
|
77 |
+
<h2 class="add2cart-msg">Logged in</h2>
|
78 |
+
|
79 |
+
<script type="text/javascript">
|
80 |
+
parent.postMessage("loginOK", "*");
|
81 |
+
</script>
|
82 |
+
EOT;
|
83 |
+
die();
|
84 |
+
}
|
85 |
+
|
86 |
+
}
|
87 |
+
else
|
88 |
+
{
|
89 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
90 |
+
|
91 |
+
$session = Mage::getSingleton('core/session');
|
92 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
93 |
+
$url = $session->getBeforeAuthUrl();
|
94 |
+
// if(substr($url, -24) == '/checkout/onepage/index/') <<------------------ activar esto para notificar sólamente en el checkout
|
95 |
+
//Mage::register("notify_oct8ne", $customerData->getId());
|
96 |
+
$session->setData("notify_oct8ne", $customerData->getId());
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
// ent::_loginPostRedirect();
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
return parent::_welcomeCustomer($customer, $isJustConfirmed);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Customer logout action
|
109 |
+
*/
|
110 |
+
/*
|
111 |
+
public function logoutAction()
|
112 |
+
{
|
113 |
+
$session = Mage::getSingleton('core/session');
|
114 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
115 |
+
$session->setData("notify_oct8ne_logout", $customerData->getId());
|
116 |
+
parent::logoutAction();
|
117 |
+
}
|
118 |
+
*/
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Logout success page
|
122 |
+
*/
|
123 |
+
public function logoutSuccessAction()
|
124 |
+
{
|
125 |
+
$session = Mage::getSingleton('core/session');
|
126 |
+
$session->setData("notify_oct8ne_logout", TRUE);
|
127 |
+
parent::logoutSuccessAction();
|
128 |
+
// $this->loadLayout();
|
129 |
+
// $this->renderLayout();
|
130 |
+
}
|
131 |
+
}
|
app/code/community/LetsSyncroLLC/Oct8ne/controllers/FrameController.php
CHANGED
@@ -1,679 +1,810 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Action {
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
$
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
$
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
$
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
//
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$this->
|
102 |
-
|
103 |
-
/**
|
104 |
-
*
|
105 |
-
*/
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
$
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
/**
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
return $
|
176 |
-
}
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
{
|
189 |
-
$
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
$this->getRequest()->
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
$
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
$
|
254 |
-
}
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
$
|
282 |
-
|
283 |
-
|
284 |
-
$
|
285 |
-
$
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
$
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
'
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
}
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
$
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
$
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
$
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
$
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
$
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
*
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
$query->
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
$
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
$
|
548 |
-
|
549 |
-
$
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
$
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
$
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
$this->getRequest()->getParam('
|
584 |
-
);
|
585 |
-
|
586 |
-
Mage::register(
|
587 |
-
'
|
588 |
-
$
|
589 |
-
);
|
590 |
-
|
591 |
-
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
592 |
-
|
593 |
-
$this->loadLayout();
|
594 |
-
$this->renderLayout();
|
595 |
-
}
|
596 |
-
|
597 |
-
public function
|
598 |
-
{
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
$
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
$this->
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
'
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
);
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
);
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
protected function _checkApitoken()
|
6 |
+
{
|
7 |
+
$letssyncromodel = Mage::getModel('oct8ne/letssyncro')->load(1);
|
8 |
+
|
9 |
+
$token = $letssyncromodel->getApitoken();
|
10 |
+
|
11 |
+
$apitoken = $this->getRequest()->getParam('apitoken', null);
|
12 |
+
if($apitoken != $token)
|
13 |
+
die("Access denied.");
|
14 |
+
}
|
15 |
+
|
16 |
+
public function indexAction() {
|
17 |
+
// $this->_checkApitoken();
|
18 |
+
|
19 |
+
$this->loadLayout();
|
20 |
+
$this->renderLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function customerdataAction() {
|
24 |
+
// $this->_checkApitoken();
|
25 |
+
|
26 |
+
$callback = $this->getRequest()->getParam('callback', null);
|
27 |
+
Mage::register( 'callback', $callback );
|
28 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
29 |
+
$this->loadLayout();
|
30 |
+
$this->renderLayout();
|
31 |
+
}
|
32 |
+
|
33 |
+
public function productviewAction() {
|
34 |
+
// Mage::register('oct8ne_rewrite', 1); // lo usamos para deshabilitar el redirect
|
35 |
+
// $this->_checkApitoken();
|
36 |
+
|
37 |
+
// Get initial data from request
|
38 |
+
$categoryId = (int) $this->getRequest()->getParam('category', false);
|
39 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
40 |
+
$specifyOptions = $this->getRequest()->getParam('options');
|
41 |
+
|
42 |
+
// Prepare helper and params
|
43 |
+
$viewHelper = Mage::helper('catalog/product_view');
|
44 |
+
|
45 |
+
$params = new Varien_Object();
|
46 |
+
$params->setCategoryId($categoryId);
|
47 |
+
$params->setSpecifyOptions($specifyOptions);
|
48 |
+
|
49 |
+
// Render page
|
50 |
+
try {
|
51 |
+
$viewHelper->prepareAndRender($productId, $this, $params);
|
52 |
+
} catch (Exception $e) {
|
53 |
+
if ($e->getCode() == $viewHelper->ERR_NO_PRODUCT_LOADED) {
|
54 |
+
if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
|
55 |
+
$this->_redirect('');
|
56 |
+
} elseif (!$this->getResponse()->isRedirect()) {
|
57 |
+
$this->_forward('noRoute');
|
58 |
+
}
|
59 |
+
} else {
|
60 |
+
Mage::logException($e);
|
61 |
+
$this->_forward('noRoute');
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Initialize product instance from request data
|
69 |
+
*
|
70 |
+
* @return Mage_Catalog_Model_Product || false
|
71 |
+
*/
|
72 |
+
protected function _initProduct() {
|
73 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
74 |
+
|
75 |
+
if ($productId) {
|
76 |
+
$product = Mage::getModel('catalog/product')
|
77 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
78 |
+
->load($productId);
|
79 |
+
if ($product->getId())
|
80 |
+
return $product;
|
81 |
+
}
|
82 |
+
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function add2cartAction() {
|
87 |
+
// $this->_checkApitoken();
|
88 |
+
|
89 |
+
|
90 |
+
$cart = $this->_getCart();
|
91 |
+
$params = $this->getRequest()->getParams();
|
92 |
+
try {
|
93 |
+
if (isset($params['qty'])) {
|
94 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
95 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
96 |
+
);
|
97 |
+
$params['qty'] = $filter->filter($params['qty']);
|
98 |
+
}
|
99 |
+
|
100 |
+
$product = $this->_initProduct();
|
101 |
+
$related = $this->getRequest()->getParam('related_product');
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Check product availability
|
105 |
+
*/
|
106 |
+
if ( !$product ) {
|
107 |
+
$this->_goBack();
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
$cart->addProduct($product, $params);
|
112 |
+
|
113 |
+
if (!empty($related)) {
|
114 |
+
$cart->addProductsByIds(explode(',', $related));
|
115 |
+
}
|
116 |
+
|
117 |
+
$cart->save();
|
118 |
+
|
119 |
+
$this->_getSession()->setCartWasUpdated(true);
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @todo remove wishlist observer processAddToCart
|
123 |
+
*/
|
124 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete',
|
125 |
+
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
126 |
+
);
|
127 |
+
|
128 |
+
if (!$cart->getQuote()->getHasError()){
|
129 |
+
$products = $this->_getSession()->getOct8neProducts();
|
130 |
+
if(!is_array($products))
|
131 |
+
$products = array();
|
132 |
+
$products[] = $product->getId();
|
133 |
+
$this->_getSession()->setOct8neProducts($products);
|
134 |
+
|
135 |
+
// Este mensaje se deshabilita porque sale a destiempo, cuando el parámetro no sea oct8ne
|
136 |
+
// $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
|
137 |
+
// $this->_getSession()->addSuccess($message);
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
$this->loadLayout();
|
142 |
+
$this->renderLayout();
|
143 |
+
|
144 |
+
} catch (Mage_Core_Exception $e) {
|
145 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
146 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
147 |
+
} else {
|
148 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
149 |
+
foreach ($messages as $message)
|
150 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
151 |
+
}
|
152 |
+
|
153 |
+
} catch (Exception $e) {
|
154 |
+
// $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
155 |
+
Mage::logException($e);
|
156 |
+
$this->_goBack();
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Retrieve child categories of current category
|
163 |
+
*
|
164 |
+
* @return Varien_Data_Tree_Node_Collection
|
165 |
+
*/
|
166 |
+
public function getCurrentChildCategories()
|
167 |
+
{
|
168 |
+
$layer = Mage::getSingleton('catalog/layer');
|
169 |
+
$category = $layer->getCurrentCategory();
|
170 |
+
/* @var $category Mage_Catalog_Model_Category */
|
171 |
+
$categories = $category->getChildrenCategories();
|
172 |
+
$productCollection = Mage::getResourceModel('catalog/product_collection');
|
173 |
+
$layer->prepareProductCollection($productCollection);
|
174 |
+
$productCollection->addCountToCategories($categories);
|
175 |
+
return $categories;
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Retrieve request object
|
181 |
+
*
|
182 |
+
* @return Mage_Core_Controller_Request_Http
|
183 |
+
* @throws Exception
|
184 |
+
*/
|
185 |
+
public function getRequest()
|
186 |
+
{
|
187 |
+
$controller = Mage::app()->getFrontController();
|
188 |
+
if ($controller) {
|
189 |
+
$this->_request = $controller->getRequest();
|
190 |
+
} else {
|
191 |
+
throw new Exception(Mage::helper('core')->__("Can't retrieve request object"));
|
192 |
+
}
|
193 |
+
return $this->_request;
|
194 |
+
}
|
195 |
+
|
196 |
+
protected function searchAction()
|
197 |
+
{
|
198 |
+
// $this->_checkApitoken();
|
199 |
+
|
200 |
+
$search_criteria = $this->getRequest()->getParam('search', null);
|
201 |
+
$search_order = $this->getRequest()->getParam('orderby', null);
|
202 |
+
$search_dir = $this->getRequest()->getParam('dir', null);
|
203 |
+
|
204 |
+
$storeId = $this->getRequest()->getParam('store', null);
|
205 |
+
$currency = $this->getRequest()->getParam('currency', null);
|
206 |
+
|
207 |
+
if(is_null($storeId))
|
208 |
+
{
|
209 |
+
$storeId = Mage::app()->getStore()->getId();
|
210 |
+
$initialEnvironmentInfo = null;
|
211 |
+
}
|
212 |
+
else
|
213 |
+
{
|
214 |
+
$appEmulation = Mage::getSingleton('core/app_emulation');
|
215 |
+
// Start environment emulation of the specified store
|
216 |
+
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
|
217 |
+
}
|
218 |
+
|
219 |
+
$currentCurrency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
220 |
+
if(!is_null($currency))
|
221 |
+
Mage::app()->getStore()->setCurrentCurrencyCode($currency);
|
222 |
+
|
223 |
+
$callback = $this->getRequest()->getParam('callback', null);
|
224 |
+
$this->getRequest()->setParam('q', $search_criteria);
|
225 |
+
|
226 |
+
if(is_null($search_criteria) || strlen($search_criteria)==0){
|
227 |
+
//passem totes les dades buides per tal que no mostri resultats
|
228 |
+
Mage::register('total_search_results', 0);
|
229 |
+
Mage::register('search_result_collection', array());
|
230 |
+
Mage::register('partial_search', false);
|
231 |
+
Mage::register('callback', $callback);
|
232 |
+
Mage::register('search_result_attrs', array());
|
233 |
+
Mage::register('search_result_attrs_applied', array());
|
234 |
+
Mage::register('search_result_attrs_available', array());
|
235 |
+
|
236 |
+
Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
|
237 |
+
|
238 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
239 |
+
|
240 |
+
$this->loadLayout();
|
241 |
+
$this->renderLayout();
|
242 |
+
return ;
|
243 |
+
|
244 |
+
}
|
245 |
+
// $this->getRequest()->setParam('order', $search_sort);
|
246 |
+
// $this->getRequest()->setParam('dir', $search_order);
|
247 |
+
|
248 |
+
// de esto se encarga Magento $search_criteria = Mage::helper('core/string')->cleanString( $search_criteria );
|
249 |
+
//die(Mage::app()->getStore()->getId());
|
250 |
+
$query = Mage::helper('catalogsearch')->getQuery();
|
251 |
+
$query->setStoreId($storeId);
|
252 |
+
if ($query->getId()) {
|
253 |
+
$query->setPopularity($query->getPopularity()+1);
|
254 |
+
}
|
255 |
+
else {
|
256 |
+
$query->setPopularity(1);
|
257 |
+
}
|
258 |
+
$query->prepare();
|
259 |
+
Mage::helper('catalogsearch')->checkNotes();
|
260 |
+
|
261 |
+
$query = Mage::getModel('catalogsearch/layer');
|
262 |
+
|
263 |
+
|
264 |
+
|
265 |
+
$filterableAttributes = $query->getFilterableAttributes();
|
266 |
+
$attrs = array();
|
267 |
+
|
268 |
+
if(!empty($filterableAttributes))
|
269 |
+
{
|
270 |
+
$tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();
|
271 |
+
$tmp->SetAttributeCode('category');
|
272 |
+
$tmp->setFrontendLabel('Category');
|
273 |
+
$filterableAttributes->addItem($tmp);
|
274 |
+
}
|
275 |
+
// $filterableAttributes[] =
|
276 |
+
// category
|
277 |
+
|
278 |
+
foreach ($filterableAttributes as $attribute)
|
279 |
+
{
|
280 |
+
$code = $attribute->getAttributeCode();
|
281 |
+
$name = $attribute->getFrontendLabel();
|
282 |
+
|
283 |
+
// INIT
|
284 |
+
$items = array();
|
285 |
+
switch($code)
|
286 |
+
{
|
287 |
+
case 'price':
|
288 |
+
$_filterModelName = "catalog/layer_filter_price";
|
289 |
+
break;
|
290 |
+
case 'decimal':
|
291 |
+
$_filterModelName = "catalog/layer_filter_decimal";
|
292 |
+
break;
|
293 |
+
case 'category':
|
294 |
+
$_filterModelName = "catalog/layer_filter_category";
|
295 |
+
break;
|
296 |
+
default:
|
297 |
+
$_filterModelName = "catalog/layer_filter_attribute";
|
298 |
+
break;
|
299 |
+
}
|
300 |
+
|
301 |
+
$filter = Mage::getModel($_filterModelName)
|
302 |
+
->setLayer($query)
|
303 |
+
->setAttributeModel($attribute);
|
304 |
+
$filter->apply($this->getRequest(), $this);
|
305 |
+
$items = $filter->getItems();
|
306 |
+
// INIT
|
307 |
+
|
308 |
+
// En los filtros aplicados no nos viene el nombre, solo el id, lo obtenemos aqui
|
309 |
+
$optionId = $this->getRequest()->getParam($filter->getRequestVar());
|
310 |
+
$featurename = "";
|
311 |
+
if(!is_null($optionId)) {
|
312 |
+
switch($code)
|
313 |
+
{
|
314 |
+
case 'price':
|
315 |
+
$featurename = $this->getRequest()->get($code);
|
316 |
+
break;
|
317 |
+
case 'decimal':
|
318 |
+
$featurename = $this->getRequest()->get($code);
|
319 |
+
break;
|
320 |
+
case 'category':
|
321 |
+
$featurename = $filter->getCategory()->getName();
|
322 |
+
break;
|
323 |
+
default:
|
324 |
+
$featurename = $filter->getAttributeModel()->getFrontend()->getOption($optionId);
|
325 |
+
break;
|
326 |
+
}
|
327 |
+
|
328 |
+
}
|
329 |
+
|
330 |
+
$options = array();
|
331 |
+
foreach($items as $item)
|
332 |
+
{
|
333 |
+
if($item->getCount() > 0)
|
334 |
+
$options[] = array("label" => $item->getLabel(), "value" => $item->getValue(), "qty" => $item->getCount());
|
335 |
+
}
|
336 |
+
|
337 |
+
$attrs[] = array(
|
338 |
+
'code' => $code,
|
339 |
+
'name' => $name,
|
340 |
+
'options' => $options,
|
341 |
+
'featurename' => $featurename
|
342 |
+
);
|
343 |
+
}
|
344 |
+
|
345 |
+
$attrs_applied = array();
|
346 |
+
$attrs_available = array();
|
347 |
+
foreach($attrs as $attr)
|
348 |
+
{
|
349 |
+
if(!is_null($this->getRequest()->getParam($attr['code'])))
|
350 |
+
{
|
351 |
+
$attr['value'] = $this->getRequest()->getParam($attr['code']);
|
352 |
+
$attrs_applied[] = $attr;
|
353 |
+
}
|
354 |
+
else
|
355 |
+
{
|
356 |
+
$attrs_available[] = $attr;
|
357 |
+
}
|
358 |
+
/*
|
359 |
+
if($this->getRequest()
|
360 |
+
$attrs[] = array(
|
361 |
+
'code' => $code,
|
362 |
+
'name' => $name,
|
363 |
+
'options' => $options
|
364 |
+
);
|
365 |
+
*/
|
366 |
+
}
|
367 |
+
|
368 |
+
|
369 |
+
$result_collection = $query->getProductCollection();
|
370 |
+
|
371 |
+
$order = Mage::getSingleton('catalog/session')->getSortOrder();
|
372 |
+
$dir = Mage::getSingleton('catalog/session')->getSortDirection();
|
373 |
+
|
374 |
+
if(!$order)
|
375 |
+
$order = "relevance"; // Mage::getStoreConfig( Mage_Catalog_Model_Config::XML_PATH_LIST_DEFAULT_SORT_BY );
|
376 |
+
if(!$dir)
|
377 |
+
$dir = "asc";
|
378 |
+
|
379 |
+
|
380 |
+
if($search_order)
|
381 |
+
{
|
382 |
+
if(!$search_dir)
|
383 |
+
$search_dir = "asc";
|
384 |
+
$result_collection->setOrder($search_order, $search_dir);
|
385 |
+
} else if ($order) {
|
386 |
+
$result_collection->setOrder($order, $dir);
|
387 |
+
}
|
388 |
+
|
389 |
+
Mage::register( 'total_search_results', $result_collection->count() );
|
390 |
+
|
391 |
+
|
392 |
+
/*
|
393 |
+
$_categories = $this->getCurrentChildCategories();
|
394 |
+
foreach ($_categories as $_category)
|
395 |
+
{
|
396 |
+
if($_category->getIsActive())
|
397 |
+
{
|
398 |
+
|
399 |
+
}
|
400 |
+
}
|
401 |
+
*/
|
402 |
+
|
403 |
+
$currency = Mage::helper('oct8ne/customer_data')->getCurrency();
|
404 |
+
$v = array();
|
405 |
+
if ( is_numeric( $this->getRequest()->getParam('start') ) )
|
406 |
+
$start = $this->getRequest()->getParam('start');
|
407 |
+
else
|
408 |
+
$start = 0;
|
409 |
+
if ( is_numeric( $this->getRequest()->getParam('items') ) )
|
410 |
+
$items = $this->getRequest()->getParam('items');
|
411 |
+
else
|
412 |
+
$items = 10;
|
413 |
+
|
414 |
+
$new_collection = array();
|
415 |
+
$i0 = $start;
|
416 |
+
$i1 = $i0 + $items;
|
417 |
+
$i = 0;
|
418 |
+
foreach( $result_collection as $item ) {
|
419 |
+
if ( $i >= $i0 && $i < $i1 )
|
420 |
+
$new_collection[] = $item;
|
421 |
+
$i++;
|
422 |
+
}
|
423 |
+
$result_collection = $new_collection;
|
424 |
+
|
425 |
+
foreach( $result_collection as $item ) {
|
426 |
+
$id = $item->getId();
|
427 |
+
/*
|
428 |
+
$product = Mage::getModel('catalog/product')->load( $id );
|
429 |
+
$description = str_replace( array("\r\n", "\n", "\r"), "\\n", htmlentities ($product->getDescription()) );
|
430 |
+
$vi = array(
|
431 |
+
'id' => $product->getId(),
|
432 |
+
'title' => htmlentities( $product->getName() ),
|
433 |
+
// 'price' => sprintf( "%.02f$currency", is_numeric($product->getSpecialPrice()) ? $product->getSpecialPrice() : $product->getPrice() ),
|
434 |
+
'price' => number_format($product->getFinalPrice(), '2', '.', ','),
|
435 |
+
'description' => $description,
|
436 |
+
'url' => Mage::helper('oct8ne')->getProductFullUrl( $product ),
|
437 |
+
'imgs' => Mage::helper('oct8ne')->getProductImagesUrl( $product ),
|
438 |
+
'thumbnail' => Mage::helper('oct8ne')->getProductThumbnail( $product, 120 )
|
439 |
+
);
|
440 |
+
$v[] = $vi;
|
441 |
+
*/
|
442 |
+
$v[] = Mage::helper('oct8ne')->getProductInfo($id);
|
443 |
+
}
|
444 |
+
|
445 |
+
Mage::register( 'search_result_collection', $v );
|
446 |
+
Mage::register( 'partial_search', false );
|
447 |
+
Mage::register( 'callback', $callback );
|
448 |
+
Mage::register( 'search_result_attrs', $attrs );
|
449 |
+
Mage::register( 'search_result_attrs_applied', $attrs_applied );
|
450 |
+
Mage::register( 'search_result_attrs_available', $attrs_available );
|
451 |
+
|
452 |
+
if(!is_null($initialEnvironmentInfo))
|
453 |
+
{
|
454 |
+
//Stop environment emulation and restore original store
|
455 |
+
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
|
456 |
+
}
|
457 |
+
|
458 |
+
Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
|
459 |
+
|
460 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
461 |
+
|
462 |
+
$this->loadLayout();
|
463 |
+
$this->renderLayout();
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Get checkout session model instance
|
468 |
+
*
|
469 |
+
* @return Mage_Checkout_Model_Session
|
470 |
+
*/
|
471 |
+
protected function _getSession() { return Mage::getSingleton('checkout/session'); }
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Set back redirect url to response
|
475 |
+
*
|
476 |
+
* @return Mage_Checkout_CartController
|
477 |
+
*/
|
478 |
+
protected function _goBack() {
|
479 |
+
$returnUrl = $this->getRequest()->getParam('return_url');
|
480 |
+
if ( $returnUrl ) {
|
481 |
+
|
482 |
+
if (!$this->_isUrlInternal($returnUrl))
|
483 |
+
throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
|
484 |
+
|
485 |
+
$this->_getSession()->getMessages(true);
|
486 |
+
$this->getResponse()->setRedirect($returnUrl);
|
487 |
+
|
488 |
+
} elseif ( $backUrl = $this->_getRefererUrl() )
|
489 |
+
$this->getResponse()->setRedirect($backUrl);
|
490 |
+
|
491 |
+
return $this;
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Retrieve shopping cart model object
|
496 |
+
*
|
497 |
+
* @return Mage_Checkout_Model_Cart
|
498 |
+
*/
|
499 |
+
protected function _getCart() { return Mage::getSingleton('checkout/cart'); }
|
500 |
+
|
501 |
+
public function search2Action() {
|
502 |
+
// $this->_checkApitoken();
|
503 |
+
|
504 |
+
$query = Mage::helper('oct8ne/search')->getQuery();
|
505 |
+
/* @var $query Mage_CatalogSearch_Model_Query */
|
506 |
+
|
507 |
+
$query->setStoreId(Mage::app()->getStore()->getId());
|
508 |
+
|
509 |
+
if ($query->getQueryText() != '') {
|
510 |
+
if (Mage::helper('catalogsearch')->isMinQueryLength())
|
511 |
+
$query->setId(0)
|
512 |
+
->setIsActive(1)
|
513 |
+
->setIsProcessed(1);
|
514 |
+
else {
|
515 |
+
if ($query->getId())
|
516 |
+
$query->setPopularity($query->getPopularity()+1);
|
517 |
+
else
|
518 |
+
$query->setPopularity(1);
|
519 |
+
|
520 |
+
if ($query->getRedirect()) {
|
521 |
+
$query->save();
|
522 |
+
$this->getResponse()->setRedirect($query->getRedirect());
|
523 |
+
return;
|
524 |
+
} else
|
525 |
+
$query->prepare();
|
526 |
+
}
|
527 |
+
|
528 |
+
Mage::helper('catalogsearch')->checkNotes();
|
529 |
+
|
530 |
+
$this->loadLayout();
|
531 |
+
$this->_initLayoutMessages('catalog/session');
|
532 |
+
$this->_initLayoutMessages('checkout/session');
|
533 |
+
$this->renderLayout();
|
534 |
+
|
535 |
+
if (!Mage::helper('catalogsearch')->isMinQueryLength())
|
536 |
+
$query->save();
|
537 |
+
}
|
538 |
+
|
539 |
+
}
|
540 |
+
|
541 |
+
public function getcartAction()
|
542 |
+
{
|
543 |
+
// $this->_checkApitoken();
|
544 |
+
|
545 |
+
$callback = $this->getRequest()->getParam('callback', null);
|
546 |
+
|
547 |
+
$result = array();
|
548 |
+
$cart = $this->_getCart();
|
549 |
+
foreach($cart->getItems() as $item)
|
550 |
+
{
|
551 |
+
$product = $item->getProduct();
|
552 |
+
$qty = $item->getQty();
|
553 |
+
$type = $product->getTypeId();
|
554 |
+
|
555 |
+
if($type == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
|
556 |
+
|| $type == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL
|
557 |
+
) {
|
558 |
+
$result[] = Mage::helper('oct8ne')->getProductInfo($product->getId(), $qty); /*array(
|
559 |
+
'id' => $product->getId(),
|
560 |
+
'title' => $product->getName(),
|
561 |
+
'price' => number_format($product->getFinalPrice(), '2', '.', ','),
|
562 |
+
'qty' => $qty);*/
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
|
567 |
+
Mage::register( 'cart', $result );
|
568 |
+
Mage::register( 'callback', $callback );
|
569 |
+
|
570 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
571 |
+
|
572 |
+
$this->loadLayout();
|
573 |
+
$this->renderLayout();
|
574 |
+
}
|
575 |
+
|
576 |
+
|
577 |
+
public function getwishlistAction()
|
578 |
+
{
|
579 |
+
// $this->_checkApitoken();
|
580 |
+
|
581 |
+
Mage::register(
|
582 |
+
'callback',
|
583 |
+
$this->getRequest()->getParam('callback', null)
|
584 |
+
);
|
585 |
+
|
586 |
+
Mage::register(
|
587 |
+
'oct8ne_customer_id',
|
588 |
+
$this->getRequest()->getParam('customer', null)
|
589 |
+
);
|
590 |
+
|
591 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
592 |
+
|
593 |
+
$this->loadLayout();
|
594 |
+
$this->renderLayout();
|
595 |
+
}
|
596 |
+
|
597 |
+
public function addtowishlistAction()
|
598 |
+
{
|
599 |
+
// $this->_checkApitoken();
|
600 |
+
|
601 |
+
Mage::register(
|
602 |
+
'callback',
|
603 |
+
$this->getRequest()->getParam('callback', null)
|
604 |
+
);
|
605 |
+
|
606 |
+
$api = Mage::helper( 'oct8ne/wishlist' );
|
607 |
+
|
608 |
+
$result = $api->addToWishlist(
|
609 |
+
$this->getRequest()->getParam('product', null),
|
610 |
+
$this->getRequest()->getParam('customer', null)
|
611 |
+
);
|
612 |
+
|
613 |
+
Mage::register(
|
614 |
+
'oct8ne_result',
|
615 |
+
$result
|
616 |
+
);
|
617 |
+
|
618 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
619 |
+
|
620 |
+
$this->loadLayout();
|
621 |
+
$this->renderLayout();
|
622 |
+
}
|
623 |
+
|
624 |
+
public function removefromwishlistAction()
|
625 |
+
{
|
626 |
+
// $this->_checkApitoken();
|
627 |
+
|
628 |
+
Mage::register(
|
629 |
+
'callback',
|
630 |
+
$this->getRequest()->getParam('callback', null)
|
631 |
+
);
|
632 |
+
|
633 |
+
$api = Mage::helper( 'oct8ne/wishlist' );
|
634 |
+
|
635 |
+
$result = $api->removeFromWishlist(
|
636 |
+
$this->getRequest()->getParam('product', null),
|
637 |
+
$this->getRequest()->getParam('customer', null)
|
638 |
+
);
|
639 |
+
|
640 |
+
Mage::register(
|
641 |
+
'oct8ne_result',
|
642 |
+
$result
|
643 |
+
);
|
644 |
+
|
645 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
646 |
+
|
647 |
+
$this->loadLayout();
|
648 |
+
$this->renderLayout();
|
649 |
+
}
|
650 |
+
|
651 |
+
public function productInfoAction()
|
652 |
+
{
|
653 |
+
// $this->_checkApitoken();
|
654 |
+
|
655 |
+
Mage::register(
|
656 |
+
'callback',
|
657 |
+
$this->getRequest()->getParam('callback', null)
|
658 |
+
);
|
659 |
+
|
660 |
+
Mage::register(
|
661 |
+
'oct8ne_product_id',
|
662 |
+
$this->getRequest()->getParam('id', null)
|
663 |
+
);
|
664 |
+
|
665 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
666 |
+
|
667 |
+
$this->loadLayout();
|
668 |
+
$this->renderLayout();
|
669 |
+
}
|
670 |
+
|
671 |
+
public function productRelatedAction()
|
672 |
+
{
|
673 |
+
// $this->_checkApitoken();
|
674 |
+
|
675 |
+
Mage::register(
|
676 |
+
'callback',
|
677 |
+
$this->getRequest()->getParam('callback', null)
|
678 |
+
);
|
679 |
+
|
680 |
+
Mage::register(
|
681 |
+
'oct8ne_product_id',
|
682 |
+
$this->getRequest()->getParam('id', null)
|
683 |
+
);
|
684 |
+
|
685 |
+
|
686 |
+
if ( is_numeric( $this->getRequest()->getParam('start') ) )
|
687 |
+
$start = $this->getRequest()->getParam('start',0);
|
688 |
+
else
|
689 |
+
$start = 0;
|
690 |
+
|
691 |
+
if ( is_numeric( $this->getRequest()->getParam('items') ) )
|
692 |
+
$items = $this->getRequest()->getParam('items',10);
|
693 |
+
else
|
694 |
+
$items = 10;
|
695 |
+
|
696 |
+
|
697 |
+
Mage::register(
|
698 |
+
'oct8ne_product_related_num_items',
|
699 |
+
$items
|
700 |
+
);
|
701 |
+
|
702 |
+
Mage::register(
|
703 |
+
'oct8ne_product_related_start',
|
704 |
+
$start
|
705 |
+
);
|
706 |
+
|
707 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
708 |
+
|
709 |
+
$this->loadLayout();
|
710 |
+
$this->renderLayout();
|
711 |
+
}
|
712 |
+
|
713 |
+
|
714 |
+
|
715 |
+
protected function resizeImg($fileName, $width, $height = null)
|
716 |
+
{
|
717 |
+
$folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
718 |
+
$imageURL = $folderURL . $fileName;
|
719 |
+
|
720 |
+
$basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . $fileName;
|
721 |
+
$newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "resized" . DS . $width . DS . $fileName;
|
722 |
+
//if width empty then return original size image's URL
|
723 |
+
if ($width != '') {
|
724 |
+
//if image has already resized then just return URL
|
725 |
+
if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
|
726 |
+
$imageObj = new Varien_Image($basePath);
|
727 |
+
if($imageObj->getOriginalWidth() <= $width)
|
728 |
+
return $basePath;
|
729 |
+
$imageObj->constrainOnly(TRUE);
|
730 |
+
$imageObj->keepAspectRatio(FALSE);
|
731 |
+
$imageObj->keepFrame(FALSE);
|
732 |
+
$imageObj->resize($width, $height);
|
733 |
+
$imageObj->save($newPath);
|
734 |
+
}
|
735 |
+
$resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "resized" . DS . $fileName;
|
736 |
+
} else {
|
737 |
+
$resizedURL = $imageURL;
|
738 |
+
}
|
739 |
+
return $newPath; // $resizedURL;
|
740 |
+
}
|
741 |
+
|
742 |
+
public function imageAction()
|
743 |
+
{
|
744 |
+
// $this->_checkApitoken();
|
745 |
+
|
746 |
+
$base = Mage::getBaseDir('media');
|
747 |
+
$file = $this->getRequest()->getParam('file', null);
|
748 |
+
$width = $this->getRequest()->getParam('width', null);
|
749 |
+
|
750 |
+
if($width == null)
|
751 |
+
$newfile = "$base/$file";
|
752 |
+
else
|
753 |
+
$newfile = $this->resizeImg($file, $width);
|
754 |
+
|
755 |
+
$mime_types = array(
|
756 |
+
'png' => 'image/png',
|
757 |
+
'jpe' => 'image/jpeg',
|
758 |
+
'jpeg' => 'image/jpeg',
|
759 |
+
'jpg' => 'image/jpeg',
|
760 |
+
'gif' => 'image/gif',
|
761 |
+
'bmp' => 'image/bmp',
|
762 |
+
'ico' => 'image/vnd.microsoft.icon',
|
763 |
+
'tiff' => 'image/tiff',
|
764 |
+
'tif' => 'image/tiff',
|
765 |
+
'svg' => 'image/svg+xml',
|
766 |
+
'svgz' => 'image/svg+xml',
|
767 |
+
);
|
768 |
+
$path_parts = pathinfo($newfile);
|
769 |
+
$mime = $mime_types[strtolower($path_parts['extension'])];
|
770 |
+
|
771 |
+
$this->getResponse()->clearHeaders();
|
772 |
+
$this->getResponse()->setHeader('Content-Type', $mime, true);
|
773 |
+
$this->getResponse()->setHeader('Cache-Control', 'max-age: 300', true);
|
774 |
+
$this->getResponse()->setHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + 86400), true);
|
775 |
+
$this->getResponse()->setHeader('Pragma', 'cache', true);
|
776 |
+
$this->getResponse()->setHeader('Age', '0', true);
|
777 |
+
|
778 |
+
$this->getResponse()->setBody(file_get_contents($newfile));
|
779 |
+
}
|
780 |
+
|
781 |
+
public function getReportDataAction()
|
782 |
+
{
|
783 |
+
$this->_checkApitoken();
|
784 |
+
|
785 |
+
Mage::register(
|
786 |
+
'callback',
|
787 |
+
$this->getRequest()->getParam('callback', null)
|
788 |
+
);
|
789 |
+
|
790 |
+
Mage::register(
|
791 |
+
'oct8ne_from',
|
792 |
+
$this->getRequest()->getParam('from', null)
|
793 |
+
);
|
794 |
+
|
795 |
+
Mage::register(
|
796 |
+
'oct8ne_to',
|
797 |
+
$this->getRequest()->getParam('to', null)
|
798 |
+
);
|
799 |
+
|
800 |
+
Mage::register(
|
801 |
+
'oct8ne_report',
|
802 |
+
$this->getRequest()->getParam('report', null)
|
803 |
+
);
|
804 |
+
|
805 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
806 |
+
|
807 |
+
$this->loadLayout();
|
808 |
+
$this->renderLayout();
|
809 |
+
}
|
810 |
+
};
|
app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml
CHANGED
@@ -1,229 +1,257 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<LetsSyncroLLC_Oct8ne>
|
5 |
-
<version>1.1.
|
6 |
-
</LetsSyncroLLC_Oct8ne>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<models>
|
10 |
-
<oct8ne>
|
11 |
-
<class>LetsSyncroLLC_Oct8ne_Model</class>
|
12 |
-
<resourceModel>oct8ne_mysql4</resourceModel>
|
13 |
-
</oct8ne>
|
14 |
-
<oct8ne_mysql4>
|
15 |
-
<class>LetsSyncroLLC_Oct8ne_Model_Mysql4</class>
|
16 |
-
<entities>
|
17 |
-
<letssyncro>
|
18 |
-
<table>letssyncro</table>
|
19 |
-
</letssyncro>
|
20 |
-
|
21 |
-
<orderproducts>
|
22 |
-
<table>orderproducts</table>
|
23 |
-
</orderproducts>
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
<
|
55 |
-
<
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
<
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
<
|
68 |
-
<
|
69 |
-
<
|
70 |
-
</
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
<
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
<
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
</
|
139 |
-
|
140 |
-
<
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
<use>
|
145 |
-
<args>
|
146 |
-
<module>LetsSyncroLLC_Oct8ne</module>
|
147 |
-
<frontName>oct8ne</frontName>
|
148 |
-
</args>
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
</
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<LetsSyncroLLC_Oct8ne>
|
5 |
+
<version>1.1.7</version>
|
6 |
+
</LetsSyncroLLC_Oct8ne>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<oct8ne>
|
11 |
+
<class>LetsSyncroLLC_Oct8ne_Model</class>
|
12 |
+
<resourceModel>oct8ne_mysql4</resourceModel>
|
13 |
+
</oct8ne>
|
14 |
+
<oct8ne_mysql4>
|
15 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Mysql4</class>
|
16 |
+
<entities>
|
17 |
+
<letssyncro>
|
18 |
+
<table>letssyncro</table>
|
19 |
+
</letssyncro>
|
20 |
+
|
21 |
+
<orderproducts>
|
22 |
+
<table>orderproducts</table>
|
23 |
+
</orderproducts>
|
24 |
+
|
25 |
+
<quoteproducts>
|
26 |
+
<table>quoteproducts</table>
|
27 |
+
</quoteproducts>
|
28 |
+
</entities>
|
29 |
+
</oct8ne_mysql4>
|
30 |
+
|
31 |
+
|
32 |
+
<core>
|
33 |
+
<rewrite>
|
34 |
+
<url>LetsSyncroLLC_Oct8ne_Model_Mage_Url</url>
|
35 |
+
<url_rewrite>LetsSyncroLLC_Oct8ne_Model_Mage_Rewrite</url_rewrite>
|
36 |
+
<url_rewrite_request>LetsSyncroLLC_Oct8ne_Model_Mage_Request</url_rewrite_request>
|
37 |
+
<design_package>LetsSyncroLLC_Oct8ne_Model_Mage_Package</design_package>
|
38 |
+
<!-- domainpolicy>LetsSyncroLLC_Oct8ne_Model_Mage_Domainpolicy</domainpolicy -->
|
39 |
+
</rewrite>
|
40 |
+
</core>
|
41 |
+
|
42 |
+
<checkout>
|
43 |
+
<rewrite>
|
44 |
+
<type_onepage>LetsSyncroLLC_Oct8ne_Model_Mage_Onepage</type_onepage>
|
45 |
+
</rewrite>
|
46 |
+
</checkout>
|
47 |
+
|
48 |
+
</models>
|
49 |
+
<blocks>
|
50 |
+
<oct8ne>
|
51 |
+
<class>LetsSyncroLLC_Oct8ne_Block</class>
|
52 |
+
</oct8ne>
|
53 |
+
|
54 |
+
<page>
|
55 |
+
<rewrite>
|
56 |
+
<html_head>LetsSyncroLLC_Oct8ne_Block_Html_Head</html_head>
|
57 |
+
</rewrite>
|
58 |
+
</page>
|
59 |
+
|
60 |
+
</blocks>
|
61 |
+
<helpers>
|
62 |
+
<oct8ne>
|
63 |
+
<class>LetsSyncroLLC_Oct8ne_Helper</class>
|
64 |
+
</oct8ne>
|
65 |
+
</helpers>
|
66 |
+
<resources>
|
67 |
+
<oct8ne_setup>
|
68 |
+
<setup>
|
69 |
+
<module>LetsSyncroLLC_Oct8ne</module>
|
70 |
+
</setup>
|
71 |
+
<connection>
|
72 |
+
<use>core_setup</use>
|
73 |
+
</connection>
|
74 |
+
</oct8ne_setup>
|
75 |
+
<oct8ne_write>
|
76 |
+
<connection>
|
77 |
+
<use>core_write</use>
|
78 |
+
</connection>
|
79 |
+
</oct8ne_write>
|
80 |
+
<oct8ne_read>
|
81 |
+
<connection>
|
82 |
+
<use>core_read</use>
|
83 |
+
</connection>
|
84 |
+
</oct8ne_read>
|
85 |
+
</resources>
|
86 |
+
|
87 |
+
|
88 |
+
<events>
|
89 |
+
<controller_front_init_routers>
|
90 |
+
<observers>
|
91 |
+
<LetsSyncroLLC_Oct8ne_Intercept>
|
92 |
+
<type>singleton</type>
|
93 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
94 |
+
<method>interceptMethod</method>
|
95 |
+
</LetsSyncroLLC_Oct8ne_Intercept>
|
96 |
+
</observers>
|
97 |
+
</controller_front_init_routers>
|
98 |
+
|
99 |
+
<controller_action_layout_render_before>
|
100 |
+
<observers>
|
101 |
+
<LetsSyncroLLC_Oct8ne_Layout>
|
102 |
+
<type>singleton</type>
|
103 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
104 |
+
<method>layoutRenderBefore</method>
|
105 |
+
</LetsSyncroLLC_Oct8ne_Layout>
|
106 |
+
</observers>
|
107 |
+
</controller_action_layout_render_before>
|
108 |
+
|
109 |
+
<sales_order_place_after>
|
110 |
+
<observers>
|
111 |
+
<LetsSyncroLLC_Oct8ne_Order>
|
112 |
+
<type>singleton</type>
|
113 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
114 |
+
<method>placeOrderBefore</method>
|
115 |
+
</LetsSyncroLLC_Oct8ne_Order>
|
116 |
+
</observers>
|
117 |
+
</sales_order_place_after>
|
118 |
+
|
119 |
+
<sales_quote_save_after>
|
120 |
+
<observers>
|
121 |
+
<LetsSyncroLLC_Oct8ne_Quote>
|
122 |
+
<type>singleton</type>
|
123 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
124 |
+
<method>saveQuoteAfter</method>
|
125 |
+
</LetsSyncroLLC_Oct8ne_Quote>
|
126 |
+
</observers>
|
127 |
+
</sales_quote_save_after>
|
128 |
+
|
129 |
+
<controller_action_predispatch>
|
130 |
+
<observers>
|
131 |
+
<LetsSyncroLLC_Oct8ne_Quote_security_domain_policy>
|
132 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
133 |
+
<method>checkDomainPolicyHeader</method>
|
134 |
+
</LetsSyncroLLC_Oct8ne_Quote_security_domain_policy>
|
135 |
+
</observers>
|
136 |
+
</controller_action_predispatch>
|
137 |
+
|
138 |
+
</events>
|
139 |
+
</global>
|
140 |
+
<frontend>
|
141 |
+
<routers>
|
142 |
+
<oct8ne>
|
143 |
+
<!-- <LetsSyncroLLC_LetsSyncro> -->
|
144 |
+
<use>standard</use>
|
145 |
+
<args>
|
146 |
+
<module>LetsSyncroLLC_Oct8ne</module>
|
147 |
+
<frontName>oct8ne</frontName>
|
148 |
+
</args>
|
149 |
+
<!-- </LetsSyncroLLC_LetsSyncro> -->
|
150 |
+
</oct8ne>
|
151 |
+
|
152 |
+
<customer>
|
153 |
+
<args>
|
154 |
+
<modules>
|
155 |
+
<oct8ne before="Mage_Customer">LetsSyncroLLC_Oct8ne</oct8ne>
|
156 |
+
</modules>
|
157 |
+
</args>
|
158 |
+
</customer>
|
159 |
+
</routers>
|
160 |
+
<layout>
|
161 |
+
<updates>
|
162 |
+
<LetsSyncroLLC_Oct8ne>
|
163 |
+
<file>oct8ne.xml</file>
|
164 |
+
</LetsSyncroLLC_Oct8ne>
|
165 |
+
</updates>
|
166 |
+
</layout>
|
167 |
+
</frontend>
|
168 |
+
<admin>
|
169 |
+
<routers>
|
170 |
+
<!-- <LetsSyncroLLC_LetsSyncro> -->
|
171 |
+
<oct8ne>
|
172 |
+
<use>admin</use>
|
173 |
+
<args>
|
174 |
+
<module>LetsSyncroLLC_Oct8ne</module>
|
175 |
+
<frontName>oct8ne</frontName>
|
176 |
+
</args>
|
177 |
+
</oct8ne>
|
178 |
+
<!-- </LetsSyncroLLC_LetsSyncro> -->
|
179 |
+
</routers>
|
180 |
+
</admin>
|
181 |
+
<adminhtml>
|
182 |
+
<translate>
|
183 |
+
<modules>
|
184 |
+
<LetsSyncroLLC_Oct8ne>
|
185 |
+
<files>
|
186 |
+
<default>LetsSyncroLLC_Oct8ne.csv</default>
|
187 |
+
</files>
|
188 |
+
</LetsSyncroLLC_Oct8ne>
|
189 |
+
</modules>
|
190 |
+
</translate>
|
191 |
+
<menu>
|
192 |
+
<oct8ne translate="title" module="oct8ne">
|
193 |
+
<title>Oct8ne</title>
|
194 |
+
<sort_order>1000</sort_order>
|
195 |
+
<children>
|
196 |
+
<accountconfig translate="title" module="oct8ne">
|
197 |
+
<title>Account Setup</title>
|
198 |
+
<action>oct8ne/admin/accountconfig</action>
|
199 |
+
<sort_order>0</sort_order>
|
200 |
+
</accountconfig>
|
201 |
+
<!--<dashboard translate="title" module="oct8ne">
|
202 |
+
<title>Dashboard</title>
|
203 |
+
<action>oct8ne/admin/dashboard</action>
|
204 |
+
<sort_order>20</sort_order>
|
205 |
+
</dashboard>
|
206 |
+
<syncrodata translate="title" module="oct8ne">
|
207 |
+
<title>Syncro Data</title>
|
208 |
+
<action>oct8ne/admin/syncrodata</action>
|
209 |
+
<sort_order>40</sort_order>
|
210 |
+
</syncrodata>-->
|
211 |
+
</children>
|
212 |
+
</oct8ne>
|
213 |
+
</menu>
|
214 |
+
<acl>
|
215 |
+
<resources>
|
216 |
+
<admin>
|
217 |
+
<children>
|
218 |
+
<oct8ne translate="title" module="oct8ne">
|
219 |
+
<title>Oct8ne</title>
|
220 |
+
<sort_order>1000</sort_order>
|
221 |
+
<children>
|
222 |
+
<accountconfig translate="title" module="oct8ne">
|
223 |
+
<title>Account Setup</title>
|
224 |
+
<action>oct8ne/admin/accountconfig</action>
|
225 |
+
<sort_order>0</sort_order>
|
226 |
+
</accountconfig>
|
227 |
+
<!--<dashboard translate="title" module="oct8ne">
|
228 |
+
<title>Dashboard</title>
|
229 |
+
<action>oct8ne/admin/dashboard</action>
|
230 |
+
<sort_order>20</sort_order>
|
231 |
+
</dashboard>
|
232 |
+
<syncrodata translate="title" module="oct8ne">
|
233 |
+
<title>Syncro Data</title>
|
234 |
+
<action>oct8ne/admin/syncrodata</action>
|
235 |
+
<sort_order>40</sort_order>
|
236 |
+
</syncrodata>-->
|
237 |
+
</children>
|
238 |
+
</oct8ne>
|
239 |
+
</children>
|
240 |
+
</admin>
|
241 |
+
|
242 |
+
</resources>
|
243 |
+
|
244 |
+
|
245 |
+
</acl>
|
246 |
+
</adminhtml>
|
247 |
+
|
248 |
+
<default>
|
249 |
+
<design>
|
250 |
+
<oct8nedesign>
|
251 |
+
<package>default</package>
|
252 |
+
<theme>oct8ne</theme>
|
253 |
+
</oct8nedesign>
|
254 |
+
</design>
|
255 |
+
</default>
|
256 |
+
</config>
|
257 |
+
|
app/code/community/LetsSyncroLLC/Oct8ne/sql/oct8ne_setup/mysql4-upgrade-1.1.6-1.1.7.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
ALTER TABLE {$this->getTable('orderproducts')}
|
9 |
+
ADD `qty` int(11) unsigned NOT NULL,
|
10 |
+
ADD `customer_id` int(11) unsigned NOT NULL,
|
11 |
+
ADD `product_price` decimal(12,4) NOT NULL default '0.0000',
|
12 |
+
ADD `order_price` decimal(12,4) NOT NULL default '0.0000',
|
13 |
+
ADD `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
|
14 |
+
ADD `currency` varchar(3) NOT NULL default 'EUR',
|
15 |
+
MODIFY `oct8ne` varchar(128)
|
16 |
+
");
|
17 |
+
|
18 |
+
$installer->run("
|
19 |
+
|
20 |
+
-- DROP TABLE IF EXISTS {$this->getTable('quoteproducts')};
|
21 |
+
CREATE TABLE {$this->getTable('quoteproducts')} (
|
22 |
+
`quoteproducts_id` int(11) unsigned NOT NULL auto_increment,
|
23 |
+
`quote_id` int(11) unsigned NOT NULL,
|
24 |
+
`product_id` int(11) unsigned NOT NULL,
|
25 |
+
`product_price` decimal(12,4) NOT NULL default '0.0000',
|
26 |
+
`quote_price` decimal(12,4) NOT NULL default '0.0000',
|
27 |
+
`oct8ne` varchar(128),
|
28 |
+
`qty` int(11) unsigned NOT NULL,
|
29 |
+
`customer_id` int(11) unsigned NOT NULL,
|
30 |
+
`created_at` datetime NOT NULL default '0000-00-00 00:00:00',
|
31 |
+
`currency` varchar(3) NOT NULL default 'EUR',
|
32 |
+
PRIMARY KEY (`quoteproducts_id`)
|
33 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
34 |
+
|
35 |
+
");
|
36 |
+
|
37 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/oct8ne.xml
CHANGED
@@ -1,240 +1,223 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
|
4 |
-
<default>
|
5 |
-
<!-- fem que la crida es faci al final de la pàgina per tal que no afecti a elements pendents de càrrega-->
|
6 |
-
<reference name="before_body_end">
|
7 |
-
<block type="core/template" name="oct8ne_script" template="oct8ne/letssyncro.phtml">
|
8 |
-
</block>
|
9 |
-
</reference>
|
10 |
-
</default>
|
11 |
-
|
12 |
-
|
13 |
-
<oct8ne_frame_customerdata>
|
14 |
-
<reference name="root">
|
15 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<action method="
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<block type="
|
77 |
-
<
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
<block type="catalog/
|
83 |
-
<action method="
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
<block type="catalog/
|
89 |
-
|
90 |
-
|
91 |
-
<block type="
|
92 |
-
<
|
93 |
-
</block>
|
94 |
-
|
95 |
-
<block type="catalog/product_view" name="product.info.
|
96 |
-
|
97 |
-
|
98 |
-
<
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
</block>
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
<
|
116 |
-
<action method="
|
117 |
-
<action method="append"><block>product.info.
|
118 |
-
|
119 |
-
|
120 |
-
<block type="core/template_facade" name="product.info.
|
121 |
-
<action method="setDataByKey"><key>alias_in_layout</key><value>
|
122 |
-
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
123 |
-
<action method="append"><block>product.info.options.wrapper</block></action>
|
124 |
-
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
125 |
-
</block>
|
126 |
-
<
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
<reference name="
|
146 |
-
<
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
<
|
155 |
-
|
156 |
-
</
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
<reference name="
|
177 |
-
<
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
<
|
214 |
-
</reference>
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
</reference>
|
225 |
-
|
226 |
-
<reference name="content">
|
227 |
-
<block type="core/template" template="oct8ne/frame/productinfo.phtml" />
|
228 |
-
</reference>
|
229 |
-
</oct8ne_frame_productinfo>
|
230 |
-
|
231 |
-
<oct8ne_frame_productrelated>
|
232 |
-
<reference name="root">
|
233 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
234 |
-
</reference>
|
235 |
-
|
236 |
-
<reference name="content">
|
237 |
-
<block type="core/template" template="oct8ne/frame/productrelated.phtml" />
|
238 |
-
</reference>
|
239 |
-
</oct8ne_frame_productrelated>
|
240 |
-
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<default>
|
5 |
+
<!-- fem que la crida es faci al final de la pàgina per tal que no afecti a elements pendents de càrrega-->
|
6 |
+
<reference name="before_body_end">
|
7 |
+
<block type="core/template" name="oct8ne_script" template="oct8ne/letssyncro.phtml">
|
8 |
+
</block>
|
9 |
+
</reference>
|
10 |
+
</default>
|
11 |
+
|
12 |
+
|
13 |
+
<oct8ne_frame_customerdata>
|
14 |
+
<reference name="root">
|
15 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
16 |
+
<block type="core/template" template="oct8ne/frame/customer/data.phtml" name="jsoncontent" />
|
17 |
+
</reference>
|
18 |
+
</oct8ne_frame_customerdata>
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
<oct8ne_frame_add2cart>
|
23 |
+
<reference name="root">
|
24 |
+
<action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
|
25 |
+
</reference>
|
26 |
+
|
27 |
+
<reference name="content">
|
28 |
+
<block type="core/template" template="oct8ne/frame/add2cart.phtml" />
|
29 |
+
</reference>
|
30 |
+
</oct8ne_frame_add2cart>
|
31 |
+
|
32 |
+
|
33 |
+
<oct8ne_frame_search>
|
34 |
+
<reference name="root">
|
35 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
36 |
+
<block type="core/template" template="oct8ne/frame/search.phtml" name="jsoncontent" />
|
37 |
+
</reference>
|
38 |
+
</oct8ne_frame_search>
|
39 |
+
|
40 |
+
|
41 |
+
<oct8ne_frame_productview>
|
42 |
+
|
43 |
+
<reference name="head">
|
44 |
+
<action method="addJs"><script>varien/product.js</script></action>
|
45 |
+
</reference>
|
46 |
+
|
47 |
+
<!-- <block type="core/template_facade" name="root" template="oct8ne/frame/productview.phtml"/> -->
|
48 |
+
|
49 |
+
<label>Catalog Product View (Any)</label>
|
50 |
+
<!-- Mage_Catalog -->
|
51 |
+
<reference name="head">
|
52 |
+
<remove name="oct8ne_script" />
|
53 |
+
</reference>
|
54 |
+
<reference name="root">
|
55 |
+
<!-- <action method="setTemplate"><template>page/2columns-right.phtml</template></action> -->
|
56 |
+
<action method="setTemplate"><template>oct8ne/frame/clean-page.phtml</template></action>
|
57 |
+
</reference>
|
58 |
+
<reference name="head">
|
59 |
+
<action method="addJs"><script>varien/product.js</script></action>
|
60 |
+
<action method="addJs"><script>varien/configurable.js</script></action>
|
61 |
+
|
62 |
+
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
63 |
+
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
64 |
+
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
65 |
+
</reference>
|
66 |
+
<reference name="content">
|
67 |
+
<block type="catalog/product_view" name="product.info" template="oct8ne/frame/productview.phtml">
|
68 |
+
|
69 |
+
<block type="catalog/product_view_media" name="product.info.media" as="media" template="oct8ne/frame/productview/media.phtml"/>
|
70 |
+
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
|
71 |
+
<label>Alert Urls</label>
|
72 |
+
</block>
|
73 |
+
|
74 |
+
<action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
|
75 |
+
|
76 |
+
<block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="oct8ne/frame/productview/list/upsell.phtml">
|
77 |
+
<action method="setColumnCount"><columns>4</columns></action>
|
78 |
+
<action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
|
79 |
+
</block>
|
80 |
+
|
81 |
+
<block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
|
82 |
+
<block type="catalog/product_view_description" name="product.description" as="description" template="oct8ne/frame/productview/description.phtml">
|
83 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
84 |
+
</block>
|
85 |
+
<block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="oct8ne/frame/productview/attributes.phtml">
|
86 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
87 |
+
</block>
|
88 |
+
<block type="catalog/product_view" name="product.info.addto" as="addto" template="oct8ne/frame/productview/addto.phtml"/>
|
89 |
+
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="oct8ne/frame/productview/addtocart.phtml"/>
|
90 |
+
|
91 |
+
<block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label">
|
92 |
+
<label>Product View Extra Hint</label>
|
93 |
+
</block>
|
94 |
+
|
95 |
+
<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="oct8ne/frame/productview/options/wrapper.phtml" translate="label">
|
96 |
+
<label>Info Column Options Wrapper</label>
|
97 |
+
<block type="core/template" name="options_js" template="oct8ne/frame/productview/options/js.phtml"/>
|
98 |
+
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="oct8ne/frame/productview/options.phtml">
|
99 |
+
<action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
|
100 |
+
<action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
|
101 |
+
<action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
|
102 |
+
<action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
|
103 |
+
</block>
|
104 |
+
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
105 |
+
</block>
|
106 |
+
<block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="oct8ne/frame/productview/options/wrapper/bottom.phtml" translate="label">
|
107 |
+
<label>Bottom Block Options Wrapper</label>
|
108 |
+
<action method="insert"><block>product.tierprices</block></action>
|
109 |
+
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="oct8ne/frame/productview/price_clone.phtml"/>
|
110 |
+
<action method="append"><block>product.info.addtocart</block></action>
|
111 |
+
<action method="append"><block>product.info.addto</block></action>
|
112 |
+
</block>
|
113 |
+
|
114 |
+
<block type="core/template_facade" name="product.info.container1" as="container1">
|
115 |
+
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
|
116 |
+
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
117 |
+
<action method="append"><block>product.info.options.wrapper</block></action>
|
118 |
+
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
119 |
+
</block>
|
120 |
+
<block type="core/template_facade" name="product.info.container2" as="container2">
|
121 |
+
<action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
|
122 |
+
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
123 |
+
<action method="append"><block>product.info.options.wrapper</block></action>
|
124 |
+
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
125 |
+
</block>
|
126 |
+
<action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
127 |
+
<action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
128 |
+
</block>
|
129 |
+
</reference>
|
130 |
+
<reference name="right">
|
131 |
+
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="oct8ne/frame/productview/list/related.phtml"/>
|
132 |
+
</reference>
|
133 |
+
|
134 |
+
</oct8ne_frame_productview>
|
135 |
+
|
136 |
+
|
137 |
+
<oct8ne_frame_search2 translate="label">
|
138 |
+
<label>Oct8ne Search</label>
|
139 |
+
<reference name="root">
|
140 |
+
<action method="setTemplate"><template>page/3columns.phtml</template></action>
|
141 |
+
</reference>
|
142 |
+
<reference name="left">
|
143 |
+
<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
|
144 |
+
</reference>
|
145 |
+
<reference name="content">
|
146 |
+
<block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
|
147 |
+
<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
|
148 |
+
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
|
149 |
+
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
150 |
+
</block>
|
151 |
+
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
|
152 |
+
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
|
153 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
|
154 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
|
155 |
+
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
|
156 |
+
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
|
157 |
+
</block>
|
158 |
+
<action method="setListOrders"/>
|
159 |
+
<action method="setListModes"/>
|
160 |
+
<action method="setListCollection"/>
|
161 |
+
</block>
|
162 |
+
</reference>
|
163 |
+
</oct8ne_frame_search2>
|
164 |
+
|
165 |
+
<customer_account_loginpost>
|
166 |
+
<reference name="root">
|
167 |
+
<action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
|
168 |
+
</reference>
|
169 |
+
|
170 |
+
<reference name="content">
|
171 |
+
<block type="core/template" template="oct8ne/frame/loginpost.phtml" />
|
172 |
+
</reference>
|
173 |
+
</customer_account_loginpost>
|
174 |
+
|
175 |
+
<oct8ne_frame_getcart>
|
176 |
+
<reference name="root">
|
177 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
178 |
+
<block type="core/template" template="oct8ne/frame/getcart.phtml" name="jsoncontent" />
|
179 |
+
</reference>
|
180 |
+
</oct8ne_frame_getcart>
|
181 |
+
|
182 |
+
<oct8ne_frame_getwishlist>
|
183 |
+
<reference name="root">
|
184 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
185 |
+
<block type="core/template" template="oct8ne/frame/getwishlist.phtml" name="jsoncontent" />
|
186 |
+
</reference>
|
187 |
+
</oct8ne_frame_getwishlist>
|
188 |
+
|
189 |
+
<oct8ne_frame_addtowishlist>
|
190 |
+
<reference name="root">
|
191 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
192 |
+
<block type="core/template" template="oct8ne/frame/addtowishlist.phtml" name="jsoncontent" />
|
193 |
+
</reference>
|
194 |
+
</oct8ne_frame_addtowishlist>
|
195 |
+
|
196 |
+
<oct8ne_frame_removefromwishlist>
|
197 |
+
<reference name="root">
|
198 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
199 |
+
<block type="core/template" template="oct8ne/frame/removefromwishlist.phtml" name="jsoncontent" />
|
200 |
+
</reference>
|
201 |
+
</oct8ne_frame_removefromwishlist>
|
202 |
+
|
203 |
+
<oct8ne_frame_productinfo>
|
204 |
+
<reference name="root">
|
205 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
206 |
+
<block type="core/template" template="oct8ne/frame/productinfo.phtml" name="jsoncontent" />
|
207 |
+
</reference>
|
208 |
+
</oct8ne_frame_productinfo>
|
209 |
+
|
210 |
+
<oct8ne_frame_productrelated>
|
211 |
+
<reference name="root">
|
212 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
213 |
+
<block type="core/template" template="oct8ne/frame/productrelated.phtml" name="jsoncontent"/>
|
214 |
+
</reference>
|
215 |
+
</oct8ne_frame_productrelated>
|
216 |
+
|
217 |
+
<oct8ne_frame_getreportdata>
|
218 |
+
<reference name="root">
|
219 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
220 |
+
<block type="core/template" template="oct8ne/frame/getreportdata.phtml" name="jsoncontent"/>
|
221 |
+
</reference>
|
222 |
+
</oct8ne_frame_getreportdata>
|
223 |
+
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/oct8ne/frame/getreportdata.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
// $result_collection = Mage::registry( 'search_result_collection' );
|
1 |
$report = Mage::registry('oct8ne_report');
|
2 |
switch($report)
|
3 |
{
|
4 |
case 'order':
|
5 |
$result_collection = Mage::getModel('oct8ne/orderproducts')->getCollection();
|
6 |
break;
|
7 |
case 'quote':
|
8 |
$result_collection = Mage::getModel('oct8ne/quoteproducts')->getCollection();
|
9 |
break;
|
10 |
}
|
11 |
$from = Mage::registry('oct8ne_from');
|
12 |
$to = Mage::registry('oct8ne_to');
|
13 |
|
14 |
if(!empty($from)) {
|
15 |
$result_collection->getSelect()->where("created_at >= CAST(? AS DATETIME)", $from);
|
16 |
}
|
17 |
if(!empty($to)) {
|
18 |
$result_collection->getSelect()->where("CAST(? AS DATETIME) > created_at", $to);
|
19 |
}
|
20 |
|
21 |
//if ( !Mage::registry( 'partial_search' ) )
|
22 |
echo " \"total\": \"".$result_collection->getSize()."\",\n";
|
23 |
"results": [
|
24 |
$values = array(
|
25 |
'ProductId' => $item['product_id'],
|
26 |
'Qty' => $item['qty'],
|
27 |
'UserId' => $item['customer_id'],
|
28 |
'Oct8neSession' => $item['oct8ne'],
|
29 |
'Date' => $item['created_at'],
|
30 |
'ProductPrice' => $item['product_price'],
|
31 |
'Currency' => $item['currency'],
|
32 |
);
|
33 |
|
34 |
if($report == 'order')
|
35 |
{
|
36 |
$order = Mage::getModel('sales/order')->load($item['order_id']);
|
37 |
if($order != null)
|
38 |
{
|
39 |
$orderValid = 1;
|
40 |
$incrementId = $order->getIncrementId();
|
41 |
$status = $order->getStatus();
|
42 |
}
|
43 |
else
|
44 |
{
|
45 |
$orderValid = 0;
|
46 |
}
|
47 |
|
48 |
$values += array(
|
49 |
'InternalId' => $item['orderproducts_id'],
|
50 |
'OrderId' => $item['order_id'],
|
51 |
'OrderValid' => $orderValid,
|
52 |
'IncrementId' => $incrementId,
|
53 |
'OrderPrice' => $item[$report . '_price'],
|
54 |
'Status' => $status
|
55 |
);
|
56 |
}
|
57 |
else if($report == 'quote')
|
58 |
{
|
59 |
$quote = Mage::getModel('sales/order')->load($item['quoteproducts_id']);
|
60 |
if($quote != null)
|
61 |
{
|
62 |
$quoteValid = 1;
|
63 |
}
|
64 |
else
|
65 |
{
|
66 |
$quoteValid = 0;
|
67 |
}
|
68 |
|
69 |
$values += array(
|
70 |
'InternalId' => $item['quoteproducts_id'],
|
71 |
'QuoteId' => $item['quote_id'],
|
72 |
'QuoteValid' => $quoteValid,
|
73 |
'QuotePrice' => $item[$report . '_price'],
|
74 |
);
|
75 |
}
|
76 |
// $d = $order->getCreatedAtStoreDate();
|
77 |
{
|
78 |
<?php $n = 0; foreach($values as $key=>$val) { ?>
|
79 |
"<?php $n++; echo $key ?>": "<?php echo $val ?>"<?php if ( $n < count( $values ) ) echo ",\n"; else echo "\n"; ?>
|
80 |
<?php } ?>
|
81 |
|
82 |
<?php $k++; if ( $k < count( $result_collection ) ) echo "},\n"; else echo "}\n"; ?>
|
83 |
]
|
1 |
+
<?php
|
2 |
// $result_collection = Mage::registry( 'search_result_collection' );
|
3 |
$report = Mage::registry('oct8ne_report');
|
4 |
switch($report)
|
5 |
{
|
6 |
case 'order':
|
7 |
$result_collection = Mage::getModel('oct8ne/orderproducts')->getCollection();
|
8 |
break;
|
9 |
case 'quote':
|
10 |
$result_collection = Mage::getModel('oct8ne/quoteproducts')->getCollection();
|
11 |
break;
|
12 |
}
|
13 |
$from = Mage::registry('oct8ne_from');
|
14 |
$to = Mage::registry('oct8ne_to');
|
15 |
|
16 |
if(!empty($from)) {
|
17 |
$result_collection->getSelect()->where("created_at >= CAST(? AS DATETIME)", $from);
|
18 |
}
|
19 |
if(!empty($to)) {
|
20 |
$result_collection->getSelect()->where("CAST(? AS DATETIME) > created_at", $to);
|
21 |
}
|
22 |
|
23 |
//if ( !Mage::registry( 'partial_search' ) )
|
24 |
echo " \"total\": \"".$result_collection->getSize()."\",\n";
|
25 |
"results": [
|
26 |
$values = array(
|
27 |
'ProductId' => $item['product_id'],
|
28 |
'Qty' => $item['qty'],
|
29 |
'UserId' => $item['customer_id'],
|
30 |
'Oct8neSession' => $item['oct8ne'],
|
31 |
'Date' => $item['created_at'],
|
32 |
'ProductPrice' => $item['product_price'],
|
33 |
'Currency' => $item['currency'],
|
34 |
);
|
35 |
|
36 |
if($report == 'order')
|
37 |
{
|
38 |
$order = Mage::getModel('sales/order')->load($item['order_id']);
|
39 |
if($order != null)
|
40 |
{
|
41 |
$orderValid = 1;
|
42 |
$incrementId = $order->getIncrementId();
|
43 |
$status = $order->getStatus();
|
44 |
}
|
45 |
else
|
46 |
{
|
47 |
$orderValid = 0;
|
48 |
}
|
49 |
|
50 |
$values += array(
|
51 |
'InternalId' => $item['orderproducts_id'],
|
52 |
'OrderId' => $item['order_id'],
|
53 |
'OrderValid' => $orderValid,
|
54 |
'IncrementId' => $incrementId,
|
55 |
'OrderPrice' => $item[$report . '_price'],
|
56 |
'Status' => $status
|
57 |
);
|
58 |
}
|
59 |
else if($report == 'quote')
|
60 |
{
|
61 |
$quote = Mage::getModel('sales/order')->load($item['quoteproducts_id']);
|
62 |
if($quote != null)
|
63 |
{
|
64 |
$quoteValid = 1;
|
65 |
}
|
66 |
else
|
67 |
{
|
68 |
$quoteValid = 0;
|
69 |
}
|
70 |
|
71 |
$values += array(
|
72 |
'InternalId' => $item['quoteproducts_id'],
|
73 |
'QuoteId' => $item['quote_id'],
|
74 |
'QuoteValid' => $quoteValid,
|
75 |
'QuotePrice' => $item[$report . '_price'],
|
76 |
);
|
77 |
}
|
78 |
// $d = $order->getCreatedAtStoreDate();
|
79 |
{
|
80 |
<?php $n = 0; foreach($values as $key=>$val) { ?>
|
81 |
"<?php $n++; echo $key ?>": "<?php echo $val ?>"<?php if ( $n < count( $values ) ) echo ",\n"; else echo "\n"; ?>
|
82 |
<?php } ?>
|
83 |
|
84 |
<?php $k++; if ( $k < count( $result_collection ) ) echo "},\n"; else echo "}\n"; ?>
|
85 |
]
|
app/design/frontend/base/default/template/oct8ne/frame/json-page.phtml
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php echo $this->getChildHtml('
|
1 |
+
<?php echo $this->getChildHtml('jsoncontent') ?>
|
app/design/frontend/base/default/template/oct8ne/letssyncro.phtml
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
global $letssyncro;
|
3 |
|
|
|
|
|
4 |
$req = Mage::app()->getRequest();
|
5 |
// Deshabilitar iframe al ver imágenes de productos
|
6 |
$disable = ($req->getModuleName() == 'catalog' && $req->getActionName() == 'gallery');
|
@@ -29,8 +31,8 @@ if (!isset($letssyncro)) {
|
|
29 |
<!-- LetsSyncro block (idnovate.com for LetsSyncro LLC)-->
|
30 |
";
|
31 |
*/
|
32 |
-
$baseurl = Mage::getBaseUrl();
|
33 |
-
$checkouturl = Mage::helper('checkout/url')->getCheckoutUrl();
|
34 |
$loginurl = Mage::helper('customer')->getLoginUrl();
|
35 |
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
36 |
$store = Mage::app()->getStore()->getId();
|
1 |
<?php
|
2 |
global $letssyncro;
|
3 |
|
4 |
+
function _letsyncro_remove_http($str) { return preg_replace('#^https?:#', '', $str); }
|
5 |
+
|
6 |
$req = Mage::app()->getRequest();
|
7 |
// Deshabilitar iframe al ver imágenes de productos
|
8 |
$disable = ($req->getModuleName() == 'catalog' && $req->getActionName() == 'gallery');
|
31 |
<!-- LetsSyncro block (idnovate.com for LetsSyncro LLC)-->
|
32 |
";
|
33 |
*/
|
34 |
+
$baseurl = _letsyncro_remove_http(Mage::getBaseUrl());
|
35 |
+
$checkouturl = _letsyncro_remove_http(Mage::helper('checkout/url')->getCheckoutUrl());
|
36 |
$loginurl = Mage::helper('customer')->getLoginUrl();
|
37 |
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
38 |
$store = Mage::app()->getStore()->getId();
|
app/etc/modules/LetsSyncroLLC_Oct8ne.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<LetsSyncroLLC_Oct8ne>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
-
<version>1.1.
|
8 |
<depends>
|
9 |
<Mage_Eav/>
|
10 |
<Mage_Dataflow/>
|
4 |
<LetsSyncroLLC_Oct8ne>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
+
<version>1.1.8</version>
|
8 |
<depends>
|
9 |
<Mage_Eav/>
|
10 |
<Mage_Dataflow/>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>LetsSyncroLLC_Oct8ne</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>license</license>
|
7 |
<channel>community</channel>
|
@@ -10,8 +10,8 @@
|
|
10 |
<description>Oct8ne extension description</description>
|
11 |
<notes>Notes</notes>
|
12 |
<authors><author><name>Oct8ne</name><user>Oct8ne</user><email>xavier.gonzalez@oct8ne.com</email></author></authors>
|
13 |
-
<date>2014-
|
14 |
-
<time>
|
15 |
<contents>
|
16 |
<target name="magecommunity">
|
17 |
<dir name="LetsSyncroLLC">
|
@@ -41,6 +41,9 @@
|
|
41 |
<dir name="Mage">
|
42 |
<file name="Onepage.php" hash="09bdc97f5328062520758798a2b5545c"/>
|
43 |
<file name="Url.php" hash="9811f73a73b5f1bd216442150f854a70"/>
|
|
|
|
|
|
|
44 |
</dir>
|
45 |
<dir name="Mysql4">
|
46 |
<dir name="LetsSyncro">
|
@@ -49,11 +52,16 @@
|
|
49 |
<file name="Letssyncro.php" hash="81b49a4f7770d408eacd230a41434cbf"/>
|
50 |
<dir name="Orderproducts">
|
51 |
<file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
|
|
|
|
|
|
|
52 |
</dir>
|
53 |
<file name="Orderproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
|
|
|
54 |
</dir>
|
55 |
<file name="Observer.php" hash="35c7a2608b071457d02ef3d0bc31f542"/>
|
56 |
<file name="Orderproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
|
|
|
57 |
</dir>
|
58 |
<dir name="controllers">
|
59 |
<file name="AccountController.php" hash="492f053985eca9a14bc1abf698966d77"/>
|
@@ -71,6 +79,7 @@
|
|
71 |
<file name="mysql4-install-0.5.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
|
72 |
<file name="mysql4-install-1.0.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
|
73 |
<file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="0de801ad4896defa9491391754ee7229"/>
|
|
|
74 |
</dir>
|
75 |
</dir>
|
76 |
</dir>
|
@@ -112,6 +121,7 @@
|
|
112 |
</dir>
|
113 |
<file name="getcart.phtml" hash="f67bacfaf225c8972a52de542cac1d69"/>
|
114 |
<file name="getwishlist.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
|
|
|
115 |
<file name="json-page.phtml" hash="509893c584213ad7d78e17a1a53249d1"/>
|
116 |
<file name="loginpost.phtml" hash="ea57cb60b282d1fc60186503f6909176"/>
|
117 |
<file name="naked-page.phtml" hash="6b9275b9ba11e9c79610b52e423e5dda"/>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>LetsSyncroLLC_Oct8ne</name>
|
4 |
+
<version>1.1.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>license</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Oct8ne extension description</description>
|
11 |
<notes>Notes</notes>
|
12 |
<authors><author><name>Oct8ne</name><user>Oct8ne</user><email>xavier.gonzalez@oct8ne.com</email></author></authors>
|
13 |
+
<date>2014-05-15</date>
|
14 |
+
<time>16:34:43</time>
|
15 |
<contents>
|
16 |
<target name="magecommunity">
|
17 |
<dir name="LetsSyncroLLC">
|
41 |
<dir name="Mage">
|
42 |
<file name="Onepage.php" hash="09bdc97f5328062520758798a2b5545c"/>
|
43 |
<file name="Url.php" hash="9811f73a73b5f1bd216442150f854a70"/>
|
44 |
+
<file name="Package.php" hash="9811f73a73b5f1bd216442150f854a70"/>
|
45 |
+
<file name="Rewrite.php" hash="9811f73a73b5f1bd216442150f854a70"/>
|
46 |
+
<file name="Request.php" hash="9811f73a73b5f1bd216442150f854a70"/>
|
47 |
</dir>
|
48 |
<dir name="Mysql4">
|
49 |
<dir name="LetsSyncro">
|
52 |
<file name="Letssyncro.php" hash="81b49a4f7770d408eacd230a41434cbf"/>
|
53 |
<dir name="Orderproducts">
|
54 |
<file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
|
55 |
+
</dir>
|
56 |
+
<dir name="Quoteproducts">
|
57 |
+
<file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
|
58 |
</dir>
|
59 |
<file name="Orderproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
|
60 |
+
<file name="Quoteproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
|
61 |
</dir>
|
62 |
<file name="Observer.php" hash="35c7a2608b071457d02ef3d0bc31f542"/>
|
63 |
<file name="Orderproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
|
64 |
+
<file name="Quoteproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
|
65 |
</dir>
|
66 |
<dir name="controllers">
|
67 |
<file name="AccountController.php" hash="492f053985eca9a14bc1abf698966d77"/>
|
79 |
<file name="mysql4-install-0.5.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
|
80 |
<file name="mysql4-install-1.0.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
|
81 |
<file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="0de801ad4896defa9491391754ee7229"/>
|
82 |
+
<file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="0de801ad4896defa9491391754ee7229"/>
|
83 |
</dir>
|
84 |
</dir>
|
85 |
</dir>
|
121 |
</dir>
|
122 |
<file name="getcart.phtml" hash="f67bacfaf225c8972a52de542cac1d69"/>
|
123 |
<file name="getwishlist.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
|
124 |
+
<file name="getreportdata.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
|
125 |
<file name="json-page.phtml" hash="509893c584213ad7d78e17a1a53249d1"/>
|
126 |
<file name="loginpost.phtml" hash="ea57cb60b282d1fc60186503f6909176"/>
|
127 |
<file name="naked-page.phtml" hash="6b9275b9ba11e9c79610b52e423e5dda"/>
|