Post by Melanie » Tue Aug 02, 2011 8:10 pm

Melanie wrote:Hi,

Okay I have done this mod on version 1.5.1

However slight problem, the image on the contact us page is not coming up (the on that needs to be entered to submit the form).

I think it is to do with "index.php?route=information/contact/captcha"

Can anyone help?
Do I have to make another modication somewhere?

Thanks,
Mel
Further more, when I go to http://WWW.MYSITE.COM/index.php?route=i ... ct/captcha
I get an error: The image “http://WWW.MYSITE.COM/index.php?route=i ... ct/captcha” cannot be displayed, because it contains errors.

However when I try it on another site I have in 1.51 it works fine.

Can anybody help :(


Thanks,
Mel

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by uksitebuilder » Tue Aug 02, 2011 8:41 pm

Hi melanie,

All I can suggest is you compare the associated files for the contact form and captcha files to see what differences (if any) there are.

The files concerned are:

catalog/controller/information/contact.php
catalog/view/theme/default/template/information/contact.tpl
system/library/captcha.php

Just out of interest, when you view a product page, click on the reviews tab and there should be a captcha there also. Does that one display ?

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Melanie » Tue Aug 02, 2011 8:51 pm

uksitebuilder wrote:Just out of interest, when you view a product page, click on the reviews tab and there should be a captcha there also. Does that one display ?
Hi,

Thanks for your reply.

Yes also in the product page the captcha does NOT show...

Any ideas :(


Thanks, Mel

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by JAY6390 » Tue Aug 02, 2011 9:00 pm

Do you have a link to the site in question? (PM if you want it kept private)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Melanie » Tue Aug 02, 2011 9:06 pm

Thanks Jay
Last edited by Melanie on Tue Aug 02, 2011 9:15 pm, edited 1 time in total.

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by JAY6390 » Tue Aug 02, 2011 9:09 pm

ok, the fix is pretty easy. you just need to go into the template for that, and find the index.php.... line and add a / before it

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by JAY6390 » Tue Aug 02, 2011 9:11 pm

Actually, your page has an error for generating the captcha image, which is why its not working (even if you add the above). Chances are php is throwing an error

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by macmuchacha » Wed Aug 03, 2011 3:31 am

amdev wrote:Hi, u need to modify seo_url.php controller.
I'm tried and work fine for my site.
http://www.luxurywatchesbrands.co.cc/home

and see another link like account , checkout , login ...

oc 15x easier than 14x because it just edit 1 file.
In 14x need to edit 2 file and need to load tool/seo_url before to rewite.
But in 15x no need.

there r 2 things to do.
1. edit catalog/controller/common/seo_url.php this is my code(Backup your file before edit)

Code: Select all

<?php
class ControllerCommonSeoUrl extends Controller {
	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_']);

			$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(count($url) > 1){
					
					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{
						$route = $url[0];
					}
				} else {
					$this->request->get['route'] = 'error/not_found';	
				}
			}
			
			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';
			}else {
				$this->request->get['route'] = $route;
			}

			
			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 (($key == 'product_id') || ($key == 'manufacturer_id') || ($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]);
				}elseif ($key == 'route') {
					$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($value) . "'");
				
					if ($query->num_rows) {
						$url .= '/' . $query->row['keyword'];
						
						unset($data[$key]);
					}					
				}
			}
		
			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;
		}		
	}	
}
?>

2.goto url_alias table (PHPmyadmin) and inset

query field = common/home(add another route ie. checkout/cart,checkout/checkout,information/sitemap,...)
keyword = home(or u need).

See my attach file.


Sorry for my bad english.

Good luck sir. :) :) :)


On step "2" you say to go to url_alias table (phpmyadmin), my question is where is this located and can you please explain this step a little better? because I am new to all this and i'm not sure what i am looking at.

Newbie

Posts

Joined
Wed Aug 03, 2011 3:18 am

Post by amdev » Wed Aug 03, 2011 8:52 am

On step "2" you say to go to url_alias table (phpmyadmin), my question is where is this located and can you please explain this step a little better? because I am new to all this and i'm not sure what i am looking at.
usr_alias table store in your database that you install an opencart(Dependent on your systems).
If u don't know where is it locate , contact your hosting.

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by Evilboy » Tue Sep 13, 2011 2:15 pm

Can someone please explain how to implement this in 1.5.1?

Newbie

Posts

Joined
Tue Sep 13, 2011 2:10 pm

Post by Eva30 » Tue Sep 13, 2011 4:25 pm

hellogoodbye wrote:Thanks for the quick fix, uksitebuilder. Though it would be better if the categories didn't do that. Are there benefits to having the subcategories without the parent categories work?

I made a vqmod for it.
perfect, thank you! ;)

User avatar
New member

Posts

Joined
Fri Sep 09, 2011 4:17 pm

Post by keijers » Wed Sep 14, 2011 9:30 pm

How to implement it in 1.4.9 ? Which 2 files i need to edit?

New member

Posts

Joined
Wed Sep 14, 2011 9:29 pm

Post by dony_b » Tue Sep 20, 2011 4:32 am

the seo_url.php does not work with 1.5.1.1 or 1.5.1.2

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by dony_b » Wed Sep 21, 2011 2:07 am

I actually figured this out with the the help of @uksitebuilder

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by Evilboy » Wed Sep 21, 2011 2:10 pm

dony_b wrote:I actually figured this out with the the help of @uksitebuilder
Can you please post it here as well so that it can help the rest of us?

Newbie

Posts

Joined
Tue Sep 13, 2011 2:10 pm

Post by dony_b » Wed Sep 21, 2011 9:27 pm

In your seo_url.php find the following :

Code: Select all

if ($url) {
and replace it with :

Code: Select all

if ($url || (isset($data['route']) && $data['route'] == 'common/home') ) {

Attachments

ssp_temp_capture.jpg

ssp_temp_capture.jpg (12.48 KiB) Viewed 7197 times


User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by Evilboy » Thu Sep 22, 2011 1:15 am

Thanks a lot mate!

Newbie

Posts

Joined
Tue Sep 13, 2011 2:10 pm

Post by piyushshekhar » Tue Oct 11, 2011 2:43 am

amdev wrote:Hi, u need to modify seo_url.php controller.
I'm tried and work fine for my site.
http://www.luxurywatchesbrands.co.cc/home

and see another link like account , checkout , login ...

oc 15x easier than 14x because it just edit 1 file.
In 14x need to edit 2 file and need to load tool/seo_url before to rewite.
But in 15x no need.

there r 2 things to do.
1. edit catalog/controller/common/seo_url.php this is my code(Backup your file before edit)

Code: Select all

<?php
class ControllerCommonSeoUrl extends Controller {
	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_']);

			$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(count($url) > 1){
					
					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{
						$route = $url[0];
					}
				} else {
					$this->request->get['route'] = 'error/not_found';	
				}
			}
			
			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';
			}else {
				$this->request->get['route'] = $route;
			}

			
			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 (($key == 'product_id') || ($key == 'manufacturer_id') || ($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]);
				}elseif ($key == 'route') {
					$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($value) . "'");
				
					if ($query->num_rows) {
						$url .= '/' . $query->row['keyword'];
						
						unset($data[$key]);
					}					
				}
			}
		
			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;
		}		
	}	
}
?>

2.goto url_alias table (PHPmyadmin) and inset

query field = common/home(add another route ie. checkout/cart,checkout/checkout,information/sitemap,...)
keyword = home(or u need).

See my attach file.


Sorry for my bad english.

Good luck sir. :) :) :)

That worked like a charm!

Newbie

Posts

Joined
Mon Oct 10, 2011 9:37 pm

Post by Evilboy » Mon Oct 17, 2011 11:40 pm

I'm having the same problem like the one Melanie mentioned above. The captchas are not working and the error logs throw up the following errors

Code: Select all

2011-10-17 15:34:36 - PHP Warning:  Cannot modify header information - headers already sent by (output started at /catalog/controller/common/seo_url.php:1) in /system/library/captcha.php on line 40
I'm using Opencart 1.5.1

Newbie

Posts

Joined
Tue Sep 13, 2011 2:10 pm

Post by amdev » Sun Oct 23, 2011 5:29 pm

Hi all, there r
many peaple PM to me some problem about captcha code when they use my mod.

This is a new code (I'm tested with latest SVN r680 and work fine!!!).

Code: Select all

<?php
class ControllerCommonSeoUrl extends Controller {
	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_']);
			
				    $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(count($url) > 1){
					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{
                      $route = $url[0];
                   }					
				} else {
					$this->request->get['route'] = 'error/not_found';	
				}
			}
			
			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';
			}else {
                $this->request->get['route'] = $route;
             }
			
			if (isset($this->request->get['route']) && $this->request->get['route'] != 'captcha' ) {//Add && $this->request->get['route'] != 'captcha' for don't rewrite when using captcha function.
				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]);
					}elseif ($key == 'route') {
                   $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($value) . "'");
                
                   if ($query->num_rows) {
                      $url .= '/' . $query->row['keyword'];
                      
                      unset($data[$key]);
                   }               
                }
				}
			}
		
			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;
		}		
	}	
}
?>
GoodLuck Guys!!!

update tested with 15131 with my site http://www.punbbthailand.com/ work fine!!!

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand
Who is online

Users browsing this forum: No registered users and 39 guests