Entries Tagged as ''

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]

Beware duplicate mail()’s in PHP/Firefox

Strangely, invoking the PHP SMTP mail() function after outputting any HTML within a PHP page will cause Firefox to intepret the PHP command twice, thereby sending out 2 duplicate emails. This was happening using PHP5, FF1.5, and Windows IIS6. The issue is fixed by simply placing the mail() command as the first part of any script, before any headers or output are called. I cannot ascertain yet why this is occurring. Any ideas, anyone?