Version Notes
- Fixed price slider filtering: doesn't remove previous filters anymore.
- Fixed ___SID=U in URLs after AJAX call.
Download this release
Release Info
Developer | Catalin Ciobanu |
Extension | Catalin_Seo |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.1
- app/code/community/Catalin/SEO/Controller/Router.php +3 -1
- app/code/community/Catalin/SEO/Helper/Data.php +10 -8
- app/code/community/Catalin/SEO/Model/Catalog/Layer/Filter/Item.php +1 -1
- app/code/community/Catalin/SEO/Model/CatalogSearch/Layer/Filter/Attribute.php +5 -4
- app/code/community/Catalin/SEO/controllers/CategoryController.php +5 -0
- app/code/community/Catalin/SEO/controllers/ResultController.php +5 -0
- app/design/frontend/default/default/template/catalin_seo/catalog/layer/price.phtml +13 -12
- app/design/frontend/default/default/template/catalin_seo/catalog/product/list.phtml +11 -10
- package.xml +6 -6
app/code/community/Catalin/SEO/Controller/Router.php
CHANGED
@@ -97,10 +97,12 @@ class Catalin_SEO_Controller_Router extends Mage_Core_Controller_Varien_Router_S
|
|
97 |
}
|
98 |
|
99 |
// Set the required data on $request object
|
100 |
-
$request->setPathInfo($
|
|
|
101 |
$request->setModuleName('catalog')
|
102 |
->setControllerName('category')
|
103 |
->setActionName('view')
|
|
|
104 |
->setParam('id', $urlRewrite->getCategoryId())
|
105 |
->setAlias(
|
106 |
Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $catPath
|
97 |
}
|
98 |
|
99 |
// Set the required data on $request object
|
100 |
+
$request->setPathInfo($urlRewrite->getTargetPath());
|
101 |
+
$request->setRequestUri('/' . $urlRewrite->getTargetPath());
|
102 |
$request->setModuleName('catalog')
|
103 |
->setControllerName('category')
|
104 |
->setActionName('view')
|
105 |
+
->setControllerModule($realModule)
|
106 |
->setParam('id', $urlRewrite->getCategoryId())
|
107 |
->setAlias(
|
108 |
Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $catPath
|
app/code/community/Catalin/SEO/Helper/Data.php
CHANGED
@@ -140,7 +140,7 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Data
|
|
140 |
* @param array $q array with values to add to query string
|
141 |
* @return string
|
142 |
*/
|
143 |
-
public function getFilterUrl(array $filters, $
|
144 |
{
|
145 |
$query = array(
|
146 |
'isLayerAjax' => null, // this needs to be removed because of ajax request
|
@@ -153,12 +153,9 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Data
|
|
153 |
'_current' => true,
|
154 |
'_use_rewrite' => true,
|
155 |
'_query' => $query,
|
156 |
-
'
|
157 |
);
|
158 |
-
|
159 |
-
if ($escape) {
|
160 |
-
$params['_escape'] = true;
|
161 |
-
}
|
162 |
$url = Mage::getUrl('*/*/*', $params);
|
163 |
$urlPath = '';
|
164 |
|
@@ -171,6 +168,11 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Data
|
|
171 |
$urlPath .= "/{$key}/{$value}";
|
172 |
}
|
173 |
}
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
$urlParts = explode('?', $url);
|
176 |
|
@@ -194,7 +196,7 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Data
|
|
194 |
*/
|
195 |
public function getClearFiltersUrl()
|
196 |
{
|
197 |
-
return $this->getFilterUrl(array(), true
|
198 |
}
|
199 |
|
200 |
/**
|
@@ -205,7 +207,7 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Data
|
|
205 |
*/
|
206 |
public function getPagerUrl(array $query)
|
207 |
{
|
208 |
-
return $this->getFilterUrl(array(),
|
209 |
}
|
210 |
|
211 |
/**
|
140 |
* @param array $q array with values to add to query string
|
141 |
* @return string
|
142 |
*/
|
143 |
+
public function getFilterUrl(array $filters, $noFilters = false, array $q = array())
|
144 |
{
|
145 |
$query = array(
|
146 |
'isLayerAjax' => null, // this needs to be removed because of ajax request
|
153 |
'_current' => true,
|
154 |
'_use_rewrite' => true,
|
155 |
'_query' => $query,
|
156 |
+
'_escape' => true,
|
157 |
);
|
158 |
+
|
|
|
|
|
|
|
159 |
$url = Mage::getUrl('*/*/*', $params);
|
160 |
$urlPath = '';
|
161 |
|
168 |
$urlPath .= "/{$key}/{$value}";
|
169 |
}
|
170 |
}
|
171 |
+
|
172 |
+
// Skip adding routing suffix for links with no filters
|
173 |
+
if (empty($urlPath)) {
|
174 |
+
return $url;
|
175 |
+
}
|
176 |
|
177 |
$urlParts = explode('?', $url);
|
178 |
|
196 |
*/
|
197 |
public function getClearFiltersUrl()
|
198 |
{
|
199 |
+
return $this->getFilterUrl(array(), true);
|
200 |
}
|
201 |
|
202 |
/**
|
207 |
*/
|
208 |
public function getPagerUrl(array $query)
|
209 |
{
|
210 |
+
return $this->getFilterUrl(array(), false, $query);
|
211 |
}
|
212 |
|
213 |
/**
|
app/code/community/Catalin/SEO/Model/Catalog/Layer/Filter/Item.php
CHANGED
@@ -59,7 +59,7 @@ class Catalin_SEO_Model_Catalog_Layer_Filter_Item extends Mage_Catalog_Model_Lay
|
|
59 |
|
60 |
return $this->_helper()->getFilterUrl(array(
|
61 |
$this->getFilter()->getRequestVar() => $values
|
62 |
-
)
|
63 |
}
|
64 |
|
65 |
/**
|
59 |
|
60 |
return $this->_helper()->getFilterUrl(array(
|
61 |
$this->getFilter()->getRequestVar() => $values
|
62 |
+
));
|
63 |
}
|
64 |
|
65 |
/**
|
app/code/community/Catalin/SEO/Model/CatalogSearch/Layer/Filter/Attribute.php
CHANGED
@@ -18,13 +18,14 @@ class Catalin_SEO_Model_CatalogSearch_Layer_Filter_Attribute extends Catalin_SEO
|
|
18 |
{
|
19 |
|
20 |
/**
|
21 |
-
*
|
22 |
*
|
|
|
|
|
23 |
*/
|
24 |
-
|
25 |
{
|
26 |
-
|
27 |
-
$this->_filterModelName = 'catalogsearch/layer_filter_attribute';
|
28 |
}
|
29 |
|
30 |
}
|
18 |
{
|
19 |
|
20 |
/**
|
21 |
+
* Check whether specified attribute can be used in LN
|
22 |
*
|
23 |
+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
|
24 |
+
* @return bool
|
25 |
*/
|
26 |
+
protected function _getIsFilterableAttribute($attribute)
|
27 |
{
|
28 |
+
return $attribute->getIsFilterableInSearch();
|
|
|
29 |
}
|
30 |
|
31 |
}
|
app/code/community/Catalin/SEO/controllers/CategoryController.php
CHANGED
@@ -75,6 +75,11 @@ class Catalin_Seo_CategoryController extends Mage_Catalog_CategoryController
|
|
75 |
if ($this->getRequest()->isAjax()) {
|
76 |
$listing = $this->getLayout()->getBlock('product_list')->toHtml();
|
77 |
$layer = $this->getLayout()->getBlock('catalog.leftnav')->toHtml();
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
$response = array(
|
80 |
'listing' => $listing,
|
75 |
if ($this->getRequest()->isAjax()) {
|
76 |
$listing = $this->getLayout()->getBlock('product_list')->toHtml();
|
77 |
$layer = $this->getLayout()->getBlock('catalog.leftnav')->toHtml();
|
78 |
+
|
79 |
+
// Fix urls that contain '___SID=U'
|
80 |
+
$urlModel = Mage::getSingleton('core/url');
|
81 |
+
$listing = $urlModel->sessionUrlVar($listing);
|
82 |
+
$layer = $urlModel->sessionUrlVar($layer);
|
83 |
|
84 |
$response = array(
|
85 |
'listing' => $listing,
|
app/code/community/Catalin/SEO/controllers/ResultController.php
CHANGED
@@ -65,6 +65,11 @@ class Catalin_Seo_ResultController extends Mage_CatalogSearch_ResultController
|
|
65 |
if ($this->getRequest()->isAjax()) {
|
66 |
$listing = $this->getLayout()->getBlock('search_result_list')->toHtml();
|
67 |
$layer = $this->getLayout()->getBlock('catalogsearch.leftnav')->toHtml();
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
$response = array(
|
70 |
'listing' => $listing,
|
65 |
if ($this->getRequest()->isAjax()) {
|
66 |
$listing = $this->getLayout()->getBlock('search_result_list')->toHtml();
|
67 |
$layer = $this->getLayout()->getBlock('catalogsearch.leftnav')->toHtml();
|
68 |
+
|
69 |
+
// Fix urls that contain '___SID=U'
|
70 |
+
$urlModel = Mage::getSingleton('core/url');
|
71 |
+
$listing = $urlModel->sessionUrlVar($listing);
|
72 |
+
$layer = $urlModel->sessionUrlVar($layer);
|
73 |
|
74 |
$response = array(
|
75 |
'listing' => $listing,
|
app/design/frontend/default/default/template/catalin_seo/catalog/layer/price.phtml
CHANGED
@@ -15,27 +15,28 @@
|
|
15 |
<?php endif; ?>
|
16 |
|
17 |
<script type="text/javascript">
|
18 |
-
|
19 |
-
<?php if (!$this->isSubmitTypeButton()): ?>
|
20 |
-
var timerSlider = null;
|
21 |
-
var priceSliderDelay = <?php echo $this->helper('catalin_seo')->getPriceSliderDelay() * 1000 ?>;
|
22 |
-
<?php endif; ?>
|
23 |
|
|
|
24 |
function handlePriceEvent(val) {
|
25 |
if (val) {
|
26 |
-
var
|
27 |
-
link = link.replace('__PRICE_VALUE__', val);
|
28 |
<?php if ($this->helper('catalin_seo')->isAjaxEnabled()): ?>
|
29 |
-
handleEvent(
|
30 |
<?php else: ?>
|
31 |
-
window.location.href =
|
32 |
<?php endif; ?>
|
33 |
}
|
34 |
}
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
// horizontal slider control with preset values
|
38 |
-
new Control.Slider(
|
39 |
range: $R(0, maxPriceInt, false),
|
40 |
sliderValue: [0, maxPriceInt],
|
41 |
values: [
|
15 |
<?php endif; ?>
|
16 |
|
17 |
<script type="text/javascript">
|
18 |
+
priceSliderUrlTemplate = '<?php echo $this->getUrlPattern(); ?>';
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
<?php if (!$this->getRequest()->isAjax()): ?>
|
21 |
function handlePriceEvent(val) {
|
22 |
if (val) {
|
23 |
+
var url = priceSliderUrlTemplate.replace('__PRICE_VALUE__', val);
|
|
|
24 |
<?php if ($this->helper('catalin_seo')->isAjaxEnabled()): ?>
|
25 |
+
handleEvent(url);
|
26 |
<?php else: ?>
|
27 |
+
window.location.href = url;
|
28 |
<?php endif; ?>
|
29 |
}
|
30 |
}
|
31 |
+
<?php endif; ?>
|
32 |
+
|
33 |
+
maxPriceInt = <?php echo $this->getMaxPriceInt(); ?>;
|
34 |
+
<?php if (!$this->isSubmitTypeButton()): ?>
|
35 |
+
timerSlider = null;
|
36 |
+
priceSliderDelay = <?php echo $this->helper('catalin_seo')->getPriceSliderDelay() * 1000 ?>;
|
37 |
+
<?php endif; ?>
|
38 |
// horizontal slider control with preset values
|
39 |
+
new Control.Slider([$('price-min'), $('price-max')], 'price-range', {
|
40 |
range: $R(0, maxPriceInt, false),
|
41 |
sliderValue: [0, maxPriceInt],
|
42 |
values: [
|
app/design/frontend/default/default/template/catalin_seo/catalog/product/list.phtml
CHANGED
@@ -129,28 +129,28 @@
|
|
129 |
}
|
130 |
|
131 |
function handleEvent(el, event) {
|
132 |
-
var
|
133 |
if (typeof el === 'string') {
|
134 |
-
|
135 |
} else if (el.tagName.toLowerCase() === 'a') {
|
136 |
-
|
137 |
} else if (el.tagName.toLowerCase() === 'select') {
|
138 |
-
|
139 |
}
|
140 |
|
141 |
<?php // Add this to query string for full page caching systems ?>
|
142 |
-
if (
|
143 |
-
|
144 |
} else {
|
145 |
-
|
146 |
}
|
147 |
|
148 |
$('loading').show();
|
149 |
$('ajax-errors').hide();
|
150 |
|
151 |
-
pushState(null,
|
152 |
|
153 |
-
new Ajax.Request(
|
154 |
method: 'get',
|
155 |
onSuccess: function(transport) {
|
156 |
if (transport.responseJSON) {
|
@@ -159,7 +159,7 @@
|
|
159 |
pushState({
|
160 |
listing: transport.responseJSON.listing,
|
161 |
layer: transport.responseJSON.layer
|
162 |
-
},
|
163 |
ajaxListener();
|
164 |
} else {
|
165 |
$('ajax-errors').show();
|
@@ -167,6 +167,7 @@
|
|
167 |
$('loading').hide();
|
168 |
}
|
169 |
});
|
|
|
170 |
if (event) {
|
171 |
event.preventDefault();
|
172 |
}
|
129 |
}
|
130 |
|
131 |
function handleEvent(el, event) {
|
132 |
+
var url, fullUrl;
|
133 |
if (typeof el === 'string') {
|
134 |
+
url = el;
|
135 |
} else if (el.tagName.toLowerCase() === 'a') {
|
136 |
+
url = $(el).readAttribute('href');
|
137 |
} else if (el.tagName.toLowerCase() === 'select') {
|
138 |
+
url = $(el).getValue();
|
139 |
}
|
140 |
|
141 |
<?php // Add this to query string for full page caching systems ?>
|
142 |
+
if (url.indexOf('?') != -1) {
|
143 |
+
fullUrl = url + '&isLayerAjax=1';
|
144 |
} else {
|
145 |
+
fullUrl = url + '?isLayerAjax=1';
|
146 |
}
|
147 |
|
148 |
$('loading').show();
|
149 |
$('ajax-errors').hide();
|
150 |
|
151 |
+
pushState(null, url, false);
|
152 |
|
153 |
+
new Ajax.Request(fullUrl, {
|
154 |
method: 'get',
|
155 |
onSuccess: function(transport) {
|
156 |
if (transport.responseJSON) {
|
159 |
pushState({
|
160 |
listing: transport.responseJSON.listing,
|
161 |
layer: transport.responseJSON.layer
|
162 |
+
}, url, true);
|
163 |
ajaxListener();
|
164 |
} else {
|
165 |
$('ajax-errors').show();
|
167 |
$('loading').hide();
|
168 |
}
|
169 |
});
|
170 |
+
|
171 |
if (event) {
|
172 |
event.preventDefault();
|
173 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Catalin_Seo</name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
@@ -16,12 +16,12 @@
|
|
16 |
<li>multiple filters for the same attribute</li>
|
17 |
</ul>
|
18 |
<p>All the above features can be enabled/disabled from backend from "System -> Configuration -> Catalin SEO -> Catalog Layered Navigation"</p></description>
|
19 |
-
<notes>- Fixed
|
20 |
-
-
|
21 |
<authors><author><name>Catalin Ciobanu</name><user>catalin_ciobanu</user><email>ciobanu.catalin@yahoo.com</email></author></authors>
|
22 |
-
<date>2013-
|
23 |
-
<time>
|
24 |
-
<contents><target name="magecommunity"><dir name="Catalin"><dir name="SEO"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="decdc5633827964ff7aba28f8e8f89ff"/><file name="Price.php" hash="fb413c30cfd742818757beb88264fd68"/></dir><file name="State.php" hash="fd21c5a6603427ae81e7eddbef3d827f"/></dir><dir name="Product"><dir name="List"><file name="Pager.php" hash="7720a417475b5a512d383fd06242e43a"/><file name="Toolbar.php" hash="1624c89efb4f94ed1f35622c70fd3d9a"/></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="008e737de084f5a400518bda4dda09f8"/></dir></dir></dir></dir><dir name="Controller"><file name="Router.php" hash="
|
25 |
<compatible/>
|
26 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Catalin_Seo</name>
|
4 |
+
<version>2.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
16 |
<li>multiple filters for the same attribute</li>
|
17 |
</ul>
|
18 |
<p>All the above features can be enabled/disabled from backend from "System -> Configuration -> Catalin SEO -> Catalog Layered Navigation"</p></description>
|
19 |
+
<notes>- Fixed price slider filtering: doesn't remove previous filters anymore.
|
20 |
+
- Fixed ___SID=U in URLs after AJAX call.</notes>
|
21 |
<authors><author><name>Catalin Ciobanu</name><user>catalin_ciobanu</user><email>ciobanu.catalin@yahoo.com</email></author></authors>
|
22 |
+
<date>2013-02-16</date>
|
23 |
+
<time>15:49:49</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Catalin"><dir name="SEO"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="decdc5633827964ff7aba28f8e8f89ff"/><file name="Price.php" hash="fb413c30cfd742818757beb88264fd68"/></dir><file name="State.php" hash="fd21c5a6603427ae81e7eddbef3d827f"/></dir><dir name="Product"><dir name="List"><file name="Pager.php" hash="7720a417475b5a512d383fd06242e43a"/><file name="Toolbar.php" hash="1624c89efb4f94ed1f35622c70fd3d9a"/></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="008e737de084f5a400518bda4dda09f8"/></dir></dir></dir></dir><dir name="Controller"><file name="Router.php" hash="a1fae53e03202bb9f08ea9063b4163e6"/></dir><dir name="Helper"><file name="Data.php" hash="46f65d3605c9dd11640a3b9a1e87219c"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="17dde650381b5a65dd1c3fc6d942bb2a"/><file name="Category.php" hash="5a5b4213e521b0fd33cc7623435dd3aa"/><file name="Item.php" hash="13654b27109eebf1a6c619e5629bfb5e"/></dir></dir><file name="Layer.php" hash="32e0397c7eea8dacc421f3f2e1b5273a"/><dir name="Resource"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="7f235b63e342d77b18da3ffffd97de10"/></dir></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="10d9f2ce5066e42a3338c1a6018f2643"/></dir></dir><file name="Layer.php" hash="3f980ee1a82354d0bd65edde410a2818"/></dir><dir name="Indexer"><file name="Attribute.php" hash="9d5bd74b9c9204c4aee3fd6f0478688b"/></dir><dir name="Resource"><dir name="Attribute"><file name="Urlkey.php" hash="485538d19fad7b7b5b647feb220e5c03"/></dir><dir name="Indexer"><file name="Attribute.php" hash="645ebc0fe5ee7a461c06d805a529b678"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Seo"><file name="Catalog.php" hash="233ca11b938d6198b5a4400a2c5e1d61"/></dir></dir><dir name="Source"><dir name="Slider"><dir name="Submit"><file name="Type.php" hash="cb2383c3568982b09e4878735e598fca"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="CategoryController.php" hash="6d34f9ca5e73384c14f8dd98e0991629"/><file name="ResultController.php" hash="5e520cd6609a0c5f474d956c6a089f89"/></dir><dir name="etc"><file name="adminhtml.xml" hash="240f607b0156d1de84667b382ba3f73c"/><file name="config.xml" hash="f492966665665d3594f5a84ace4b4abd"/><file name="system.xml" hash="92e698eebc986af7d98f9676138730cd"/></dir><dir name="sql"><dir name="catalin_seo_setup"><file name="install-2.0.0.php" hash="1f1e47269b9658b4a3f53cb17ba728e1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="catalin_seo.xml" hash="17f80ca298cc0093ef29f69d02e8117b"/></dir><dir name="template"><dir name="catalin_seo"><dir><dir name="catalog"><dir name="layer"><file name="filter.phtml" hash="dd1d3278e691814f0cd242179e5bf53f"/><file name="price.phtml" hash="bcfe4e9c750c9b45c30f4c1242067dc1"/><file name="view.phtml" hash="bc5f21109be4dab996b152e7a756fe03"/></dir><dir name="product"><file name="list.phtml" hash="8228c48a98c8cca4c2ab18cd2df99239"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="price_slider"><file name="style.css" hash="61d0b59ed239bc64deaf4aed969652cd"/></dir></dir><dir name="images"><dir name="price_slider"><file name="bkg_slider.png" hash="1b7a1eb7add1d2b2002501f4602c3d3e"/><file name="slider.png" hash="d77b417b68ba91402c3b7180b165110c"/></dir></dir><dir name="js"><dir name="catalin_seo"><file name="native.history.js" hash="ee04bc106db73bdbe17a0eac44497df1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Catalin_SEO.xml" hash="e0ad01abfe976aefb6587fcfb3bf0d2b"/></dir></target></contents>
|
25 |
<compatible/>
|
26 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
</package>
|