Version Notes
Notes
Download this release
Release Info
Developer | Oct8ne |
Extension | LetsSyncroLLC_Oct8ne |
Version | 1.1.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.5 to 1.1.7
- app/code/community/LetsSyncroLLC/Oct8ne/Block/Accountconfig.php +16 -2
- app/code/community/LetsSyncroLLC/Oct8ne/Helper/Data.php +144 -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/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 +167 -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 +244 -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 +250 -240
- app/design/frontend/base/default/template/oct8ne/frame/getreportdata.phtml +1 -0
- app/design/frontend/base/default/template/oct8ne/letssyncro.phtml +4 -2
- app/etc/modules/LetsSyncroLLC_Oct8ne.xml +1 -1
- package.xml +11 -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,144 @@
|
|
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 |
-
foreach( $gallery_data['images'] as $image )
|
16 |
-
$v[] = array(
|
17 |
-
'url' => Mage::getBaseUrl('media').'catalog/product'.$image['file']
|
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 |
-
$description
|
48 |
-
$description
|
49 |
-
$description =
|
50 |
-
$description = str_replace("\
|
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 |
+
foreach( $gallery_data['images'] as $image )
|
16 |
+
$v[] = array(
|
17 |
+
// 'url' => Mage::getBaseUrl('media').'catalog/product'.$image['file']
|
18 |
+
// 'url' => Mage::getUrl('oct8ne/frame/image', array('file' => 'catalog/product'.$image['file']))
|
19 |
+
'url' => self::_remove_http(Mage::getUrl('oct8ne/frame/image') . '?file=' . 'catalog/product'.$image['file'])
|
20 |
+
);
|
21 |
+
|
22 |
+
return $v;
|
23 |
+
}
|
24 |
+
|
25 |
+
static protected $_productThumbnail = array();
|
26 |
+
static public function getProductThumbnail($product, $width = null)
|
27 |
+
{
|
28 |
+
$id = $product->getId();
|
29 |
+
if (array_key_exists($id, self::$_productThumbnail)) {
|
30 |
+
return self::$_productThumbnail[$id];
|
31 |
+
}
|
32 |
+
$thumb = Mage::helper('catalog/image')->init($product, 'thumbnail');
|
33 |
+
|
34 |
+
if(!is_null($width))
|
35 |
+
$thumb->resize($width);
|
36 |
+
|
37 |
+
$file = (string)$thumb;
|
38 |
+
|
39 |
+
self::$_productThumbnail[$id] = $file;
|
40 |
+
|
41 |
+
return $file;
|
42 |
+
}
|
43 |
+
|
44 |
+
static public function getProductInfo($product_id, $qty = null)
|
45 |
+
{
|
46 |
+
$product = Mage::getModel('catalog/product')->load( $product_id );
|
47 |
+
// $description = str_replace( array("\r\n", "\n", "\r"), "\\n", htmlentities ($product->getDescription()) );
|
48 |
+
$description = htmlspecialchars($product->getDescription(), ENT_QUOTES, "UTF-8");
|
49 |
+
$description = trim($description, "\r\n\t ");
|
50 |
+
$description = str_replace("\r", "", $description);
|
51 |
+
$description = str_replace("\t", "", $description);
|
52 |
+
$description = str_replace("\n", "<br/>", $description);
|
53 |
+
$tmp = is_null($qty) ? array() : array('qty' => $qty);
|
54 |
+
return array_merge($tmp, array(
|
55 |
+
'id' => $product->getId(),
|
56 |
+
'title' => htmlspecialchars($product->getName(), ENT_QUOTES, "UTF-8"), // htmlentities( $product->getName() ),
|
57 |
+
// 'price' => sprintf( "%.02f$currency", is_numeric($product->getSpecialPrice()) ? $product->getSpecialPrice() : $product->getPrice() ),
|
58 |
+
//'price' => Mage::helper('core')->currency(number_format($product->getFinalPrice(), '2', '.', ',')),
|
59 |
+
'original_price' => number_format(
|
60 |
+
Mage::helper('core')->currency( $product->getPrice(), false, false ),
|
61 |
+
'2', '.', ','
|
62 |
+
),
|
63 |
+
'price' => number_format( Mage::helper('core')->currency($product->getFinalPrice(), false, false), '2', '.', ',' ),
|
64 |
+
'description' => $description,
|
65 |
+
'url' => self::_remove_http(Mage::helper('oct8ne')->getProductFullUrl( $product )),
|
66 |
+
'imgs' => Mage::helper('oct8ne')->getProductImagesUrl( $product ),
|
67 |
+
'thumbnail' => self::_remove_http(Mage::helper('oct8ne')->getProductThumbnail( $product, 120 )),
|
68 |
+
'rating' => self::getProductRating($product_id)
|
69 |
+
));
|
70 |
+
}
|
71 |
+
|
72 |
+
static public function getProductRating($productId)
|
73 |
+
{
|
74 |
+
// Obtener la colección de reviews
|
75 |
+
$reviews = Mage::getModel('review/review')
|
76 |
+
->getResourceCollection()
|
77 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
78 |
+
->addEntityFilter('product', $productId)
|
79 |
+
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
|
80 |
+
->setDateOrder()
|
81 |
+
->addRateVotes();
|
82 |
+
// Calcular la media de ratings/reviews
|
83 |
+
$avg = 0;
|
84 |
+
$ratings = array();
|
85 |
+
if (count($reviews) > 0) {
|
86 |
+
foreach ($reviews->getItems() as $review) {
|
87 |
+
foreach( $review->getRatingVotes() as $vote ) {
|
88 |
+
$ratings[] = $vote->getPercent();
|
89 |
+
}
|
90 |
+
}
|
91 |
+
$avg = array_sum($ratings)/count($ratings);
|
92 |
+
}
|
93 |
+
else
|
94 |
+
{
|
95 |
+
return 'no-rating';
|
96 |
+
}
|
97 |
+
return $avg;
|
98 |
+
}
|
99 |
+
|
100 |
+
static public function getRelatedProducts($productId)
|
101 |
+
{
|
102 |
+
// obtener categorias del producto $productId
|
103 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
104 |
+
$cats = $product->getCategoryIds();
|
105 |
+
|
106 |
+
// buscar todos los productos de las categorias obtenidas
|
107 |
+
$productsInfo = array();
|
108 |
+
$productIds = array();
|
109 |
+
foreach ($cats as $category_id) {
|
110 |
+
$cat = Mage::getModel('catalog/category')->load($category_id) ;
|
111 |
+
|
112 |
+
$collection = $cat->getProductCollection();
|
113 |
+
$collection->addAttributeToFilter('visibility', 4);
|
114 |
+
//get all products in this category
|
115 |
+
foreach ($collection as $product){
|
116 |
+
if(!in_array($product->getId(), $productIds) && $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED){
|
117 |
+
$productIds[$product->getId()] = $product->getId();
|
118 |
+
$productsInfo[] = self::getProductInfo($product->getId());
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
// retornar array de getProductInfo();
|
124 |
+
return $productsInfo;
|
125 |
+
}
|
126 |
+
|
127 |
+
public function getExtensionVersion() {
|
128 |
+
return (string) Mage::getConfig()->getNode()->modules->LetsSyncroLLC_Oct8ne->version;
|
129 |
+
}
|
130 |
+
|
131 |
+
protected function _remove_http($str)
|
132 |
+
{
|
133 |
+
return preg_replace('#^https?:#', '', $str);
|
134 |
+
}
|
135 |
+
|
136 |
+
/*
|
137 |
+
static public function getOrderReport($from, $to)
|
138 |
+
{
|
139 |
+
// obtener categorias del producto $productId
|
140 |
+
$items = Mage::getModel('oct8ne/orderproducts')->getCollection();
|
141 |
+
return $productsInfo;
|
142 |
+
}
|
143 |
+
*/
|
144 |
+
};
|
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/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,167 @@
|
|
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 |
-
public function layoutRenderBefore($observer)
|
28 |
-
{
|
29 |
-
$session = Mage::getSingleton('core/session');
|
30 |
-
$logged_in = $session->getData("notify_oct8ne", null);
|
31 |
-
if(!is_null($logged_in))
|
32 |
-
{
|
33 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
34 |
-
|
35 |
-
$session->unsetData("notify_oct8ne");
|
36 |
-
$layout = Mage::getSingleton('core/layout');
|
37 |
-
|
38 |
-
$head = $layout->getBlock('root')->getChild('head');
|
39 |
-
if (is_object($head)) {
|
40 |
-
$head->addItem("script", "oct8ne-notify", <<<EOT
|
41 |
-
function lookForOct8neIFrameLoaded() {
|
42 |
-
var iframe = document.getElementById( 'oct8ne-iframe-return' );
|
43 |
-
if ( iframe == null )
|
44 |
-
setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
|
45 |
-
else {
|
46 |
-
var post_data = {
|
47 |
-
user: {
|
48 |
-
id: {$customer->getId()},
|
49 |
-
firstName: "{$customer->getFirstname()}",
|
50 |
-
lastName: "{$customer->getLastname()}",
|
51 |
-
email: "{$customer->getEmail()}"
|
52 |
-
}
|
53 |
-
};
|
54 |
-
iframe.contentWindow.postMessage( JSON.stringify(post_data), '*' );
|
55 |
-
}
|
56 |
-
};
|
57 |
-
lookForOct8neIFrameLoaded();
|
58 |
-
EOT
|
59 |
-
);
|
60 |
-
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
$logged_out = $session->getData("notify_oct8ne_logout", null);
|
65 |
-
if(!is_null($logged_out))
|
66 |
-
{
|
67 |
-
// $customer = Mage::getSingleton('customer/session')->getCustomer();
|
68 |
-
|
69 |
-
$session->unsetData("notify_oct8ne_logout");
|
70 |
-
$layout = Mage::getSingleton('core/layout');
|
71 |
-
|
72 |
-
$head = $layout->getBlock('root')->getChild('head');
|
73 |
-
if (is_object($head)) {
|
74 |
-
$head->addItem("script", "oct8ne-notify", <<<EOT
|
75 |
-
function lookForOct8neIFrameLoaded() {
|
76 |
-
var iframe = document.getElementById( 'oct8ne-iframe-return' );
|
77 |
-
if ( iframe == null )
|
78 |
-
setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
|
79 |
-
else
|
80 |
-
iframe.contentWindow.postMessage( 'logout', '*' );
|
81 |
-
}
|
82 |
-
lookForOct8neIFrameLoaded();
|
83 |
-
EOT
|
84 |
-
);
|
85 |
-
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Get checkout session model instance
|
92 |
-
*
|
93 |
-
* @return Mage_Checkout_Model_Session
|
94 |
-
*/
|
95 |
-
protected function _getSession() { return Mage::getSingleton('checkout/session'); }
|
96 |
-
|
97 |
-
public function placeOrderBefore($observer)
|
98 |
-
{
|
99 |
-
$order = $observer->getEvent()->getOrder();
|
100 |
-
$oct8ne_products = $this->_getSession()->getOct8neProducts();
|
101 |
-
if(!is_array($oct8ne_products))
|
102 |
-
$oct8ne_products = array();
|
103 |
-
|
104 |
-
$items = $order->getAllItems();
|
105 |
-
foreach($items as $item)
|
106 |
-
{
|
107 |
-
$product = $item->getProduct();
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
$
|
119 |
-
|
120 |
-
$model
|
121 |
-
$model->
|
122 |
-
$model->
|
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 |
+
|
27 |
+
public function layoutRenderBefore($observer)
|
28 |
+
{
|
29 |
+
$session = Mage::getSingleton('core/session');
|
30 |
+
$logged_in = $session->getData("notify_oct8ne", null);
|
31 |
+
if(!is_null($logged_in))
|
32 |
+
{
|
33 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
34 |
+
|
35 |
+
$session->unsetData("notify_oct8ne");
|
36 |
+
$layout = Mage::getSingleton('core/layout');
|
37 |
+
|
38 |
+
$head = $layout->getBlock('root')->getChild('head');
|
39 |
+
if (is_object($head)) {
|
40 |
+
$head->addItem("script", "oct8ne-notify", <<<EOT
|
41 |
+
function lookForOct8neIFrameLoaded() {
|
42 |
+
var iframe = document.getElementById( 'oct8ne-iframe-return' );
|
43 |
+
if ( iframe == null )
|
44 |
+
setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
|
45 |
+
else {
|
46 |
+
var post_data = {
|
47 |
+
user: {
|
48 |
+
id: {$customer->getId()},
|
49 |
+
firstName: "{$customer->getFirstname()}",
|
50 |
+
lastName: "{$customer->getLastname()}",
|
51 |
+
email: "{$customer->getEmail()}"
|
52 |
+
}
|
53 |
+
};
|
54 |
+
iframe.contentWindow.postMessage( JSON.stringify(post_data), '*' );
|
55 |
+
}
|
56 |
+
};
|
57 |
+
lookForOct8neIFrameLoaded();
|
58 |
+
EOT
|
59 |
+
);
|
60 |
+
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
$logged_out = $session->getData("notify_oct8ne_logout", null);
|
65 |
+
if(!is_null($logged_out))
|
66 |
+
{
|
67 |
+
// $customer = Mage::getSingleton('customer/session')->getCustomer();
|
68 |
+
|
69 |
+
$session->unsetData("notify_oct8ne_logout");
|
70 |
+
$layout = Mage::getSingleton('core/layout');
|
71 |
+
|
72 |
+
$head = $layout->getBlock('root')->getChild('head');
|
73 |
+
if (is_object($head)) {
|
74 |
+
$head->addItem("script", "oct8ne-notify", <<<EOT
|
75 |
+
function lookForOct8neIFrameLoaded() {
|
76 |
+
var iframe = document.getElementById( 'oct8ne-iframe-return' );
|
77 |
+
if ( iframe == null )
|
78 |
+
setTimeout( 'lookForOct8neIFrameLoaded()', 500 );
|
79 |
+
else
|
80 |
+
iframe.contentWindow.postMessage( 'logout', '*' );
|
81 |
+
}
|
82 |
+
lookForOct8neIFrameLoaded();
|
83 |
+
EOT
|
84 |
+
);
|
85 |
+
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get checkout session model instance
|
92 |
+
*
|
93 |
+
* @return Mage_Checkout_Model_Session
|
94 |
+
*/
|
95 |
+
protected function _getSession() { return Mage::getSingleton('checkout/session'); }
|
96 |
+
|
97 |
+
public function placeOrderBefore($observer)
|
98 |
+
{
|
99 |
+
$order = $observer->getEvent()->getOrder();
|
100 |
+
$oct8ne_products = $this->_getSession()->getOct8neProducts();
|
101 |
+
if(!is_array($oct8ne_products))
|
102 |
+
$oct8ne_products = array();
|
103 |
+
|
104 |
+
$items = $order->getAllItems();
|
105 |
+
foreach($items as $item)
|
106 |
+
{
|
107 |
+
$product = $item->getProduct();
|
108 |
+
$qty = $item->getQtyOrdered();
|
109 |
+
/*
|
110 |
+
foreach($oct8ne_products as $op)
|
111 |
+
{
|
112 |
+
$found = false;
|
113 |
+
if($op->getId() == $product->getId())
|
114 |
+
$found = true;
|
115 |
+
}
|
116 |
+
*/
|
117 |
+
$found = in_array($product->getId(), $oct8ne_products);
|
118 |
+
$session = Mage::getModel('core/cookie')->get('oct8ne-session');
|
119 |
+
|
120 |
+
$model = Mage::getModel('oct8ne/orderproducts');
|
121 |
+
$model->setOrderId($order->getId());
|
122 |
+
$model->setCustomerId($order->getCustomerId());
|
123 |
+
$model->setProductId($product->getId());
|
124 |
+
$model->setProductPrice($product->getPrice());
|
125 |
+
$model->setOrderPrice($order->getGrandTotal());
|
126 |
+
$model->setCreatedAt($order->getCreatedAt());
|
127 |
+
// $model->setOct8ne($found?'Y':'N');
|
128 |
+
$model->setOct8ne($session);
|
129 |
+
$model->setQty($qty);
|
130 |
+
$model->setCurrency($order->getOrderCurrency()->getCode());
|
131 |
+
$model->save();
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
public function saveQuoteAfter($observer)
|
136 |
+
{
|
137 |
+
$quote = $observer->getEvent()->getQuote();
|
138 |
+
// Eliminar los datos anteriores
|
139 |
+
foreach (Mage::getModel('oct8ne/quoteproducts')->getCollection()->addFilter('quote_id', $quote->getId()) as $ccitem) {
|
140 |
+
$ccitem->delete();
|
141 |
+
}
|
142 |
+
|
143 |
+
// Añadir los nuevos
|
144 |
+
$items = $quote->getAllItems();
|
145 |
+
foreach($items as $item)
|
146 |
+
{
|
147 |
+
$product = $item->getProduct();
|
148 |
+
$qty = $item->getQty();
|
149 |
+
|
150 |
+
$session = Mage::getModel('core/cookie')->get('oct8ne-session');
|
151 |
+
|
152 |
+
$model = Mage::getModel('oct8ne/quoteproducts');
|
153 |
+
$model->setQuoteId($quote->getId());
|
154 |
+
$model->setCustomerId($quote->getCustomerId());
|
155 |
+
$model->setProductId($product->getId());
|
156 |
+
$model->setProductPrice($product->getPrice());
|
157 |
+
$model->setQuotePrice($quote->getGrandTotal());
|
158 |
+
$model->setCreatedAt($quote->getCreatedAt());
|
159 |
+
$model->setOct8ne($session);
|
160 |
+
$model->setQty($qty);
|
161 |
+
$model->setCurrency($quote->getQuoteCurrencyCode());
|
162 |
+
$model->save();
|
163 |
+
|
164 |
+
// echo $order->getOrderCurrency()->getCode(); /* $item['oct8ne']; */
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
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 |
-
|
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 |
-
if (
|
128 |
-
$this->_getSession()->
|
129 |
-
|
130 |
-
$
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
if(
|
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 |
+
// $this->_checkApitoken();
|
35 |
+
|
36 |
+
// Get initial data from request
|
37 |
+
$categoryId = (int) $this->getRequest()->getParam('category', false);
|
38 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
39 |
+
$specifyOptions = $this->getRequest()->getParam('options');
|
40 |
+
|
41 |
+
// Prepare helper and params
|
42 |
+
$viewHelper = Mage::helper('catalog/product_view');
|
43 |
+
|
44 |
+
$params = new Varien_Object();
|
45 |
+
$params->setCategoryId($categoryId);
|
46 |
+
$params->setSpecifyOptions($specifyOptions);
|
47 |
+
|
48 |
+
// Render page
|
49 |
+
try {
|
50 |
+
$viewHelper->prepareAndRender($productId, $this, $params);
|
51 |
+
} catch (Exception $e) {
|
52 |
+
if ($e->getCode() == $viewHelper->ERR_NO_PRODUCT_LOADED) {
|
53 |
+
if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
|
54 |
+
$this->_redirect('');
|
55 |
+
} elseif (!$this->getResponse()->isRedirect()) {
|
56 |
+
$this->_forward('noRoute');
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
Mage::logException($e);
|
60 |
+
$this->_forward('noRoute');
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Initialize product instance from request data
|
68 |
+
*
|
69 |
+
* @return Mage_Catalog_Model_Product || false
|
70 |
+
*/
|
71 |
+
protected function _initProduct() {
|
72 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
73 |
+
|
74 |
+
if ($productId) {
|
75 |
+
$product = Mage::getModel('catalog/product')
|
76 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
77 |
+
->load($productId);
|
78 |
+
if ($product->getId())
|
79 |
+
return $product;
|
80 |
+
}
|
81 |
+
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
|
85 |
+
public function add2cartAction() {
|
86 |
+
// $this->_checkApitoken();
|
87 |
+
|
88 |
+
|
89 |
+
$cart = $this->_getCart();
|
90 |
+
$params = $this->getRequest()->getParams();
|
91 |
+
try {
|
92 |
+
if (isset($params['qty'])) {
|
93 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
94 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
95 |
+
);
|
96 |
+
$params['qty'] = $filter->filter($params['qty']);
|
97 |
+
}
|
98 |
+
|
99 |
+
$product = $this->_initProduct();
|
100 |
+
$related = $this->getRequest()->getParam('related_product');
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Check product availability
|
104 |
+
*/
|
105 |
+
if ( !$product ) {
|
106 |
+
$this->_goBack();
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
$cart->addProduct($product, $params);
|
111 |
+
|
112 |
+
if (!empty($related)) {
|
113 |
+
$cart->addProductsByIds(explode(',', $related));
|
114 |
+
}
|
115 |
+
|
116 |
+
$cart->save();
|
117 |
+
|
118 |
+
$this->_getSession()->setCartWasUpdated(true);
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @todo remove wishlist observer processAddToCart
|
122 |
+
*/
|
123 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete',
|
124 |
+
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
125 |
+
);
|
126 |
+
|
127 |
+
if (!$cart->getQuote()->getHasError()){
|
128 |
+
$products = $this->_getSession()->getOct8neProducts();
|
129 |
+
if(!is_array($products))
|
130 |
+
$products = array();
|
131 |
+
$products[] = $product->getId();
|
132 |
+
$this->_getSession()->setOct8neProducts($products);
|
133 |
+
|
134 |
+
// Este mensaje se deshabilita porque sale a destiempo, cuando el parámetro no sea oct8ne
|
135 |
+
// $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
|
136 |
+
// $this->_getSession()->addSuccess($message);
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
$this->loadLayout();
|
141 |
+
$this->renderLayout();
|
142 |
+
|
143 |
+
} catch (Mage_Core_Exception $e) {
|
144 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
145 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
146 |
+
} else {
|
147 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
148 |
+
foreach ($messages as $message)
|
149 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
150 |
+
}
|
151 |
+
|
152 |
+
} catch (Exception $e) {
|
153 |
+
// $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
154 |
+
Mage::logException($e);
|
155 |
+
$this->_goBack();
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Retrieve child categories of current category
|
162 |
+
*
|
163 |
+
* @return Varien_Data_Tree_Node_Collection
|
164 |
+
*/
|
165 |
+
public function getCurrentChildCategories()
|
166 |
+
{
|
167 |
+
$layer = Mage::getSingleton('catalog/layer');
|
168 |
+
$category = $layer->getCurrentCategory();
|
169 |
+
/* @var $category Mage_Catalog_Model_Category */
|
170 |
+
$categories = $category->getChildrenCategories();
|
171 |
+
$productCollection = Mage::getResourceModel('catalog/product_collection');
|
172 |
+
$layer->prepareProductCollection($productCollection);
|
173 |
+
$productCollection->addCountToCategories($categories);
|
174 |
+
return $categories;
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Retrieve request object
|
180 |
+
*
|
181 |
+
* @return Mage_Core_Controller_Request_Http
|
182 |
+
* @throws Exception
|
183 |
+
*/
|
184 |
+
public function getRequest()
|
185 |
+
{
|
186 |
+
$controller = Mage::app()->getFrontController();
|
187 |
+
if ($controller) {
|
188 |
+
$this->_request = $controller->getRequest();
|
189 |
+
} else {
|
190 |
+
throw new Exception(Mage::helper('core')->__("Can't retrieve request object"));
|
191 |
+
}
|
192 |
+
return $this->_request;
|
193 |
+
}
|
194 |
+
|
195 |
+
protected function searchAction()
|
196 |
+
{
|
197 |
+
// $this->_checkApitoken();
|
198 |
+
|
199 |
+
$search_criteria = $this->getRequest()->getParam('search', null);
|
200 |
+
$search_order = $this->getRequest()->getParam('orderby', null);
|
201 |
+
$search_dir = $this->getRequest()->getParam('dir', null);
|
202 |
+
|
203 |
+
$storeId = $this->getRequest()->getParam('store', null);
|
204 |
+
$currency = $this->getRequest()->getParam('currency', null);
|
205 |
+
|
206 |
+
if(is_null($storeId))
|
207 |
+
{
|
208 |
+
$storeId = Mage::app()->getStore()->getId();
|
209 |
+
$initialEnvironmentInfo = null;
|
210 |
+
}
|
211 |
+
else
|
212 |
+
{
|
213 |
+
$appEmulation = Mage::getSingleton('core/app_emulation');
|
214 |
+
// Start environment emulation of the specified store
|
215 |
+
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
|
216 |
+
}
|
217 |
+
|
218 |
+
$currentCurrency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
219 |
+
if(!is_null($currency))
|
220 |
+
Mage::app()->getStore()->setCurrentCurrencyCode($currency);
|
221 |
+
|
222 |
+
$callback = $this->getRequest()->getParam('callback', null);
|
223 |
+
$this->getRequest()->setParam('q', $search_criteria);
|
224 |
+
|
225 |
+
if(is_null($search_criteria) || strlen($search_criteria)==0){
|
226 |
+
//passem totes les dades buides per tal que no mostri resultats
|
227 |
+
Mage::register('total_search_results', 0);
|
228 |
+
Mage::register('search_result_collection', array());
|
229 |
+
Mage::register('partial_search', false);
|
230 |
+
Mage::register('callback', $callback);
|
231 |
+
Mage::register('search_result_attrs', array());
|
232 |
+
Mage::register('search_result_attrs_applied', array());
|
233 |
+
Mage::register('search_result_attrs_available', array());
|
234 |
+
|
235 |
+
Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
|
236 |
+
|
237 |
+
$this->getResponse()->setHeader('Content-type', 'application/json; charset=UTF8', true);
|
238 |
+
|
239 |
+
$this->loadLayout();
|
240 |
+
$this->renderLayout();
|
241 |
+
return ;
|
242 |
+
|
243 |
+
}
|
244 |
+
// $this->getRequest()->setParam('order', $search_sort);
|
245 |
+
// $this->getRequest()->setParam('dir', $search_order);
|
246 |
+
|
247 |
+
// de esto se encarga Magento $search_criteria = Mage::helper('core/string')->cleanString( $search_criteria );
|
248 |
+
//die(Mage::app()->getStore()->getId());
|
249 |
+
$query = Mage::helper('catalogsearch')->getQuery();
|
250 |
+
$query->setStoreId($storeId);
|
251 |
+
if ($query->getId()) {
|
252 |
+
$query->setPopularity($query->getPopularity()+1);
|
253 |
+
}
|
254 |
+
else {
|
255 |
+
$query->setPopularity(1);
|
256 |
+
}
|
257 |
+
$query->prepare();
|
258 |
+
Mage::helper('catalogsearch')->checkNotes();
|
259 |
+
|
260 |
+
$query = Mage::getModel('catalogsearch/layer');
|
261 |
+
|
262 |
+
|
263 |
+
|
264 |
+
$filterableAttributes = $query->getFilterableAttributes();
|
265 |
+
$attrs = array();
|
266 |
+
|
267 |
+
if(!empty($filterableAttributes))
|
268 |
+
{
|
269 |
+
$tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();
|
270 |
+
$tmp->SetAttributeCode('category');
|
271 |
+
$tmp->setFrontendLabel('Category');
|
272 |
+
$filterableAttributes->addItem($tmp);
|
273 |
+
}
|
274 |
+
// $filterableAttributes[] =
|
275 |
+
// category
|
276 |
+
|
277 |
+
foreach ($filterableAttributes as $attribute)
|
278 |
+
{
|
279 |
+
$code = $attribute->getAttributeCode();
|
280 |
+
$name = $attribute->getFrontendLabel();
|
281 |
+
|
282 |
+
// INIT
|
283 |
+
$items = array();
|
284 |
+
switch($code)
|
285 |
+
{
|
286 |
+
case 'price':
|
287 |
+
$_filterModelName = "catalog/layer_filter_price";
|
288 |
+
break;
|
289 |
+
case 'decimal':
|
290 |
+
$_filterModelName = "catalog/layer_filter_decimal";
|
291 |
+
break;
|
292 |
+
case 'category':
|
293 |
+
$_filterModelName = "catalog/layer_filter_category";
|
294 |
+
break;
|
295 |
+
default:
|
296 |
+
$_filterModelName = "catalog/layer_filter_attribute";
|
297 |
+
break;
|
298 |
+
}
|
299 |
+
|
300 |
+
$filter = Mage::getModel($_filterModelName)
|
301 |
+
->setLayer($query)
|
302 |
+
->setAttributeModel($attribute);
|
303 |
+
$filter->apply($this->getRequest(), $this);
|
304 |
+
$items = $filter->getItems();
|
305 |
+
// INIT
|
306 |
+
|
307 |
+
// En los filtros aplicados no nos viene el nombre, solo el id, lo obtenemos aqui
|
308 |
+
$optionId = $this->getRequest()->getParam($filter->getRequestVar());
|
309 |
+
$featurename = "";
|
310 |
+
if(!is_null($optionId)) {
|
311 |
+
switch($code)
|
312 |
+
{
|
313 |
+
case 'price':
|
314 |
+
$featurename = $this->getRequest()->get($code);
|
315 |
+
break;
|
316 |
+
case 'decimal':
|
317 |
+
$featurename = $this->getRequest()->get($code);
|
318 |
+
break;
|
319 |
+
case 'category':
|
320 |
+
$featurename = $filter->getCategory()->getName();
|
321 |
+
break;
|
322 |
+
default:
|
323 |
+
$featurename = $filter->getAttributeModel()->getFrontend()->getOption($optionId);
|
324 |
+
break;
|
325 |
+
}
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
$options = array();
|
330 |
+
foreach($items as $item)
|
331 |
+
{
|
332 |
+
if($item->getCount() > 0)
|
333 |
+
$options[] = array("label" => $item->getLabel(), "value" => $item->getValue(), "qty" => $item->getCount());
|
334 |
+
}
|
335 |
+
|
336 |
+
$attrs[] = array(
|
337 |
+
'code' => $code,
|
338 |
+
'name' => $name,
|
339 |
+
'options' => $options,
|
340 |
+
'featurename' => $featurename
|
341 |
+
);
|
342 |
+
}
|
343 |
+
|
344 |
+
$attrs_applied = array();
|
345 |
+
$attrs_available = array();
|
346 |
+
foreach($attrs as $attr)
|
347 |
+
{
|
348 |
+
if(!is_null($this->getRequest()->getParam($attr['code'])))
|
349 |
+
{
|
350 |
+
$attr['value'] = $this->getRequest()->getParam($attr['code']);
|
351 |
+
$attrs_applied[] = $attr;
|
352 |
+
}
|
353 |
+
else
|
354 |
+
{
|
355 |
+
$attrs_available[] = $attr;
|
356 |
+
}
|
357 |
+
/*
|
358 |
+
if($this->getRequest()
|
359 |
+
$attrs[] = array(
|
360 |
+
'code' => $code,
|
361 |
+
'name' => $name,
|
362 |
+
'options' => $options
|
363 |
+
);
|
364 |
+
*/
|
365 |
+
}
|
366 |
+
|
367 |
+
|
368 |
+
$result_collection = $query->getProductCollection();
|
369 |
+
|
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,244 @@
|
|
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 |
-
<connection>
|
69 |
-
<use>
|
70 |
-
</connection>
|
71 |
-
</
|
72 |
-
<
|
73 |
-
<connection>
|
74 |
-
<use>
|
75 |
-
</connection>
|
76 |
-
</
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
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 |
+
<design_package>LetsSyncroLLC_Oct8ne_Model_Mage_Package</design_package>
|
36 |
+
</rewrite>
|
37 |
+
</core>
|
38 |
+
|
39 |
+
<checkout>
|
40 |
+
<rewrite>
|
41 |
+
<type_onepage>LetsSyncroLLC_Oct8ne_Model_Mage_Onepage</type_onepage>
|
42 |
+
</rewrite>
|
43 |
+
</checkout>
|
44 |
+
|
45 |
+
</models>
|
46 |
+
<blocks>
|
47 |
+
<oct8ne>
|
48 |
+
<class>LetsSyncroLLC_Oct8ne_Block</class>
|
49 |
+
</oct8ne>
|
50 |
+
|
51 |
+
<page>
|
52 |
+
<rewrite>
|
53 |
+
<html_head>LetsSyncroLLC_Oct8ne_Block_Html_Head</html_head>
|
54 |
+
</rewrite>
|
55 |
+
</page>
|
56 |
+
|
57 |
+
</blocks>
|
58 |
+
<helpers>
|
59 |
+
<oct8ne>
|
60 |
+
<class>LetsSyncroLLC_Oct8ne_Helper</class>
|
61 |
+
</oct8ne>
|
62 |
+
</helpers>
|
63 |
+
<resources>
|
64 |
+
<oct8ne_setup>
|
65 |
+
<setup>
|
66 |
+
<module>LetsSyncroLLC_Oct8ne</module>
|
67 |
+
</setup>
|
68 |
+
<connection>
|
69 |
+
<use>core_setup</use>
|
70 |
+
</connection>
|
71 |
+
</oct8ne_setup>
|
72 |
+
<oct8ne_write>
|
73 |
+
<connection>
|
74 |
+
<use>core_write</use>
|
75 |
+
</connection>
|
76 |
+
</oct8ne_write>
|
77 |
+
<oct8ne_read>
|
78 |
+
<connection>
|
79 |
+
<use>core_read</use>
|
80 |
+
</connection>
|
81 |
+
</oct8ne_read>
|
82 |
+
</resources>
|
83 |
+
|
84 |
+
|
85 |
+
<events>
|
86 |
+
<controller_front_init_routers>
|
87 |
+
<observers>
|
88 |
+
<LetsSyncroLLC_Oct8ne_Intercept>
|
89 |
+
<type>singleton</type>
|
90 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
91 |
+
<method>interceptMethod</method>
|
92 |
+
</LetsSyncroLLC_Oct8ne_Intercept>
|
93 |
+
</observers>
|
94 |
+
</controller_front_init_routers>
|
95 |
+
|
96 |
+
<controller_action_layout_render_before>
|
97 |
+
<observers>
|
98 |
+
<LetsSyncroLLC_Oct8ne_Layout>
|
99 |
+
<type>singleton</type>
|
100 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
101 |
+
<method>layoutRenderBefore</method>
|
102 |
+
</LetsSyncroLLC_Oct8ne_Layout>
|
103 |
+
</observers>
|
104 |
+
</controller_action_layout_render_before>
|
105 |
+
|
106 |
+
<sales_order_place_after>
|
107 |
+
<observers>
|
108 |
+
<LetsSyncroLLC_Oct8ne_Order>
|
109 |
+
<type>singleton</type>
|
110 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
111 |
+
<method>placeOrderBefore</method>
|
112 |
+
</LetsSyncroLLC_Oct8ne_Order>
|
113 |
+
</observers>
|
114 |
+
</sales_order_place_after>
|
115 |
+
|
116 |
+
<sales_quote_save_after>
|
117 |
+
<observers>
|
118 |
+
<LetsSyncroLLC_Oct8ne_Quote>
|
119 |
+
<type>singleton</type>
|
120 |
+
<class>LetsSyncroLLC_Oct8ne_Model_Observer</class>
|
121 |
+
<method>saveQuoteAfter</method>
|
122 |
+
</LetsSyncroLLC_Oct8ne_Quote>
|
123 |
+
</observers>
|
124 |
+
</sales_quote_save_after>
|
125 |
+
</events>
|
126 |
+
</global>
|
127 |
+
<frontend>
|
128 |
+
<routers>
|
129 |
+
<oct8ne>
|
130 |
+
<!-- <LetsSyncroLLC_LetsSyncro> -->
|
131 |
+
<use>standard</use>
|
132 |
+
<args>
|
133 |
+
<module>LetsSyncroLLC_Oct8ne</module>
|
134 |
+
<frontName>oct8ne</frontName>
|
135 |
+
</args>
|
136 |
+
<!-- </LetsSyncroLLC_LetsSyncro> -->
|
137 |
+
</oct8ne>
|
138 |
+
|
139 |
+
<customer>
|
140 |
+
<args>
|
141 |
+
<modules>
|
142 |
+
<oct8ne before="Mage_Customer">LetsSyncroLLC_Oct8ne</oct8ne>
|
143 |
+
</modules>
|
144 |
+
</args>
|
145 |
+
</customer>
|
146 |
+
</routers>
|
147 |
+
<layout>
|
148 |
+
<updates>
|
149 |
+
<LetsSyncroLLC_Oct8ne>
|
150 |
+
<file>oct8ne.xml</file>
|
151 |
+
</LetsSyncroLLC_Oct8ne>
|
152 |
+
</updates>
|
153 |
+
</layout>
|
154 |
+
</frontend>
|
155 |
+
<admin>
|
156 |
+
<routers>
|
157 |
+
<!-- <LetsSyncroLLC_LetsSyncro> -->
|
158 |
+
<oct8ne>
|
159 |
+
<use>admin</use>
|
160 |
+
<args>
|
161 |
+
<module>LetsSyncroLLC_Oct8ne</module>
|
162 |
+
<frontName>oct8ne</frontName>
|
163 |
+
</args>
|
164 |
+
</oct8ne>
|
165 |
+
<!-- </LetsSyncroLLC_LetsSyncro> -->
|
166 |
+
</routers>
|
167 |
+
</admin>
|
168 |
+
<adminhtml>
|
169 |
+
<translate>
|
170 |
+
<modules>
|
171 |
+
<LetsSyncroLLC_Oct8ne>
|
172 |
+
<files>
|
173 |
+
<default>LetsSyncroLLC_Oct8ne.csv</default>
|
174 |
+
</files>
|
175 |
+
</LetsSyncroLLC_Oct8ne>
|
176 |
+
</modules>
|
177 |
+
</translate>
|
178 |
+
<menu>
|
179 |
+
<oct8ne translate="title" module="oct8ne">
|
180 |
+
<title>Oct8ne</title>
|
181 |
+
<sort_order>1000</sort_order>
|
182 |
+
<children>
|
183 |
+
<accountconfig translate="title" module="oct8ne">
|
184 |
+
<title>Account Setup</title>
|
185 |
+
<action>oct8ne/admin/accountconfig</action>
|
186 |
+
<sort_order>0</sort_order>
|
187 |
+
</accountconfig>
|
188 |
+
<!--<dashboard translate="title" module="oct8ne">
|
189 |
+
<title>Dashboard</title>
|
190 |
+
<action>oct8ne/admin/dashboard</action>
|
191 |
+
<sort_order>20</sort_order>
|
192 |
+
</dashboard>
|
193 |
+
<syncrodata translate="title" module="oct8ne">
|
194 |
+
<title>Syncro Data</title>
|
195 |
+
<action>oct8ne/admin/syncrodata</action>
|
196 |
+
<sort_order>40</sort_order>
|
197 |
+
</syncrodata>-->
|
198 |
+
</children>
|
199 |
+
</oct8ne>
|
200 |
+
</menu>
|
201 |
+
<acl>
|
202 |
+
<resources>
|
203 |
+
<admin>
|
204 |
+
<children>
|
205 |
+
<oct8ne translate="title" module="oct8ne">
|
206 |
+
<title>Oct8ne</title>
|
207 |
+
<sort_order>1000</sort_order>
|
208 |
+
<children>
|
209 |
+
<accountconfig translate="title" module="oct8ne">
|
210 |
+
<title>Account Setup</title>
|
211 |
+
<action>oct8ne/admin/accountconfig</action>
|
212 |
+
<sort_order>0</sort_order>
|
213 |
+
</accountconfig>
|
214 |
+
<!--<dashboard translate="title" module="oct8ne">
|
215 |
+
<title>Dashboard</title>
|
216 |
+
<action>oct8ne/admin/dashboard</action>
|
217 |
+
<sort_order>20</sort_order>
|
218 |
+
</dashboard>
|
219 |
+
<syncrodata translate="title" module="oct8ne">
|
220 |
+
<title>Syncro Data</title>
|
221 |
+
<action>oct8ne/admin/syncrodata</action>
|
222 |
+
<sort_order>40</sort_order>
|
223 |
+
</syncrodata>-->
|
224 |
+
</children>
|
225 |
+
</oct8ne>
|
226 |
+
</children>
|
227 |
+
</admin>
|
228 |
+
|
229 |
+
</resources>
|
230 |
+
|
231 |
+
|
232 |
+
</acl>
|
233 |
+
</adminhtml>
|
234 |
+
|
235 |
+
<default>
|
236 |
+
<design>
|
237 |
+
<oct8nedesign>
|
238 |
+
<package>default</package>
|
239 |
+
<theme>oct8ne</theme>
|
240 |
+
</oct8nedesign>
|
241 |
+
</design>
|
242 |
+
</default>
|
243 |
+
</config>
|
244 |
+
|
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,250 @@
|
|
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 |
-
</reference>
|
17 |
-
|
18 |
-
<reference name="content">
|
19 |
-
<block type="core/template" template="oct8ne/frame/customer/data.phtml" />
|
20 |
-
</reference>
|
21 |
-
</oct8ne_frame_customerdata>
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
<oct8ne_frame_add2cart>
|
26 |
-
<reference name="root">
|
27 |
-
<action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
|
28 |
-
</reference>
|
29 |
-
|
30 |
-
<reference name="content">
|
31 |
-
<block type="core/template" template="oct8ne/frame/add2cart.phtml" />
|
32 |
-
</reference>
|
33 |
-
</oct8ne_frame_add2cart>
|
34 |
-
|
35 |
-
|
36 |
-
<oct8ne_frame_search>
|
37 |
-
<reference name="root">
|
38 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
39 |
-
</reference>
|
40 |
-
|
41 |
-
<reference name="content">
|
42 |
-
<block type="core/template" template="oct8ne/frame/search.phtml" />
|
43 |
-
</reference>
|
44 |
-
</oct8ne_frame_search>
|
45 |
-
|
46 |
-
|
47 |
-
<oct8ne_frame_productview>
|
48 |
-
|
49 |
-
<reference name="head">
|
50 |
-
<action method="addJs"><script>varien/product.js</script></action>
|
51 |
-
</reference>
|
52 |
-
|
53 |
-
<!-- <block type="core/template_facade" name="root" template="oct8ne/frame/productview.phtml"/> -->
|
54 |
-
|
55 |
-
<label>Catalog Product View (Any)</label>
|
56 |
-
<!-- Mage_Catalog -->
|
57 |
-
<reference name="head">
|
58 |
-
<remove name="oct8ne_script" />
|
59 |
-
</reference>
|
60 |
-
<reference name="root">
|
61 |
-
<!-- <action method="setTemplate"><template>page/2columns-right.phtml</template></action> -->
|
62 |
-
<action method="setTemplate"><template>oct8ne/frame/clean-page.phtml</template></action>
|
63 |
-
</reference>
|
64 |
-
<reference name="head">
|
65 |
-
<action method="addJs"><script>varien/product.js</script></action>
|
66 |
-
<action method="addJs"><script>varien/configurable.js</script></action>
|
67 |
-
|
68 |
-
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
69 |
-
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
70 |
-
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
71 |
-
</reference>
|
72 |
-
<reference name="content">
|
73 |
-
<block type="catalog/product_view" name="product.info" template="oct8ne/frame/productview.phtml">
|
74 |
-
|
75 |
-
<block type="catalog/product_view_media" name="product.info.media" as="media" template="oct8ne/frame/productview/media.phtml"/>
|
76 |
-
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
|
77 |
-
<label>Alert Urls</label>
|
78 |
-
</block>
|
79 |
-
|
80 |
-
<action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
|
81 |
-
|
82 |
-
<block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="oct8ne/frame/productview/list/upsell.phtml">
|
83 |
-
<action method="setColumnCount"><columns>4</columns></action>
|
84 |
-
<action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
|
85 |
-
</block>
|
86 |
-
|
87 |
-
<block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
|
88 |
-
<block type="catalog/product_view_description" name="product.description" as="description" template="oct8ne/frame/productview/description.phtml">
|
89 |
-
<action method="addToParentGroup"><group>detailed_info</group></action>
|
90 |
-
</block>
|
91 |
-
<block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="oct8ne/frame/productview/attributes.phtml">
|
92 |
-
<action method="addToParentGroup"><group>detailed_info</group></action>
|
93 |
-
</block>
|
94 |
-
<block type="catalog/product_view" name="product.info.addto" as="addto" template="oct8ne/frame/productview/addto.phtml"/>
|
95 |
-
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="oct8ne/frame/productview/addtocart.phtml"/>
|
96 |
-
|
97 |
-
<block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label">
|
98 |
-
<label>Product View Extra Hint</label>
|
99 |
-
</block>
|
100 |
-
|
101 |
-
<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="oct8ne/frame/productview/options/wrapper.phtml" translate="label">
|
102 |
-
<label>Info Column Options Wrapper</label>
|
103 |
-
<block type="core/template" name="options_js" template="oct8ne/frame/productview/options/js.phtml"/>
|
104 |
-
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="oct8ne/frame/productview/options.phtml">
|
105 |
-
<action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
|
106 |
-
<action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
|
107 |
-
<action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
|
108 |
-
<action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
|
109 |
-
</block>
|
110 |
-
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
111 |
-
</block>
|
112 |
-
<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">
|
113 |
-
<label>Bottom Block Options Wrapper</label>
|
114 |
-
<action method="insert"><block>product.tierprices</block></action>
|
115 |
-
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="oct8ne/frame/productview/price_clone.phtml"/>
|
116 |
-
<action method="append"><block>product.info.addtocart</block></action>
|
117 |
-
<action method="append"><block>product.info.addto</block></action>
|
118 |
-
</block>
|
119 |
-
|
120 |
-
<block type="core/template_facade" name="product.info.container1" as="container1">
|
121 |
-
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</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 |
-
<block type="core/template_facade" name="product.info.container2" as="container2">
|
127 |
-
<action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
|
128 |
-
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
129 |
-
<action method="append"><block>product.info.options.wrapper</block></action>
|
130 |
-
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
131 |
-
</block>
|
132 |
-
<action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
133 |
-
<action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
134 |
-
</block>
|
135 |
-
</reference>
|
136 |
-
<reference name="right">
|
137 |
-
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="oct8ne/frame/productview/list/related.phtml"/>
|
138 |
-
</reference>
|
139 |
-
|
140 |
-
</oct8ne_frame_productview>
|
141 |
-
|
142 |
-
|
143 |
-
<oct8ne_frame_search2 translate="label">
|
144 |
-
<label>Oct8ne Search</label>
|
145 |
-
<reference name="root">
|
146 |
-
<action method="setTemplate"><template>page/3columns.phtml</template></action>
|
147 |
-
</reference>
|
148 |
-
<reference name="left">
|
149 |
-
<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
|
150 |
-
</reference>
|
151 |
-
<reference name="content">
|
152 |
-
<block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
|
153 |
-
<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
|
154 |
-
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
|
155 |
-
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
156 |
-
</block>
|
157 |
-
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
|
158 |
-
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
|
159 |
-
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
|
160 |
-
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
|
161 |
-
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
|
162 |
-
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
|
163 |
-
</block>
|
164 |
-
<action method="setListOrders"/>
|
165 |
-
<action method="setListModes"/>
|
166 |
-
<action method="setListCollection"/>
|
167 |
-
</block>
|
168 |
-
</reference>
|
169 |
-
</oct8ne_frame_search2>
|
170 |
-
|
171 |
-
<customer_account_loginpost>
|
172 |
-
<reference name="root">
|
173 |
-
<action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
|
174 |
-
</reference>
|
175 |
-
|
176 |
-
<reference name="content">
|
177 |
-
<block type="core/template" template="oct8ne/frame/loginpost.phtml" />
|
178 |
-
</reference>
|
179 |
-
</customer_account_loginpost>
|
180 |
-
|
181 |
-
<oct8ne_frame_getcart>
|
182 |
-
<reference name="root">
|
183 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
184 |
-
</reference>
|
185 |
-
|
186 |
-
<reference name="content">
|
187 |
-
<block type="core/template" template="oct8ne/frame/getcart.phtml" />
|
188 |
-
</reference>
|
189 |
-
</oct8ne_frame_getcart>
|
190 |
-
|
191 |
-
<oct8ne_frame_getwishlist>
|
192 |
-
<reference name="root">
|
193 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
194 |
-
</reference>
|
195 |
-
|
196 |
-
<reference name="content">
|
197 |
-
<block type="core/template" template="oct8ne/frame/getwishlist.phtml" />
|
198 |
-
</reference>
|
199 |
-
</oct8ne_frame_getwishlist>
|
200 |
-
|
201 |
-
<oct8ne_frame_addtowishlist>
|
202 |
-
<reference name="root">
|
203 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
204 |
-
</reference>
|
205 |
-
|
206 |
-
<reference name="content">
|
207 |
-
<block type="core/template" template="oct8ne/frame/addtowishlist.phtml" />
|
208 |
-
</reference>
|
209 |
-
</oct8ne_frame_addtowishlist>
|
210 |
-
|
211 |
-
<oct8ne_frame_removefromwishlist>
|
212 |
-
<reference name="root">
|
213 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
214 |
-
</reference>
|
215 |
-
|
216 |
-
<reference name="content">
|
217 |
-
<block type="core/template" template="oct8ne/frame/removefromwishlist.phtml" />
|
218 |
-
</reference>
|
219 |
-
</oct8ne_frame_removefromwishlist>
|
220 |
-
|
221 |
-
<oct8ne_frame_productinfo>
|
222 |
-
<reference name="root">
|
223 |
-
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
</reference>
|
17 |
+
|
18 |
+
<reference name="content">
|
19 |
+
<block type="core/template" template="oct8ne/frame/customer/data.phtml" />
|
20 |
+
</reference>
|
21 |
+
</oct8ne_frame_customerdata>
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
<oct8ne_frame_add2cart>
|
26 |
+
<reference name="root">
|
27 |
+
<action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
|
28 |
+
</reference>
|
29 |
+
|
30 |
+
<reference name="content">
|
31 |
+
<block type="core/template" template="oct8ne/frame/add2cart.phtml" />
|
32 |
+
</reference>
|
33 |
+
</oct8ne_frame_add2cart>
|
34 |
+
|
35 |
+
|
36 |
+
<oct8ne_frame_search>
|
37 |
+
<reference name="root">
|
38 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
39 |
+
</reference>
|
40 |
+
|
41 |
+
<reference name="content">
|
42 |
+
<block type="core/template" template="oct8ne/frame/search.phtml" />
|
43 |
+
</reference>
|
44 |
+
</oct8ne_frame_search>
|
45 |
+
|
46 |
+
|
47 |
+
<oct8ne_frame_productview>
|
48 |
+
|
49 |
+
<reference name="head">
|
50 |
+
<action method="addJs"><script>varien/product.js</script></action>
|
51 |
+
</reference>
|
52 |
+
|
53 |
+
<!-- <block type="core/template_facade" name="root" template="oct8ne/frame/productview.phtml"/> -->
|
54 |
+
|
55 |
+
<label>Catalog Product View (Any)</label>
|
56 |
+
<!-- Mage_Catalog -->
|
57 |
+
<reference name="head">
|
58 |
+
<remove name="oct8ne_script" />
|
59 |
+
</reference>
|
60 |
+
<reference name="root">
|
61 |
+
<!-- <action method="setTemplate"><template>page/2columns-right.phtml</template></action> -->
|
62 |
+
<action method="setTemplate"><template>oct8ne/frame/clean-page.phtml</template></action>
|
63 |
+
</reference>
|
64 |
+
<reference name="head">
|
65 |
+
<action method="addJs"><script>varien/product.js</script></action>
|
66 |
+
<action method="addJs"><script>varien/configurable.js</script></action>
|
67 |
+
|
68 |
+
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
69 |
+
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
70 |
+
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
71 |
+
</reference>
|
72 |
+
<reference name="content">
|
73 |
+
<block type="catalog/product_view" name="product.info" template="oct8ne/frame/productview.phtml">
|
74 |
+
|
75 |
+
<block type="catalog/product_view_media" name="product.info.media" as="media" template="oct8ne/frame/productview/media.phtml"/>
|
76 |
+
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
|
77 |
+
<label>Alert Urls</label>
|
78 |
+
</block>
|
79 |
+
|
80 |
+
<action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
|
81 |
+
|
82 |
+
<block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="oct8ne/frame/productview/list/upsell.phtml">
|
83 |
+
<action method="setColumnCount"><columns>4</columns></action>
|
84 |
+
<action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
|
85 |
+
</block>
|
86 |
+
|
87 |
+
<block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
|
88 |
+
<block type="catalog/product_view_description" name="product.description" as="description" template="oct8ne/frame/productview/description.phtml">
|
89 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
90 |
+
</block>
|
91 |
+
<block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="oct8ne/frame/productview/attributes.phtml">
|
92 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
93 |
+
</block>
|
94 |
+
<block type="catalog/product_view" name="product.info.addto" as="addto" template="oct8ne/frame/productview/addto.phtml"/>
|
95 |
+
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="oct8ne/frame/productview/addtocart.phtml"/>
|
96 |
+
|
97 |
+
<block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label">
|
98 |
+
<label>Product View Extra Hint</label>
|
99 |
+
</block>
|
100 |
+
|
101 |
+
<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="oct8ne/frame/productview/options/wrapper.phtml" translate="label">
|
102 |
+
<label>Info Column Options Wrapper</label>
|
103 |
+
<block type="core/template" name="options_js" template="oct8ne/frame/productview/options/js.phtml"/>
|
104 |
+
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="oct8ne/frame/productview/options.phtml">
|
105 |
+
<action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
|
106 |
+
<action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
|
107 |
+
<action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
|
108 |
+
<action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
|
109 |
+
</block>
|
110 |
+
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
111 |
+
</block>
|
112 |
+
<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">
|
113 |
+
<label>Bottom Block Options Wrapper</label>
|
114 |
+
<action method="insert"><block>product.tierprices</block></action>
|
115 |
+
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="oct8ne/frame/productview/price_clone.phtml"/>
|
116 |
+
<action method="append"><block>product.info.addtocart</block></action>
|
117 |
+
<action method="append"><block>product.info.addto</block></action>
|
118 |
+
</block>
|
119 |
+
|
120 |
+
<block type="core/template_facade" name="product.info.container1" as="container1">
|
121 |
+
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</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 |
+
<block type="core/template_facade" name="product.info.container2" as="container2">
|
127 |
+
<action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
|
128 |
+
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
129 |
+
<action method="append"><block>product.info.options.wrapper</block></action>
|
130 |
+
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
131 |
+
</block>
|
132 |
+
<action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
133 |
+
<action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
134 |
+
</block>
|
135 |
+
</reference>
|
136 |
+
<reference name="right">
|
137 |
+
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="oct8ne/frame/productview/list/related.phtml"/>
|
138 |
+
</reference>
|
139 |
+
|
140 |
+
</oct8ne_frame_productview>
|
141 |
+
|
142 |
+
|
143 |
+
<oct8ne_frame_search2 translate="label">
|
144 |
+
<label>Oct8ne Search</label>
|
145 |
+
<reference name="root">
|
146 |
+
<action method="setTemplate"><template>page/3columns.phtml</template></action>
|
147 |
+
</reference>
|
148 |
+
<reference name="left">
|
149 |
+
<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
|
150 |
+
</reference>
|
151 |
+
<reference name="content">
|
152 |
+
<block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
|
153 |
+
<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
|
154 |
+
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
|
155 |
+
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
156 |
+
</block>
|
157 |
+
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
|
158 |
+
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
|
159 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
|
160 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
|
161 |
+
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
|
162 |
+
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
|
163 |
+
</block>
|
164 |
+
<action method="setListOrders"/>
|
165 |
+
<action method="setListModes"/>
|
166 |
+
<action method="setListCollection"/>
|
167 |
+
</block>
|
168 |
+
</reference>
|
169 |
+
</oct8ne_frame_search2>
|
170 |
+
|
171 |
+
<customer_account_loginpost>
|
172 |
+
<reference name="root">
|
173 |
+
<action method="setTemplate"><template>oct8ne/frame/naked-page.phtml</template></action>
|
174 |
+
</reference>
|
175 |
+
|
176 |
+
<reference name="content">
|
177 |
+
<block type="core/template" template="oct8ne/frame/loginpost.phtml" />
|
178 |
+
</reference>
|
179 |
+
</customer_account_loginpost>
|
180 |
+
|
181 |
+
<oct8ne_frame_getcart>
|
182 |
+
<reference name="root">
|
183 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
184 |
+
</reference>
|
185 |
+
|
186 |
+
<reference name="content">
|
187 |
+
<block type="core/template" template="oct8ne/frame/getcart.phtml" />
|
188 |
+
</reference>
|
189 |
+
</oct8ne_frame_getcart>
|
190 |
+
|
191 |
+
<oct8ne_frame_getwishlist>
|
192 |
+
<reference name="root">
|
193 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
194 |
+
</reference>
|
195 |
+
|
196 |
+
<reference name="content">
|
197 |
+
<block type="core/template" template="oct8ne/frame/getwishlist.phtml" />
|
198 |
+
</reference>
|
199 |
+
</oct8ne_frame_getwishlist>
|
200 |
+
|
201 |
+
<oct8ne_frame_addtowishlist>
|
202 |
+
<reference name="root">
|
203 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
204 |
+
</reference>
|
205 |
+
|
206 |
+
<reference name="content">
|
207 |
+
<block type="core/template" template="oct8ne/frame/addtowishlist.phtml" />
|
208 |
+
</reference>
|
209 |
+
</oct8ne_frame_addtowishlist>
|
210 |
+
|
211 |
+
<oct8ne_frame_removefromwishlist>
|
212 |
+
<reference name="root">
|
213 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
214 |
+
</reference>
|
215 |
+
|
216 |
+
<reference name="content">
|
217 |
+
<block type="core/template" template="oct8ne/frame/removefromwishlist.phtml" />
|
218 |
+
</reference>
|
219 |
+
</oct8ne_frame_removefromwishlist>
|
220 |
+
|
221 |
+
<oct8ne_frame_productinfo>
|
222 |
+
<reference name="root">
|
223 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
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 |
+
|
241 |
+
<oct8ne_frame_getreportdata>
|
242 |
+
<reference name="root">
|
243 |
+
<action method="setTemplate"><template>oct8ne/frame/json-page.phtml</template></action>
|
244 |
+
</reference>
|
245 |
+
|
246 |
+
<reference name="content">
|
247 |
+
<block type="core/template" template="oct8ne/frame/getreportdata.phtml" />
|
248 |
+
</reference>
|
249 |
+
</oct8ne_frame_getreportdata>
|
250 |
+
</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/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.6</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,7 @@
|
|
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 +50,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 +77,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 +119,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.7</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 |
</dir>
|
46 |
<dir name="Mysql4">
|
47 |
<dir name="LetsSyncro">
|
50 |
<file name="Letssyncro.php" hash="81b49a4f7770d408eacd230a41434cbf"/>
|
51 |
<dir name="Orderproducts">
|
52 |
<file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
|
53 |
+
</dir>
|
54 |
+
<dir name="Quoteproducts">
|
55 |
+
<file name="Collection.php" hash="d41809333ca198109c3e0511790a333b"/>
|
56 |
</dir>
|
57 |
<file name="Orderproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
|
58 |
+
<file name="Quoteproducts.php" hash="4c05fe63b71bbc669d7053915969ea0c"/>
|
59 |
</dir>
|
60 |
<file name="Observer.php" hash="35c7a2608b071457d02ef3d0bc31f542"/>
|
61 |
<file name="Orderproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
|
62 |
+
<file name="Quoteproducts.php" hash="96432b6c3a3abdd58d9f9657a6432e18"/>
|
63 |
</dir>
|
64 |
<dir name="controllers">
|
65 |
<file name="AccountController.php" hash="492f053985eca9a14bc1abf698966d77"/>
|
77 |
<file name="mysql4-install-0.5.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
|
78 |
<file name="mysql4-install-1.0.0.php" hash="51668af264bb01c6607c68964ac6bdb7"/>
|
79 |
<file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="0de801ad4896defa9491391754ee7229"/>
|
80 |
+
<file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="0de801ad4896defa9491391754ee7229"/>
|
81 |
</dir>
|
82 |
</dir>
|
83 |
</dir>
|
119 |
</dir>
|
120 |
<file name="getcart.phtml" hash="f67bacfaf225c8972a52de542cac1d69"/>
|
121 |
<file name="getwishlist.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
|
122 |
+
<file name="getreportdata.phtml" hash="4e00716786afcebad70c7f72000b998e"/>
|
123 |
<file name="json-page.phtml" hash="509893c584213ad7d78e17a1a53249d1"/>
|
124 |
<file name="loginpost.phtml" hash="ea57cb60b282d1fc60186503f6909176"/>
|
125 |
<file name="naked-page.phtml" hash="6b9275b9ba11e9c79610b52e423e5dda"/>
|