Version Notes
Fix for category URL. Added changes for letter like 'я'='ya', 'ъ'='', 'ь'='', 'э'='e'
Download this release
Release Info
Developer | Alex |
Extension | Magefast_FixUrlCategory |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
app/code/local/Magefast/FixUrlCategory/Helper/Data.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* FixUrlCategory Helper
|
5 |
+
*
|
6 |
+
* @category Magefast
|
7 |
+
* @package Magefast_FixUrlCategory
|
8 |
+
* @author
|
9 |
+
*/
|
10 |
+
class Magefast_FixUrlCategory_Helper_Data extends Mage_Catalog_Helper_Product_Url {
|
11 |
+
|
12 |
+
protected $_convertTable = array(
|
13 |
+
'&' => 'and', '@' => 'at', '©' => 'c', '®' => 'r', 'À' => 'a',
|
14 |
+
'Á' => 'a', 'Â' => 'a', 'Ä' => 'a', 'Å' => 'a', 'Æ' => 'ae','Ç' => 'c',
|
15 |
+
'È' => 'e', 'É' => 'e', 'Ë' => 'e', 'Ì' => 'i', 'Í' => 'i', 'Î' => 'i',
|
16 |
+
'Ï' => 'i', 'Ò' => 'o', 'Ó' => 'o', 'Ô' => 'o', 'Õ' => 'o', 'Ö' => 'o',
|
17 |
+
'Ø' => 'o', 'Ù' => 'u', 'Ú' => 'u', 'Û' => 'u', 'Ü' => 'u', 'Ý' => 'y',
|
18 |
+
'ß' => 'ss','à' => 'a', 'á' => 'a', 'â' => 'a', 'ä' => 'a', 'å' => 'a',
|
19 |
+
'æ' => 'ae','ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
|
20 |
+
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ò' => 'o', 'ó' => 'o',
|
21 |
+
'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u',
|
22 |
+
'û' => 'u', 'ü' => 'u', 'ý' => 'y', 'þ' => 'p', 'ÿ' => 'y', 'Ā' => 'a',
|
23 |
+
'ā' => 'a', 'Ă' => 'a', 'ă' => 'a', 'Ą' => 'a', 'ą' => 'a', 'Ć' => 'c',
|
24 |
+
'ć' => 'c', 'Ĉ' => 'c', 'ĉ' => 'c', 'Ċ' => 'c', 'ċ' => 'c', 'Č' => 'c',
|
25 |
+
'č' => 'c', 'Ď' => 'd', 'ď' => 'd', 'Đ' => 'd', 'đ' => 'd', 'Ē' => 'e',
|
26 |
+
'ē' => 'e', 'Ĕ' => 'e', 'ĕ' => 'e', 'Ė' => 'e', 'ė' => 'e', 'Ę' => 'e',
|
27 |
+
'ę' => 'e', 'Ě' => 'e', 'ě' => 'e', 'Ĝ' => 'g', 'ĝ' => 'g', 'Ğ' => 'g',
|
28 |
+
'ğ' => 'g', 'Ġ' => 'g', 'ġ' => 'g', 'Ģ' => 'g', 'ģ' => 'g', 'Ĥ' => 'h',
|
29 |
+
'ĥ' => 'h', 'Ħ' => 'h', 'ħ' => 'h', 'Ĩ' => 'i', 'ĩ' => 'i', 'Ī' => 'i',
|
30 |
+
'ī' => 'i', 'Ĭ' => 'i', 'ĭ' => 'i', 'Į' => 'i', 'į' => 'i', 'İ' => 'i',
|
31 |
+
'ı' => 'i', 'IJ' => 'ij','ij' => 'ij','Ĵ' => 'j', 'ĵ' => 'j', 'Ķ' => 'k',
|
32 |
+
'ķ' => 'k', 'ĸ' => 'k', 'Ĺ' => 'l', 'ĺ' => 'l', 'Ļ' => 'l', 'ļ' => 'l',
|
33 |
+
'Ľ' => 'l', 'ľ' => 'l', 'Ŀ' => 'l', 'ŀ' => 'l', 'Ł' => 'l', 'ł' => 'l',
|
34 |
+
'Ń' => 'n', 'ń' => 'n', 'Ņ' => 'n', 'ņ' => 'n', 'Ň' => 'n', 'ň' => 'n',
|
35 |
+
'ʼn' => 'n', 'Ŋ' => 'n', 'ŋ' => 'n', 'Ō' => 'o', 'ō' => 'o', 'Ŏ' => 'o',
|
36 |
+
'ŏ' => 'o', 'Ő' => 'o', 'ő' => 'o', 'Œ' => 'oe','œ' => 'oe','Ŕ' => 'r',
|
37 |
+
'ŕ' => 'r', 'Ŗ' => 'r', 'ŗ' => 'r', 'Ř' => 'r', 'ř' => 'r', 'Ś' => 's',
|
38 |
+
'ś' => 's', 'Ŝ' => 's', 'ŝ' => 's', 'Ş' => 's', 'ş' => 's', 'Š' => 's',
|
39 |
+
'š' => 's', 'Ţ' => 't', 'ţ' => 't', 'Ť' => 't', 'ť' => 't', 'Ŧ' => 't',
|
40 |
+
'ŧ' => 't', 'Ũ' => 'u', 'ũ' => 'u', 'Ū' => 'u', 'ū' => 'u', 'Ŭ' => 'u',
|
41 |
+
'ŭ' => 'u', 'Ů' => 'u', 'ů' => 'u', 'Ű' => 'u', 'ű' => 'u', 'Ų' => 'u',
|
42 |
+
'ų' => 'u', 'Ŵ' => 'w', 'ŵ' => 'w', 'Ŷ' => 'y', 'ŷ' => 'y', 'Ÿ' => 'y',
|
43 |
+
'Ź' => 'z', 'ź' => 'z', 'Ż' => 'z', 'ż' => 'z', 'Ž' => 'z', 'ž' => 'z',
|
44 |
+
'ſ' => 'z', 'Ə' => 'e', 'ƒ' => 'f', 'Ơ' => 'o', 'ơ' => 'o', 'Ư' => 'u',
|
45 |
+
'ư' => 'u', 'Ǎ' => 'a', 'ǎ' => 'a', 'Ǐ' => 'i', 'ǐ' => 'i', 'Ǒ' => 'o',
|
46 |
+
'ǒ' => 'o', 'Ǔ' => 'u', 'ǔ' => 'u', 'Ǖ' => 'u', 'ǖ' => 'u', 'Ǘ' => 'u',
|
47 |
+
'ǘ' => 'u', 'Ǚ' => 'u', 'ǚ' => 'u', 'Ǜ' => 'u', 'ǜ' => 'u', 'Ǻ' => 'a',
|
48 |
+
'ǻ' => 'a', 'Ǽ' => 'ae','ǽ' => 'ae','Ǿ' => 'o', 'ǿ' => 'o', 'ə' => 'e',
|
49 |
+
'Ё' => 'jo','Є' => 'e', 'І' => 'i', 'Ї' => 'i', 'А' => 'a', 'Б' => 'b',
|
50 |
+
'В' => 'v', 'Г' => 'g', 'Д' => 'd', 'Е' => 'e', 'Ж' => 'zh','З' => 'z',
|
51 |
+
'И' => 'i', 'Й' => 'y', 'К' => 'k', 'Л' => 'l', 'М' => 'm', 'Н' => 'n',
|
52 |
+
'О' => 'o', 'П' => 'p', 'Р' => 'r', 'С' => 's', 'Т' => 't', 'У' => 'u',
|
53 |
+
'Ф' => 'f', 'Х' => 'h', 'Ц' => 'c', 'Ч' => 'ch','Ш' => 'sh','Щ' => 'sch',
|
54 |
+
'Ъ' => '', 'Ы' => 'y', 'Ь' => '', 'Э' => 'e','Ю' => 'yu','Я' => 'ya',
|
55 |
+
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e',
|
56 |
+
'ж' => 'zh','з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l',
|
57 |
+
'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's',
|
58 |
+
'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch',
|
59 |
+
'ш' => 'sh','щ' => 'sch','ъ' => '','ы' => 'y', 'ь' => '', 'э' => 'e',
|
60 |
+
'ю' => 'ju','я' => 'ya','ё' => 'jo','є' => 'e', 'і' => 'i', 'ї' => 'i',
|
61 |
+
'Ґ' => 'g', 'ґ' => 'g', 'א' => 'a', 'ב' => 'b', 'ג' => 'g', 'ד' => 'd',
|
62 |
+
'ה' => 'h', 'ו' => 'v', 'ז' => 'z', 'ח' => 'h', 'ט' => 't', 'י' => 'i',
|
63 |
+
'ך' => 'k', 'כ' => 'k', 'ל' => 'l', 'ם' => 'm', 'מ' => 'm', 'ן' => 'n',
|
64 |
+
'נ' => 'n', 'ס' => 's', 'ע' => 'e', 'ף' => 'p', 'פ' => 'p', 'ץ' => 'C',
|
65 |
+
'צ' => 'c', 'ק' => 'q', 'ר' => 'r', 'ש' => 'w', 'ת' => 't', '™' => 'tm',
|
66 |
+
);
|
67 |
+
|
68 |
+
}
|
app/code/local/Magefast/FixUrlCategory/Model/Category.php
CHANGED
@@ -17,7 +17,7 @@ class Magefast_FixUrlCategory_Model_Category extends Mage_Catalog_Model_Category
|
|
17 |
*/
|
18 |
public function formatUrlKey($str)
|
19 |
{
|
20 |
-
$str = Mage::helper('
|
21 |
//$str = Mage::helper('core')->removeAccents($str); //old
|
22 |
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', $str);
|
23 |
$urlKey = strtolower($urlKey);
|
17 |
*/
|
18 |
public function formatUrlKey($str)
|
19 |
{
|
20 |
+
$str = Mage::helper('fixurlcategory')->format($str); //new, like for product
|
21 |
//$str = Mage::helper('core')->removeAccents($str); //old
|
22 |
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', $str);
|
23 |
$urlKey = strtolower($urlKey);
|
app/code/local/Magefast/FixUrlCategory/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Magefast_FixUrlCategory>
|
5 |
-
<version>1.
|
6 |
</Magefast_FixUrlCategory>
|
7 |
</modules>
|
8 |
<global>
|
@@ -13,5 +13,10 @@
|
|
13 |
</rewrite>
|
14 |
</catalog>
|
15 |
</models>
|
|
|
|
|
|
|
|
|
|
|
16 |
</global>
|
17 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Magefast_FixUrlCategory>
|
5 |
+
<version>1.1.0</version>
|
6 |
</Magefast_FixUrlCategory>
|
7 |
</modules>
|
8 |
<global>
|
13 |
</rewrite>
|
14 |
</catalog>
|
15 |
</models>
|
16 |
+
<helpers>
|
17 |
+
<fixurlcategory>
|
18 |
+
<class>Magefast_FixUrlCategory_Helper</class>
|
19 |
+
</fixurlcategory>
|
20 |
+
</helpers>
|
21 |
</global>
|
22 |
</config>
|
package.xml
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Magefast_FixUrlCategory</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Fix for saving URL of category.</summary>
|
10 |
-
<description>Extension for fix problem URL, if use with cyrillic or other non-latin charset.
|
11 |
Extension based on Product Helper as example. URL key before save will converted, non-latin symbols will translit.</description>
|
12 |
-
<notes>Fix for category URL</notes>
|
13 |
<authors><author><name>Alex</name><user>alexhost</user><email>b07400@yandex.com</email></author></authors>
|
14 |
-
<date>2012-02
|
15 |
-
<time>
|
16 |
-
<contents><target name="magelocal"><dir name="Magefast"><dir name="FixUrlCategory"><dir name="Model"><file name="Category.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Magefast_FixUrlCategory</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Fix for saving URL of category.</summary>
|
10 |
+
<description>Extension for fix problem URL, if use with cyrillic or other non-latin charset. &#xD;
|
11 |
Extension based on Product Helper as example. URL key before save will converted, non-latin symbols will translit.</description>
|
12 |
+
<notes>Fix for category URL. Added changes for letter like 'я'='ya', 'ъ'='', 'ь'='', 'э'='e'</notes>
|
13 |
<authors><author><name>Alex</name><user>alexhost</user><email>b07400@yandex.com</email></author></authors>
|
14 |
+
<date>2012-08-02</date>
|
15 |
+
<time>12:41:07</time>
|
16 |
+
<contents><target name="magelocal"><dir name="Magefast"><dir name="FixUrlCategory"><dir name="Helper"><file name="Data.php" hash="8edb5aee29b6077343338494c9c7c66e"/></dir><dir name="Model"><file name="Category.php" hash="dddcd3859f597ef12bdefad3a293d701"/></dir><dir name="etc"><file name="config.xml" hash="4af617f17e77af910c86a446d5bd789f"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Magefast_FixUrlCategory.xml" hash="2cb30a168d275e171619048b227d829b"/></dir></dir></dir></target></contents>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|