Post by crazydog2401 » Sun Jul 12, 2009 5:03 am

make full site with url friendly html
Test with only site language latin...
Replace file admin/model/tool/seo_url.php with this code
then add a product or update a product, the site autoupdate all link on your site
Good luck!
demo: http://f2laptop.com.vn

Code: Select all

<?php
function sanitize_title($title) {
// Preserve escaped octets.
  $title=preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|','---$1---',$title);
// Remove percent signs that are not part of an octet.
  $title=str_replace('%','',$title);
// Restore octets.
  $title=preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|','%$1',$title);
  $title=strtolower($title);
  $title=preg_replace('/&.+?;/','',$title);
// kill entities
  $title=preg_replace('/[^%a-z0-9 _-]/','',$title);
  $title=preg_replace('/\s+/','-',$title);
  $title=preg_replace('|-+|','-',$title);
  $title=trim($title,'-');
  return $title;
}

class ModelToolSeoUrl extends Model {
  public function generate() {
    $this->db->query("TRUNCATE TABLE `".DB_PREFIX."url_alias`");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=common/home',         `alias` = ''");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=product/special',     `alias` = 'special.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=account/account',     `alias` = 'account.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=account/create',      `alias` = 'create.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=product/latest',      `alias` = 'latest.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=account/login',       `alias` = 'login.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=account/logout',      `alias` = 'logout.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=checkout/cart',       `alias` = 'cart.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=checkout/shipping',   `alias` = 'shipping'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=information/contact', `alias` = 'contact.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=information/sitemap', `alias` = 'sitemap.html'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET `query` = 'route=product/search',      `alias` = 'search.html'");

// Product
    $product_query=$this->db->query("SELECT * FROM ".DB_PREFIX."product_description");
    foreach($product_query->rows as $product) {
      if($product['name']) {
        $seoalias=sanitize_title($product['name']."-".$product['product_id']).".html";
        $this->db->query("INSERT INTO ".DB_PREFIX."url_alias SET `query` = 'route=product/product&product_id=".(int) $product['product_id']."', `alias` = '$seoalias'");
      }
    }
// Category /
    $this->categories(0);
// Manufacturer
    $manufacturer_query=$this->db->query("SELECT * FROM ".DB_PREFIX."manufacturer");
    foreach($manufacturer_query->rows as $manufacturer) {
      if($manufacturer['keyword']) {
        $this->db->query("INSERT INTO ".DB_PREFIX."url_alias SET `query` = 'route=product/manufacturer&manufacturer_id=".(int) $manufacturer['manufacturer_id']."', `alias` = '".$this->db->escape($manufacturer['keyword']).".html'");
      }
      $product_query=$this->db->query("SELECT * FROM ".DB_PREFIX."product WHERE manufacturer_id = '".(int) $manufacturer['manufacturer_id']."'");
      foreach($product_query->rows as $product) {
        if(($manufacturer['keyword'])&&($product['keyword'])) {
          $this->db->query("INSERT INTO ".DB_PREFIX."url_alias SET `query` = 'route=product/product&manufacturer_id=".(int) $manufacturer['manufacturer_id']."&product_id=".(int) $product['product_id']."', `alias` = '".$this->db->escape($manufacturer['keyword'].'/'.$product['keyword']).".html'");
        }
      }
    }
// Information
    $information_query=$this->db->query("SELECT * FROM ".DB_PREFIX."information");
    foreach($information_query->rows as $information) {
      if($information['keyword']) {
        $this->db->query("INSERT INTO ".DB_PREFIX."url_alias SET `query` = 'route=information/information&information_id=".(int) $information['information_id']."', `alias` = '".$this->db->escape($information['keyword']).".html'");
      }
    }
  }
  private function categories($path) {
    $keyword='';
    $parts=explode('_',$path);
    foreach($parts as $category_id) {
      $category_query=$this->db->query("SELECT * FROM ".DB_PREFIX."category_description WHERE category_id = '".(int) $category_id."'");
      if($category_query->num_rows) {
        $keyword.=$category_query->row['name'].'/';
      }
    }
    $category_id=array_pop($parts);
    $category_query=$this->db->query("SELECT * FROM ".DB_PREFIX."category_description a LEFT JOIN ".DB_PREFIX."category b ON (a.category_id = b.category_id) WHERE parent_id = '".(int) $category_id."'");
    foreach($category_query->rows as $category) {
      if(!$path) {
        $new_path=$category['category_id'];
      }
      else{
        $new_path=$path.'_'.$category['category_id'];
      }
      if($category['name']) {
        $seoalias=sanitize_title($keyword."-".$category['name']).".html";
        $this->db->query("INSERT INTO ".DB_PREFIX."url_alias SET `query` = 'route=product/category&path=".$this->db->escape($new_path)."', `alias` = '$seoalias'");
      }
      $product_query=$this->db->query("SELECT * FROM ".DB_PREFIX."product_description p LEFT JOIN ".DB_PREFIX."product_to_category p2c ON (p.product_id = p2c.product_id) WHERE p2c.category_id = '".(int) $category['category_id']."'");
      foreach($product_query->rows as $product) {
        if(($category['name'])&&($product['name'])) {
          $seoalias=sanitize_title($keyword."-".$category['name']."-".$product['name']."-".$product['product_id']).".html";
          $this->db->query("INSERT INTO ".DB_PREFIX."url_alias SET `query` = 'route=product/product&path=".$this->db->escape($new_path)."&product_id=".(int) $product['product_id']."', `alias` = '$seoalias'");
        }
      }
      $this->categories($new_path);
    }
  }
}
?>

website: www.webcongty.net
IT Manager / Linux / MAC / Windows
Web Developments with PHP & MySQL
Webmaster / Search Engine Optimization


User avatar
Newbie

Posts

Joined
Sun Jul 12, 2009 4:58 am

Post by pee » Mon Jul 13, 2009 2:18 pm

Hi,

ok - your code is better than the original.

But it helps not really, when the shop is in a subfolder. Like:

Code: Select all

http://www.foo.bar/the-shop
I've tried with line 40:

Code: Select all

$seoalias='the-shop/'.$seoalias;
But it wasn't working. Then the article-link from the start-page is leading me to the start-page. I'm not understanding the regex so far. The good thing is maybe, that the links from all shop-products are updated with your file. And why have you done .html at the end of the url? This is not useful, I guess.

Daniels (the OC-developer) Seo-file is only making seo urls, when the product is updated. But then the link is not working probably, too - when the shop is in a subfolder.

I'll play around with the Seo-Urls. Maybe I'll work it out. O0

Best regards from germany,
pee

Professionelles Onlineshop-Design & -Programmierung: http://netzor.de


User avatar
pee
New member

Posts

Joined
Fri May 08, 2009 4:48 pm
Location - Germany

Post by nterry » Thu Jul 23, 2009 1:49 pm

Any idea in what to change to get this to work in 1.3.0? Thanks.

Newbie

Posts

Joined
Sat Jul 04, 2009 9:33 am

Post by crazydog2401 » Thu Jul 23, 2009 6:29 pm

Yes, thank you.
New code is very better..., don't scan all link on site. :) :)

website: www.webcongty.net
IT Manager / Linux / MAC / Windows
Web Developments with PHP & MySQL
Webmaster / Search Engine Optimization


User avatar
Newbie

Posts

Joined
Sun Jul 12, 2009 4:58 am

Post by crazydog2401 » Fri Jul 24, 2009 12:51 pm

crazydog2401 wrote:Yes, thank you.
New code is very better..., don't scan all link on site. :) :)
HACK SEO URL Rewrite 1.3.0 -=> http://forum.opencart.com/viewtopic.php?f=24&t=5146

website: www.webcongty.net
IT Manager / Linux / MAC / Windows
Web Developments with PHP & MySQL
Webmaster / Search Engine Optimization


User avatar
Newbie

Posts

Joined
Sun Jul 12, 2009 4:58 am

Post by nmtechlv » Tue Jul 28, 2009 12:22 pm

Hello. I'm new to opencart but I'm very excited to dig in and make it work for me. However, that being said, I am not a tech guru so I need a more simplified walk thru on how to get the SEO friendly URL's to work in version 1.3.0. Can anyone give me a step-by-step? Sorry to be so simplistic. Any help is appreciated!

Thank you!

Newbie

Posts

Joined
Tue Jul 28, 2009 11:33 am

Post by crazydog2401 » Wed Jul 29, 2009 10:36 am

nmtechlv wrote:Hello. I'm new to opencart but I'm very excited to dig in and make it work for me. However, that being said, I am not a tech guru so I need a more simplified walk thru on how to get the SEO friendly URL's to work in version 1.3.0. Can anyone give me a step-by-step? Sorry to be so simplistic. Any help is appreciated!

Thank you!
HACK SEO URL Rewrite 1.3.0 -=> viewtopic.php?f=24&t=5146, Have 3 step, fix 3 file, good luck, Post a reference, you can develop more

website: www.webcongty.net
IT Manager / Linux / MAC / Windows
Web Developments with PHP & MySQL
Webmaster / Search Engine Optimization


User avatar
Newbie

Posts

Joined
Sun Jul 12, 2009 4:58 am

Post by nmtechlv » Wed Jul 29, 2009 11:04 am

crazydog2401 wrote:
nmtechlv wrote:Hello. I'm new to opencart but I'm very excited to dig in and make it work for me. However, that being said, I am not a tech guru so I need a more simplified walk thru on how to get the SEO friendly URL's to work in version 1.3.0. Can anyone give me a step-by-step? Sorry to be so simplistic. Any help is appreciated!

Thank you!
HACK SEO URL Rewrite 1.3.0 -=> viewtopic.php?f=24&t=5146, Have 3 step, fix 3 file, good luck, Post a reference, you can develop more
I've tried it. Doesn't work.

Newbie

Posts

Joined
Tue Jul 28, 2009 11:33 am

Post by crazydog2401 » Sat Oct 31, 2009 5:37 am


website: www.webcongty.net
IT Manager / Linux / MAC / Windows
Web Developments with PHP & MySQL
Webmaster / Search Engine Optimization


User avatar
Newbie

Posts

Joined
Sun Jul 12, 2009 4:58 am

Post by wachowski » Sat Dec 12, 2009 7:11 pm

How to know if a SEO company is reputable? What's the easiest way to know and understand what a ethical SEO company is?

keyword research ~ keyword tool ~ keyword tracking ~ affiliate elite


Newbie

Posts

Joined
Wed Dec 09, 2009 6:58 pm

Post by Qphoria » Sat Dec 12, 2009 9:19 pm

what is an "SEO Company"
SEO is a design factor you apply ... not a company you pay.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by montanaflynn » Sun Dec 13, 2009 11:41 am

OpenCart already has pretty good SEO built in, as long as you turn it on. The only problem's I know of is that http://domain.com/index.php?route=common/home should do a 301 rewrite to http://domain.com.

Also categorized product URI's should have a <link rel="canonical" href="http://www.domain.com/product-slug" /> tag in the header. This will avoid any duplicate content issues and make your main product page rank higher.

SEO is a never ending process of manipulating search engines to rank you higher than your competitors. The design of your site including URI's, header tags, meta tags, and page content / keyword density all are important, but the most important thing is getting one way links to your site. Check out my site Complimedia Online to find out more.

Things to think about when hiring a SEO:

1) How long will it take? No SEO can realistically guarantee fast results, it simply takes time for Search Engines to crawl and index any changes they may have made.

2) What will they do? Sure I could add a few header tags to your site and make it more optimised, but that will not have a huge impact. A good SEO will analyze your progress and have analytical proof that you are getting more visits and conversions based on their services.

3) It is in the fine print, many SEO's will say they can get you on the first page of google for your keywords, but what keywords are they? Some companies even use shady business practices like adding quotes to your keyword in order to make the results much lower.

User avatar
New member

Posts

Joined
Fri Oct 09, 2009 5:19 am

Post by jacksmith » Sat Jan 02, 2010 6:26 pm

The code is really helpful and works nicely.I was trying to do such tweaking but somehow I can't do it properly.But finally I get the right one.

sd cards


Newbie

Posts

Joined
Sat Jan 02, 2010 2:17 pm

Post by runerggsilent » Fri Feb 12, 2010 11:12 am

happy

SEO : รับทำ SEO : web design


Newbie

Posts

Joined
Fri Feb 12, 2010 11:09 am

Post by adelaida » Fri Feb 19, 2010 8:34 pm

i dont know how about you guys, but i couldn’t manage to install (integrate) it properly. still trying

opencart shopping saved lots of time for me!
thank you! just another situk mind (c)
simply clear uk granny dating website


Newbie

Posts

Joined
Fri Feb 19, 2010 8:17 pm

Post by nerijus9 » Wed Jun 29, 2011 12:21 am

it worked for me just fine, thanks a lot!

seo optimizavimas


Newbie

Posts

Joined
Wed Jun 29, 2011 12:18 am

Post by emile14 » Tue Jul 12, 2011 1:13 pm

I truly like to reading your post. Thank you so much for taking the time to share such a nice information. I'll definitely add this great post in my article section.

seo in canada


Newbie

Posts

Joined
Tue Jul 12, 2011 1:09 pm

Post by Adamhenry » Mon Sep 05, 2011 3:40 pm

I am fairly new to websites so online marketing is a bit of a minefield. What are the recommend per page/per word rates for freelance seo writers in the uk?

seo uk

Newbie

Posts

Joined
Mon Sep 05, 2011 3:39 pm

Post by TheSirgke » Sat Feb 11, 2012 4:23 am

Best SEO practice is based on the idea that SEO process is like running a race. The keyword of your choice decides on the kind of race and the strength of competitors that you’ll be up against. Best SEO approach is a strategy that determines which races you should run and which ones to avoid. A good SEO expert therefore should give you at least money back guarantee if the set SEO targets are not achieved.
___________________________________________
SEO Guarantee
Last edited by TheSirgke on Wed Feb 15, 2012 10:42 pm, edited 1 time in total.

Newbie

Posts

Joined
Sat Feb 11, 2012 4:13 am

Post by ce_opencrt » Wed Feb 15, 2012 3:29 am

has anyone worked with this hack for v 1.5?

or is there another way to generate SEO friendly URLs for category and product pages once i have done a database import?

Newbie

Posts

Joined
Sat Jan 28, 2012 1:25 am
Who is online

Users browsing this forum: No registered users and 4 guests