activo_categoryurlseo - Version 1.0.2

Version Notes

Fixed an issue with the double slash reported by users with newer versions of Magento.

Download this release

Release Info

Developer Activo Extensions
Extension activo_categoryurlseo
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Activo/Categoryurlseo/Model/Url.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Activo_Categoryurlseo_Model_Url extends Mage_Catalog_Model_Url
3
+ {
4
+ /**
5
+ * Get unique product request path
6
+ *
7
+ * @param Varien_Object $product
8
+ * @param Varien_Object $category
9
+ * @return string
10
+ */
11
+ public function getProductRequestPath($product, $category)
12
+ {
13
+ if (Mage::getStoreConfig('activo_categoryurlseo/global/enabled')==0)
14
+ {
15
+ return parent::getProductRequestPath($product, $category);
16
+ }
17
+ else
18
+ {
19
+ if ($product->getUrlKey() == '') {
20
+ $urlKey = $this->getProductModel()->formatUrlKey($product->getName());
21
+ } else {
22
+ $urlKey = $this->getProductModel()->formatUrlKey($product->getUrlKey());
23
+ }
24
+ $storeId = $category->getStoreId();
25
+ $suffix = $this->getProductUrlSuffix($storeId);
26
+ $idPath = $this->generatePath('id', $product, $category);
27
+ /**
28
+ * Prepare product base request path
29
+ */
30
+ if ($category->getLevel() > 1) {
31
+ // To ensure, that category has path either from attribute or generated now
32
+ $this->_addCategoryUrlPath($category);
33
+ $categoryUrl = Mage::helper('catalog/category')->getCategoryUrlPath($category->getUrlPath(),
34
+ false, $storeId);
35
+ $requestPath = $categoryUrl . ($categoryUrl==''?'':'/') . $urlKey;
36
+ } else {
37
+ $requestPath = $urlKey;
38
+ }
39
+
40
+ if (strlen($requestPath) > self::MAX_REQUEST_PATH_LENGTH + self::ALLOWED_REQUEST_PATH_OVERFLOW) {
41
+ $requestPath = substr($requestPath, 0, self::MAX_REQUEST_PATH_LENGTH);
42
+ }
43
+
44
+ $this->_rewrite = null;
45
+ /**
46
+ * Check $requestPath should be unique
47
+ */
48
+ if (isset($this->_rewrites[$idPath])) {
49
+ $this->_rewrite = $this->_rewrites[$idPath];
50
+ $existingRequestPath = $this->_rewrites[$idPath]->getRequestPath();
51
+ $existingRequestPath = str_replace($suffix, '', $existingRequestPath);
52
+
53
+ if ($existingRequestPath == $requestPath) {
54
+ return $requestPath.$suffix;
55
+ }
56
+ /**
57
+ * Check if existing request past can be used
58
+ */
59
+ if ($product->getUrlKey() == '' && !empty($requestPath)
60
+ && strpos($existingRequestPath, $requestPath) !== false
61
+ ) {
62
+ $existingRequestPath = str_replace($requestPath, '', $existingRequestPath);
63
+ if (preg_match('#^-([0-9]+)$#i', $existingRequestPath)) {
64
+ return $this->_rewrites[$idPath]->getRequestPath();
65
+ }
66
+ }
67
+ /**
68
+ * check if current generated request path is one of the old paths
69
+ */
70
+ $fullPath = $requestPath.$suffix;
71
+ $finalOldTargetPath = $this->getResource()->findFinalTargetPath($fullPath, $storeId);
72
+ if ($finalOldTargetPath && $finalOldTargetPath == $idPath) {
73
+ $this->getResource()->deleteRewrite($fullPath, $storeId);
74
+ return $fullPath;
75
+ }
76
+ }
77
+ /**
78
+ * Check 2 variants: $requestPath and $requestPath . '-' . $productId
79
+ */
80
+ $validatedPath = $this->getResource()->checkRequestPaths(
81
+ array($requestPath.$suffix, $requestPath.'-'.$product->getId().$suffix),
82
+ $storeId
83
+ );
84
+
85
+ if ($validatedPath) {
86
+ return $validatedPath;
87
+ }
88
+ /**
89
+ * Use unique path generator
90
+ */
91
+ return $this->getUnusedPath($storeId, $requestPath.$suffix, $idPath);
92
+ }
93
+ }
94
+ }
app/code/community/Activo/Categoryurlseo/etc/config.xml CHANGED
@@ -21,6 +21,11 @@
21
  <categoryurlseo>
22
  <class>Activo_Categoryurlseo_Model</class>
23
  </categoryurlseo>
 
 
 
 
 
24
  </models>
25
  </global>
26
  <adminhtml>
21
  <categoryurlseo>
22
  <class>Activo_Categoryurlseo_Model</class>
23
  </categoryurlseo>
24
+ <catalog>
25
+ <rewrite>
26
+ <url>Activo_Categoryurlseo_Model_Url</url>
27
+ </rewrite>
28
+ </catalog>
29
  </models>
30
  </global>
31
  <adminhtml>
app/code/community/Activo/News/Model/Feed.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Activo
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Commercial Software License
8
+ * that is available through the world-wide-web at this URL:
9
+ * http://extensions.activo.com/license_professional
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to extensions@activo.com so we can send you a copy immediately.
13
+ *
14
+ * @category
15
+ * @package news
16
+ * @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
17
+ * @license Open Source
18
+ */
19
+
20
+ //http://www.nicksays.co.uk/2009/05/magento-custom-admin-notifications/
21
+ class Activo_News_Model_Feed extends Mage_AdminNotification_Model_Feed
22
+ {
23
+ /**
24
+ * Retrieve feed url
25
+ *
26
+ * @return string
27
+ */
28
+ public function getFeedUrl()
29
+ {
30
+ if (is_null($this->_feedUrl)) {
31
+ $this->_feedUrl = 'http://extensions.activo.com/adminrss.php?s='.Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_UNSECURE_URL);
32
+ }
33
+ return $this->_feedUrl;
34
+ }
35
+
36
+ public function observe()
37
+ {
38
+ $model = Mage::getModel('news/feed');
39
+ $model->checkUpdate();
40
+ }
41
+
42
+ // public function getFrequency()
43
+ // {
44
+ // return 1;
45
+ // }
46
+
47
+ }
app/code/community/Activo/News/etc/config.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Activo
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Commercial Software License
9
+ * that is available through the world-wide-web at this URL:
10
+ * http://extensions.activo.com/license_professional
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to extensions@activo.com so we can send you a copy immediately.
14
+ *
15
+ * @category
16
+ * @package news
17
+ * @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
18
+ * @license Open Source
19
+ */
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <Activo_News>
24
+ <version>1.0.0</version>
25
+ </Activo_News>
26
+ </modules>
27
+ <global>
28
+ <models>
29
+ <news>
30
+ <class>Activo_News_Model</class>
31
+ </news>
32
+ </models>
33
+ </global>
34
+ <adminhtml>
35
+ <events>
36
+ <controller_action_predispatch>
37
+ <observers>
38
+ <activo_news>
39
+ <type>singleton</type>
40
+ <class>news/feed</class>
41
+ <method>observe</method>
42
+ </activo_news>
43
+ </observers>
44
+ </controller_action_predispatch>
45
+ </events>
46
+ </adminhtml>
47
+ </config>
app/etc/modules/Activo_News.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Activo
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Commercial Software License
9
+ * that is available through the world-wide-web at this URL:
10
+ * http://extensions.activo.com/license_professional
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to extensions@activo.com so we can send you a copy immediately.
14
+ *
15
+ * @category
16
+ * @package news
17
+ * @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
18
+ * @license Open Source
19
+ */
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <Activo_News>
24
+ <active>true</active>
25
+ <codePool>community</codePool>
26
+ <depends>
27
+ <Mage_AdminNotification />
28
+ </depends>
29
+ </Activo_News>
30
+ </modules>
31
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>activo_categoryurlseo</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -24,13 +24,11 @@
24
  &lt;li&gt;Uses Magento's own URL rewriting mechanism for improved compatibility&lt;/li&gt;&#xD;
25
  &lt;li&gt;100% FREE&lt;/li&gt;&#xD;
26
  &lt;/ul&gt;&lt;/p&gt;</description>
27
- <notes>This simple FREE extension can flatten your store URL structure and drastically improve your SEO in just few simple clicks.&#xD;
28
- &#xD;
29
- Repackaged for Magento Connect.</notes>
30
  <authors><author><name>Activo Extensions</name><user>activo</user><email>extensions@activo.com</email></author></authors>
31
- <date>2012-03-01</date>
32
- <time>20:37:57</time>
33
- <contents><target name="magecommunity"><dir name="Activo"><dir name="Categoryurlseo"><dir><dir name="Helper"><file name="Category.php" hash="f57ed5be33c88d2de3082d62182dea0c"/><file name="Data.php" hash="6892bf5f068f01ecbe4bc746ed0be85b"/></dir><dir name="etc"><file name="config.xml" hash="a8ab9f1efc96fef3d4584a340e4c356d"/><file name="system.xml" hash="9e14735283e6600bfca941f3ca40296a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Activo_Categoryurlseo.xml" hash="cbb2d56a19efe3658ff0b6bf21376dd3"/></dir></target></contents>
34
  <compatible/>
35
  <dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
36
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>activo_categoryurlseo</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
24
  &lt;li&gt;Uses Magento's own URL rewriting mechanism for improved compatibility&lt;/li&gt;&#xD;
25
  &lt;li&gt;100% FREE&lt;/li&gt;&#xD;
26
  &lt;/ul&gt;&lt;/p&gt;</description>
27
+ <notes>Fixed an issue with the double slash reported by users with newer versions of Magento.</notes>
 
 
28
  <authors><author><name>Activo Extensions</name><user>activo</user><email>extensions@activo.com</email></author></authors>
29
+ <date>2012-06-21</date>
30
+ <time>19:51:46</time>
31
+ <contents><target name="magecommunity"><dir name="Activo"><dir name="Categoryurlseo"><dir><dir name="Helper"><file name="Category.php" hash="f57ed5be33c88d2de3082d62182dea0c"/><file name="Data.php" hash="6892bf5f068f01ecbe4bc746ed0be85b"/></dir><dir name="Model"><file name="Url.php" hash="1b8675ba5cc7e514fe84110ae173d895"/></dir><dir name="etc"><file name="config.xml" hash="f1c61d3bbec241cde8ddfef27f0f97e2"/><file name="system.xml" hash="9e14735283e6600bfca941f3ca40296a"/></dir></dir></dir><dir name="News"><dir><dir name="Model"><file name="Feed.php" hash="3ac6617af7eaceb5cac373a4f13a8b1b"/></dir><dir name="etc"><file name="config.xml" hash="16cfd0b7ac1e67d0d3534b99a6c1e512"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Activo_Categoryurlseo.xml" hash="cbb2d56a19efe3658ff0b6bf21376dd3"/><file name="Activo_News.xml" hash="1c8b4c7e70aa752c05241df66dd5d29b"/></dir></target></contents>
32
  <compatible/>
33
  <dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
34
  </package>