Catalin_Seo - Version 1.0.4

Version Notes

ajax, seo urls, price slider, multiple selection for the same attribute.

Download this release

Release Info

Developer Catalin Ciobanu
Extension Catalin_Seo
Version 1.0.4
Comparing to
See all releases


Code changes from version 1.0.3 to 1.0.4

app/code/community/Catalin/SEO/Controller/Router.php CHANGED
@@ -38,15 +38,17 @@ class Catalin_SEO_Controller_Router extends Mage_Core_Controller_Varien_Router_S
38
  */
39
  public function match(Zend_Controller_Request_Http $request)
40
  {
41
- if (!Mage::helper('catalin_seo')->isEnabled()) {
 
42
  return false;
43
  }
44
 
45
  $suffix = Mage::getStoreConfig('catalog/seo/category_url_suffix');
46
- $identifier = trim(str_replace($suffix, '', $request->getPathInfo()), '/');
47
- $urlSplit = explode(Catalin_SEO_Helper_Data::ROUTING_CATEGORY_SUFFIX, $identifier, 2);
48
-
49
- //Check if it is a link generated by the SEO module
 
50
  if (!isset($urlSplit[1])) {
51
  return false;
52
  }
@@ -93,15 +95,15 @@ class Catalin_SEO_Controller_Router extends Mage_Core_Controller_Varien_Router_S
93
  if (!$found) {
94
  return false;
95
  }
96
-
97
  // Set the required data on $request object
98
- $request->setPathInfo($catPath . Catalin_SEO_Helper_Data::ROUTING_CATEGORY_SUFFIX);
99
  $request->setModuleName('catalog')
100
  ->setControllerName('category')
101
  ->setActionName('view')
102
  ->setParam('id', $urlRewrite->getCategoryId())
103
  ->setAlias(
104
- Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $catPath . Catalin_SEO_Helper_Data::ROUTING_CATEGORY_SUFFIX
105
  );
106
 
107
  // Parse url params
38
  */
39
  public function match(Zend_Controller_Request_Http $request)
40
  {
41
+ $helper = Mage::helper('catalin_seo');
42
+ if (!$helper->isEnabled()) {
43
  return false;
44
  }
45
 
46
  $suffix = Mage::getStoreConfig('catalog/seo/category_url_suffix');
47
+ $identifier = ltrim($request->getPathInfo(), '/');
48
+ $identifier = substr($identifier, 0, strlen($identifier) - strlen($suffix));
49
+ $urlSplit = explode($helper->getRoutingSuffix(), $identifier, 2);
50
+
51
+ // Check if it is a link generated by the SEO module
52
  if (!isset($urlSplit[1])) {
53
  return false;
54
  }
95
  if (!$found) {
96
  return false;
97
  }
98
+
99
  // Set the required data on $request object
100
+ $request->setPathInfo($catPath);
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
107
  );
108
 
109
  // Parse url params
app/code/community/Catalin/SEO/Helper/Data.php CHANGED
@@ -16,15 +16,10 @@
16
  */
17
  class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
18
  {
19
-
20
- /**
21
- * Routing suffix
22
- */
23
- const ROUTING_CATEGORY_SUFFIX = '/f';
24
-
25
  /**
26
  * Delimiter for multiple filters
27
  */
 
28
  const MULTIPLE_FILTERS_DELIMITER = ',';
29
 
30
  /**
@@ -75,7 +70,7 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
75
  }
76
  return Mage::getStoreConfigFlag('catalin_seo/catalog/price_slider');
77
  }
78
-
79
  /**
80
  * Retrieve price slider delay in seconds.
81
  *
@@ -86,6 +81,16 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
86
  return Mage::getStoreConfig('catalin_seo/catalog/price_slider_delay');
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
89
  /**
90
  * Getter for layered navigation params
91
  * If $params are provided then it overrides the ones from registry
@@ -145,7 +150,7 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
145
  $params['_escape'] = true;
146
  }
147
  $url = Mage::getUrl('*/*/*', $params);
148
- $url = str_replace($suffix, '', $url);
149
  $urlPath = '';
150
 
151
  if (!$noFilters) {
@@ -161,9 +166,8 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
161
  $urlParts = explode('?', $url);
162
 
163
  // Add the suffix to the url - fixes when comming from non suffixed pages
164
- if (stripos($urlParts[0], self::ROUTING_CATEGORY_SUFFIX) === false) {
165
- $urlParts[0] .= self::ROUTING_CATEGORY_SUFFIX;
166
- }
167
 
168
  $url = $urlParts[0] . $urlPath . $suffix;
169
  if (!empty($urlParts[1])) {
@@ -193,7 +197,7 @@ class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
193
  {
194
  return $this->getFilterUrl(array(), true, false, $query);
195
  }
196
-
197
  /**
198
  * Check if we are in the catalog search
199
  *
16
  */
17
  class Catalin_SEO_Helper_Data extends Mage_Core_Helper_Abstract
18
  {
 
 
 
 
 
 
19
  /**
20
  * Delimiter for multiple filters
21
  */
22
+
23
  const MULTIPLE_FILTERS_DELIMITER = ',';
24
 
25
  /**
70
  }
71
  return Mage::getStoreConfigFlag('catalin_seo/catalog/price_slider');
72
  }
73
+
74
  /**
75
  * Retrieve price slider delay in seconds.
76
  *
81
  return Mage::getStoreConfig('catalin_seo/catalog/price_slider_delay');
82
  }
83
 
84
+ /**
85
+ * Retrieve routing suffix
86
+ *
87
+ * @return string
88
+ */
89
+ public function getRoutingSuffix()
90
+ {
91
+ return '/' . Mage::getStoreConfig('catalin_seo/catalog/routing_suffix');
92
+ }
93
+
94
  /**
95
  * Getter for layered navigation params
96
  * If $params are provided then it overrides the ones from registry
150
  $params['_escape'] = true;
151
  }
152
  $url = Mage::getUrl('*/*/*', $params);
153
+ $url = substr($url, 0, strlen($url) - strlen($suffix));
154
  $urlPath = '';
155
 
156
  if (!$noFilters) {
166
  $urlParts = explode('?', $url);
167
 
168
  // Add the suffix to the url - fixes when comming from non suffixed pages
169
+ // It should always be the last bits in the URL
170
+ $urlParts[0] .= $this->getRoutingSuffix();
 
171
 
172
  $url = $urlParts[0] . $urlPath . $suffix;
173
  if (!empty($urlParts[1])) {
197
  {
198
  return $this->getFilterUrl(array(), true, false, $query);
199
  }
200
+
201
  /**
202
  * Check if we are in the catalog search
203
  *
app/code/community/Catalin/SEO/etc/config.xml CHANGED
@@ -95,6 +95,7 @@
95
  <price_slider>1</price_slider>
96
  <price_slider_delay>3</price_slider_delay>
97
  <multiple_choise_filters>1</multiple_choise_filters>
 
98
  </catalog>
99
  </catalin_seo>
100
  </default>
95
  <price_slider>1</price_slider>
96
  <price_slider_delay>3</price_slider_delay>
97
  <multiple_choise_filters>1</multiple_choise_filters>
98
+ <routing_suffix>filter</routing_suffix>
99
  </catalog>
100
  </catalin_seo>
101
  </default>
app/code/community/Catalin/SEO/etc/system.xml CHANGED
@@ -78,6 +78,17 @@
78
  <show_in_store>1</show_in_store>
79
  <depends><enabled>1</enabled></depends>
80
  </multiple_choise_filters>
 
 
 
 
 
 
 
 
 
 
 
81
  </fields>
82
  </catalog>
83
  </groups>
78
  <show_in_store>1</show_in_store>
79
  <depends><enabled>1</enabled></depends>
80
  </multiple_choise_filters>
81
+ <routing_suffix translate="label">
82
+ <label>Routing Souffix</label>
83
+ <frontend_type>text</frontend_type>
84
+ <comment>Used in url generation (it should be alphanumeric) - Do not use slash ( / )</comment>
85
+ <backend_model>catalin_seo/system_config_backend_seo_catalog</backend_model>
86
+ <sort_order>6</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ <depends><enabled>1</enabled></depends>
91
+ </routing_suffix>
92
  </fields>
93
  </catalog>
94
  </groups>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Catalin_Seo</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -23,8 +23,8 @@
23
  &lt;/ul&gt;</description>
24
  <notes>ajax, seo urls, price slider, multiple selection for the same attribute.</notes>
25
  <authors><author><name>Catalin Ciobanu</name><user>catalin_ciobanu</user><email>ciobanu.catalin@yahoo.com</email></author></authors>
26
- <date>2012-11-22</date>
27
- <time>14:48:20</time>
28
  <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="b0fb7deaeec0d46bc170e510c3d6f73a"/><file name="Price.php" hash="73fe2b9d21dab816474ee8d662a530bd"/></dir><file name="State.php" hash="fece6cd5534ae48f0f9f9233a7f714af"/></dir><dir name="Product"><dir name="List"><file name="Pager.php" hash="5f41fc06bddb70fc2f7de3792c933879"/><file name="Toolbar.php" hash="6db34892e1937dd1e527c8ac2fda4746"/></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="120da8cc984bf1d55428ee4cfeaedca5"/></dir></dir></dir></dir><dir name="Controller"><file name="Router.php" hash="71c67346a0c3e89775e5d7762c8a3588"/></dir><dir name="Helper"><file name="Data.php" hash="47a5e37ea96a12615ad1818f919d634f"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="cd5ef92601544ed236617881b0dd6352"/><file name="Category.php" hash="bc5df542ef28c4e7a9583ae441c550c8"/><file name="Item.php" hash="9d89a99bebad467ca14e50333c556649"/></dir></dir><dir name="Resource"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="ab59cb798f1069786a98408f6ebaf948"/></dir></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="137c0b3795d3eea4da8442db3e05e7a0"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Seo"><file name="Catalog.php" hash="ea4cd41cf4e919935919585a22dfea29"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="CategoryController.php" hash="3f3404592e64ffc3d3e302a92e76dc06"/><file name="ResultController.php" hash="660c07990539e5605112cb42e24c02d6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="240f607b0156d1de84667b382ba3f73c"/><file name="config.xml" hash="9e2487e6c0eb5b09c43f65c01db3d882"/><file name="system.xml" hash="9fd01148901e15950868e312b96dbfde"/></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></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Catalin_SEO.xml" hash="e0ad01abfe976aefb6587fcfb3bf0d2b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><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="19f1583df9e7f14d81318c633b334a88"/><file name="view.phtml" hash="bc5f21109be4dab996b152e7a756fe03"/></dir><dir name="product"><file name="list.phtml" hash="bd332a192ed36c56c00968e13b599cd3"/></dir></dir></dir></dir></dir><dir name="layout"><file name="catalin_seo.xml" hash="61db4d9d696f2d12c562ae70a5164e4c"/></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Catalin_Seo</name>
4
+ <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
23
  &lt;/ul&gt;</description>
24
  <notes>ajax, seo urls, price slider, multiple selection for the same attribute.</notes>
25
  <authors><author><name>Catalin Ciobanu</name><user>catalin_ciobanu</user><email>ciobanu.catalin@yahoo.com</email></author></authors>
26
+ <date>2012-12-03</date>
27
+ <time>11:55:30</time>
28
  <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="b0fb7deaeec0d46bc170e510c3d6f73a"/><file name="Price.php" hash="73fe2b9d21dab816474ee8d662a530bd"/></dir><file name="State.php" hash="fece6cd5534ae48f0f9f9233a7f714af"/></dir><dir name="Product"><dir name="List"><file name="Pager.php" hash="5f41fc06bddb70fc2f7de3792c933879"/><file name="Toolbar.php" hash="6db34892e1937dd1e527c8ac2fda4746"/></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="120da8cc984bf1d55428ee4cfeaedca5"/></dir></dir></dir></dir><dir name="Controller"><file name="Router.php" hash="71c67346a0c3e89775e5d7762c8a3588"/></dir><dir name="Helper"><file name="Data.php" hash="47a5e37ea96a12615ad1818f919d634f"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="cd5ef92601544ed236617881b0dd6352"/><file name="Category.php" hash="bc5df542ef28c4e7a9583ae441c550c8"/><file name="Item.php" hash="9d89a99bebad467ca14e50333c556649"/></dir></dir><dir name="Resource"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="ab59cb798f1069786a98408f6ebaf948"/></dir></dir></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="137c0b3795d3eea4da8442db3e05e7a0"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Seo"><file name="Catalog.php" hash="ea4cd41cf4e919935919585a22dfea29"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="CategoryController.php" hash="3f3404592e64ffc3d3e302a92e76dc06"/><file name="ResultController.php" hash="660c07990539e5605112cb42e24c02d6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="240f607b0156d1de84667b382ba3f73c"/><file name="config.xml" hash="9e2487e6c0eb5b09c43f65c01db3d882"/><file name="system.xml" hash="9fd01148901e15950868e312b96dbfde"/></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></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Catalin_SEO.xml" hash="e0ad01abfe976aefb6587fcfb3bf0d2b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><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="19f1583df9e7f14d81318c633b334a88"/><file name="view.phtml" hash="bc5f21109be4dab996b152e7a756fe03"/></dir><dir name="product"><file name="list.phtml" hash="bd332a192ed36c56c00968e13b599cd3"/></dir></dir></dir></dir></dir><dir name="layout"><file name="catalin_seo.xml" hash="61db4d9d696f2d12c562ae70a5164e4c"/></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>