Version Notes
Any questions or concerns, please email cs@tagalys.com and we will get back to you in less than 24 hours.
Download this release
Release Info
Developer | Aaditya |
Extension | Personalized-localized-and-Intelligent-Site-Search |
Version | 1.0.16 |
Comparing to | |
See all releases |
Code changes from version 1.0.15 to 1.0.16
- app/code/local/Tagalys/MerchandisingPage/.DS_Store +0 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/Filter/Attribute.php +49 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/Filter/Category.php +34 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/Filter/Price.php +48 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/State.php +15 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/View.php +135 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Product/List.php +48 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Product/List/Toolbar.php +95 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Layer.php +32 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Layer/Filter/Attribute.php +39 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Layer/View.php +145 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Result.php +29 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Filter.php +21 -0
- app/code/local/Tagalys/MerchandisingPage/Block/Page/Html/Pager.php +156 -0
- app/code/local/Tagalys/MerchandisingPage/Helper/Data.php +203 -0
- app/code/local/Tagalys/MerchandisingPage/Model/.DS_Store +0 -0
- app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer.php +62 -0
- app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer/Filter/Attribute.php +166 -0
- app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer/Filter/Category.php +103 -0
- app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer/Filter/Price.php +177 -0
- app/code/local/Tagalys/MerchandisingPage/Model/Catalogsearch/Layer.php +59 -0
- app/code/local/Tagalys/MerchandisingPage/Model/Client.php +146 -0
- app/code/local/Tagalys/MerchandisingPage/controllers/IndexController.php +37 -0
- app/code/local/Tagalys/MerchandisingPage/etc/config.xml +94 -0
- app/design/adminhtml/default/default/layout/Tagalys_core.xml +0 -22
- app/design/adminhtml/default/default/template/tagalys/progressbar.phtml +0 -159
- app/design/frontend/base/default/layout/tagalys/ss.xml +0 -7
- app/design/frontend/base/default/layout/tagalys_merchandising.xml +79 -0
- app/design/frontend/base/default/template/tagalys/tagalys_ss.phtml +0 -128
- app/design/frontend/base/default/template/tagalys_merchandising_page/mp_template.phtml +20 -0
- app/etc/modules/Tagalys_MerchandisingPage.xml +14 -0
- package.xml +3 -3
- skin/adminhtml/default/default/images/logo-tagalys.png +0 -0
app/code/local/Tagalys/MerchandisingPage/.DS_Store
ADDED
Binary file
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/Filter/Attribute.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles attribute filtering in layered navigation.
|
4 |
+
*
|
5 |
+
* @package Tagalys_Merchandising
|
6 |
+
* @subpackage Tagalys_Merchandising_Block
|
7 |
+
* @author Aaditya
|
8 |
+
*/
|
9 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Layer_Filter_Attribute extends Mage_Catalog_Block_Layer_Filter_Attribute
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Defines specific filter model name.
|
13 |
+
*
|
14 |
+
* @see Tagalys_Merchandising_Model_Catalog_Layer_Filter_Attribute
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
|
19 |
+
parent::__construct();
|
20 |
+
|
21 |
+
$this->_filterModelName = 'merchandisingpage/catalog_layer_filter_attribute';
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Prepares filter model.
|
26 |
+
*
|
27 |
+
* @return Tagalys_Merchandising_Block_Catalog_Layer_Filter_Attribute
|
28 |
+
*/
|
29 |
+
protected function _prepareFilter()
|
30 |
+
{
|
31 |
+
$this->_filter->setAttributeModel($this->getAttributeModel());
|
32 |
+
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Adds facet condition to filter.
|
38 |
+
*
|
39 |
+
* @see Tagalys_Merchandising_Model_Catalog_Layer_Filter_Attribute::addFacetCondition()
|
40 |
+
* @return Tagalys_Merchandising_Block_Catalog_Layer_Filter_Attribute
|
41 |
+
*/
|
42 |
+
public function addFacetCondition()
|
43 |
+
{
|
44 |
+
// Mage::log("Tagalys_Merchandising_Block_Catalog_Layer_Filter_Attribute::addFacetCondition()",null,'debug.log');
|
45 |
+
$this->_filter->addFacetCondition();
|
46 |
+
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/Filter/Category.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles category filtering in layered navigation.
|
4 |
+
*
|
5 |
+
* @package Tagalys_MerchandisingPage
|
6 |
+
* @subpackage Tagalys_MerchandisingPage_Block
|
7 |
+
* @author Tagalys
|
8 |
+
*/
|
9 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Layer_Filter_Category extends Mage_Catalog_Block_Layer_Filter_Category
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Defines specific filter model name.
|
13 |
+
*
|
14 |
+
* @see Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Category
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$this->_filterModelName = 'merchandisingpage/catalog_layer_filter_category';
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Adds facet condition to filter.
|
24 |
+
*
|
25 |
+
* @see Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Category::addFacetCondition()
|
26 |
+
* @return Tagalys_MerchandisingPage_Block_Catalog_Layer_Filter_Attribute
|
27 |
+
*/
|
28 |
+
public function addFacetCondition()
|
29 |
+
{
|
30 |
+
$this->_filter->addFacetCondition();
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/Filter/Price.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles decimal attribute filtering in layered navigation.
|
4 |
+
*
|
5 |
+
* @package Tagalys_MerchandisingPage
|
6 |
+
* @subpackage Tagalys_MerchandisingPage_Block
|
7 |
+
* @author Tagalys
|
8 |
+
*/
|
9 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Layer_Filter_Price extends Mage_Catalog_Block_Layer_Filter_Price
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Defines specific filter model name.
|
13 |
+
*
|
14 |
+
* @see Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Price
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$this->_filterModelName = 'merchandisingpage/catalog_layer_filter_price';
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Prepares filter model.
|
24 |
+
*
|
25 |
+
* @return Tagalys_MerchandisingPage_Block_Catalog_Layer_Filter_Price
|
26 |
+
*/
|
27 |
+
protected function _prepareFilter()
|
28 |
+
{
|
29 |
+
$this->_filter->setAttributeModel($this->getAttributeModel());
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Adds facet condition to filter.
|
36 |
+
*
|
37 |
+
* @see Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Price::addFacetCondition()
|
38 |
+
* @return Tagalys_MerchandisingPage_Block_Catalog_Layer_Filter_Price
|
39 |
+
*/
|
40 |
+
public function addFacetCondition()
|
41 |
+
{
|
42 |
+
if (!$this->getRequest()->getParam('price')) {
|
43 |
+
$this->_filter->addFacetCondition();
|
44 |
+
}
|
45 |
+
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/State.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Layer_State extends Mage_Catalog_Block_Layer_State
|
3 |
+
{
|
4 |
+
public function getActiveFilters()
|
5 |
+
{
|
6 |
+
|
7 |
+
$filters = $this->getLayer()->getFilters();
|
8 |
+
if (!is_array($filters)) {
|
9 |
+
$filters = array();
|
10 |
+
}
|
11 |
+
$filters = array();
|
12 |
+
return $filters;
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Layer/View.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Overrides default layer view process to define custom filter blocks.
|
4 |
+
*
|
5 |
+
* @package Tagalys_MerchandisingPage
|
6 |
+
* @subpackage Tagalys_MerchandisingPage_Block
|
7 |
+
* @author Tagalys
|
8 |
+
*/
|
9 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Layer_View extends Mage_Catalog_Block_Layer_View
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Boolean block name.
|
13 |
+
*
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
protected $_booleanFilterBlockName;
|
17 |
+
/**
|
18 |
+
* Registers current layer in registry.
|
19 |
+
*
|
20 |
+
* @see Mage_Catalog_Block_Product_List::getLayer()
|
21 |
+
*/
|
22 |
+
protected function _construct()
|
23 |
+
{
|
24 |
+
// die(var_dump('expression'));
|
25 |
+
parent::_construct();
|
26 |
+
Mage::unregister('current_layer');
|
27 |
+
Mage::register('current_layer', $this->getLayer());
|
28 |
+
}
|
29 |
+
/**
|
30 |
+
* Modifies default block names to specific ones if engine is active.
|
31 |
+
*/
|
32 |
+
protected function _initBlocks()
|
33 |
+
{
|
34 |
+
parent::_initBlocks();
|
35 |
+
if (Mage::helper('merchandisingpage')->isTagalysActive()) {
|
36 |
+
$this->_categoryBlockName = 'merchandisingpage/catalog_layer_filter_category';
|
37 |
+
$this->_attributeFilterBlockName = 'merchandisingpage/catalog_layer_filter_attribute';
|
38 |
+
$this->_priceFilterBlockName = 'merchandisingpage/catalog_layer_filter_price';
|
39 |
+
// $this->_booleanFilterBlockName = 'merchandisingpage/catalog_layer_filter_boolean';
|
40 |
+
}
|
41 |
+
}
|
42 |
+
/**
|
43 |
+
* Prepares layout if engine is active.
|
44 |
+
* Difference between parent method is addFacetCondition() call on each created block.
|
45 |
+
*
|
46 |
+
* @return Tagalys_MerchandisingPage_Block_Catalog_Layer_View
|
47 |
+
*/
|
48 |
+
protected function _prepareLayout()
|
49 |
+
{
|
50 |
+
|
51 |
+
if (Mage::helper('merchandisingpage')->isTagalysActive()) {
|
52 |
+
$stateBlock = $this->getLayout()->createBlock($this->_stateBlockName)
|
53 |
+
->setLayer($this->getLayer());
|
54 |
+
$categoryBlock = $this->getLayout()->createBlock($this->_categoryBlockName)
|
55 |
+
->setLayer($this->getLayer())
|
56 |
+
->init();
|
57 |
+
$this->setChild('layer_state', $stateBlock);
|
58 |
+
$this->setChild('category_filter', $categoryBlock->addFacetCondition());
|
59 |
+
$filterableAttributes = $this->_getFilterableAttributes();
|
60 |
+
$filters = array();
|
61 |
+
foreach ($filterableAttributes as $attribute) {
|
62 |
+
|
63 |
+
if ($attribute->getAttributeCode() == 'price') {
|
64 |
+
$filterBlockName = $this->_priceFilterBlockName;
|
65 |
+
|
66 |
+
} else {
|
67 |
+
$filterBlockName = $this->_attributeFilterBlockName;
|
68 |
+
}
|
69 |
+
|
70 |
+
if(isset($filterBlockName)) {
|
71 |
+
$filters[$attribute->getAttributeCode() . '_filter'] = $this->getLayout()->createBlock($filterBlockName)
|
72 |
+
->setLayer($this->getLayer())
|
73 |
+
->setAttributeModel($attribute)
|
74 |
+
->init();
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
foreach ($filters as $filterName => $block) {
|
79 |
+
// var_dump($filterName);
|
80 |
+
$this->setChild($filterName, $block->addFacetCondition());
|
81 |
+
}
|
82 |
+
$this->getLayer()->apply();
|
83 |
+
$this->getLayer()->getProductCollection()->load();
|
84 |
+
} else {
|
85 |
+
parent::_prepareLayout();
|
86 |
+
}
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
public function getRequest(){
|
90 |
+
$controller = Mage::app()->getFrontController();
|
91 |
+
if ($controller) {
|
92 |
+
$this->_request = $controller->getRequest();
|
93 |
+
} else {
|
94 |
+
throw new Exception(Mage::helper('core')->__("Can't retrieve request object"));
|
95 |
+
}
|
96 |
+
return $this->_request;
|
97 |
+
}
|
98 |
+
/**
|
99 |
+
* Returns current catalog layer.
|
100 |
+
*
|
101 |
+
* @return Tagalys_MerchandisingPage_Model_Catalog_Layer|Mage_Catalog_Model_Layer
|
102 |
+
*/
|
103 |
+
public function getLayer()
|
104 |
+
{
|
105 |
+
|
106 |
+
return parent::getLayer();
|
107 |
+
}
|
108 |
+
public function getFilters()
|
109 |
+
{
|
110 |
+
try {
|
111 |
+
$filters = array();
|
112 |
+
if ($categoryFilter = $this->_getCategoryFilter()) {
|
113 |
+
$filters[] = $categoryFilter;
|
114 |
+
}
|
115 |
+
$filterableAttributes = $this->_getFilterableAttributes();
|
116 |
+
foreach ($filterableAttributes as $attribute) {
|
117 |
+
$filters[] = $this->getChild($attribute->getAttributeCode() . '_filter');
|
118 |
+
|
119 |
+
}
|
120 |
+
return $filters;
|
121 |
+
} catch (Exception $e) {
|
122 |
+
// die("die");
|
123 |
+
var_dump($e);
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
protected function _getFilterableAttributes(){
|
128 |
+
if (Mage::helper('merchandisingpage')->isTagalysActive()) {
|
129 |
+
$attributeModel = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
|
130 |
+
return $attributeModel;
|
131 |
+
}
|
132 |
+
return parent::_getFilterableAttributes();
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Product/List.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
|
3 |
+
{
|
4 |
+
public function getLoadedProductCollection()
|
5 |
+
{
|
6 |
+
var_dump("asggag");
|
7 |
+
return $this->_getProductCollection();
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _getProductCollection()
|
11 |
+
{
|
12 |
+
|
13 |
+
$tagalys = Mage::helper("merchandisingPage")->getTagalysSearchData();
|
14 |
+
|
15 |
+
if($tagalys == false) {
|
16 |
+
|
17 |
+
|
18 |
+
return parent::_getProductCollection();
|
19 |
+
|
20 |
+
} else {
|
21 |
+
|
22 |
+
$searchResult = $tagalys;
|
23 |
+
// die(var_dump(empty($searchResult));
|
24 |
+
if(empty($searchResult) || empty($searchResult["results"])) {
|
25 |
+
return parent::_getProductCollection();
|
26 |
+
}
|
27 |
+
|
28 |
+
$collection = $this->_productCollection = Mage::getModel('catalog/product')
|
29 |
+
->getCollection()
|
30 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
31 |
+
->setStore(Mage::app()->getStore())
|
32 |
+
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
33 |
+
->addAttributeToFilter( 'entity_id', array( 'in' => $searchResult['results'] ) );
|
34 |
+
|
35 |
+
$orderString = array('CASE e.entity_id');
|
36 |
+
foreach($searchResult['results'] as $i => $productId) {
|
37 |
+
$orderString[] = 'WHEN '.$productId.' THEN '.$i;
|
38 |
+
}
|
39 |
+
$orderString[] = 'END';
|
40 |
+
$orderString = implode(' ', $orderString);
|
41 |
+
|
42 |
+
$collection->getSelect()->order(new Zend_Db_Expr($orderString));
|
43 |
+
|
44 |
+
return $this->_productCollection;
|
45 |
+
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalog/Product/List/Toolbar.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tagalys_MerchandisingPage_Block_Catalog_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar {
|
3 |
+
|
4 |
+
public function getAvailableOrders()
|
5 |
+
{
|
6 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
7 |
+
if($tagalysData == false) {
|
8 |
+
return $this->_availableOrder;
|
9 |
+
} else {
|
10 |
+
$sort_options = array();
|
11 |
+
foreach ($tagalysData['sort_options'] as $key => $sort) {
|
12 |
+
foreach ($sort as $key => $value) {
|
13 |
+
foreach ($value as $field => $val) {
|
14 |
+
$sort_options[$val["id"]] = $val['label'];
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
18 |
+
$sort_options = array();
|
19 |
+
foreach ($tagalysData['sort_options'] as $key => $sort) {
|
20 |
+
$sort_options[$sort["id"]] =$sort["label"];
|
21 |
+
}
|
22 |
+
$this->_availableOrder = $sort_options;
|
23 |
+
return $this->_availableOrder;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
public function getLastPageNum() {
|
27 |
+
|
28 |
+
$this->_pageSize = $this->getLimit();
|
29 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
30 |
+
if($tagalysData == false) {
|
31 |
+
return parent::getLastPageNum();
|
32 |
+
} else {
|
33 |
+
|
34 |
+
$collectionSize = (int) $tagalysData["total"];
|
35 |
+
|
36 |
+
if (0 === $collectionSize) {
|
37 |
+
return 1;
|
38 |
+
}
|
39 |
+
elseif($this->_pageSize) {
|
40 |
+
return ceil($collectionSize/$this->_pageSize);
|
41 |
+
}
|
42 |
+
else{
|
43 |
+
return 1;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getTotalNum() {
|
49 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
50 |
+
if($tagalysData == false) {
|
51 |
+
return parent::getTotalNum();
|
52 |
+
} else {
|
53 |
+
return (int) $tagalysData["total"];
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getLimit() {
|
58 |
+
$current_list_mode = Mage::app()->getLayout()->createBlock('catalog/product_list_toolbar')->getCurrentMode();
|
59 |
+
|
60 |
+
if( $current_list_mode == "grid" || $current_list_mode == "grid-list") {
|
61 |
+
$defaultLimit = Mage::getStoreConfig('catalog/frontend/grid_per_page');
|
62 |
+
|
63 |
+
} else if($current_list_mode == "list" || $current_list_mode == "list-grid") {
|
64 |
+
$defaultLimit = Mage::getStoreConfig('catalog/frontend/list_per_page');
|
65 |
+
}
|
66 |
+
$session_limit = $this->getRequest()->getParam($this->getLimitVarName(), $this->getDefaultPerPageValue());
|
67 |
+
|
68 |
+
!empty($session_limit) ? $session_limit : $defaultLimit;
|
69 |
+
return !empty($session_limit) ? $session_limit : $defaultLimit;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getFirstNum()
|
73 |
+
{
|
74 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
75 |
+
if($tagalysData == false) {
|
76 |
+
return parent::getFirstNum();
|
77 |
+
} else {
|
78 |
+
$this->_pageSize = $this->getLimit();
|
79 |
+
return $this->_pageSize*($this->getCurrentPage()-1)+1;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
public function getLastNum()
|
83 |
+
{
|
84 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
85 |
+
if($tagalysData == false) {
|
86 |
+
return parent::getLastNum();
|
87 |
+
} else {
|
88 |
+
$this->_pageSize = $this->getLimit();
|
89 |
+
$blind_last_num = $this->getFirstNum() + $this->_pageSize - 1;
|
90 |
+
$actual_last_num = min($blind_last_num, $tagalysData["total"]);
|
91 |
+
return $actual_last_num;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Layer.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
<?php
|
4 |
+
|
5 |
+
class Tagalys_Tsearch_Block_Catalogsearch_Layer extends Tagalys_Tsearch_Block_Catalogsearch_Layer_View {
|
6 |
+
|
7 |
+
protected function _initBlocks()
|
8 |
+
{
|
9 |
+
parent::_initBlocks();
|
10 |
+
|
11 |
+
}
|
12 |
+
public function canShowBlock() {
|
13 |
+
|
14 |
+
$availableResCount = (int) Mage::app()->getStore()
|
15 |
+
->getConfig(Mage_CatalogSearch_Model_Layer::XML_PATH_DISPLAY_LAYER_COUNT);
|
16 |
+
|
17 |
+
if (!$availableResCount || ($availableResCount >= $this->getLayer()->getProductCollection()->getSize())) {
|
18 |
+
return parent::canShowBlock();
|
19 |
+
}
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function createCategoriesBlock() {
|
24 |
+
|
25 |
+
$categoryBlock = $this->getLayout()
|
26 |
+
->createBlock('tsearch/catalog_layer_filter_category')
|
27 |
+
->setLayer($this->getLayer())
|
28 |
+
->init();
|
29 |
+
$this->setChild('category_filter', $categoryBlock);
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Layer/Filter/Attribute.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles attribute filtering in layered navigation in a query search context.
|
4 |
+
*
|
5 |
+
* @package Unbxd_Search
|
6 |
+
* @subpackage Unbxd_Search_Block
|
7 |
+
* @author Tagalys
|
8 |
+
*/
|
9 |
+
class Tagalys_Tsearch_Block_Catalogsearch_Layer_Filter_Attribute extends Mage_Catalog_Block_Layer_Filter_Attribute
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Set filter model name
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$this->_filterModelName = 'tsearch/catalogsearch_layer_filter_attribute';
|
19 |
+
|
20 |
+
}
|
21 |
+
protected function _prepareFilter()
|
22 |
+
{
|
23 |
+
$this->_filter->setAttributeModel($this->getAttributeModel());
|
24 |
+
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Adds facet condition to filter.
|
30 |
+
*
|
31 |
+
* @see Tagalys_Tsearch_Model_Catalog_Layer_Filter_Attribute::addFacetCondition()
|
32 |
+
* @return Tagalys_Tsearch_Block_Catalogsearch_Layer_Filter_Attribute
|
33 |
+
*/
|
34 |
+
public function addFacetCondition()
|
35 |
+
{
|
36 |
+
$this->_filter->addFacetCondition();
|
37 |
+
return $this;
|
38 |
+
}
|
39 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Layer/View.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tagalys_MerchandisingPage_Block_Catalogsearch_Layer_View extends Mage_Catalog_Block_Layer_View {
|
4 |
+
|
5 |
+
protected $_filterBlocks = null;
|
6 |
+
protected $_helper = null;
|
7 |
+
//to-do
|
8 |
+
public function __construct() {
|
9 |
+
parent::__construct();
|
10 |
+
// $this->_helper = Mage::helper('layerednav');
|
11 |
+
|
12 |
+
if (Mage::helper('tsearch')->isTagalysActive()) {
|
13 |
+
|
14 |
+
$this->_categoryBlockName = 'tsearch/catalog_layer_filter_category';
|
15 |
+
$this->_attributeFilterBlockName = 'tsearch/catalog_layer_filter_attribute';
|
16 |
+
$this->_priceFilterBlockName = 'tsearch/catalog_layer_filter_price';
|
17 |
+
// $this->_decimalFilterBlockName = 'tsearch/catalog_layer_filter_decimal';
|
18 |
+
// $this->_booleanFilterBlockName = 'tsearch/catalog_layer_filter_boolean';
|
19 |
+
} else {
|
20 |
+
$this->_categoryBlockName = 'catalog/layer_filter_category';
|
21 |
+
$this->_attributeFilterBlockName = 'catalog/layer_filter_attribute';
|
22 |
+
$this->_priceFilterBlockName = 'catalog/layer_filter_price';
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
public function getClearUrl()
|
28 |
+
{
|
29 |
+
|
30 |
+
$params['_current'] = true;
|
31 |
+
$params['_use_rewrite'] = true;
|
32 |
+
$params['_query'] = "q=".Mage::helper('catalogsearch')->getQuery()->getQueryText();
|
33 |
+
$params['_escape'] = true;
|
34 |
+
|
35 |
+
return Mage::getUrl('*/*/*', $params );
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _prepareLayout() {
|
39 |
+
// $_hlp = $this->_helper;
|
40 |
+
// Return an object of current category
|
41 |
+
$category = Mage::registry('current_category');
|
42 |
+
|
43 |
+
if ($category) {
|
44 |
+
$currentCategoryID = $category->getId();
|
45 |
+
} else {
|
46 |
+
$currentCategoryID = null;
|
47 |
+
}
|
48 |
+
|
49 |
+
// Return session object
|
50 |
+
$sessionObject = Mage::getSingleton('catalog/session');
|
51 |
+
if ($sessionObject AND $lastCategoryID = $sessionObject->getLastCatgeoryID()) {
|
52 |
+
if ($currentCategoryID != $lastCategoryID) {
|
53 |
+
Mage::register('new_category', true);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$sessionObject->setLastCatgeoryID($currentCategoryID);
|
57 |
+
|
58 |
+
//Create Category Blocks
|
59 |
+
$stateBlock = $this->getLayout()->createBlock($this->_stateBlockName)
|
60 |
+
->setLayer($this->getLayer());
|
61 |
+
|
62 |
+
$categoryBlock = $this->getLayout()->createBlock($this->_categoryBlockName)
|
63 |
+
->setLayer($this->getLayer())
|
64 |
+
->init();
|
65 |
+
|
66 |
+
|
67 |
+
$this->setChild('layer_state', $stateBlock);
|
68 |
+
$this->setChild('category_filter', $categoryBlock);
|
69 |
+
// $this->createCategoriesBlock();
|
70 |
+
|
71 |
+
// preload setting
|
72 |
+
// $this->setIsRemoveLinks($_hlp->removeLinks());
|
73 |
+
|
74 |
+
//Get $this->_getFilterableAttributes() Mage_Catalog_Block_Layer_View
|
75 |
+
$filterableAttributes = $this->_getFilterableAttributes();
|
76 |
+
|
77 |
+
|
78 |
+
$blocks = array();
|
79 |
+
foreach ($filterableAttributes as $attribute) {
|
80 |
+
|
81 |
+
$blockType = $this->_attributeFilterBlockName;
|
82 |
+
|
83 |
+
if ($attribute->getAttributeCode() == 'price') {
|
84 |
+
$blockType = $this->_priceFilterBlockName;
|
85 |
+
}
|
86 |
+
|
87 |
+
$name = $attribute->getAttributeCode() . '_filter';
|
88 |
+
|
89 |
+
$blocks[$name] = $this->getLayout()->createBlock($blockType)
|
90 |
+
->setLayer($this->getLayer())
|
91 |
+
->setAttributeModel($attribute);
|
92 |
+
|
93 |
+
$this->setChild($name, $blocks[$name]);
|
94 |
+
}
|
95 |
+
|
96 |
+
foreach ($blocks as $name => $block) {
|
97 |
+
$block->init();
|
98 |
+
}
|
99 |
+
$this->getLayer()->apply();
|
100 |
+
return Mage_Core_Block_Template::_prepareLayout();
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
public function getLayer() {
|
105 |
+
if (!Mage::helper('tsearch')->isTagalysActive()) {
|
106 |
+
return Mage::getSingleton('catalogsearch/layer');
|
107 |
+
}
|
108 |
+
return parent::getLayer();
|
109 |
+
}
|
110 |
+
|
111 |
+
protected function createCategoriesBlock() {
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
$categoryBlock = $this->getLayout()
|
116 |
+
->createBlock("tsearch/catalog_layer_filter_category")
|
117 |
+
->setLayer($this->getLayer())
|
118 |
+
->init();
|
119 |
+
$this->setChild('category_filter', $categoryBlock);
|
120 |
+
}
|
121 |
+
|
122 |
+
public function getFilters() {
|
123 |
+
if (is_null($this->_filterBlocks)) {
|
124 |
+
$this->_filterBlocks = parent::getFilters();
|
125 |
+
}
|
126 |
+
return $this->_filterBlocks;
|
127 |
+
}
|
128 |
+
|
129 |
+
protected function _toHtml() {
|
130 |
+
$html = parent::_toHtml();
|
131 |
+
if (!Mage::app()->getRequest()->isXmlHttpRequest()) {
|
132 |
+
$html = '<div id="catalog-filters">' . $html . '</div>';
|
133 |
+
}
|
134 |
+
return $html;
|
135 |
+
}
|
136 |
+
protected function _getFilterableAttributes(){
|
137 |
+
if (Mage::helper('tsearch')->isTagalysActive()) {
|
138 |
+
$attributeModel = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
|
139 |
+
return $attributeModel;
|
140 |
+
}
|
141 |
+
return parent::_getFilterableAttributes();
|
142 |
+
}
|
143 |
+
|
144 |
+
}
|
145 |
+
|
app/code/local/Tagalys/MerchandisingPage/Block/Catalogsearch/Result.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Tagalys_Tsearch_Block_Catalogsearch_Result extends Mage_CatalogSearch_Block_Result
|
5 |
+
{
|
6 |
+
|
7 |
+
public function setListCollection()
|
8 |
+
{
|
9 |
+
$this->getListBlock()
|
10 |
+
->setCollection($this->_getProductCollection());
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
/**
|
14 |
+
* Retrieve loaded category collection
|
15 |
+
*
|
16 |
+
* @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
|
17 |
+
*/
|
18 |
+
protected function _getProductCollection()
|
19 |
+
{
|
20 |
+
|
21 |
+
if (is_null($this->_productCollection)) {
|
22 |
+
//$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
|
23 |
+
$this->_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
|
24 |
+
}
|
25 |
+
|
26 |
+
return $this->_productCollection;
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Filter.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Merchanding Page Filter Helper
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Tagalys_MerchandisingPage_Block_Filter extends Mage_Core_Block_Template
|
7 |
+
{
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
// die('asdfus');
|
11 |
+
// $this->setTemplate('catalog/layer/filter.phtml');
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _toHtml() {
|
15 |
+
return parent::_toHtml();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function canShowBlock() {
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Block/Page/Html/Pager.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tagalys_MerchandisingPage_Block_Page_Html_Pager extends Mage_Page_Block_Html_Pager {
|
3 |
+
|
4 |
+
public function getLastPageNum() {
|
5 |
+
$this->_pageSize = $this->getLimit();
|
6 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
7 |
+
if($tagalysData == false) {
|
8 |
+
return parent::getLastPageNum();
|
9 |
+
} else {
|
10 |
+
$collectionSize = (int) $tagalysData["total"];
|
11 |
+
|
12 |
+
if (0 === $collectionSize) {
|
13 |
+
return 1;
|
14 |
+
}
|
15 |
+
elseif($this->_pageSize) {
|
16 |
+
return ceil($collectionSize/$this->_pageSize);
|
17 |
+
}
|
18 |
+
else {
|
19 |
+
return 1;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getTotalNum() {
|
25 |
+
$tagalysData = Mage::helper("merchandisingpage")->getTagalysSearchData();
|
26 |
+
if($tagalysData == false) {
|
27 |
+
return parent::getTotalNum();
|
28 |
+
} else {
|
29 |
+
return (int) $tagalysData["total"];
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getLimit() {
|
34 |
+
$current_list_mode = Mage::app()->getLayout()->createBlock('catalog/product_list_toolbar')->getCurrentMode();
|
35 |
+
|
36 |
+
if( $current_list_mode == "grid" || $current_list_mode == "grid-list") {
|
37 |
+
$defaultLimit = Mage::getStoreConfig('catalog/frontend/grid_per_page');
|
38 |
+
|
39 |
+
} else if($current_list_mode == "list" || $current_list_mode == "list-grid") {
|
40 |
+
$defaultLimit = Mage::getStoreConfig('catalog/frontend/list_per_page');
|
41 |
+
}
|
42 |
+
|
43 |
+
$session_limit = $this->getRequest()->getParam($this->getLimitVarName(), $this->getDefaultPerPageValue());
|
44 |
+
|
45 |
+
!empty($session_limit) ? $session_limit : $defaultLimit;
|
46 |
+
return !empty($session_limit) ? $session_limit : $defaultLimit;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getPages()
|
50 |
+
{
|
51 |
+
$collection = $this->getCollection();
|
52 |
+
|
53 |
+
$pages = array();
|
54 |
+
if ($this->getLastPageNum() <= $this->_displayPages) {
|
55 |
+
$pages = range(1, $this->getLastPageNum());
|
56 |
+
}
|
57 |
+
else {
|
58 |
+
$half = ceil($this->_displayPages / 2);
|
59 |
+
if ($collection->getCurPage() >= $half
|
60 |
+
&& $collection->getCurPage() <= $this->getLastPageNum() - $half
|
61 |
+
) {
|
62 |
+
$start = ($collection->getCurPage() - $half) + 1;
|
63 |
+
$finish = ($start + $this->_displayPages) - 1;
|
64 |
+
}
|
65 |
+
elseif ($collection->getCurPage() < $half) {
|
66 |
+
$start = 1;
|
67 |
+
$finish = $this->_displayPages;
|
68 |
+
}
|
69 |
+
elseif ($collection->getCurPage() > ($this->getLastPageNum() - $half)) {
|
70 |
+
$finish = $this->getLastPageNum();
|
71 |
+
$start = $finish - $this->_displayPages + 1;
|
72 |
+
}
|
73 |
+
|
74 |
+
$pages = range($start, $finish);
|
75 |
+
}
|
76 |
+
return $pages;
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function _initFrame()
|
80 |
+
{
|
81 |
+
if (!$this->isFrameInitialized()) {
|
82 |
+
$start = 0;
|
83 |
+
$end = 0;
|
84 |
+
|
85 |
+
//$collection = $this->getCollection();
|
86 |
+
if ($this->getLastPageNum() <= $this->getFrameLength()) {
|
87 |
+
$start = 1;
|
88 |
+
$end = $this->getLastPageNum();
|
89 |
+
}
|
90 |
+
else {
|
91 |
+
$half = ceil($this->getFrameLength() / 2);
|
92 |
+
if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
|
93 |
+
$start = ($this->getCurrentPage() - $half) + 1;
|
94 |
+
$end = ($start + $this->getFrameLength()) - 1;
|
95 |
+
}
|
96 |
+
elseif ($this->getCurrentPage() < $half) {
|
97 |
+
$start = 1;
|
98 |
+
$end = $this->getFrameLength();
|
99 |
+
}
|
100 |
+
elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
|
101 |
+
$end = $this->getLastPageNum();
|
102 |
+
$start = $end - $this->getFrameLength() + 1;
|
103 |
+
}
|
104 |
+
//$start = 1;
|
105 |
+
//$end = $this->getLastPageNum() - abs($this->getLastPageNum() - $this->getFrameLength());
|
106 |
+
|
107 |
+
}
|
108 |
+
$this->_frameStart = $start;
|
109 |
+
$this->_frameEnd = $end;
|
110 |
+
|
111 |
+
$this->_setFrameInitialized(true);
|
112 |
+
}
|
113 |
+
|
114 |
+
return $this;
|
115 |
+
}
|
116 |
+
|
117 |
+
public function getFramePages()
|
118 |
+
{
|
119 |
+
$start = $this->getFrameStart();
|
120 |
+
|
121 |
+
$end = $this->getFrameEnd();
|
122 |
+
|
123 |
+
return range($start, $end);
|
124 |
+
}
|
125 |
+
|
126 |
+
public function getCurrentPage()
|
127 |
+
{
|
128 |
+
return (int) $this->getRequest()->getParam($this->getPageVarName(), 1);
|
129 |
+
}
|
130 |
+
|
131 |
+
public function getPreviousPageUrl()
|
132 |
+
{
|
133 |
+
return $this->getPageUrl($this->getCurrentPage() - 1);
|
134 |
+
}
|
135 |
+
|
136 |
+
public function getNextPageUrl()
|
137 |
+
{
|
138 |
+
return $this->getPageUrl($this->getCurrentPage() + 1);
|
139 |
+
}
|
140 |
+
public function getFirstPageUrl()
|
141 |
+
{
|
142 |
+
return $this->getPageUrl($this->getLastPageNum());
|
143 |
+
}
|
144 |
+
public function getLastPageUrl()
|
145 |
+
{
|
146 |
+
return $this->getPageUrl($this->getLastPageNum());
|
147 |
+
}
|
148 |
+
public function isFirstPage()
|
149 |
+
{
|
150 |
+
return $this->getCurrentPage() == 1;
|
151 |
+
}
|
152 |
+
public function isLastPage()
|
153 |
+
{
|
154 |
+
return $this->getCurrentPage() == $this->getLastPageNum();
|
155 |
+
}
|
156 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Helper/Data.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Merchandising Page Helper
|
4 |
+
*/
|
5 |
+
class Tagalys_MerchandisingPage_Helper_Data extends Mage_Core_Helper_Abstract {
|
6 |
+
|
7 |
+
public function getMerchandisingData() {
|
8 |
+
$service = Mage::getModel("Tagalys_MerchandisingPage_Model_Client");
|
9 |
+
// die(var_dump($service));
|
10 |
+
$query = Mage::app()->getRequest()->getParam('q');
|
11 |
+
$q = Mage::app()->getRequest();
|
12 |
+
|
13 |
+
$request = array();
|
14 |
+
$request = $q->getParams();
|
15 |
+
$request['filters'] = true;
|
16 |
+
$request['q'] = $request['product'];
|
17 |
+
|
18 |
+
$payload = $request;
|
19 |
+
$entity = 'catalog_product';
|
20 |
+
|
21 |
+
$current_list_mode = Mage::app()->getLayout()->createBlock('catalog/product_list_toolbar')->setChild('product_list_toolbar_pager', $pager)->getCurrentMode();
|
22 |
+
|
23 |
+
if( $current_list_mode == "grid" || $current_list_mode == "grid-list") {
|
24 |
+
$defaultLimit = Mage::getStoreConfig('catalog/frontend/grid_per_page');
|
25 |
+
|
26 |
+
} else if($current_list_mode == "list" || $current_list_mode == "list-grid") {
|
27 |
+
$defaultLimit = Mage::getStoreConfig('catalog/frontend/list_per_page');
|
28 |
+
}
|
29 |
+
|
30 |
+
$payload['filters'] = true;
|
31 |
+
|
32 |
+
$session_limit = $request['limit']; //Mage::getSingleton('catalog/session')->getLimitPage();
|
33 |
+
|
34 |
+
$payload['per_page'] = (!empty($session_limit) ? $session_limit : $defaultLimit);
|
35 |
+
$payload['page'] = (!empty($request['p'])) ? $request['p'] : 1;
|
36 |
+
// $payload['per_page'] = (!empty($session_limit) ? $session_limit : $defaultLimit) * ($payload['page'] + 1);
|
37 |
+
// if($payload['page'] == 1) {
|
38 |
+
// $payload['per_page'] = (!empty($session_limit) ? $session_limit : $defaultLimit) * 2;
|
39 |
+
// } else {
|
40 |
+
// $payload['per_page'] = (!empty($session_limit) ? $session_limit : $defaultLimit) ;
|
41 |
+
// }
|
42 |
+
foreach ($request as $key => $value) {
|
43 |
+
|
44 |
+
$code = $key;
|
45 |
+
$attr = Mage::getResourceModel('catalog/eav_attribute')
|
46 |
+
->loadByCode($entity,$code);
|
47 |
+
|
48 |
+
if ($attr->getId()) {
|
49 |
+
$filters[$key] = array($request[$key]);
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
if(isset($request["cat"])) {
|
55 |
+
$filters["__categories"] = array($request["cat"]);
|
56 |
+
// $payload["f"] = $category;
|
57 |
+
}
|
58 |
+
if(isset($request["min"]) && isset($request["max"])) {
|
59 |
+
$filters["price"] = array("min" => $request["min"], "max" => $request["max"] );
|
60 |
+
}
|
61 |
+
if(!empty($filters)) {
|
62 |
+
$payload["f"] = ($filters);
|
63 |
+
}
|
64 |
+
|
65 |
+
//$payload['filters'] = true;
|
66 |
+
$payload['request'] = array("variables","url_component","results","sort_options","filters","total");
|
67 |
+
$payload["store"] = Mage::app()->getStore()->getStoreId();
|
68 |
+
|
69 |
+
//by aaditya
|
70 |
+
if(isset($request['order'])) {
|
71 |
+
$payload['sort'] = $request['order']."-".$request['dir'];
|
72 |
+
// $payload['order'] = $request['dir'];
|
73 |
+
} else {
|
74 |
+
$payload['sort'] = $payload['sort']; //Mage::getSingleton('catalog/session')->getSortOrder();
|
75 |
+
}
|
76 |
+
$user_id = "";
|
77 |
+
$request["seed"] = "";
|
78 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
79 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
80 |
+
$user_id = $customer->getID();
|
81 |
+
}
|
82 |
+
|
83 |
+
$device_id = Mage::getModel('core/cookie')->get('__ta_device');
|
84 |
+
$visitor_id = Mage::getModel('core/cookie')->get('__ta_visit');
|
85 |
+
|
86 |
+
if (isset($payload)) {
|
87 |
+
$payload['user'] = (array("ip" => Mage::helper('core/http')->getRemoteAddr(), "snapshot" => $request["snapshot"] , "visitor_id" => $visitor_id, "user_id" => $user_id , "device_id" => $device_id));
|
88 |
+
}
|
89 |
+
|
90 |
+
unset($payload['isAjax']);
|
91 |
+
|
92 |
+
unset($payload['limit']);
|
93 |
+
unset($payload['product']);
|
94 |
+
unset($payload['dir']);
|
95 |
+
unset($payload['order']);
|
96 |
+
|
97 |
+
|
98 |
+
return $service->merchandisingPage($payload);
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
public function getTagalysSearchData() {
|
103 |
+
$controllerModule = Mage::app()->getRequest()->getControllerModule();
|
104 |
+
if($controllerModule == 'Tagalys_MerchandisingPage') {
|
105 |
+
$service = Mage::getSingleton("merchandisingpage/client");
|
106 |
+
} else {
|
107 |
+
$service = Mage::getSingleton("tsearch/client_connector");
|
108 |
+
}
|
109 |
+
if($this->isTagalysActive()) {
|
110 |
+
$searchResult = $service->getSearchResult();
|
111 |
+
// die(var_dump($searchResult));
|
112 |
+
if ($searchResult == null || ( isset($searchResult["status"]) && $searchResult["status"] != "OK")) {
|
113 |
+
return false;
|
114 |
+
} else {
|
115 |
+
|
116 |
+
return $searchResult;
|
117 |
+
}
|
118 |
+
} else {
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
public function isTagalysActive() {
|
125 |
+
|
126 |
+
$status = Mage::helper('tagalys_core')->getTagalysConfig("is_merchandising_page_active");
|
127 |
+
|
128 |
+
if ($status) {
|
129 |
+
$service = Mage::getSingleton("merchandisingpage/client");
|
130 |
+
// $tagalys = $service->isRequestSuccess();
|
131 |
+
if($service) {
|
132 |
+
return true;
|
133 |
+
} else {
|
134 |
+
return false;
|
135 |
+
}
|
136 |
+
} else {
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
// return true;
|
140 |
+
}
|
141 |
+
|
142 |
+
public function getTagalysFilter() {
|
143 |
+
$result = Mage::helper('merchandisingpage')->getTagalysSearchData();
|
144 |
+
if ($result) {
|
145 |
+
$data = $result;
|
146 |
+
$filters = (!empty($data['filters'])) ? $data['filters'] : null ;
|
147 |
+
return $filters;
|
148 |
+
}
|
149 |
+
return false;
|
150 |
+
}
|
151 |
+
|
152 |
+
public function getAttributeFieldName($attribute, $localeCode = null)
|
153 |
+
{
|
154 |
+
// Mage::log($attribute,null,'debug.log');
|
155 |
+
|
156 |
+
if (is_string($attribute)) {
|
157 |
+
$this->getSearchableAttributes(); // populate searchable attributes if not already set
|
158 |
+
if (!isset($this->_searchableAttributes[$attribute])) {
|
159 |
+
return $attribute;
|
160 |
+
}
|
161 |
+
$attribute = $this->_searchableAttributes[$attribute];
|
162 |
+
}
|
163 |
+
$attributeCode = $attribute->getAttributeCode();
|
164 |
+
$backendType = $attribute->getBackendType();
|
165 |
+
|
166 |
+
return $attributeCode;
|
167 |
+
}
|
168 |
+
|
169 |
+
public function getSearchParam($attribute, $value)
|
170 |
+
{
|
171 |
+
if (empty($value) ||
|
172 |
+
(isset($value['from']) && empty($value['from']) &&
|
173 |
+
isset($value['to']) && empty($value['to']))) {
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
|
177 |
+
$field = $this->getAttributeFieldName($attribute);
|
178 |
+
$backendType = $attribute->getBackendType();
|
179 |
+
if ($backendType == 'datetime') {
|
180 |
+
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
181 |
+
if (is_array($value)) {
|
182 |
+
foreach ($value as &$val) {
|
183 |
+
if (!is_empty_date($val)) {
|
184 |
+
$date = new Zend_Date($val, $format);
|
185 |
+
$val = $date->toString(Zend_Date::ISO_8601) . 'Z';
|
186 |
+
}
|
187 |
+
}
|
188 |
+
unset($val);
|
189 |
+
} else {
|
190 |
+
if (!is_empty_date($value)) {
|
191 |
+
$date = new Zend_Date($value, $format);
|
192 |
+
$value = $date->toString(Zend_Date::ISO_8601) . 'Z';
|
193 |
+
}
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
if ($attribute->usesSource()) {
|
198 |
+
$attribute->setStoreId(Mage::app()->getStore()->getId());
|
199 |
+
}
|
200 |
+
|
201 |
+
return array($field => $value);
|
202 |
+
}
|
203 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Model/.DS_Store
ADDED
Binary file
|
app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tagalys_MerchandisingPage_Model_Catalog_Layer extends Mage_Catalog_Model_Layer
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_facetsConditions = array();
|
7 |
+
|
8 |
+
public function getProductCollection()
|
9 |
+
{
|
10 |
+
try {
|
11 |
+
$tagalysSearchResults = Mage::helper('merchandisingpage')->getTagalysSearchData();
|
12 |
+
|
13 |
+
if($tagalysSearchResults == false) {
|
14 |
+
|
15 |
+
return parent::getProductCollection();
|
16 |
+
} else {
|
17 |
+
if(empty($tagalysSearchResults)) {
|
18 |
+
return parent::getProductCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
$collection = $this->_productCollection = Mage::getModel('catalog/product')
|
22 |
+
->getCollection()
|
23 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
24 |
+
->setStore(Mage::app()->getStore())
|
25 |
+
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
26 |
+
->addAttributeToFilter( 'entity_id', array( 'in' => $tagalysSearchResults['results'] ) );
|
27 |
+
|
28 |
+
$orderString = array('CASE e.entity_id');
|
29 |
+
|
30 |
+
foreach($tagalysSearchResults['results'] as $i => $productId) {
|
31 |
+
$orderString[] = 'WHEN '.$productId.' THEN '.$i;
|
32 |
+
}
|
33 |
+
$orderString[] = 'END';
|
34 |
+
$orderString = implode(' ', $orderString);
|
35 |
+
|
36 |
+
$collection->getSelect()->order(new Zend_Db_Expr($orderString));
|
37 |
+
|
38 |
+
return $this->_productCollection;
|
39 |
+
|
40 |
+
}
|
41 |
+
} catch(Exception $e) {
|
42 |
+
|
43 |
+
return parent::getProductCollection();
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
public function addFacetCondition($field, $condition = null)
|
48 |
+
{
|
49 |
+
|
50 |
+
if (array_key_exists($field, $this->_facetsConditions)) {
|
51 |
+
if (!empty($this->_facetsConditions[$field])){
|
52 |
+
$this->_facetsConditions[$field] = array($this->_facetsConditions[$field]);
|
53 |
+
}
|
54 |
+
$this->_facetsConditions[$field][] = $condition;
|
55 |
+
} else {
|
56 |
+
$this->_facetsConditions[$field] = $condition;
|
57 |
+
}
|
58 |
+
|
59 |
+
return $this;
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer/Filter/Attribute.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Attribute extends Mage_Catalog_Model_Layer_Filter_Attribute {
|
4 |
+
const OPTIONS_ONLY_WITH_RESULTS = 1;
|
5 |
+
const MULTI_SELECT_FACET_SPLIT = '-';
|
6 |
+
|
7 |
+
public function addFacetCondition() {
|
8 |
+
|
9 |
+
$this->getLayer()
|
10 |
+
// ->getProductCollection()
|
11 |
+
->addFacetCondition($this->_getFilterField());
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
|
16 |
+
{
|
17 |
+
$filter = $request->getParam($this->_requestVar);
|
18 |
+
//aadi
|
19 |
+
|
20 |
+
$request = Mage::app()->getRequest()->getParams();
|
21 |
+
if (!empty($request["qf"])) {
|
22 |
+
foreach (explode("~", $request["qf"]) as $key => $value) {
|
23 |
+
|
24 |
+
$temp = explode("-", $value);
|
25 |
+
if($temp[0] == $this->_requestVar) {
|
26 |
+
|
27 |
+
$temp_val = explode("-", $value);
|
28 |
+
$filter = $temp_val[1];
|
29 |
+
|
30 |
+
}
|
31 |
+
# code...
|
32 |
+
}
|
33 |
+
}
|
34 |
+
//aadi end
|
35 |
+
if (is_array($filter)) {
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
$text = $this->_getOptionText($filter);
|
39 |
+
if ($filter && strlen($text)) {
|
40 |
+
$this->_getResource()->applyFilterToCollection($this, $filter);
|
41 |
+
$this->getLayer()->getState()->addFilter($this->_createItem($text, $filter));
|
42 |
+
$this->_items = array();
|
43 |
+
}
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
|
47 |
+
public function applyFilterToCollection($filter, $value) {
|
48 |
+
if(!is_array($value)) {
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
$attribute = $filter->getAttributeModel();
|
52 |
+
$param = Mage::helper('merchandisingpage')->getSearchParam($attribute, $value);
|
53 |
+
|
54 |
+
$this->getLayer()
|
55 |
+
->getProductCollection();
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Returns facets data of current attribute.
|
61 |
+
*
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
protected function _getFacets() {
|
65 |
+
/** @var $productCollection Tagalys_Tsearch_Model_Resource_Catalog_Product_Collection */
|
66 |
+
$productCollection = $this->getLayer()->getProductCollection();
|
67 |
+
$fieldName = $this->_getFilterField();
|
68 |
+
$facets = $productCollection;
|
69 |
+
return $facets;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
public function getMaxPriceInt() {
|
74 |
+
$priceStat = Mage::getSingleton('tagalys_merchandisingpage/catalog_layer')->getProductCollection()->getStats('price');
|
75 |
+
$productCollection = $this->getLayer()->getProductCollection();
|
76 |
+
return isset($priceStat["max"])?$priceStat["max"]:0;
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Returns attribute field name.
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
protected function _getFilterField() {
|
86 |
+
|
87 |
+
/** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
|
88 |
+
// Mage::log("Tagalys_Tsearch_Model_Catalog_Layer_Filter_Attribute::_getFilterField()",null,'debug.log');
|
89 |
+
$attribute = $this->getAttributeModel();
|
90 |
+
$fieldName = Mage::helper('merchandisingpage')->getAttributeFieldName($attribute);
|
91 |
+
|
92 |
+
return $fieldName;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Retrieves current items data.
|
97 |
+
*
|
98 |
+
* @return array
|
99 |
+
*/
|
100 |
+
|
101 |
+
protected function _getItemsData() {
|
102 |
+
$attribute = $this->getAttributeModel();
|
103 |
+
$this->_requestVar = $attribute->getAttributeCode();
|
104 |
+
|
105 |
+
$key = $this->getLayer()->getStateKey().'_'.$this->_requestVar;
|
106 |
+
$data = $this->getLayer()->getAggregator()->getCacheData($key);
|
107 |
+
|
108 |
+
if ($data === null) {
|
109 |
+
$filters = $attribute->getFrontend()->getSelectOptions();
|
110 |
+
$service = Mage::getSingleton("Tagalys_MerchandisingPage_Model_Client");
|
111 |
+
|
112 |
+
$tagalys = Mage::helper('merchandisingpage')->getTagalysSearchData();
|
113 |
+
// $service = Mage::getModel("Tagalys_MerchandisingPage_Model_Client");
|
114 |
+
// $tagalys = $service->merchandisingPage(array());
|
115 |
+
// die(var_dump($tagalys));
|
116 |
+
$filters = $tagalys["filters"];
|
117 |
+
$optionsCount = count($filters);
|
118 |
+
$data = array();
|
119 |
+
foreach ($filters as $filter) {
|
120 |
+
if (!empty($filter['items'])) {
|
121 |
+
// Check filter type
|
122 |
+
if ($this->_getIsFilterableAttribute($attribute) == self::OPTIONS_ONLY_WITH_RESULTS && $this->_requestVar == $filter['id'] ) {
|
123 |
+
foreach ($filter["items"] as $filterItem) {
|
124 |
+
if ($filterItem["count"]) {
|
125 |
+
$data[] = array(
|
126 |
+
'label' => $filterItem["name"],
|
127 |
+
'value' => $filterItem["id"], //$filterItem["id"],
|
128 |
+
'count' => $filterItem["count"],
|
129 |
+
);
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
$tags = array(
|
137 |
+
Mage_Eav_Model_Entity_Attribute::CACHE_TAG.':'.$attribute->getId()
|
138 |
+
);
|
139 |
+
|
140 |
+
$tags = $this->getLayer()->getStateTags($tags);
|
141 |
+
$this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
|
142 |
+
}
|
143 |
+
return $data;
|
144 |
+
}
|
145 |
+
|
146 |
+
protected function _getOptionText($optionId) {
|
147 |
+
if ($this->getAttributeModel()->getFrontendInput() == 'text') {
|
148 |
+
return $optionId;
|
149 |
+
}
|
150 |
+
|
151 |
+
return parent::_getOptionText($optionId);
|
152 |
+
}
|
153 |
+
|
154 |
+
protected function getLabel($optionId) {
|
155 |
+
if ($this->getAttributeModel()->getFrontendInput() == 'text') {
|
156 |
+
return $optionId;
|
157 |
+
}
|
158 |
+
|
159 |
+
return parent::_getOptionText($optionId);
|
160 |
+
}
|
161 |
+
|
162 |
+
protected function _isValidFilter($filter) {
|
163 |
+
return !empty($filter);
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer/Filter/Category.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles category filtering in layered navigation.
|
4 |
+
*
|
5 |
+
* @package Tagalys_Tsearch
|
6 |
+
* @subpackage Tagalys_Tsearch_Model
|
7 |
+
* @author Tagalys
|
8 |
+
*/
|
9 |
+
class Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Category extends Mage_Catalog_Model_Layer_Filter_Category
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Adds category filter to product collection.
|
13 |
+
*
|
14 |
+
* @param Mage_Catalog_Model_Category $category
|
15 |
+
* @return Tagalys_Tsearch_Model_Catalog_Layer_Filter_Category
|
16 |
+
*/
|
17 |
+
public function addCategoryFilter($category)
|
18 |
+
{
|
19 |
+
$value = array(
|
20 |
+
'categories' => $category->getId()
|
21 |
+
);
|
22 |
+
$this->getLayer()->getProductCollection()
|
23 |
+
->addFqFilter($value);
|
24 |
+
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Adds facet condition to product collection.
|
30 |
+
*
|
31 |
+
* @see Tagalys_Tsearch_Model_Resource_Catalog_Product_Collection::addFacetCondition()
|
32 |
+
* @return Tagalys_Tsearch_Model_Catalog_Layer_Filter_Category
|
33 |
+
*/
|
34 |
+
public function addFacetCondition()
|
35 |
+
{
|
36 |
+
/** @var $category Mage_Catalog_Model_Category */
|
37 |
+
$category = $this->getCategory();
|
38 |
+
$childrenCategories = $category->getChildrenCategories();
|
39 |
+
|
40 |
+
$useFlat = (bool) Mage::getStoreConfig('catalog/frontend/flat_catalog_category');
|
41 |
+
$categories = ($useFlat)
|
42 |
+
? array_keys($childrenCategories)
|
43 |
+
: array_keys($childrenCategories->toArray());
|
44 |
+
|
45 |
+
$this->getLayer()->getProductCollection();
|
46 |
+
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
protected function _getItemsData()
|
53 |
+
{
|
54 |
+
$key = $this->getLayer()->getStateKey().'_SUBCATEGORIES';
|
55 |
+
$data = $this->getLayer()->getAggregator()->getCacheData($key);
|
56 |
+
|
57 |
+
if ($data === null) {
|
58 |
+
$tagalys = Mage::helper('merchandisingpage')->getTagalysSearchData();
|
59 |
+
// $service = Mage::getModel("Tagalys_MerchandisingPage_Model_Client");
|
60 |
+
// $tagalys = $service->merchandisingPage(array())['filters'];
|
61 |
+
$filters = $tagalys['filters'];
|
62 |
+
|
63 |
+
foreach ($filters as $filter) {
|
64 |
+
if($filter["id"] == "__categories"){
|
65 |
+
$tagalys_categories = $filter;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
$data = array();
|
71 |
+
|
72 |
+
foreach ($tagalys_categories["items"] as $category) {
|
73 |
+
if($category["selected"] == true) {
|
74 |
+
foreach ($category["items"] as $sub_category) {
|
75 |
+
$data[] = array(
|
76 |
+
'label' => $sub_category["name"],
|
77 |
+
'value' => $sub_category["id"],
|
78 |
+
'count' => $sub_category["count"],
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
$tags = $this->getLayer()->getStateTags();
|
83 |
+
$this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
|
84 |
+
return $data;
|
85 |
+
|
86 |
+
} else {
|
87 |
+
if (true || $category->getIsActive()) {
|
88 |
+
$data[] = array(
|
89 |
+
'label' => $category["name"],
|
90 |
+
'value' => $category["id"],
|
91 |
+
'count' => $category["count"],
|
92 |
+
);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
//check if active
|
96 |
+
|
97 |
+
}
|
98 |
+
$tags = $this->getLayer()->getStateTags();
|
99 |
+
$this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
|
100 |
+
}
|
101 |
+
return $data;
|
102 |
+
}
|
103 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Model/Catalog/Layer/Filter/Price.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// if (Mage::Helper('tsearch')->is_fme_active()) {
|
4 |
+
// class MiddleManModelPriceClass extends FME_Layerednav_Model_Layer_Filter_Price { }
|
5 |
+
// } else {
|
6 |
+
// class MiddleManModelPriceClass extends Mage_Catalog_Model_Layer_Filter_Price { }
|
7 |
+
// }
|
8 |
+
|
9 |
+
class Tagalys_MerchandisingPage_Model_Catalog_Layer_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Price
|
10 |
+
{
|
11 |
+
const CACHE_TAG = 'MAXPRICE';
|
12 |
+
|
13 |
+
const DELIMITER = '-';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Returns cache tag.
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function getCacheTag()
|
21 |
+
{
|
22 |
+
return self::CACHE_TAG;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieves max price for ranges definition.
|
27 |
+
*
|
28 |
+
* @return float
|
29 |
+
*/
|
30 |
+
public function getMaxPriceMod()
|
31 |
+
{
|
32 |
+
$priceStat = Mage::getSingleton('tagalys_merchandisingpage/catalog_layer')->getProductCollection()->getStats('price');
|
33 |
+
$productCollection = $this->getLayer()->getProductCollection();
|
34 |
+
return isset($priceStat["max"])?(int)$priceStat["max"]:0;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Retrieves min price for ranges definition.
|
41 |
+
*
|
42 |
+
* @return float
|
43 |
+
*/
|
44 |
+
public function getMinPriceMod()
|
45 |
+
{
|
46 |
+
$priceStat = Mage::getSingleton('tagalys_tsearch/catalog_layer')->getProductCollection()->getStats('price');
|
47 |
+
$productCollection = $this->getLayer()->getProductCollection();
|
48 |
+
return isset($priceStat["min"])?(int)$priceStat["min"]:0;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns price field according to current customer group and website.
|
53 |
+
*
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
protected function _getFilterField()
|
57 |
+
{
|
58 |
+
$websiteId = Mage::app()->getStore()->getWebsiteId();
|
59 |
+
$customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
60 |
+
$priceField = 'price' ;
|
61 |
+
|
62 |
+
return $priceField;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Retrieves current items data.
|
67 |
+
*
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
protected function _getItemsData()
|
71 |
+
{
|
72 |
+
if (Mage::app()->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION) == self::RANGE_CALCULATION_IMPROVED) {
|
73 |
+
return $this->_getCalculatedItemsData();}
|
74 |
+
if ($this->getInterval()) {
|
75 |
+
return array();
|
76 |
+
}
|
77 |
+
|
78 |
+
$data = array();
|
79 |
+
// $facets = $this->getLayer()->getFacetedData($this->_getFilterField()); ref addy
|
80 |
+
$service = Mage::getSingleton("Tagalys_MerchandisingPage_Model_Client");
|
81 |
+
|
82 |
+
$tagalys = Mage::helper('merchandisingpage')->getTagalysSearchData();
|
83 |
+
$filters = $tagalys["filters"];
|
84 |
+
foreach ($filters as $filter) {
|
85 |
+
|
86 |
+
if ($filter['id'] == 'price' ) {
|
87 |
+
$filterType = $filter["type"];
|
88 |
+
foreach ($filter["items"] as $filterItem) {
|
89 |
+
if ($filterItem["count"]) {
|
90 |
+
$facets[] = $filterItem;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
if (!empty($facets)) {
|
98 |
+
$i = 0;
|
99 |
+
foreach ($facets as $key => $price) {
|
100 |
+
$i++;
|
101 |
+
|
102 |
+
preg_match('/^(\S*)-(\S*)$/', $price["id"], $rangeKey);
|
103 |
+
$fromPrice = $rangeKey[1];
|
104 |
+
$toPrice = $rangeKey[2];
|
105 |
+
if($filterType == "checkbox"){
|
106 |
+
|
107 |
+
$data[] = array(
|
108 |
+
// 'label' => $this->_renderRangeLabel($fromPrice, $toPrice),
|
109 |
+
'label' => $price["name"],
|
110 |
+
'value' => $price["id"],
|
111 |
+
'count' => $price["count"]
|
112 |
+
);
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
} elseif ($filterType == "range") {
|
117 |
+
$data[] = array(
|
118 |
+
'label' => $this->_renderRangeLabel($fromPrice, $toPrice),
|
119 |
+
'value' => 10,200,
|
120 |
+
'count' => $price["count"]
|
121 |
+
);
|
122 |
+
}
|
123 |
+
return $data;
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Adds facet condition to product collection.
|
129 |
+
*
|
130 |
+
* @see Tagalys_Tsearch_Model_Resource_Catalog_Product_Collection::addFacetCondition()
|
131 |
+
* @return Tagalys_Tsearch_Model_Catalog_Layer_Filter_Attribute
|
132 |
+
*/
|
133 |
+
public function addFacetCondition()
|
134 |
+
{
|
135 |
+
$this->getLayer()
|
136 |
+
// ->getProductCollection()
|
137 |
+
->addFacetCondition($this->_getFilterField());
|
138 |
+
|
139 |
+
return $this;
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
// public function apply(Zend_Controller_Request_Abstract $request, $filterBlock){
|
144 |
+
|
145 |
+
// $filter = $request->getParam($this->_requestVar);
|
146 |
+
// if(null == $filter){
|
147 |
+
// return $this;
|
148 |
+
// }
|
149 |
+
// $filter =explode(self::DELIMITER, $filter);
|
150 |
+
// if (!is_array($filter) || null === $filter || sizeof($filter)<2 ) {
|
151 |
+
// return $this;
|
152 |
+
// }
|
153 |
+
// $this->applyFilterToCollection($this, $filter);
|
154 |
+
// $this->_items = null;
|
155 |
+
// return $this;
|
156 |
+
// }
|
157 |
+
|
158 |
+
|
159 |
+
function applyFilterToCollection($filter,$filterValue){
|
160 |
+
$field = $this->_getFilterField();
|
161 |
+
$value = array(
|
162 |
+
$field => array(
|
163 |
+
'include_upper' => 0
|
164 |
+
)
|
165 |
+
);
|
166 |
+
|
167 |
+
if($filterValue[0]< $filterValue[1]){
|
168 |
+
$value[$field]['from'] = $filterValue[0];
|
169 |
+
$value[$field]['to'] = $filterValue[1];
|
170 |
+
}else{
|
171 |
+
$value[$field]['from'] = $filterValue[1];
|
172 |
+
$value[$field]['to'] = $filterValue[0];
|
173 |
+
}
|
174 |
+
$this->getLayer()->getProductCollection();
|
175 |
+
return $this;
|
176 |
+
}
|
177 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Model/Catalogsearch/Layer.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tagalys_Tsearch_Model_Catalogsearch_Layer extends Mage_Catalog_Model_Layer
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_facetsConditions = array();
|
7 |
+
|
8 |
+
public function getProductCollection()
|
9 |
+
{
|
10 |
+
try {
|
11 |
+
$tagalysSearchResults = Mage::helper('tsearch')->getTagalysSearchData();
|
12 |
+
|
13 |
+
if($tagalysSearchResults == false) {
|
14 |
+
return parent::getProductCollection();
|
15 |
+
} else {
|
16 |
+
if(empty($tagalysSearchResults)) {
|
17 |
+
return parent::getProductCollection();
|
18 |
+
}
|
19 |
+
|
20 |
+
$collection = $this->_productCollection = Mage::getModel('catalog/product')
|
21 |
+
->getCollection()
|
22 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
23 |
+
->setStore(Mage::app()->getStore())
|
24 |
+
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
25 |
+
->addAttributeToFilter( 'entity_id', array( 'in' => $tagalysSearchResults['results'] ) );
|
26 |
+
|
27 |
+
$orderString = array('CASE e.entity_id');
|
28 |
+
|
29 |
+
foreach($tagalysSearchResults['results'] as $i => $productId) {
|
30 |
+
$orderString[] = 'WHEN '.$productId.' THEN '.$i;
|
31 |
+
}
|
32 |
+
$orderString[] = 'END';
|
33 |
+
$orderString = implode(' ', $orderString);
|
34 |
+
|
35 |
+
$collection->getSelect()->order(new Zend_Db_Expr($orderString));
|
36 |
+
return $this->_productCollection;
|
37 |
+
|
38 |
+
}
|
39 |
+
} catch(Exception $e) {
|
40 |
+
|
41 |
+
return parent::getProductCollection();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public function addFacetCondition($field, $condition = null)
|
46 |
+
{
|
47 |
+
if (array_key_exists($field, $this->_facetsConditions)) {
|
48 |
+
if (!empty($this->_facetsConditions[$field])){
|
49 |
+
$this->_facetsConditions[$field] = array($this->_facetsConditions[$field]);
|
50 |
+
}
|
51 |
+
$this->_facetsConditions[$field][] = $condition;
|
52 |
+
} else {
|
53 |
+
$this->_facetsConditions[$field] = $condition;
|
54 |
+
}
|
55 |
+
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/Model/Client.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tagalys_MerchandisingPage_Model_Client extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
protected $_api_key;
|
6 |
+
protected $_api_server;
|
7 |
+
|
8 |
+
protected $_merchandising_ep;
|
9 |
+
|
10 |
+
protected $_search = array();
|
11 |
+
|
12 |
+
protected $_error = false;
|
13 |
+
|
14 |
+
protected $timeout = 20;
|
15 |
+
|
16 |
+
protected $visitor;
|
17 |
+
|
18 |
+
|
19 |
+
public function getSearchResult() {
|
20 |
+
if(!empty($this->_search)) {
|
21 |
+
return $this->_search;
|
22 |
+
} else {
|
23 |
+
// die("im here");
|
24 |
+
$this->_search = Mage::helper('merchandisingpage')->getMerchandisingData();
|
25 |
+
}
|
26 |
+
return $this->_search;
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _construct() {
|
30 |
+
$this->_config = Mage::helper('tagalys_core');
|
31 |
+
$this->_api_server = $this->_config->getTagalysConfig("api_server");
|
32 |
+
$this->_api_key = $this->_config->getTagalysConfig("private_api_key");
|
33 |
+
$this->_client_code = $this->_config->getTagalysConfig("client_code");
|
34 |
+
$this->_merchandising_ep = Mage::getStoreConfig('tagalys/endpoint/merchandisingpage');
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
protected function createPayload($payload , $action) {
|
39 |
+
$request = array(
|
40 |
+
'client_code' => $this->_client_code,
|
41 |
+
'api_key' => $this->_api_key,
|
42 |
+
"store_id" => $payload["store"]
|
43 |
+
);
|
44 |
+
$payload["identification"] = $request;
|
45 |
+
|
46 |
+
return json_encode($payload);
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
public function merchandisingPage($payload) {
|
51 |
+
try {
|
52 |
+
$url = $this->_api_server.$this->_merchandising_ep;
|
53 |
+
$url = str_replace(":page-name",$payload['q'],$url);
|
54 |
+
$payloadData = $this->createPayload($payload);
|
55 |
+
// die(var_dump($payloadData));
|
56 |
+
$this->_search = $this->_payloadAgent($url,($payloadData)); //to be enabled
|
57 |
+
// var_dump($this->_search); die();
|
58 |
+
// $this->_search = json_decode(file_get_contents('mpage.json'),true);
|
59 |
+
// $this->_search = array('status' => 'Not found');
|
60 |
+
// $this->_search = array('status' => 'Internal server error');
|
61 |
+
// Mage::log(">>>",null,'mrequest.log', true);
|
62 |
+
// var_dump($this->_search);
|
63 |
+
return $this->_search;
|
64 |
+
} catch (Exception $e) {
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
private function _getAgent($url) {
|
71 |
+
$agent = curl_init($url);
|
72 |
+
return $agent;
|
73 |
+
}
|
74 |
+
|
75 |
+
private function _queryAgent($url, $query) {
|
76 |
+
$q_url = $url;
|
77 |
+
$q_url .= '?q='.$query;
|
78 |
+
$q_url .= '&api_key='.$this->_api_key;
|
79 |
+
$agent = $this->_getAgent($url);
|
80 |
+
curl_setopt($agent, CURLOPT_SSL_VERIFYPEER, 0);
|
81 |
+
curl_setopt( $agent, CURLOPT_RETURNTRANSFER, true );
|
82 |
+
curl_setopt($agent, CURLOPT_TIMEOUT, $this->timeout);
|
83 |
+
|
84 |
+
$result = curl_exec($agent);
|
85 |
+
$info = curl_getinfo($agent);
|
86 |
+
|
87 |
+
if(curl_errno($agent)) {
|
88 |
+
|
89 |
+
if (curl_error($agent) === "name lookup timed out") {
|
90 |
+
for($i = 0; $i <=2 ; $i++) {
|
91 |
+
$this->_queryAgent($url, $query);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
if (empty($result)) {
|
96 |
+
$this->_error = false;
|
97 |
+
|
98 |
+
}
|
99 |
+
return $result;
|
100 |
+
}
|
101 |
+
//end of curl error log
|
102 |
+
curl_close($agent);
|
103 |
+
}
|
104 |
+
|
105 |
+
private function _payloadAgent($url, $payload) {
|
106 |
+
$agent = $this->_getAgent($url);
|
107 |
+
curl_setopt( $agent, CURLOPT_POSTFIELDS, $payload );
|
108 |
+
curl_setopt($agent, CURLOPT_POST,1);
|
109 |
+
curl_setopt( $agent, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
110 |
+
curl_setopt( $agent, CURLOPT_RETURNTRANSFER, true );
|
111 |
+
curl_setopt( $agent, CURLOPT_SSL_VERIFYPEER, 0 );
|
112 |
+
curl_setopt($agent, CURLOPT_TIMEOUT, $this->timeout);
|
113 |
+
$result = curl_exec($agent);
|
114 |
+
$info = curl_getinfo($agent);
|
115 |
+
|
116 |
+
// Mage::log("Tagalys Request info: ".json_encode($info),null,'mrequest.log', true);
|
117 |
+
// Mage::log("Tagalys Request payload: ".($payload),null,'mrequest.log', true);
|
118 |
+
// Mage::log("Tagalys Response: ".($result),null,'mrequest.log', true);
|
119 |
+
|
120 |
+
|
121 |
+
if(curl_errno($agent)) {
|
122 |
+
$this->_error = true;
|
123 |
+
|
124 |
+
} else {
|
125 |
+
if (empty($result)) {
|
126 |
+
$this->_error = true;
|
127 |
+
|
128 |
+
}
|
129 |
+
}
|
130 |
+
curl_close($agent);
|
131 |
+
if (!$this->_error) {
|
132 |
+
$decoded = json_decode($result, true);
|
133 |
+
return $decoded;
|
134 |
+
} else {
|
135 |
+
return null;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
public function isRequestSuccess() {
|
140 |
+
|
141 |
+
if( $this->_error == true || empty($this->_search) || $this->_search["status"] != "OK" ) {
|
142 |
+
return false; //ref addy
|
143 |
+
}
|
144 |
+
return true;
|
145 |
+
}
|
146 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/controllers/IndexController.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Merchandising Page Index Controller
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Tagalys_MerchandisingPage_IndexController extends Mage_Core_Controller_Front_Action
|
7 |
+
{
|
8 |
+
public function indexAction ()
|
9 |
+
{
|
10 |
+
$helper = Mage::helper('merchandisingpage');
|
11 |
+
$service = Mage::getSingleton("merchandisingpage/client");
|
12 |
+
$status = Mage::helper('tagalys_core')->getTagalysConfig("is_merchandising_page_active");
|
13 |
+
if ($status) {
|
14 |
+
$response = $helper->getTagalysSearchData();
|
15 |
+
}
|
16 |
+
|
17 |
+
$this->loadLayout();
|
18 |
+
// var_dump($response);
|
19 |
+
|
20 |
+
if(isset($response)) {
|
21 |
+
$head = $this->getLayout()->getBlock('head');
|
22 |
+
if ($head){
|
23 |
+
if(isset($response['variables']['page_title'])) {
|
24 |
+
$head->setTitle($response['variables']['page_title']);
|
25 |
+
} else {
|
26 |
+
$head->setTitle(ucwords(str_replace('-',' ',$response['product'])).$_SERVER['HOST_NAME'] );
|
27 |
+
}
|
28 |
+
$head->setKeywords($response['variables']['meta_keywords']);
|
29 |
+
$head->setDescription($response['variables']['meta_description']);
|
30 |
+
}
|
31 |
+
$this->renderLayout();
|
32 |
+
}
|
33 |
+
else {
|
34 |
+
return Mage::getClass('Mage_Core_Controller_Varien_Action')->norouteAction();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
app/code/local/Tagalys/MerchandisingPage/etc/config.xml
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<default>
|
4 |
+
<tagalys>
|
5 |
+
<endpoint>
|
6 |
+
<merchandisingpage>/v1/mpages/:page-name</merchandisingpage>
|
7 |
+
</endpoint>
|
8 |
+
</tagalys>
|
9 |
+
</default>
|
10 |
+
<modules>
|
11 |
+
<Tagalys_MerchandisingPage>
|
12 |
+
<version>0.1.0</version>
|
13 |
+
</Tagalys_MerchandisingPage>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
<helpers>
|
17 |
+
<merchandisingpage>
|
18 |
+
<class>Tagalys_MerchandisingPage_Helper</class>
|
19 |
+
</merchandisingpage>
|
20 |
+
</helpers>
|
21 |
+
|
22 |
+
<blocks>
|
23 |
+
<merchandisingpage>
|
24 |
+
<class>Tagalys_MerchandisingPage_Block</class>
|
25 |
+
</merchandisingpage>
|
26 |
+
|
27 |
+
<catalog>
|
28 |
+
<rewrite>
|
29 |
+
<layer>Tagalys_MerchandisingPage_Block_Catalog_Layer_View</layer>
|
30 |
+
</rewrite>
|
31 |
+
</catalog>
|
32 |
+
|
33 |
+
<page>
|
34 |
+
<rewrite>
|
35 |
+
<html_pager>Tagalys_MerchandisingPage_Block_Page_Html_Pager</html_pager>
|
36 |
+
</rewrite>
|
37 |
+
</page>
|
38 |
+
<catalog>
|
39 |
+
<rewrite>
|
40 |
+
<product_list_toolbar>Tagalys_MerchandisingPage_Block_Catalog_Product_List_Toolbar</product_list_toolbar>
|
41 |
+
</rewrite>
|
42 |
+
</catalog>
|
43 |
+
|
44 |
+
<catalogsearch>
|
45 |
+
<rewrite>
|
46 |
+
<layer>Tagalys_MerchandisingPage_Block_Catalogsearch_Layer_View</layer>
|
47 |
+
</rewrite>
|
48 |
+
</catalogsearch>
|
49 |
+
</blocks>
|
50 |
+
<models>
|
51 |
+
<merchandisingpage>
|
52 |
+
<class>Tagalys_MerchandisingPage_Model</class>
|
53 |
+
</merchandisingpage>
|
54 |
+
|
55 |
+
<catalog>
|
56 |
+
<rewrite>
|
57 |
+
<layer>Tagalys_MerchandisingPage_Model_Catalog_Layer</layer>
|
58 |
+
</rewrite>
|
59 |
+
</catalog>
|
60 |
+
</models>
|
61 |
+
<!-- url rewrite -->
|
62 |
+
<rewrite>
|
63 |
+
<merchandisingpage>
|
64 |
+
<from><![CDATA[#^/m/([\w-]+)/?#]]></from>
|
65 |
+
<to><![CDATA[/m/index/index/product/$1]]></to>
|
66 |
+
<complete>1</complete>
|
67 |
+
</merchandisingpage>
|
68 |
+
</rewrite>
|
69 |
+
<!-- end url rewrite -->
|
70 |
+
</global>
|
71 |
+
<frontend>
|
72 |
+
<routers>
|
73 |
+
<merchandisingpage>
|
74 |
+
<use>standard</use>
|
75 |
+
<args>
|
76 |
+
<module>Tagalys_MerchandisingPage</module>
|
77 |
+
<frontName>m</frontName>
|
78 |
+
</args>
|
79 |
+
</merchandisingpage>
|
80 |
+
</routers>
|
81 |
+
<layout>
|
82 |
+
<updates>
|
83 |
+
<merchandisingpage>
|
84 |
+
<file>tagalys_merchandising.xml</file>
|
85 |
+
</merchandisingpage>
|
86 |
+
</updates>
|
87 |
+
</layout>
|
88 |
+
</frontend>
|
89 |
+
<!-- <depends>
|
90 |
+
<Mage_Catalog />
|
91 |
+
<Mage_CatalogSearch />
|
92 |
+
<Tagalys_Sync />
|
93 |
+
</depends> -->
|
94 |
+
</config>
|
app/design/adminhtml/default/default/layout/Tagalys_core.xml
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<adminhtml_tagalys_index>
|
4 |
-
<reference name="head">
|
5 |
-
<action method="addCss"><name>css/tagalys-core.css</name></action>
|
6 |
-
<action method="addJs"><script>tagalys/tagalys-core.js</script></action>
|
7 |
-
</reference>
|
8 |
-
<reference name="left">
|
9 |
-
<block type="tagalys_core/adminhtml_tagalys_edit_tabs" name="tagalys_settings_tabs"/>
|
10 |
-
</reference>
|
11 |
-
<reference name="content">
|
12 |
-
<block type="tagalys_core/adminhtml_tagalys_edit" name="tagalys_settings"/>
|
13 |
-
</reference>
|
14 |
-
<block type="core/template" name="tagalys_progress" output="toHtml" template="tagalys/progressbar.phtml"/>
|
15 |
-
</adminhtml_tagalys_index>
|
16 |
-
<default>
|
17 |
-
<reference name="notifications">
|
18 |
-
<block type="tagalys_core/adminhtml_tagalys_notifications" name="notifications_tagalys" output="toHtml" />
|
19 |
-
</reference>
|
20 |
-
</default>
|
21 |
-
</layout>
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/tagalys/progressbar.phtml
DELETED
@@ -1,159 +0,0 @@
|
|
1 |
-
<script type="text/javascript">
|
2 |
-
|
3 |
-
var sync = function(transport) {
|
4 |
-
// var e = "#sync_store_"+transport.request.parameters.store+" "+".status";
|
5 |
-
|
6 |
-
try {
|
7 |
-
var status = "#sync_store_"+transport.request.parameters.store+" "+".status";
|
8 |
-
|
9 |
-
var message = "#sync_msg_"+transport.request.parameters.store;
|
10 |
-
if ($$(status).length > 0)
|
11 |
-
$$(status)[0].update('Loading ..');
|
12 |
-
if ($$(message).length > 0)
|
13 |
-
$$(message)[0].update('');
|
14 |
-
if(/^\d+$/.test(transport.responseText)) {
|
15 |
-
if(transport.responseText == 100) {
|
16 |
-
// clearInterval(f);
|
17 |
-
}
|
18 |
-
if ($$(status).length > 0)
|
19 |
-
$$(status)[0].update(transport.responseText+"%");
|
20 |
-
} else {
|
21 |
-
|
22 |
-
if ($$(message).length > 0)
|
23 |
-
if ($$(message).length == "Completed") {
|
24 |
-
$$(status)[0].update('Completed');
|
25 |
-
$$(message)[0].update('');
|
26 |
-
}
|
27 |
-
else
|
28 |
-
$$(status)[0].update(transport.responseText);
|
29 |
-
}
|
30 |
-
|
31 |
-
} catch (e) {
|
32 |
-
clearInterval(s);
|
33 |
-
console.log(e);
|
34 |
-
}
|
35 |
-
|
36 |
-
};
|
37 |
-
|
38 |
-
var searchStatus = function(transport) {
|
39 |
-
|
40 |
-
try {
|
41 |
-
var status = "#search_store_"+transport.request.parameters.store+" "+".status";
|
42 |
-
var message = "#search_msg_"+transport.request.parameters.store;
|
43 |
-
if ($$(status).length > 0)
|
44 |
-
$$(status)[0].update('Loading ..');
|
45 |
-
if ($$(message).length > 0)
|
46 |
-
$$(message)[0].update('');
|
47 |
-
if(/^\d+$/.test(transport.responseText)) {
|
48 |
-
if(Number(transport.responseText) == 100) {
|
49 |
-
// clearInterval(s);
|
50 |
-
}
|
51 |
-
if ($$(status).length > 0)
|
52 |
-
$$(status)[0].update(transport.responseText+"%");
|
53 |
-
} else {
|
54 |
-
|
55 |
-
if ($$(message).length > 0)
|
56 |
-
if ($$(message).length == "Completed") {
|
57 |
-
$$(status)[0].update('Completed');
|
58 |
-
$$(message)[0].update('');
|
59 |
-
}
|
60 |
-
else
|
61 |
-
$$(status)[0].update(transport.responseText);
|
62 |
-
}
|
63 |
-
} catch (e) {
|
64 |
-
clearInterval(f);
|
65 |
-
console.log(e);
|
66 |
-
}
|
67 |
-
|
68 |
-
};
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
function feed_auto_load(storeId) {
|
73 |
-
new Ajax.Request(
|
74 |
-
"<?php echo Mage::helper('adminhtml')->getUrl('tagalys/feed/progress/'); ?>",
|
75 |
-
{
|
76 |
-
method: 'GET',
|
77 |
-
loaderArea: false,
|
78 |
-
parameters: {"store":storeId},
|
79 |
-
onSuccess : sync
|
80 |
-
// onFailure : failure
|
81 |
-
}
|
82 |
-
);
|
83 |
-
}
|
84 |
-
|
85 |
-
function search_auto_load(storeId) {
|
86 |
-
new Ajax.Request(
|
87 |
-
"<?php echo Mage::helper('adminhtml')->getUrl('tagalys/feed/searchStatus/'); ?>",
|
88 |
-
{
|
89 |
-
method: 'GET',
|
90 |
-
loaderArea: false,
|
91 |
-
parameters: {"store":storeId},
|
92 |
-
onSuccess : searchStatus
|
93 |
-
// onFailure : failure
|
94 |
-
}
|
95 |
-
);
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
function button_auto_load(){
|
100 |
-
|
101 |
-
new Ajax.Request(
|
102 |
-
"<?php echo Mage::helper('adminhtml')->getUrl('tagalys/feed/enableButton/'); ?>",
|
103 |
-
{
|
104 |
-
method: 'GET',
|
105 |
-
loaderArea: false,
|
106 |
-
onSuccess : function(transport) {
|
107 |
-
if(transport.responseText == "1") {
|
108 |
-
$$("#admin_tagalys_reload")[0].show();
|
109 |
-
clearInterval(btn);
|
110 |
-
} else {
|
111 |
-
$$("#admin_tagalys_reload")[0].hide();
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
}
|
116 |
-
);
|
117 |
-
|
118 |
-
}
|
119 |
-
|
120 |
-
function fauto_load() {
|
121 |
-
<?php foreach (Mage::helper("sync/data")->getSelectedStore() as $key => $value): ?>
|
122 |
-
<?php $resync = Mage::helper('tagalys_core')->getTagalysConfig('resync'); ?>
|
123 |
-
<?php if(!(int) Mage::helper('tagalys_core')->getTagalysConfig('search_index_'.$value) || !empty($resync)): ?>
|
124 |
-
|
125 |
-
feed_auto_load('<?php echo $value ?>');
|
126 |
-
<?php endif ?>
|
127 |
-
<?php endforeach ?>
|
128 |
-
}
|
129 |
-
function sauto_load() {
|
130 |
-
<?php foreach (Mage::helper("sync/data")->getSelectedStore() as $key => $value): ?>
|
131 |
-
<?php $resync = Mage::helper('tagalys_core')->getTagalysConfig('resync'); ?>
|
132 |
-
<?php if(!(int) Mage::helper('tagalys_core')->getTagalysConfig('search_index_'.$value) || !empty($resync)): ?>
|
133 |
-
|
134 |
-
search_auto_load('<?php echo $value ?>');
|
135 |
-
<?php endif ?>
|
136 |
-
<?php endforeach ?>
|
137 |
-
}
|
138 |
-
|
139 |
-
|
140 |
-
document.addEventListener("DOMContentLoaded", function(event) {
|
141 |
-
<?php if(Mage::helper('tagalys_core')->getTagalysConfig('search_complete')): ?>
|
142 |
-
$$("#admin_tagalys_reload")[0].show();
|
143 |
-
<?php else: ?>
|
144 |
-
$$("#admin_tagalys_reload")[0].hide();
|
145 |
-
<?php endif ?>
|
146 |
-
<?php foreach (Mage::helper("sync/data")->getSelectedStore() as $key => $value): ?>
|
147 |
-
|
148 |
-
search_auto_load('<?php echo $value ?>');
|
149 |
-
feed_auto_load('<?php echo $value ?>');
|
150 |
-
|
151 |
-
<?php endforeach ?>
|
152 |
-
|
153 |
-
});
|
154 |
-
|
155 |
-
//Refresh auto_load() function after 10000 milliseconds
|
156 |
-
f = setInterval(fauto_load,5000);
|
157 |
-
s = setInterval(sauto_load,5000);
|
158 |
-
btn = setInterval(button_auto_load, 1000);
|
159 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/tagalys/ss.xml
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<default>
|
4 |
-
<block type="core/template" name="tagalys_ss" output="toHtml" template="tagalys/tagalys_ss.phtml"/>
|
5 |
-
</default>
|
6 |
-
</layout>
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/tagalys_merchandising.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
<merchandisingpage_index_index translate="label">
|
5 |
+
<!-- Set title -->
|
6 |
+
<reference name="head">
|
7 |
+
<action method="setTitle">
|
8 |
+
<title>Merchandising</title>
|
9 |
+
</action>
|
10 |
+
|
11 |
+
</reference>
|
12 |
+
<!-- Switch root template to 1 column -->
|
13 |
+
<reference name="root">
|
14 |
+
<action method="setTemplate">
|
15 |
+
<template>page/2columns-left.phtml</template>
|
16 |
+
</action>
|
17 |
+
<block type="page/html_breadcrumbs" as="breadcrumbs" name="mp_template" template="tagalys_merchandising_page/mp_template.phtml"></block>
|
18 |
+
<block type="core/template" name="mp_template" template="tagalys_merchandising_page/mp_template.phtml"></block>
|
19 |
+
</reference>
|
20 |
+
|
21 |
+
<!-- <update handle="catalog_category_layered"/>
|
22 |
+
|
23 |
+
Remove Magento layered navigation
|
24 |
+
<remove name="catalog.leftnav"/> -->
|
25 |
+
|
26 |
+
<!-- Add MPage Specific Layered navigation -->
|
27 |
+
|
28 |
+
<reference name="left">
|
29 |
+
<block type="catalog/layer" name="prduct_filter" template="catalog/layer/view.phtml">
|
30 |
+
<block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
|
31 |
+
</block>
|
32 |
+
</reference>
|
33 |
+
|
34 |
+
<reference name="content">
|
35 |
+
<!-- Ajax Scroll-->
|
36 |
+
<!-- <block type="core/template" name="ajaxscroll_js" template="ajaxscroll/ajaxscroll.phtml" after="-" /> -->
|
37 |
+
<!-- End Ajax Scroll -->
|
38 |
+
|
39 |
+
<!-- Add product list to content -->
|
40 |
+
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
|
41 |
+
|
42 |
+
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
|
43 |
+
|
44 |
+
<!-- Add pager to toolbar -->
|
45 |
+
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
46 |
+
</block>
|
47 |
+
|
48 |
+
<!-- Specify toolbar block name -->
|
49 |
+
<action method="setToolbarBlockName">
|
50 |
+
<name>product_list_toolbar</name>
|
51 |
+
</action>
|
52 |
+
|
53 |
+
<!-- Use custom product collection -->
|
54 |
+
<!-- <action method="setCollection">
|
55 |
+
<value helper="merchandisingpage/getProductCollection" />
|
56 |
+
</action> -->
|
57 |
+
|
58 |
+
<!-- Use custom available sort by orders -->
|
59 |
+
<action method="setAvailableOrders">
|
60 |
+
<value helper="merchandisingpage/getAvailableOrders" />
|
61 |
+
</action>
|
62 |
+
|
63 |
+
<!-- Set the default sort by order -->
|
64 |
+
<!-- <action method="setSortBy">
|
65 |
+
<value>price</value>
|
66 |
+
</action> -->
|
67 |
+
|
68 |
+
<!-- Set default direction to ascending -->
|
69 |
+
<!-- <action method="setDefaultDirection">
|
70 |
+
<value>asc</value>
|
71 |
+
</action> -->
|
72 |
+
|
73 |
+
<!-- <action method="setColumnCount">
|
74 |
+
<coulumn>5</coulumn>
|
75 |
+
</action> -->
|
76 |
+
</block>
|
77 |
+
</reference>
|
78 |
+
</merchandisingpage_index_index>
|
79 |
+
</layout>
|
app/design/frontend/base/default/template/tagalys/tagalys_ss.phtml
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
|
2 |
-
<?php
|
3 |
-
if(Mage::helper('tagalys_core')->getTagalysConfig('setup_complete') && Mage::helper('tagalys_core')->getTagalysConfig('search_complete') && Mage::helper('tagalys_core')->getTagalysConfig('is_tsearchsuggestion_active')): ?>
|
4 |
-
<script type="text/javascript" src="https://s3-ap-southeast-1.amazonaws.com/tagalys-assets/ss-v4.js"></script>
|
5 |
-
<script type="text/javascript">
|
6 |
-
|
7 |
-
<?php
|
8 |
-
if( Mage::helper('core')->isModuleEnabled('Tagalys_Tsearch') ){
|
9 |
-
if(Mage::helper('core')->isModuleEnabled('Tagalys_Tsearch') && Mage::helper('tagalys_core')->getTagalysConfig('is_tsearch_active')){
|
10 |
-
$tagalys_enabled = true;
|
11 |
-
} else {
|
12 |
-
$tagalys_enabled = false;
|
13 |
-
}
|
14 |
-
}
|
15 |
-
?>
|
16 |
-
tagalys_base_url = "<?php echo Mage::helper('catalogsearch')->getResultUrl(""); ?>";
|
17 |
-
base_url = "<?php echo Mage::getBaseUrl(); ?>";
|
18 |
-
function load_script_asyncronously(url, callback) {
|
19 |
-
var script = document.createElement("script");
|
20 |
-
script.type = "text/javascript";
|
21 |
-
script.async = true;
|
22 |
-
if (script.readyState) {
|
23 |
-
script.onreadystatechange = function () {
|
24 |
-
if (script.readyState == "loaded" || script.readyState == "complete") {
|
25 |
-
script.onreadystatechange = null;
|
26 |
-
if (callback && typeof callback === "function") {
|
27 |
-
callback();
|
28 |
-
}
|
29 |
-
}
|
30 |
-
};
|
31 |
-
} else {
|
32 |
-
script.onload = function () {
|
33 |
-
if (callback && typeof callback === "function") {
|
34 |
-
callback();
|
35 |
-
}
|
36 |
-
};
|
37 |
-
}
|
38 |
-
script.src = url;
|
39 |
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
|
40 |
-
}
|
41 |
-
try {
|
42 |
-
(function( $ ) {
|
43 |
-
console.log("Loading tagalys search suggestions");
|
44 |
-
|
45 |
-
$.fn.tagalys_search_suggestions.search_link = function( q, qf, qin ) {
|
46 |
-
var cat_base_url = base_url+"catalog/category/view/id/";
|
47 |
-
var search_url_base = tagalys_base_url;
|
48 |
-
if (typeof(qf) == 'undefined' || $.isEmptyObject(qf)) {
|
49 |
-
return (search_url_base + encodeURIComponent(q));
|
50 |
-
} else {
|
51 |
-
<?php
|
52 |
-
if($tagalys_enabled): ?> //{
|
53 |
-
str = Object.keys(qf).map(function(key){
|
54 |
-
if(key == "__categories")
|
55 |
-
keyword = "cat";
|
56 |
-
else
|
57 |
-
keyword = key;
|
58 |
-
return encodeURIComponent(keyword) + "-"+ encodeURIComponent(qf[key]);
|
59 |
-
}).join('~');
|
60 |
-
qf_param = encodeURIComponent("qf") + '=' + str;
|
61 |
-
|
62 |
-
return tagalys_base_url.concat(encodeURIComponent(q) +"&"+qf_param);
|
63 |
-
//}
|
64 |
-
<?php else: ?> //{
|
65 |
-
if (typeof(qin) == "undefined" ) {
|
66 |
-
if (typeof(qf) != "undefined" && qf.hasOwnProperty("__categories")) {
|
67 |
-
return cat_base_url+Number(qf["__categories"]);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
var str = Object.keys(qf).map(function(key){
|
71 |
-
if(key == "__categories")
|
72 |
-
keyword = "cat";
|
73 |
-
else
|
74 |
-
keyword = key;
|
75 |
-
return encodeURIComponent(keyword) + '=' + encodeURIComponent(qf[key]);
|
76 |
-
}).join('&');
|
77 |
-
return tagalys_base_url.concat(encodeURIComponent(q) +"&"+str);
|
78 |
-
// }
|
79 |
-
<?php endif ?>
|
80 |
-
}
|
81 |
-
|
82 |
-
};
|
83 |
-
|
84 |
-
$.fn.tagalys_search_suggestions.popular_searches = function() {
|
85 |
-
|
86 |
-
<?php $popular_searches = (file_get_contents(Mage::getBaseDir("media"). DS ."tagalys" . DS."tagalys-popularsearches-".Mage::app()->getStore()->getStoreId().".json")); ?>
|
87 |
-
var popular_searches = '<?php echo $popular_searches ?>';
|
88 |
-
return popular_searches.length > 0 ? JSON.parse(popular_searches) : JSON.parse('[]');
|
89 |
-
};
|
90 |
-
|
91 |
-
$.fn.tagalys_public_api = {
|
92 |
-
server: '<?php echo Mage::helper("tagalys_core")->getTagalysConfig("api_server") ?>',
|
93 |
-
identification: {"client_code":'<?php echo Mage::helper("tagalys_core")->getTagalysConfig("client_code") ?>',"api_key":'<?php echo Mage::helper("tagalys_core")->getTagalysConfig("public_api_key") ?>',"store_id":'<?php echo Mage::app()->getStore()->getStoreId() ?>'}
|
94 |
-
}
|
95 |
-
|
96 |
-
$('<?php echo Mage::helper("tagalys_core")->getTagalysConfig("search_box") ?>').tagalys_search_suggestions({
|
97 |
-
align_to_parent: '<?php echo Mage::helper("tagalys_core")->getTagalysConfig("search_box_container") ?>',
|
98 |
-
api: {
|
99 |
-
server: '<?php echo Mage::helper("tagalys_core")->getTagalysConfig("api_server") ?>',
|
100 |
-
identification: {
|
101 |
-
client_code: '<?php echo Mage::helper("tagalys_core")->getTagalysConfig("client_code") ?>',
|
102 |
-
api_key: '<?php echo Mage::helper("tagalys_core")->getTagalysConfig("public_api_key") ?>',
|
103 |
-
store_id: '<?php echo Mage::app()->getStore()->getStoreId() ?>'
|
104 |
-
}
|
105 |
-
},
|
106 |
-
currency: {
|
107 |
-
<?php $currency = Mage::helper('search_suggestions')->getCurrentCurrency(); ?>
|
108 |
-
label: "<?php echo $currency[0]['label']; ?>",
|
109 |
-
exchange_rate: "<?php echo $currency[0]['exchange_rate']; ?>",
|
110 |
-
fractional_digits:"<?php echo $currency[0]['fractional_digits']; ?>"
|
111 |
-
},
|
112 |
-
callbacks: {
|
113 |
-
click_search: function($a) {
|
114 |
-
$.fn.tagalys_analytics.track_asynchronously('search', $a.data('tagalys-search'), 'tagalys-search-suggestions');
|
115 |
-
return true;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
});
|
119 |
-
|
120 |
-
}( jQuery ));
|
121 |
-
} catch(err) { //We can also throw from try block and catch it here
|
122 |
-
console.log(err);
|
123 |
-
}
|
124 |
-
</script>
|
125 |
-
<?php endif ?>
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/tagalys_merchandising_page/mp_template.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$helper = Mage::helper('tagalys_core');
|
3 |
+
// $html = str_get_html($helper->getTagalysConfig('merchandising_page_template'));
|
4 |
+
|
5 |
+
// $html->find('h1')->innertext = "Merchandising Page";
|
6 |
+
|
7 |
+
// var_dump($this->getVariable('res'));
|
8 |
+
|
9 |
+
$service = Mage::helper("merchandisingpage");
|
10 |
+
$res = $service->getTagalysSearchData();
|
11 |
+
// var_dump($res);
|
12 |
+
|
13 |
+
$html = $helper->getTagalysConfig('merchandising_page_template');
|
14 |
+
|
15 |
+
$html = str_replace("{{title}}", isset($res['name']) ? $res['name'] : "" , $html);
|
16 |
+
$html = str_replace("{{description}}", isset($res['variables']['description']) ? $res['variables']['description'] : "", $html);
|
17 |
+
$html = str_replace("{{banner_image_url}}", isset($res['variables']['banner_image_url']) ? $res['variables']['banner_image_url'] : "", $html);
|
18 |
+
|
19 |
+
echo $html;
|
20 |
+
?>
|
app/etc/modules/Tagalys_MerchandisingPage.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tagalys_MerchandisingPage>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
<depends>
|
9 |
+
|
10 |
+
<Tagalys_Tsearch />
|
11 |
+
</depends>
|
12 |
+
</Tagalys_MerchandisingPage>
|
13 |
+
</modules>
|
14 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Personalized-localized-and-Intelligent-Site-Search</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>Tagalys</license>
|
7 |
<channel>community</channel>
|
@@ -11,8 +11,8 @@
|
|
11 |
<notes>Any questions or concerns, please email cs@tagalys.com and we will get back to you in less than 24 hours. </notes>
|
12 |
<authors><author><name>Aaditya</name><user>Aaditya</user><email>antony@tagalys.com</email></author></authors>
|
13 |
<date>2017-02-23</date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir><dir name="Tagalys"><dir name="SearchSuggestions"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4a1d6c59a119e36f06a9227b4a648f77"/><file name="Category.php" hash="322d606ca40b6c7a976ec09f5080281a"/></dir></dir><file name="Layer.php" hash="4e72f2b2b8788ba0dce51aa38575e313"/></dir></dir><dir name="Helper"><file name="Data.php" hash="91941f034f7fedd5c84ab7cd5c66471e"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="897b2f76ab974edea9e4dffa176662f7"/><file name="Category.php" hash="c2c91bcd957559e5b4cb0c0ad9268a7f"/></dir></dir></dir></dir><dir name="controllers"><file name="AutoSuggestController.php" hash="8ef45554e5cc780b7e9f020cd19e28c5"/></dir><dir name="etc"><file name="config.xml" hash="854e13ce3dad489f9da4ae63cadf7512"/></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Tagalys"><dir name="Edit"><file name="Form.php" hash="f03082a193308464a70ddb12929f6445"/><dir name="Tab"><file name="Credentials.php" hash="ed600b42a2fe12222ef352a9a6b0dbd7"/><file name="Debug.php" hash="300e99069b08e1c7f4ec3d3a7c056ae2"/><file name="Merchandisingpage.php" hash="2fad4e4db56eb1999e421770bbdd70c9"/><file name="Setup.php" hash="8a5b190544b9e26e7d29716b8e3946dd"/><file name="Signup.php" hash="db50f6b1f8fe7c10eba8996adaab5b46"/><file name="Similarproducts.php" hash="336f1e8c7a86babf681ee6b2ff643406"/><file name="Sync.php" hash="df41344ec4ec924ccc34ad3e8b93c8f2"/><file name="Tsearch.php" hash="0f8d06abb0058aa63bb7619d96b54986"/><file name="Tsearchsuggestion.php" hash="66ba155f8119a448ee2c2fdb6e5777d5"/></dir><file name="Tabs.php" hash="334a9a7af439df186e3bf7e73fe92ca6"/></dir><file name="Edit.php" hash="b6ed0a6d60ed8437013316ea2bf4ae8c"/><file name="Notifications.php" hash="a8a462e420cffb43dcc9a3501114e01b"/><file name="Progress.php" hash="9de974b3672b91e25f5062d6d76c350d"/><file name="SearchReady.php" hash="9e58736e1eb8cba32ee0b84b19ee7b6c"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0a045aa8949d1f1d6b4c299cf2f5579e"/></dir><dir name="Model"><file name="Config.php" hash="6b1fc527b6ee9b6386669d91ada6c0cb"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="ea729baf00ac3f73ea70eb36cf182699"/></dir><file name="Config.php" hash="f96196b73e2e9bd2ceaf4b6ba8befb1a"/></dir><file name="Observer.php" hash="c3619b4cd7264290bc7f1a34e293ac18"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7be928fd40cff7dda724457e84736624"/><file name="config.xml" hash="7b26e95fe97248975edd7f2c1c75cb80"/></dir><dir name="sql"><dir name="tagalys_core_setup"><file name="mysql4-install-0.2.0.php" hash="50451682b52f41e0e5a2b656b4ed222f"/></dir></dir></dir><dir name="Sync"><dir name="Helper"><file name="Data.php" hash="f6dbd08edafe1f615818e8ea73d412fd"/><file name="Inventory.php" hash="61a553020607ff202ddb6ea32593cc36"/><file name="Service.php" hash="41751ee2f1b4280c9885d448789d5d4d"/><file name="TagalysFeedFactory.php" hash="6b3c3c94042fb25c350ca9dba74ec8ed"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Tagalys"><file name="Cron.php" hash="497ea5cee9239e97275b87743a4341a8"/></dir></dir></dir></dir></dir><file name="Client.php" hash="8040286126ba95b02b6fe52f98668657"/><dir name="Dataflow"><dir name="Convert"><dir name="Adapter"><file name="Io.php" hash="e1796293468adb1340d6336fd37e4a43"/></dir></dir></dir><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="d0228354a318338e31d85e25960b9f5c"/></dir><file name="Queue.php" hash="8c192d482dbbaa48c703f00ef5cf1a73"/></dir><file name="Observer.php" hash="2642389de90e5d5092a12bd9f1f58a20"/><file name="ProductDetails.php" hash="340acb5c3aea7928b71c8d33ff735f11"/><file name="Queue.php" hash="c48db47089e3ca175017c409768aefe5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportController.php" hash="3e0e0d36cb252768a7ccbb823d404752"/><dir name="System"><dir name="Convert"><file name="GuiController.php" hash="0a7755e0004a1db8c3fbfdfee717cdcc"/></dir></dir><file name="TagalysController.php" hash="75b22f6cf00e1d0c55af420d0ea430ce"/></dir><file name="FeedController.php" hash="50795b468dab2326c9695ea8526ee0b8"/></dir><dir name="etc"><file name="config.xml" hash="c3aab7b4bc00cb917a6fb4803087ec36"/><file name="wsdl.xml" hash="1479803fedcad805ae6420f0eff141ad"/></dir><dir name="sql"><dir name="sync_setup"><file name="mysql4-install-0.1.0.php" hash="756c821858436db88487a3b121531d0e"/><file name="mysql4-install-0.2.0.php" hash="756c821858436db88487a3b121531d0e"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="1e1fdc5770389a9123a3079e354ad822"/></dir></dir></dir><dir name="PopularSearches"><dir name="Model"><file name="Observer.php" hash="3c4a9c3cb5d23ce28f856620f9f7b0ca"/></dir><dir name="etc"><file name="config.xml" hash="4089d29d49ff24d49446c8fed7c153b5"/></dir></dir><dir name="Tsearch"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="8d0f3d1786e1350dd3b050dac907f382"/><file name="Category.php" hash="084bd8b9a22699c867902f774eeb7f72"/><file name="Price.php" hash="2db28591e437f65cd52506906ee96663"/></dir><file name="State.php" hash="8dadc65a747943cb9973747495d3a090"/><file name="View.php" hash="28966b74d8cf4d2dd79155c546d4aa51"/></dir><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="f69cedcd9a979c27a18d5fdb2e17084c"/></dir><file name="List.php" hash="360faadf31bc8a3606f789f634ea101b"/><file name=".DS_Store" hash="e4a40ba7f202895bf09cdcf734b701c5"/></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="3a858ada3f75cf0aa8c327d27daa616b"/></dir><file name="View.php" hash="28c09e321dc22fdbb03b48f057e8ae1b"/></dir><file name="Layer.php" hash="576c376ec352ce14e7f10c7e77fb8b59"/><file name="Result.php" hash="382a1f850d62de8e86617f149244db93"/></dir><dir name="Page"><dir name="Html"><file name="Pager.php" hash="0656951942409b6eb2517ddb2d45b612"/><file name="Pager.php" hash="0656951942409b6eb2517ddb2d45b612"/></dir><file name=".DS_Store" hash="1e3895ec3ef0a8efa77b64def497589b"/><file name=".DS_Store" hash="1e3895ec3ef0a8efa77b64def497589b"/></dir><file name=".DS_Store" hash="666944fd0d46dafe20060ea2fbca5797"/></dir><dir name="Helper"><file name="Data.php" hash="eb41f6c65c50d6d2d647f434d870018f"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="46c0b60daaa32fadba95971faae4e512"/><file name="Category.php" hash="0dfb591ee8a64759177aa93bc2ffbed7"/><file name="Price.php" hash="8c630bc151659d718f7217709ca73808"/></dir></dir><file name="Layer.php" hash="5d005f705e43fc61ce548da82b22a3df"/><dir name="Product"><file name="List.php" hash="8bd460c476e4630149c7e11cb8f50a9c"/></dir></dir><dir name="Catalogsearch"><file name="Layer.php" hash="b32c1e8c132ba771bd0e0490ed97c853"/></dir><dir name="Client"><file name="Connector.php" hash="bb8622863b8e2493bdc78aa0801f99fe"/></dir><file name="Engine.php" hash="785fd4b9e9a98fdfd60b9380233107c2"/><file name="Observer.php" hash="eb77033417011509be021fba2028d018"/><dir name="Resource"><dir name="Catalog"><dir name="Product"><file name="Collection.php" hash="a0bcbb601025bc0af84ee3c11ef6e531"/><file name="testCollection.php" hash="a0bcbb601025bc0af84ee3c11ef6e531"/></dir></dir></dir><file name=".DS_Store" hash="2df909e9d680df01a6532e4b2c6acf8a"/></dir><dir name="etc"><file name="config.xml" hash="544eca65364af5532209fec42770094e"/></dir><file name=".DS_Store" hash="95f3072052f3f15a2b2aca99ce72e737"/></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="tagalys"><file name="ss.xml" hash="9d62ce5a9ae20f67f8f6b5baa8c5a2b6"/></dir></dir><dir name="template"><dir name="tagalys"><file name="tagalys_ss.phtml" hash="24c92e0e3e7415dabfb1898105fd0347"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="Tagalys_core.xml" hash="6385afae91af7bada73792120c378e65"/></dir><dir name="template"><dir name="tagalys"><file name="progressbar.phtml" hash="a54e328030c9f430a6022697f1431388"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="tagalys-core.css" hash="8d9ea54b6b1602cda702b4c55b4943a1"/></dir><dir name="images"><file name="logo-tagalys.png" hash="6b9eeda985cf02bfa23eeddcc64e422b"/></dir></dir></dir></dir></dir></target><target name="mage"><dir><dir name="js"><dir name="tagalys"><file name="tagalys-core.js" hash="09bba056df414ead8c8aea26a1fb8ed8"/></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Tagalys_SearchSuggestions.xml" hash="0b256e54d7f0344f70c4c4efd0473b61"/><file name="Tagalys_Tsearch.xml" hash="8986598b80306698d18983ef9a2926f9"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>7.0.10</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Personalized-localized-and-Intelligent-Site-Search</name>
|
4 |
+
<version>1.0.16</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Tagalys</license>
|
7 |
<channel>community</channel>
|
11 |
<notes>Any questions or concerns, please email cs@tagalys.com and we will get back to you in less than 24 hours. </notes>
|
12 |
<authors><author><name>Aaditya</name><user>Aaditya</user><email>antony@tagalys.com</email></author></authors>
|
13 |
<date>2017-02-23</date>
|
14 |
+
<time>12:29:31</time>
|
15 |
+
<contents><target name="magelocal"><dir><dir name="Tagalys"><dir name="SearchSuggestions"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4a1d6c59a119e36f06a9227b4a648f77"/><file name="Category.php" hash="322d606ca40b6c7a976ec09f5080281a"/></dir></dir><file name="Layer.php" hash="4e72f2b2b8788ba0dce51aa38575e313"/></dir></dir><dir name="Helper"><file name="Data.php" hash="91941f034f7fedd5c84ab7cd5c66471e"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="897b2f76ab974edea9e4dffa176662f7"/><file name="Category.php" hash="c2c91bcd957559e5b4cb0c0ad9268a7f"/></dir></dir></dir></dir><dir name="controllers"><file name="AutoSuggestController.php" hash="8ef45554e5cc780b7e9f020cd19e28c5"/></dir><dir name="etc"><file name="config.xml" hash="854e13ce3dad489f9da4ae63cadf7512"/></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Tagalys"><dir name="Edit"><file name="Form.php" hash="f03082a193308464a70ddb12929f6445"/><dir name="Tab"><file name="Credentials.php" hash="ed600b42a2fe12222ef352a9a6b0dbd7"/><file name="Debug.php" hash="300e99069b08e1c7f4ec3d3a7c056ae2"/><file name="Merchandisingpage.php" hash="2fad4e4db56eb1999e421770bbdd70c9"/><file name="Setup.php" hash="8a5b190544b9e26e7d29716b8e3946dd"/><file name="Signup.php" hash="db50f6b1f8fe7c10eba8996adaab5b46"/><file name="Similarproducts.php" hash="336f1e8c7a86babf681ee6b2ff643406"/><file name="Sync.php" hash="df41344ec4ec924ccc34ad3e8b93c8f2"/><file name="Tsearch.php" hash="0f8d06abb0058aa63bb7619d96b54986"/><file name="Tsearchsuggestion.php" hash="66ba155f8119a448ee2c2fdb6e5777d5"/></dir><file name="Tabs.php" hash="334a9a7af439df186e3bf7e73fe92ca6"/></dir><file name="Edit.php" hash="b6ed0a6d60ed8437013316ea2bf4ae8c"/><file name="Notifications.php" hash="a8a462e420cffb43dcc9a3501114e01b"/><file name="Progress.php" hash="9de974b3672b91e25f5062d6d76c350d"/><file name="SearchReady.php" hash="9e58736e1eb8cba32ee0b84b19ee7b6c"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0a045aa8949d1f1d6b4c299cf2f5579e"/></dir><dir name="Model"><file name="Config.php" hash="6b1fc527b6ee9b6386669d91ada6c0cb"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="ea729baf00ac3f73ea70eb36cf182699"/></dir><file name="Config.php" hash="f96196b73e2e9bd2ceaf4b6ba8befb1a"/></dir><file name="Observer.php" hash="c3619b4cd7264290bc7f1a34e293ac18"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7be928fd40cff7dda724457e84736624"/><file name="config.xml" hash="7b26e95fe97248975edd7f2c1c75cb80"/></dir><dir name="sql"><dir name="tagalys_core_setup"><file name="mysql4-install-0.2.0.php" hash="50451682b52f41e0e5a2b656b4ed222f"/></dir></dir></dir><dir name="Sync"><dir name="Helper"><file name="Data.php" hash="f6dbd08edafe1f615818e8ea73d412fd"/><file name="Inventory.php" hash="61a553020607ff202ddb6ea32593cc36"/><file name="Service.php" hash="41751ee2f1b4280c9885d448789d5d4d"/><file name="TagalysFeedFactory.php" hash="6b3c3c94042fb25c350ca9dba74ec8ed"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Tagalys"><file name="Cron.php" hash="497ea5cee9239e97275b87743a4341a8"/></dir></dir></dir></dir></dir><file name="Client.php" hash="8040286126ba95b02b6fe52f98668657"/><dir name="Dataflow"><dir name="Convert"><dir name="Adapter"><file name="Io.php" hash="e1796293468adb1340d6336fd37e4a43"/></dir></dir></dir><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="d0228354a318338e31d85e25960b9f5c"/></dir><file name="Queue.php" hash="8c192d482dbbaa48c703f00ef5cf1a73"/></dir><file name="Observer.php" hash="2642389de90e5d5092a12bd9f1f58a20"/><file name="ProductDetails.php" hash="340acb5c3aea7928b71c8d33ff735f11"/><file name="Queue.php" hash="c48db47089e3ca175017c409768aefe5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportController.php" hash="3e0e0d36cb252768a7ccbb823d404752"/><dir name="System"><dir name="Convert"><file name="GuiController.php" hash="0a7755e0004a1db8c3fbfdfee717cdcc"/></dir></dir><file name="TagalysController.php" hash="75b22f6cf00e1d0c55af420d0ea430ce"/></dir><file name="FeedController.php" hash="50795b468dab2326c9695ea8526ee0b8"/></dir><dir name="etc"><file name="config.xml" hash="c3aab7b4bc00cb917a6fb4803087ec36"/><file name="wsdl.xml" hash="1479803fedcad805ae6420f0eff141ad"/></dir><dir name="sql"><dir name="sync_setup"><file name="mysql4-install-0.1.0.php" hash="756c821858436db88487a3b121531d0e"/><file name="mysql4-install-0.2.0.php" hash="756c821858436db88487a3b121531d0e"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="1e1fdc5770389a9123a3079e354ad822"/></dir></dir></dir><dir name="PopularSearches"><dir name="Model"><file name="Observer.php" hash="3c4a9c3cb5d23ce28f856620f9f7b0ca"/></dir><dir name="etc"><file name="config.xml" hash="4089d29d49ff24d49446c8fed7c153b5"/></dir></dir><dir name="Tsearch"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="8d0f3d1786e1350dd3b050dac907f382"/><file name="Category.php" hash="084bd8b9a22699c867902f774eeb7f72"/><file name="Price.php" hash="2db28591e437f65cd52506906ee96663"/></dir><file name="State.php" hash="8dadc65a747943cb9973747495d3a090"/><file name="View.php" hash="28966b74d8cf4d2dd79155c546d4aa51"/></dir><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="f69cedcd9a979c27a18d5fdb2e17084c"/></dir><file name="List.php" hash="360faadf31bc8a3606f789f634ea101b"/><file name=".DS_Store" hash="e4a40ba7f202895bf09cdcf734b701c5"/></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="3a858ada3f75cf0aa8c327d27daa616b"/></dir><file name="View.php" hash="28c09e321dc22fdbb03b48f057e8ae1b"/></dir><file name="Layer.php" hash="576c376ec352ce14e7f10c7e77fb8b59"/><file name="Result.php" hash="382a1f850d62de8e86617f149244db93"/></dir><dir name="Page"><dir name="Html"><file name="Pager.php" hash="0656951942409b6eb2517ddb2d45b612"/><file name="Pager.php" hash="0656951942409b6eb2517ddb2d45b612"/></dir><file name=".DS_Store" hash="1e3895ec3ef0a8efa77b64def497589b"/><file name=".DS_Store" hash="1e3895ec3ef0a8efa77b64def497589b"/></dir><file name=".DS_Store" hash="666944fd0d46dafe20060ea2fbca5797"/></dir><dir name="Helper"><file name="Data.php" hash="eb41f6c65c50d6d2d647f434d870018f"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="46c0b60daaa32fadba95971faae4e512"/><file name="Category.php" hash="0dfb591ee8a64759177aa93bc2ffbed7"/><file name="Price.php" hash="8c630bc151659d718f7217709ca73808"/></dir></dir><file name="Layer.php" hash="5d005f705e43fc61ce548da82b22a3df"/><dir name="Product"><file name="List.php" hash="8bd460c476e4630149c7e11cb8f50a9c"/></dir></dir><dir name="Catalogsearch"><file name="Layer.php" hash="b32c1e8c132ba771bd0e0490ed97c853"/></dir><dir name="Client"><file name="Connector.php" hash="bb8622863b8e2493bdc78aa0801f99fe"/></dir><file name="Engine.php" hash="785fd4b9e9a98fdfd60b9380233107c2"/><file name="Observer.php" hash="eb77033417011509be021fba2028d018"/><dir name="Resource"><dir name="Catalog"><dir name="Product"><file name="Collection.php" hash="a0bcbb601025bc0af84ee3c11ef6e531"/><file name="testCollection.php" hash="a0bcbb601025bc0af84ee3c11ef6e531"/></dir></dir></dir><file name=".DS_Store" hash="2df909e9d680df01a6532e4b2c6acf8a"/></dir><dir name="etc"><file name="config.xml" hash="544eca65364af5532209fec42770094e"/></dir><file name=".DS_Store" hash="95f3072052f3f15a2b2aca99ce72e737"/></dir><dir name="MerchandisingPage"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="3c15fec74b97727a980b7ce9e73454e8"/><file name="Category.php" hash="f6d038cbcce24ed67a7a44a30578ba51"/><file name="Price.php" hash="4cd0f3a20102d469e9acbe9cdbe45ec5"/></dir><file name="State.php" hash="34a5c0d451f856e3a4af701c478fbe17"/><file name="View.php" hash="408a7d4e74f1c7e77584d0c0f318fd30"/></dir><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="f36fb9f0654508631bc3f3c8c5e31ad2"/></dir><file name="List.php" hash="35110b9d4cce21669b3febce14343bd1"/></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="3a858ada3f75cf0aa8c327d27daa616b"/></dir><file name="View.php" hash="f978e5be20a3f12db9abc1f0c9872ba5"/></dir><file name="Layer.php" hash="576c376ec352ce14e7f10c7e77fb8b59"/><file name="Result.php" hash="382a1f850d62de8e86617f149244db93"/></dir><file name="Filter.php" hash="ed4acfa073dfefdfbc15c705125f3764"/><dir name="Page"><dir name="Html"><file name="Pager.php" hash="323a99730a43b8bce5f887feb3c048b6"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d7898db41504b194f8db736d24a62078"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="0d30a7ef909de52c6aa2e029553674db"/><file name="Category.php" hash="cabe459e05ea13a36fecb30504c553da"/><file name="Price.php" hash="fab3c242664308df823e9908a0c9e246"/></dir></dir><file name="Layer.php" hash="df0e410b742028a1d95ab01d832dff0e"/></dir><dir name="Catalogsearch"><file name="Layer.php" hash="b32c1e8c132ba771bd0e0490ed97c853"/></dir><file name="Client.php" hash="49e737ea8b3ef93533860bbb220cb454"/><file name=".DS_Store" hash="2df909e9d680df01a6532e4b2c6acf8a"/></dir><dir name="controllers"><file name="IndexController.php" hash="4ce20576ad380f40acf82afbf03f1ad4"/></dir><dir name="etc"><file name="config.xml" hash="559815a9e1d450fe60bbd57015e8d52e"/></dir><file name=".DS_Store" hash="37c804674de1deaad059452b9393cb18"/></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="tagalys"><file name="ss.xml" hash=""/></dir><file name="tagalys_merchandising.xml" hash="4cf865e3b8e1d9c5649681694359f127"/></dir><dir name="template"><dir name="tagalys"><file name="tagalys_ss.phtml" hash=""/></dir><dir name="tagalys_merchandising_page"><file name="mp_template.phtml" hash="7bc29dd648ccbb3e2614d4379b16ef35"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="Tagalys_core.xml" hash=""/></dir><dir name="template"><dir name="tagalys"><file name="progressbar.phtml" hash=""/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="tagalys-core.css" hash="8d9ea54b6b1602cda702b4c55b4943a1"/></dir><dir name="images"><file name="logo-tagalys.png" hash=""/></dir></dir></dir></dir></dir></target><target name="mage"><dir><dir name="js"><dir name="tagalys"><file name="tagalys-core.js" hash="09bba056df414ead8c8aea26a1fb8ed8"/></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Tagalys_SearchSuggestions.xml" hash="0b256e54d7f0344f70c4c4efd0473b61"/><file name="Tagalys_Tsearch.xml" hash="8986598b80306698d18983ef9a2926f9"/><file name="Tagalys_MerchandisingPage.xml" hash="bfbba4af51100c948ae2869b53691c2c"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>7.0.10</max></php></required></dependencies>
|
18 |
</package>
|
skin/adminhtml/default/default/images/logo-tagalys.png
DELETED
Binary file
|