Nginx下zen cart 1.5.1伪静态规则,LNMP一键包测试成功

将其放在 /usr/local/nginx/conf/ 文件夹下 命名为zencart.conf
然后在 /usr/local/nginx/conf/vhost/www.yourname.com.conf 中将include none.conf; 换成include zencart.conf;即可

Zen Cart V1.5.1,Ultimate SEO 2.212,lnmp最新安装包下测试OK.

# if the requested file exists, return it immediately

if (-f $request_filename) {

break;

}

#For Ultimate SEO URLs

rewrite ^/(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)(.*)$ /index.php?main_page=product_info&products_id=$2&$args last;

rewrite ^/(.*)-c-([0-9]+)_([0-9]+)/$ /index.php?main_page=index&cPath=$2_$3&$args last;

rewrite ^/(.*)-c-([0-9]+)/$ /index.php?main_page=index&cPath=$2&$args last;

rewrite ^/(.*)-m-([0-9]+).html$ /index.php?main_page=index&manufacturers_id=$2&$args last;

rewrite ^/(.*)-pi-([0-9]+).html$ /index.php?main_page=popup_image&pID=$2&$args last;

rewrite ^/(.*)-pr-([0-9]+).html$ /index.php?main_page=product_reviews&products_id=$2&$args last;

rewrite ^/(.*)-pri-([0-9]+).html$ /index.php?main_page=product_reviews_info&products_id=$2&$args last;

 

# For eazy pages

rewrite ^/(.*)-ezp-([0-9]+).html$ /index.php?main_page=page&id=$2&$args last;

 

# For Open Operations Info Manager

rewrite ^/(.*)-i-([0-9]+).html$ /index.php?main_page=info_manager&pages_id=$2&$args last;

 

# For dreamscape’s News & Articles Manager

rewrite “^news/?” /index.php?main_page=news&% last;

rewrite “^news/rss.xml” /index.php?main_page=news_rss&% last;

rewrite “^news/archive/?” /index.php?main_page=news_archive&% last;

rewrite “^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html” /index.php?main_page=news&date=$1-$2-$3&% last;

rewrite “^news/archive/([0-9]{4})-([0-9]{2}).html” /index.php?main_page=news_archive&date=$1-$2&% last;

rewrite “^news/(.*)-a-([0-9]+)-comments.html” /index.php?main_page=news_comments&article_id=$2&% last;

rewrite “^news/(.*)-a-([0-9]+).html” /index.php?main_page=news_article&article_id=$2&% last;

 

# All other pages

# Don’t rewrite real files or directories

rewrite “^(.*).html” /index.php?main_page=$1&% last;

第三步重启nginx,登陆SSH使用如下命令:/root/lnmp restart

 

Zen Cart调用当前商品所在分类及对应的分类链接

Zen Cart调用当前商品所在分类及对应的分类链接,
下面三种写法 任意均可

// 当前分类链接/分类名

<!–?php echo ‘<a href=”‘.zen_href_link(FILENAME_DEFAULT, ‘cPath=’.zen_get_products_category_id((int)$_GET[‘products_id’])).'”–>’
.zen_get_categories_name_from_product((int)$_GET[‘products_id’]).”;?&gt;

// 当前商品名/分类链接

&nbsp;

// 当前分类名/分类链接

&nbsp;

记录更新:
//当前商品链接/商品名(商品URL包含商品所在分类ID)

<!–?php echo'<a href=”‘.<br ?–> zen_href_link(zen_get_info_page((int)$_GET[‘products_id’]),’cPath=’.(int)$_GET[‘cPath’].’&amp;products_id=’ . (int)$_GET[‘products_id’]).”&gt;’.$products_name.”; ?&gt;

//当前商品链接/商品名(商品URL不包含商品所在分类ID)

<!–?php echo'<a href=”‘.<br ?–> zen_href_link(zen_get_info_page($flash_page_items[$i][‘products_id’]), ‘products_id=’ . $_GET[‘products_id’]).”&gt;’.$products_name.”; ?&gt;

原帖地址:http://zcbk.org/article/multi-order-id/