Re: HTACCESS Update / Patch
Can you post the contents of your .htaccess, a screen shot of your current settings for "SEO URLs", a list of plugin / modules installed, and a link to your site please? Also do you see this behavior when using the template / theme Zen Cart comes with?
I am especially interested in the following lines from your .htaccess.
Code:
RewriteBase /shop/
# Normal operation Ultimate SEO URLs
RewriteRule ^(.*)-c-([^/])/(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$4&cpath=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
Those two lines are vital as they ensure "action=add_product" is sent to Zen Cart. The order the rules are listed in the .htaccess file are also important.
Re: HTACCESS Update / Patch
The previous fix was for the regular "buy" button on product pages. I will take a look at the "buy now" button in product listings as soon as I can.
Buy Now / Add Selected Products To Cart - Patch
Affected Environments
Stores using the "Buy Now" links or "Add selected products to cart" feature on product listing pages.
Credits
Thanks to adamells for finding this bug.
The fix
Starting at line 418 in "includes/classes/seo.url.php" change:
Code:
// case ($page == FILENAME_PRODUCT_INFO && !$this->is_attribute_string($params)):
to:
Code:
case ($page == FILENAME_DEFAULT):
$container[$p2[0]] = $p2[1];
break;
Notes
I tested this change against both clean and modified Zen Cart 1.5.0 and 1.5.1 installations.
Re: Buy Now / Add Selected Products To Cart - Patch
I installed Ultimate SEO Url's tonight and first off got a 500 error on my website and also on the admin. Changed Rewrite Engine to Off and now my homepage and admin work but any other page on my website gets a 404 error. I tried changing all the setting on the plugin in the admin but my site only works if I change the Enable SEO Urls to off. Not sure what I did wrong or what code I didn't add to .htaccess. I didn't previously have a .htaccess for my site because it is pretty new and I wanted to get the plugin's installed before I add all the security functions. This is my website maybe you could spot something http://www.luckylaketackle.com. Any help would be greatly appreciated. Thank you so much for your help.
Re: Buy Now / Add Selected Products To Cart - Patch
Now I got those to work by adding
Options +FollowSymLinks
RewriteEngine on
RewriteRule index-main_page-(.*)-cPath-(.*)\.html$ index.php?main_page=$1&cPath=$2
I just went to a URL Rewriting website and put a path to one of my products in it and it wrote this out for me. Not sure why this works? This .htaccess file is really confusing to me.
Ok now I took out that code and just replace the top of the .htaccess file to
Options +FollowSymLinks
RewriteEngine on
It seems like the RewriteEngine On caused a problem with a capital O. Not sure why this made a huge difference.
Re: Buy Now / Add Selected Products To Cart - Patch
Quote:
Originally Posted by
timbojrjr1
It seems like the RewriteEngine On caused a problem with a capital O. Not sure why this made a huge difference.
Thank You for letting us know both the issue you ran into and what the fix was for your server environment.
Some servers are more picky then others (depends on the web server, what version, who compiled, if a htaccess scanner was used, etc). I have not seen any problems using "On" on multiple test sites running apache2 (with and without a .htaccess scanner) and IIS (with a filter to use .htaccess files)... But for compatibility I'll probably switch to just "on" as lowercase when I release an example .htaccess in the future just to be safe (Apache2 documentation uses lowercase).
Updated Example .htaccess
Example .htaccess
I have been working on a new example .htaccess file. It is working correctly in my test environments: Linux, PHP 5.2 and 5.3, Zen Cart 1.5.0 and 1.5.1.
The changes in this file are still in testing. If you have a working site with this plugin already, make sure you backup the existing .htaccess before trying the changes shown here.
Keep in mind after you change the .htaccess you may need to clear your browser cache to see everything in action. When changing some settings (such as "categories as directories") in the admin configuration you will need to edit the .htaccess and may wish to also reset the SEO Cache to see the changes immediately.
Added Support
Some performance enhancements, more exact matching, and better handling of 301s after changing settings in both the admin configuration and the .htaccess file.
Removed Support
This version of "Ultimate SEO URLs" does not support Zen Cart 1.3.x. The 1.3.x versions of "Ultimate SEO URLs" included in the .htaccess file examples for "Open Operations Info Manager" or "Dreamscape's News & Articles Manager". These have been removed from the .htaccess file because the plugins are not readily availability for Zen Cart 1.5.x.
File Contents
Code:
##### NOTE: Replace /shop/ with the relative web path of your catalog in the "Rewrite Base" line below:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /shop/
# Disable if using "Categories as Directories"
#RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)\.html$ $3-p-$4\.html?cPath=$2&%{QUERY_STRING} [R=301,L]
# Enable only if using "Categories as Directories"
RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)\.html$ index\.php?main_page=product_info&products_id=$4&cpath=$2&%{QUERY_STRING} [L]
# Normal operation Ultimate SEO URLs
RewriteRule ^(.*)-p-([0-9]+)\.html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
# Disable if using "Categories as Directories"
#RewriteRule ^(.*)-c-([0-9_]+)\.html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
#RewriteRule ^(.*)-c-([0-9_]+)/$ $1-c-$2\.html [R=301,L]
# Enable only if using "Categories as Directories"
RewriteRule ^(.*)-c-([0-9_]+)/?\.html$ $1-c-$2/ [R=301,L]
RewriteRule ^(.*)-c-([0-9_]+)$ %{REQUEST_URI}/ [R=301,L]
RewriteRule ^(.*)-c-([0-9_]+)/$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
# Normal operation Ultimate SEO URLs
RewriteRule ^(.*)-m-([0-9]+)\.html$ index\.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+)\.html$ index\.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pr-([0-9]+)\.html$ index\.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+)\.html$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-ezp-([0-9]+)\.html$ index\.php?main_page=page&id=$2&%{QUERY_STRING} [L]
# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index\.php?main_page=$1&%{QUERY_STRING} [L]
# Handle when a resource is not found (404 Error Page)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index\.php?main_page=page_not_found&%{QUERY_STRING} [L]
Re: Updated Example .htaccess
New example .htaccess seems to be working for me:
prommart com
Thanks!
Re: Updated Example .htaccess
Back Button glitch fix mentioned in post # 57 also working for me. Thanks again!