23
Oct/06
16

Zen Cart New Product Type Using Ultimate SEO URL Package

This post is to help those who are using Zen Cart and are using new product types with Ultimate SEO URL package installed. There are a couple of things to change in order to make everything work together as it took me a couple of hours to figure out. I hope this will help others save these couple of hours of hair pulling.

Prerequisite:

Zen Cart installed
New product type added
Ultimate SEO URL package installed
Goal:

Have the URLs for the products using the new product type show URLs in this format.

http://www.domain.com/[product name]-p-[product id].html

Changes Required:

NOTE: [handler_name] is the new product type name added.

  1. File – seo.url.php
    Original:
    $seo_pages = array(
    FILENAME_DEFAULT,
    FILENAME_PRODUCT_INFO,
    FILENAME_POPUP_IMAGE,
    FILENAME_PRODUCT_REVIEWS,
    FILENAME_PRODUCT_REVIEWS_INFO,
    );Result:

    $seo_pages = array(
    FILENAME_DEFAULT,
    FILENAME_PRODUCT_INFO,
    FILENAME_POPUP_IMAGE,
    FILENAME_PRODUCT_REVIEWS,
    FILENAME_PRODUCT_REVIEWS_INFO,
    FILENAME_[handler name]_INFO
    );
  2. File – seo.url.php
    Original:
    $this->reg_anchors = array(
    ‘products_id’ => ‘-p-’,
    ‘cPath’ => ‘-c-’,
    ‘manufacturers_id’ => ‘-m-’,
    ‘pID’ => ‘-pi-’,
    ‘products_id_review’ => ‘-pr-’,
    ‘products_id_review_info’ => ‘-pri-’,Result:
    $this->reg_anchors = array(
    ‘products_id’ => ‘-p-’,
    ‘cPath’ => ‘-c-’,
    ‘manufacturers_id’ => ‘-m-’,
    ‘pID’ => ‘-pi-’,
    ‘products_id_review’ => ‘-pr-’,
    ‘products_id_review_info’ => ‘-pri-’,
    ‘[handler name]_id’ => ‘-pji-’,

  3. File – seo.url.php -> function parse_parameters
    Find “case ‘products_id’:”
    Within this case statement, add the following.case ($page == FILENAME_[handler name]_INFO):
    $url = $this->make_url($page, $this->get_product_name($p2[1]), ‘[
    handler_name]_id’, $p2[1], ‘.html’, $separator);
    break;
  4. File – [webroot]/includes/filenames.php
    Add the following definition.define(’FILENAME_[handler name]_INFO’, ‘[handler name]_info’);
  5. File – [webroot]/.htaccess
    Add the following rewrite rule.RewriteRule ^(.*)-pji-(.*).html$ index\.php?main_page=[
    handler_name]_info&products_id=$2&%{QUERY_STRING} [L]
Comments (16) Trackbacks (0)
  1. Scott
    1:11 pm on December 28th, 2006

    Very nice, this is just what I needed. Thanks for the post!

  2. frank
    7:23 pm on January 15th, 2007

    np. I’m glad it helped someone.

  3. CJJUNE
    8:43 pm on October 2nd, 2007

    is there a problem using PayPal with this mod?

  4. frank
    12:17 am on October 4th, 2007

    No, I am using PayPal with ZenCart using this mod. I don’t remember having to do anything special to make it work.

  5. CJJune
    5:38 am on October 4th, 2007

    Which version of Ultimate Seo URL did you run on?

  6. frank
    11:00 am on October 4th, 2007

    I am using Zencart v 1.3.5 and Ultimate Seo URL v 2.103.

  7. Matt
    12:01 pm on October 24th, 2007

    I’m getting a error in the browser when I try to enable Ultimate SEO
    Parse error: parse error
    Any ideas? Should I have a value instead of ‘handler name’ ?

  8. frank
    12:35 pm on October 24th, 2007

    Yes, where ever you see [handler_name], you need to replace it with your new product type name.

  9. Personalised Gifts
    11:29 am on April 3rd, 2008
  10. frank
    11:59 am on June 16th, 2008

    Sure. You just have to add a category called “personalized chocolate” then add “chocolate bars” as a product under that.

  11. Ken
    7:44 am on November 4th, 2008

    I have tried to get it working with document type, but fail.
    Should the handler name be document_general?
    using zencart 1.3.8 with latest ultimate seo

  12. Ken
    8:10 am on November 4th, 2008

    I’ve solved the problem now
    Thanks for the trick, work perfectly!

  13. Jack
    10:44 am on November 24th, 2008

    Thank you! It works on my site..

  14. Raine
    5:15 pm on February 2nd, 2009

    To have directory structure urls, as well as the ability to support multi languages and product types, you can check http://simple-seo-url.com/ which is free as well.

  15. Personalised Gifts
    5:01 am on September 3rd, 2009

    thanks for this, very helpful, worked out our site now, cheers!

  16. Carl
    2:17 am on September 4th, 2009

    thanks for this, been doing my head in, finally got it sorted, cheers

Leave a comment

No trackbacks yet.