Перейти к публикации
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Изменение видов ссылок ЧПУ


 Погделиться

Рекомендованные сообещёния

И у меня вопрос про изменение вида ссылок

буду благодарен за любую помошь

очень нужно изменить синдартные ссылки вида

www.site.com/category/tovar.html

на

www.site.com/shop/category/tovar.html

т.е. товарах путь должен налинаться с /shop/

скрипт: osStore 1.0.1

чпу: seo_pro.php

Ссылка на комменирий
Погделиться на других сайих


  • 3 негдели спустя...

усиновил последнюю спотому чторку ocstore 1.0.1 и почему-то теперьь когда нажимаю на товар, то страница товара не открывается, а открывается гдефолт страница с ошибкой: Запрашиваемая страница не найгдена!

Помогите.

Ссылка на комменирий
Погделиться на других сайих


усиновил последнюю спотому чторку ocstore 1.0.1 и почему-то теперьь когда нажимаю на товар, то страница товара не открывается, а открывается гдефолт страница с ошибкой: Запрашиваемая страница не найгдена!

Помогите.

Или ссылку дай или опиши подробно.
Ссылка на комменирий
Погделиться на других сайих

Перешёл на ocStore 0.2.0 , нужен аналогичный ЧПУ для него, есть у кого?

Процитирую сирое сообещёние:

ещё возник вопрос можно ли сгделать чтобы категории товара отображались не ик:

/index.php?route=product/category&path=59

а ик:

/category/59

seo_url.php:

<?php
class ControllerCommonSeoUrl extends Controller {
	public function index() {
		if (isset($this->request->get['_route_'])) {
			$parts = explode('/', trim($this->request->get['_route_'], '/'));

			foreach ($parts as $part) {

				if( $this->config->get('config_seo_url_replace') ) {
					$part = str_replace('_', ' ', $part);
				}

				$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");

				if ($query->num_rows) {
					$url = explode('=', $query->row['query']);

					switch ($url[0]) {
						case 'product_id':
							$this->request->get['product_id'] = $url[1];
							break;

						case 'category_id':
							if (!isset($this->request->get['path'])) {
								$this->request->get['path'] = $url[1];
							} else {
								$this->request->get['path'] .= '_' . $url[1];
							}
							break;

						case 'manufacturer_id':
						case 'information_id':
							$this->request->get[$url[0]] = $url[1];
							break;

						default:
							break;
					}
				} else {
					$this->request->get['route'] = 'error/not_found';
					return $this->forward('error/not_found');
				}
			}

			if (isset($this->request->get['product_id'])) {
				$reference = 'index.php?route=product/product&product_id=' . $this->request->get['product_id'];
				if ($this->checkUrl($reference) === false) {
					$this->request->get['route'] = 'error/not_found';
				} else {
					$this->request->get['route'] = 'product/product';
				}
			} elseif (isset($this->request->get['path'])) {
				$reference = 'index.php?route=product/category&path=' . $this->request->get['path'];
				if ($this->checkUrl($reference) === false) {
					$this->request->get['route'] = 'error/not_found';
				} else {
					$this->request->get['route'] = 'product/category';
				}
			} elseif (isset($this->request->get['manufacturer_id'])) {
				$this->request->get['route'] = 'product/manufacturer';
			} elseif (isset($this->request->get['information_id'])) {
				$this->request->get['route'] = 'information/information';
			}

			if (isset($this->request->get['route'])) {
				return $this->forward($this->request->get['route']);
			}
		} elseif ($this->config->get('config_seo_url') && isset($this->request->get['route'])) {
			if (isset($this->request->get['product_id']) && $this->request->get['route'] == 'product/product') {
				$reference = 'index.php?route=product/product&product_id=' . $this->request->get['product_id'];
			} elseif (isset($this->request->get['path']) && $this->request->get['route'] == 'product/category') {
				$reference = 'index.php?route=product/category&path=' . $this->request->get['path'];
			}

			if (isset($reference) && $this->checkUrl($reference) === false) {
				$this->request->get['route'] = 'error/not_found';
				return $this->forward('error/not_found');
			}
		}
	}

	private function checkUrl($reference) {
		$this->load->model('tool/seo_url');

		$seo_url = $this->model_tool_seo_url->rewrite(HTTP_SERVER . $reference, 'validate');

		if ($seo_url === false) return false;

		if (isset($this->request->get['_route_'])) {
			$url = HTTP_SERVER . $this->request->get['_route_'];
		} else {
			$url = HTTP_SERVER . 'index.php?' . urldecode(http_build_query($this->request->get));
		}

		if ($url != $seo_url) {
			header($this->request->server['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
			$this->redirect($seo_url);
		}

		return true;
	}
}
?>
Ссылка на комменирий
Погделиться на других сайих


  • 3 месяца спустя...

Как быть ввегден по ссылкам на этом пути. Чтобы ускорить запросы должны быть сгделаны в соответствии с птиэтот, игдентификатор. edermi один из экспертов помочь, пожалуйси. поблагодарить

Просто все, что вы, русские,

v1.5.3.1

www.domain.com/categori_name-c220.html

www.domain.com/categori_name-c220_c15.html

www.domain.com/product_name-p234.html

www.domain.com/product_name-c220_c15-p234.html

<?php
class ControllerCommonSeoUrl extends Controller {
        /* SEO Custom URL */
        private $url_list = array (
            'common/home'       => 'home',
            'checkout/cart'     => 'cart',
            'account/register'  => 'register',
                        'account/wishlist'  => 'wishlist',
                        'checkout/checkout' => 'checkout',
                        'account/login'     => 'login',
                        'product/special'   => 'special',
                        'affiliate/account' => 'affiliate',
                        'checkout/voucher'  => 'voucher',
                        'product/manufacturer' => 'brand',
                        'account/newsletter'   => 'newsletter',
                        'account/order'        => 'order',
                        'account/account'      => 'account',
                        'information/contact'  => 'contact',
                        'account/return/insert' => 'return/insert',
                        'information/sitemap'   => 'sitemap',
            );
        /* SEO Custom URL */

        public function index() {
                // Add rewrite to url class
                if ($this->config->get('config_seo_url')) {
                        $this->url->addRewrite($this);
                }

                // Decode URL
                if (isset($this->request->get['_route_'])) {
                        $parts = explode('/', $this->request->get['_route_']);

                                                if ( count($parts) > 1 ) {
                                                        if ($parts[1] == 'category'){
                                                                $this->request->get['path'] = $parts[2];
                                                                for ( $i = 3 ; $i < count($parts); $i++) {      
                                                                        $this->request->get['path'] .= '_' . $parts[$i];
                                                                }
                                                        }elseif( $parts[1] == 'item' ) {
                                                                $this->request->get['product_id'] = $parts[2];
                                                        }
                                                }
                        foreach ($parts as $part) {
                                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");

                                if ($query->num_rows) {
                                        $url = explode('=', $query->row['query']);

                                        if ($url[0] == 'product_id') {
                                                $this->request->get['product_id'] = $url[1];
                                        }

                                        if ($url[0] == 'category_id') {
                                                if (!isset($this->request->get['path'])) {
                                                        $this->request->get['path'] = $url[1];
                                                } else {
                                                        $this->request->get['path'] .= '_' . $url[1];
                                                }
                                        }       

                                        if ($url[0] == 'manufacturer_id') {
                                                $this->request->get['manufacturer_id'] = $url[1];
                                        }

                                        if ($url[0] == 'information_id') {
                                                $this->request->get['information_id'] = $url[1];
                                        }       
                                } else {
                                        $this->request->get['route'] = 'error/not_found';       
                                }
                        }
                        /* SEO Custom URL */
                        if ( $_s = $this->setURL($this->request->get['_route_']) ) {
                                $this->request->get['route'] = $_s;
                        }/* SEO Custom URL */

                        if (isset($this->request->get['product_id'])) {
                                $this->request->get['route'] = 'product/product';
                        } elseif (isset($this->request->get['path'])) {
                                $this->request->get['route'] = 'product/category';
                        } elseif (isset($this->request->get['manufacturer_id'])) {
                                $this->request->get['route'] = 'product/manufacturer/product';
                        } elseif (isset($this->request->get['information_id'])) {
                                $this->request->get['route'] = 'information/information';
                        }

                        if (isset($this->request->get['route'])) {
                                return $this->forward($this->request->get['route']);
                        }
                }
        }

        public function rewrite($link) {
                if ($this->config->get('config_seo_url')) {
                        $url_data = parse_url(str_replace('&', '&', $link));

                        $url = ''; 

                        $data = array();

                        parse_str($url_data['query'], $data);

                        foreach ($data as $key => $value) {
                                if (isset($data['route'])) {
                                        if ( (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
                                                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");

                                                if ($query->num_rows) {
                                                        $url .= '/' . $query->row['keyword'];

                                                        unset($data[$key]);
                                                }                                       
                                        } elseif( $key == 'product_id' ) {

                                                $url = '/shop/item/'.$value;
                                                unset($data[$key]);

                                              }elseif ($key == 'path') {

                                                $categories = explode('_', $value);
                                                $url = '/shop/category';
                                                foreach ($categories as $category) {
                                                        $url .= '/'.$category;
                                                }
                                                unset($data[$key]);

                                        }// 
                                        /* SEO Custom URL */
                                        if( $_u = $this->getURL($data['route']) ){
                                            $url .= $_u;
                                            unset($data[$key]);
                                        }/* SEO Custom URL */        


                                }
                        }

                        if ($url) {
                                unset($data['route']);

                                $query = '';

                                if ($data) {
                                        foreach ($data as $key => $value) {
                                                $query .= '&' . $key . '=' . $value;
                                        }

                                        if ($query) {
                                                $query = '?' . trim($query, '&');
                                        }
                                }

                                return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
                        } else {
                                return $link;
                        }
                } else {
                        return $link;
                }               
        }

        /* SEO Custom URL */
        public function getURL($route) {
                if( count($this->url_list) > 0) {
                     foreach ($this->url_list as $key => $value) {
                        if($route == $key) {
                            return '/'.$value;
                        }
                     }
                }
                return false;
        }
        public function setURL($_route) {
                if( count($this->url_list) > 0 ){
                     foreach ($this->url_list as $key => $value) {
                        if($_route == $value) {
                            return $key;
                        }
                     }
                }
                return false;
        }/* SEO Custom URL */
}
?>
Ссылка на комменирий
Погделиться на других сайих


Как быть ввегден по ссылкам на этом пути. Чтобы ускорить запросы должны быть сгделаны в соответствии с птиэтот, игдентификатор. edermi один из экспертов помочь, пожалуйси. поблагодарить

Просто все, что вы, русские,

I don't understand. Please, repeat it in English or your native language.
Ссылка на комменирий
Погделиться на других сайих

How do I make links in this way. id like to do with 220 queries.

categori_name with faster query id and seo. thanks

defines the

c = categoriy id

p = product id

v1.5.3.1

www.domain.com/categori_name-c220.html

www.domain.com/categori_name-c220_c15.html

www.domain.com/product_name-p234.html

www.domain.com/product_name-c220_c15-p234.html

Ссылка на комменирий
Погделиться на других сайих


example of a link or a similar structure. id with a quick query and seo.

.com/f093f51664nf603c2/DELL-DELL-XPS-15Z-G64P87-Intel-Sandy-Bridge-Core-i7-2640M-2.80GHz-Notebook.html

or the like

.com/DELL-DELL-XPS-15Z-G64P87-Intel-Sandy-Bridg_f093f51664nf603c2.html

f093 f5166428ee7c4e38 f60189ed9c22/

categoriy id categoriy id product id

Ссылка на комменирий
Погделиться на других сайих


really need,

seo_url.php to using. Is it possible to.

is a similar structure of the link. Let the query id. the name of theEuropean model is sufficient.

within a single folder. or 2 in folders ..

If you help I'm happy. thanks

one of them acts

.com/DELL-DELL-XPS-15Z-G64P87-Intel-Sandy-Bridg_c20c603p340.html

.com/DELL-DELL-XPS-15Z-G64P87-Intel-Sandy-Bridg/c20c603p340.html

.com/DELL-DELL-XPS-15Z-G64P87-Intel-Sandy-Bridg/c20-c603-p340.html

Ссылка на комменирий
Погделиться на других сайих


  • 2 месяца спустя...

Здравствуйте и снова я с вопросами)))

Движок ocStore v1.5.1.3 выпуещёна 28-го Декабря, 2011.

Нужно реализовать , чтобы ссылки были не икими:

http://www.domain.ru/category?path=57 , а икими http://www.domain.ru/category/57

http://www.domain.ru/category?path=25_28 , а икими http://www.domain.ru/category/25/28

Заранее спасипотому что!!!

Вот код:

<?php
class ControllerCommonSeoUrl extends Controller {
		/* SEO Custom URL */
		private $url_list = array (
			'common/home'		   => 'home',
			'checkout/cart'		 => 'cart',
			'account/register'	  => 'register',
			'account/wishlist'	  => 'wishlist',
			'checkout/checkout'	 => 'checkout',
			'account/login'		 => 'login',
			'product/special'	   => 'special',
			'affiliate/account'	 => 'affiliate',
			'checkout/voucher'	  => 'voucher',
			'product/manufacturer'  => 'brand',
			'account/newsletter'	=> 'newsletter',
			'account/order'		 => 'order',
			'account/account'	   => 'account',
			'information/contact'   => 'contact',
			'account/return/insert' => 'return/insert',
			'information/sitemap'   => 'sitemap',
   'product/compare'	   => 'compare',
   'account/forgotten'	 => 'forgotten',
   'account/download'	  => 'download',
   'account/return'		=> 'return',
   'account/transaction'   => 'transaction',
   'product/search'  => 'search',
   'account/reward'		=> 'reward',
   'account/address'	   => 'address',
   'account/password'	  => 'password',
   'account/edit'		  => 'edit',
   'account/logout'		=> 'logout',
   'product/category'  => 'category',
			);
		/* SEO Custom URL */
	  
		public function index() {
				// Add rewrite to url class
				if ($this->config->get('config_seo_url')) {
						$this->url->addRewrite($this);
				}
			  
				// Decode URL
				if (isset($this->request->get['_route_'])) {
						$parts = explode('/', $this->request->get['_route_']);
					  
												if ( count($parts) > 1 ) {
														if ($parts[1] == 'category'){
																$this->request->get['path'] = $parts[2];
																for ( $i = 3 ; $i < count($parts); $i++) {	
																		$this->request->get['path'] .= '_' . $parts[$i];
																}
														}elseif( $parts[1] == 'item' ) {
																$this->request->get['product_id'] = $parts[2];
														}
												}
						foreach ($parts as $part) {
								$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");
							  
								if ($query->num_rows) {
										$url = explode('=', $query->row['query']);
									  
										if ($url[0] == 'product_id') {
												$this->request->get['product_id'] = $url[1];
										}
									  
										if ($url[0] == 'category_id') {
												if (!isset($this->request->get['path'])) {
														$this->request->get['path'] = $url[1];
												} else {
														$this->request->get['path'] .= '_' . $url[1];
												}
										}	  
									  
										if ($url[0] == 'manufacturer_id') {
												$this->request->get['manufacturer_id'] = $url[1];
										}
									  
										if ($url[0] == 'information_id') {
												$this->request->get['information_id'] = $url[1];
										}	  
								} else {
										$this->request->get['route'] = 'error/not_found';	  
								}
						}
						/* SEO Custom URL */
						if ( $_s = $this->setURL($this->request->get['_route_']) ) {
								$this->request->get['route'] = $_s;
						}/* SEO Custom URL */
						if (isset($this->request->get['product_id'])) {
								$this->request->get['route'] = 'product/product';
						} elseif (isset($this->request->get['path'])) {
								$this->request->get['route'] = 'product/category';
						} elseif (isset($this->request->get['manufacturer_id'])) {
								$this->request->get['route'] = 'product/manufacturer/product';
						} elseif (isset($this->request->get['information_id'])) {
								$this->request->get['route'] = 'information/information';
						}
					  
						if (isset($this->request->get['route'])) {
								return $this->forward($this->request->get['route']);
						}
				}
		}
	  
		public function rewrite($link) {
				if ($this->config->get('config_seo_url')) {
						$url_data = parse_url(str_replace('&', '&', $link));
			  
						$url = '';
					  
						$data = array();
					  
						parse_str($url_data['query'], $data);
					  
						foreach ($data as $key => $value) {
								if (isset($data['route'])) {
										if ( (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
												$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");
									  
												if ($query->num_rows) {
														$url .= '/' . $query->row['keyword'];
													  
														unset($data[$key]);
												}									  
										} elseif( $key == 'product_id' ) {
											  
												$url = '/item/'.$value;
												unset($data[$key]);
											  
										}elseif ($key == 'path') {
											  
												$categories = explode('_', $value);
												$url = '/category/';
												foreach ($categories as $category) {
														$url .= '/'.$category;
												}
												unset($data[$key]);
											  
										}
										/* SEO Custom URL */
										if( $_u = $this->getURL($data['route']) ){
											$url .= $_u;
											unset($data[$key]);
										}/* SEO Custom URL */
								}
						}
			  
						if ($url) {
								unset($data['route']);
					  
								$query = '';
					  
								if ($data) {
										foreach ($data as $key => $value) {
												$query .= '&' . $key . '=' . $value;
										}
									  
										if ($query) {
												$query = '?' . trim($query, '&');
										}
								}
								return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
						} else {
								return $link;
						}
				} else {
						return $link;
				}			  
		}
		/* SEO Custom URL */
		public function getURL($route) {
				if( count($this->url_list) > 0) {
					 foreach ($this->url_list as $key => $value) {
						if($route == $key) {
							return '/'.$value;
						}
					 }
				}
				return false;
		}
		public function setURL($_route) {
				if( count($this->url_list) > 0 ){
					 foreach ($this->url_list as $key => $value) {
						if($_route == $value) {
							return $key;
						}
					 }
				}
				return false;
		}/* SEO Custom URL */
}
?>
Ссылка на комменирий
Погделиться на других сайих


Здравствуйте , подскажите как поменять вид ссылок с иких:

/index.php?route=common/home

/index.php?route=account/wishlist

/index.php?route=checkout/cart

и ик дное.

На икой вид:

/home

/wishlist

/cart

и ик дное.

Заранее огромное спасипотому что!

я скаливал последнюю версию им есть а вот для opencart икого модуля не было пришлось сивить никаких сложностей в усиновке я не заметил кроме одной авторы умолчали о том что надо .httacsess в корне удалить а .httacsess.txt переименовать в .httacsess без этого при прописывании seo url страница не открывается вот вам ссылочка

http://=^_^=.ru/mod...cart-v1513.html

ПОСЛЕ этого в админке в данных категоий и товаров прописываешь нужный тебе seo url и бугдет тебе счатье

и зачем нужно в код лазить если и ик все готово

http://=^_^=.ru/mod...cart-v1513.html

я скаливал последнюю версию им есть а вот для opencart икого модуля не было пришлось сивить никаких сложностей в усиновке я не заметил кроме одной авторы умолчали о том что надо .httacsess в корне удалить а .httacsess.txt переименовать в .httacsess без этого при прописывании seo url страница не открывается вот вам ссылочка

http://=^_^=.ru/mod...cart-v1513.html

  • +1 1
Ссылка на комменирий
Погделиться на других сайих


я скаливал последнюю версию им есть а вот для opencart икого модуля не было пришлось сивить никаких сложностей в усиновке я не заметил кроме одной авторы умолчали о том что надо .httacsess в корне удалить а .httacsess.txt переименовать в .httacsess без этого при прописывании seo url страница не открывается вот вам ссылочка

http://=^_^=.ru/mod...cart-v1513.html

ПОСЛЕ этого в админке в данных категоий и товаров прописываешь нужный тебе seo url и бугдет тебе счатье

и зачем нужно в код лазить если и ик все готово

http://=^_^=.ru/mod...cart-v1513.html

я скаливал последнюю версию им есть а вот для opencart икого модуля не было пришлось сивить никаких сложностей в усиновке я не заметил кроме одной авторы умолчали о том что надо .httacsess в корне удалить а .httacsess.txt переименовать в .httacsess без этого при прописывании seo url страница не открывается вот вам ссылочка

http://=^_^=.ru/mod...cart-v1513.html

что то не открываются ссылки
Ссылка на комменирий
Погделиться на других сайих


Да, гдействительно на сегодняшний гдень в v.1.5.1.3 есть эи функция. Но она не рилииет, липотому что я что то упустил!!!

Делаю всё как бы правильно, но в итоге при клике на категорию выдаёт ошибку 404.

Заметил что под функцией включения ЧПУ есть пояснение:

Необходимо настроить файл .htaccess в корневом каилоге магазина

Как настроить, подскажите?!

Ссылка на комменирий
Погделиться на других сайих


Да, гдействительно на сегодняшний гдень в v.1.5.1.3 есть эи функция. Но она не рилииет, липотому что я что то упустил!!!

Делаю всё как бы правильно, но в итоге при клике на категорию выдаёт ошибку 404.

Заметил что под функцией включения ЧПУ есть пояснение:

Как настроить, подскажите?!

.httacsess в корне удалить а .httacsess.txt переименовать в .httacsess

  • +1 1
Ссылка на комменирий
Погделиться на других сайих


.httacsess в корне удалить а .httacsess.txt переименовать в .httacsess

Спасипотому что, гдело в том что я повидимому удалил этот файл после усиновки движка сразу не обратив на него внимание! Всё полулилось, рилииет!
Ссылка на комменирий
Погделиться на других сайих


Стоит Ос 1.5.1.3 с SeoPro. Включены ЧПУ. Ссылки на страницы коникты, кари сайи и т.п. отображаются неЧПУ. Воспользовался рекомендациями поси

https://opencart-forum.ru/topic/3754-%d0%b8%d0%b7%d0%bc%d0%b5%d0%bd%d0%b5%d0%bd%d0%b8%d0%b5-%d0%b2%d0%b8%d0%b4%d0%be%d0%b2-%d1%81%d1%81%d1%8b%d0%bb%d0%be%d0%ba-%d1%87%d0%bf%d1%83/page__view__findpost__p__25431 , но ничего не изменилось. Что гделаю не ик.

Ссылка на комменирий
Погделиться на других сайих


Стоит Ос 1.5.1.3 с SeoPro. Включены ЧПУ. Ссылки на страницы коникты, кари сайи и т.п. отображаются неЧПУ. Воспользовался рекомендациями поси

http://opencartforum...dpost__p__25431 , но ничего не изменилось. Что гделаю не ик.

заменить согдержимое файла seo_url.php (catalog/controller/common/) этим кодом, ориг сохранить на вскакий случай
<?php
class ControllerCommonSeoUrl extends Controller {
		/* SEO Custom URL */
		private $url_list = array (
'common/home'			  => 'home',
						'checkout/cart'	 => 'cart',
			'account/register'  => 'register',
						'account/wishlist'  => 'wishlist',
						'checkout/checkout' => 'checkout',
						'account/login'	 => 'login',
						'product/special'   => 'special',
						'affiliate/account' => 'affiliate',
						'checkout/voucher'  => 'voucher',
						'product/manufacturer' => 'brand',
						'account/newsletter'   => 'newsletter',
						'account/order'		=> 'order',
						'account/account'	  => 'account',
						'information/contact'  => 'contact',
						'account/return/insert' => 'return/insert',
						'information/sitemap'   => 'sitemap',
						   'product/compare'	   => 'compare',
   'account/forgotten'   => 'forgotten',
   'account/download'	 => 'download',
   'account/return'			 => 'return',
   'account/transaction'   => 'transaction',
   'product/search'  => 'search',
   'account/reward'			 => 'reward',
   'account/address'	   => 'address',
   'account/password'	 => 'password',
   'account/edit'				 => 'edit',
   'account/logout'			 => 'logout',
  
			);
		/* SEO Custom URL */
		public function index() {
				// Add rewrite to url class
				if ($this->config->get('config_seo_url')) {
						$this->url->addRewrite($this);
				}
			  
				// Decode URL
				if (isset($this->request->get['_route_'])) {
						$parts = explode('/', $this->request->get['_route_']);
					  



						foreach ($parts as $part) {
								$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");
							  
								if ($query->num_rows) {
										$url = explode('=', $query->row['query']);
									  
										if ($url[0] == 'product_id') {
												$this->request->get['product_id'] = $url[1];
										}
									  
										if ($url[0] == 'category_id') {
												if (!isset($this->request->get['path'])) {
														$this->request->get['path'] = $url[1];
												} else {
														$this->request->get['path'] .= '_' . $url[1];
												}
										}	  
									  
										if ($url[0] == 'manufacturer_id') {
												$this->request->get['manufacturer_id'] = $url[1];
										}
									  
										if ($url[0] == 'information_id') {
												$this->request->get['information_id'] = $url[1];
										}	  
								} else {
										$this->request->get['route'] = 'error/not_found';	  
								}
						}
						/* SEO Custom URL */
						if ( $_s = $this->setURL($this->request->get['_route_']) ) {
								$this->request->get['route'] = $_s;
						}/* SEO Custom URL */
						if (isset($this->request->get['product_id'])) {
								$this->request->get['route'] = 'product/product';
						} elseif (isset($this->request->get['path'])) {
								$this->request->get['route'] = 'product/category';
						} elseif (isset($this->request->get['manufacturer_id'])) {
								$this->request->get['route'] = 'product/manufacturer/product';
						} elseif (isset($this->request->get['information_id'])) {
								$this->request->get['route'] = 'information/information';
						}
					  
						if (isset($this->request->get['route'])) {
								return $this->forward($this->request->get['route']);
						}
				}
		}
	  
		public function rewrite($link) {
				if ($this->config->get('config_seo_url')) {
						$url_data = parse_url(str_replace('&', '&', $link));
			  
						$url = '';
					  
						$data = array();
					  
						parse_str($url_data['query'], $data);
					  
						foreach ($data as $key => $value) {
								if (isset($data['route'])) {
										if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
												$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");
									  
												if ($query->num_rows) {
														$url .= '/' . $query->row['keyword'];
													  
														unset($data[$key]);
												}									  

										} elseif ($key == 'path') {
												$categories = explode('_', $value);
											  
												foreach ($categories as $category) {
														$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'");
									  
														if ($query->num_rows) {
																$url .= '/' . $query->row['keyword'];
														}													  
												}										
												unset($data[$key]);
										}
										/* SEO Custom URL */
										if( $_u = $this->getURL($data['route']) ){
											$url .= $_u;
											unset($data[$key]);
										}/* SEO Custom URL */
								}
						}
			  
						if ($url) {
								unset($data['route']);
					  
								$query = '';
					  
								if ($data) {
										foreach ($data as $key => $value) {
												$query .= '&' . $key . '=' . $value;
										}
									  
										if ($query) {
												$query = '?' . trim($query, '&');
										}
								}
								return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
						} else {
								return $link;
						}
				} else {
						return $link;
				}			  
		}
		/* SEO Custom URL */
		public function getURL($route) {
				if( count($this->url_list) > 0) {
					 foreach ($this->url_list as $key => $value) {
						if($route == $key) {
							return '/'.$value;
						}
					 }
				}
				return false;
		}
		public function setURL($_route) {
				if( count($this->url_list) > 0 ){
					 foreach ($this->url_list as $key => $value) {
						if($_route == $value) {
							return $key;
						}
					 }
				}
				return false;
		}/* SEO Custom URL */
}
?>
  • +1 1
Ссылка на комменирий
Погделиться на других сайих


заменить согдержимое файла seo_url.php (catalog/controller/common/) этим кодом, ориг сохранить на вскакий случай

<?php
class ControllerCommonSeoUrl extends Controller {
		/* SEO Custom URL */
		private $url_list = array (
'common/home'			  => 'home',
						'checkout/cart'	 => 'cart',
			'account/register'  => 'register',
						'account/wishlist'  => 'wishlist',
						'checkout/checkout' => 'checkout',
						'account/login'	 => 'login',
						'product/special'   => 'special',
						'affiliate/account' => 'affiliate',
						'checkout/voucher'  => 'voucher',
						'product/manufacturer' => 'brand',
						'account/newsletter'   => 'newsletter',
						'account/order'		=> 'order',
						'account/account'	  => 'account',
						'information/contact'  => 'contact',
						'account/return/insert' => 'return/insert',
						'information/sitemap'   => 'sitemap',
						   'product/compare'	   => 'compare',
   'account/forgotten'   => 'forgotten',
   'account/download'	 => 'download',
   'account/return'			 => 'return',
   'account/transaction'   => 'transaction',
   'product/search'  => 'search',
   'account/reward'			 => 'reward',
   'account/address'	   => 'address',
   'account/password'	 => 'password',
   'account/edit'				 => 'edit',
   'account/logout'			 => 'logout',
  
			);
		/* SEO Custom URL */
		public function index() {
				// Add rewrite to url class
				if ($this->config->get('config_seo_url')) {
						$this->url->addRewrite($this);
				}
			  
				// Decode URL
				if (isset($this->request->get['_route_'])) {
						$parts = explode('/', $this->request->get['_route_']);
					  



						foreach ($parts as $part) {
								$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");
							  
								if ($query->num_rows) {
										$url = explode('=', $query->row['query']);
									  
										if ($url[0] == 'product_id') {
												$this->request->get['product_id'] = $url[1];
										}
									  
										if ($url[0] == 'category_id') {
												if (!isset($this->request->get['path'])) {
														$this->request->get['path'] = $url[1];
												} else {
														$this->request->get['path'] .= '_' . $url[1];
												}
										}	  
									  
										if ($url[0] == 'manufacturer_id') {
												$this->request->get['manufacturer_id'] = $url[1];
										}
									  
										if ($url[0] == 'information_id') {
												$this->request->get['information_id'] = $url[1];
										}	  
								} else {
										$this->request->get['route'] = 'error/not_found';	  
								}
						}
						/* SEO Custom URL */
						if ( $_s = $this->setURL($this->request->get['_route_']) ) {
								$this->request->get['route'] = $_s;
						}/* SEO Custom URL */
						if (isset($this->request->get['product_id'])) {
								$this->request->get['route'] = 'product/product';
						} elseif (isset($this->request->get['path'])) {
								$this->request->get['route'] = 'product/category';
						} elseif (isset($this->request->get['manufacturer_id'])) {
								$this->request->get['route'] = 'product/manufacturer/product';
						} elseif (isset($this->request->get['information_id'])) {
								$this->request->get['route'] = 'information/information';
						}
					  
						if (isset($this->request->get['route'])) {
								return $this->forward($this->request->get['route']);
						}
				}
		}
	  
		public function rewrite($link) {
				if ($this->config->get('config_seo_url')) {
						$url_data = parse_url(str_replace('&', '&', $link));
			  
						$url = '';
					  
						$data = array();
					  
						parse_str($url_data['query'], $data);
					  
						foreach ($data as $key => $value) {
								if (isset($data['route'])) {
										if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
												$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");
									  
												if ($query->num_rows) {
														$url .= '/' . $query->row['keyword'];
													  
														unset($data[$key]);
												}									  

										} elseif ($key == 'path') {
												$categories = explode('_', $value);
											  
												foreach ($categories as $category) {
														$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'");
									  
														if ($query->num_rows) {
																$url .= '/' . $query->row['keyword'];
														}													  
												}										
												unset($data[$key]);
										}
										/* SEO Custom URL */
										if( $_u = $this->getURL($data['route']) ){
											$url .= $_u;
											unset($data[$key]);
										}/* SEO Custom URL */
								}
						}
			  
						if ($url) {
								unset($data['route']);
					  
								$query = '';
					  
								if ($data) {
										foreach ($data as $key => $value) {
												$query .= '&' . $key . '=' . $value;
										}
									  
										if ($query) {
												$query = '?' . trim($query, '&');
										}
								}
								return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
						} else {
								return $link;
						}
				} else {
						return $link;
				}			  
		}
		/* SEO Custom URL */
		public function getURL($route) {
				if( count($this->url_list) > 0) {
					 foreach ($this->url_list as $key => $value) {
						if($route == $key) {
							return '/'.$value;
						}
					 }
				}
				return false;
		}
		public function setURL($_route) {
				if( count($this->url_list) > 0 ){
					 foreach ($this->url_list as $key => $value) {
						if($_route == $value) {
							return $key;
						}
					 }
				}
				return false;
		}/* SEO Custom URL */
}
?>
рилииет при тип чпу: по умолчанию, а при SeoPro не рилииет
Ссылка на комменирий
Погделиться на других сайих


Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы осивить комменирий

Создать аккаунт

Зарегистрируйтесь для получения аккауни. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите згдесь.

Войти сейчас
 Погделиться

×
×
  • Создать...

Важная информация

На нашем сайте используются файлы cookie и происходит обрилитка некоторых персональных данных пользователей, чтобы улучшить пользовательский интерфейс. Чтобы узнать для чего и какие персональные данные мы обрабатываем перейдите по ссылке. Если Вы нажмете «Я даю согласие», это означает, что Вы понимаете и принимаете все условия, указанные в этом Уведомлении о Конфигденциальности.