[Contribution] Ultimate SEO URLs - by Chemo
#41
Posted 19 January 2005, 09:10
Server info
Apache on FreeBSD 4.8-STABLE
Ultimate SEO URLs 1.1 installed
Exact problem1
USING CNAME OPTION: I've noticed that when listing the contents in a category (i.e. what would normally be a index.php?cPath=xxx URL), that AFTER I click the "buy now" button in a product listing (I've configured mine to NOT immediately take you to the shopping cart in that circumstance), all of the "buy now" buttons get rewritten to be the identical URL. This has the unfortunate effect of adding exactly the same item to the cart each and every subsequent "buy now" click, no matter which product they are wishing to add to the cart.
I see this problem with the 1.4 cName/pName code, as well as the current Ultimate SEO URLs code.
Exact problem2
USING REWRITE OPTION: The "buy now" button, in the same location as explained above, does not seem to work at all. The URL listed is http://mydomain.com/making-memories-blue-c...buy_now&sort=2a . When I click on it, the URL displayed in my browser is http://mydomain.com/product_info.php?sort=2a
Debugging
- Turned off osC stock caching for manufacturers box, categories box, also purchased boxes
- Turned off Page Cache
- verified that SEF URLs are off (just to be sure, though I haven't enabled them for many moons)
- tried the .htaccess both ways, since I am doing this in a testing area (but osC is docrooted to that area)
- LiveHTTPHeaders extension for Firefox shows me that when FF does a GET for http://mydomain.com/making-memories-blue-c...buy_now&sort=2a gets a 302 redirect to http://mydomain.com/product_info.php?sort=2a . I also saw cookies for my admin area and my phpbb area. Closed, re-opened browser, killed cache and cookies. No effect, other than getting an osCsid cookie set (since I'd just cleared all of those) when attempting to add the item to the cart.
- noticed that you are not having these problems on your test server, so began to wonder if this has something to do with the fact that I'm not redirecting to shopping_cart.php when an item is added to the cart.
-- turned that back on (Admin > Configuration > Display Cart After Adding Product > True (was set to False) = ITEMS ADD TO THE CART NOW! (but I don't want it to work this way . . .) This appears to resolve Problem1 and Problem2.
So, I now have a workaround. I know that my wife (it's her store) will not want it configured this way, though . . . I'm not sure how to fix it at 2am. Maybe tomorrow night, if Bobby hasn't beaten me to it (You're notoriously fast). <grin>
Bobby, I have a new staging area so it'd be super easy to create you an account if you'd like.
-jared
#42
Posted 19 January 2005, 10:30
Chemo, on Jan 18 2005, 03:02 PM, said:
Try turnng on the rewrite option and then clear all your cache files...it gets even better!
Bobby
Hi Bobby
Ok, i know its early so i'm using that excuse lol. When you say clear the cache files, i assume you mean to delete the file seo_english.cacheseo_english.cache which is in the new cache dir i made during the install?
I have tried to change to rewrite, but when i do i get 404 errors on every cat and prod. I deleted the seo_english.cacheseo_english.cache file straight after changing the setting.
Any ideas what may be wrong?
Paul
Paul
#43
Posted 19 January 2005, 11:48
Working fine now.
A couple of things spring to mind for future enhancements...
1.
For the static type htm pages, I still like the idea of including the immediate category as well as product title as part of the URL.
e.g.
We have generic products that will work with many devices. However, we list them under the category for each device.
So, we have categories Dell, HP, Toshiba all containing the same product.
This potentially makes a big difference in user searches.
2.
How about option for somehow not loosing the old cached links in some way.
a. Perhaps have a time stamp and offer delete old endtries over x days option.
Or
b. simply offer option whether or not to delete entry on update. Though that could leave alot of left over code.
With a. You could potentially change URL type and still leave the old URLs in there.
Just some ideas...
Thanks again for the excellent contribution.
Zuber
#44
Posted 19 January 2005, 13:56
Just wondering if this contrib is likely to work with the sts template system. I have already read that your Page Cache is not recommended to be installed with sts.
Cheers,
Rich
#45
Posted 19 January 2005, 15:44
jcall, on Jan 19 2005, 04:10 AM, said:
USING CNAME OPTION: I've noticed that when listing the contents in a category (i.e. what would normally be a index.php?cPath=xxx URL), that AFTER I click the "buy now" button in a product listing (I've configured mine to NOT immediately take you to the shopping cart in that circumstance), all of the "buy now" buttons get rewritten to be the identical URL. This has the unfortunate effect of adding exactly the same item to the cart each and every subsequent "buy now" click, no matter which product they are wishing to add to the cart.
Exact problem2
USING REWRITE OPTION: The "buy now" button, in the same location as explained above, does not seem to work at all. The URL listed is http://mydomain.com/making-memories-blue-c...buy_now&sort=2a . When I click on it, the URL displayed in my browser is http://mydomain.com/product_info.php?sort=2a
In application_top.php find this code:
if (DISPLAY_CART == 'true') {
$goto = FILENAME_SHOPPING_CART;
$parameters = array('action', 'cPath', 'products_id', 'pid');
} else {
$goto = basename($PHP_SELF);
if ($HTTP_GET_VARS['action'] == 'buy_now') {
$parameters = array('action', 'pid', 'products_id');
} else {
$parameters = array('action', 'pid');
}
}
and replace it with this: if (DISPLAY_CART == 'true') {
$goto = FILENAME_SHOPPING_CART;
$parameters = array('action', 'cPath', 'products_id', 'pid', 'cName', 'pName');
} else {
$goto = basename($PHP_SELF);
if ($HTTP_GET_VARS['action'] == 'buy_now') {
$parameters = array('action', 'pid', 'products_id', 'pName');
} else {
$parameters = array('action', 'pid');
}
}
Notice that all we did was add cName and pName to the list of excluded parameters.Next, find this code:
case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
} else {
$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
and replace it with this: case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
} else {
$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
}
}
if ( (defined('SEO_URLS') && SEO_URLS == 'true') && (defined('SEO_URLS_TYPE') && SEO_URLS_TYPE == 'Rewrite') ){
$cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);
$cPath_array = tep_parse_category_path($cPath);
$cPath = implode('_', $cPath_array);
tep_redirect(tep_href_link($goto, 'cPath=' . $cPath . '&' . tep_get_all_get_params($parameters)));
} else {
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
}
break;
The issue is that since we only pass the products_id with the Rewrite it must get the cPath to redirect to.Next, to correct the issue of persistent products_id (pName) in the buy now column edit includes/modules/product_listing.php. Find this code:
case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
break;
and replace it with this: case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'pName')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
break;
Notice all we did was add pName to the excluded parameters.With these changes the buy now should function with both cName and Rewrite.
pauldarthvader, on Jan 19 2005, 05:30 AM, said:
Ok, i know its early so i'm using that excuse lol. When you say clear the cache files, i assume you mean to delete the file seo_english.cacheseo_english.cache which is in the new cache dir i made during the install?
I have tried to change to rewrite, but when i do i get 404 errors on every cat and prod. I deleted the seo_english.cacheseo_english.cache file straight after changing the setting.
Any ideas what may be wrong?
Paul
If you use my Page Cache contribution then also go to Admin Control Panel -> Page Cache Settings -> Delete Cache Files -> TRUE
The issue is if the areas (boxes or pages) are cached then the old links will be stored and the results not immediately displayed.
richandzhaoyan, on Jan 19 2005, 08:56 AM, said:
Just wondering if this contrib is likely to work with the sts template system. I have already read that your Page Cache is not recommended to be installed with sts.
Cheers,
Rich
Bobby
#46
Posted 19 January 2005, 15:48
pauldarthvader, on Jan 19 2005, 05:30 AM, said:
I have tried to change to rewrite, but when i do i get 404 errors on every cat and prod. I deleted the seo_english.cacheseo_english.cache file straight after changing the setting.
Any ideas what may be wrong?
Paul
My first guess would be that you did not perform the .htaccess file edit and hence do not have anything rewriting the URLs. If you forgot to do that step it will give 404 errors as you describe.
Go back and verify that you did indeed make the changes...the code should look like this:
RewriteEngine On
RewriteBase /
# or, RewriteBase /catalog/ depending on if it is root or folder install
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
Bobby
#47
Posted 19 January 2005, 16:15
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home//public_html//includes/functions/html_output.php:427) in /home//public_html//includes/functions/sessions.php on line 67
Can you help me please, thanks.
#48
Posted 19 January 2005, 16:59
yoclaudio, on Jan 19 2005, 09:15 AM, said:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home//public_html//includes/functions/html_output.php:427) in /home//public_html//includes/functions/sessions.php on line 67
Can you help me please, thanks.
Make sure you don't have any spaces after the "?>" last line in the file.
Paul
#49
Posted 19 January 2005, 17:08
Fourbit, on Jan 19 2005, 05:59 PM, said:
Thatīs the problem. Thank you very much Paul.
#50
Posted 19 January 2005, 17:11
Chemo, on Jan 19 2005, 12:29 AM, said:
Bobby
Yea, I agree. That would be a nice feature. But, I was thinking that a 'reset' for that file coded in to the EP file itself would be nice too. But, that involves modifying a contrib and that just getts to wild to change later. Would there be any other way to make this automagic?
Paul
#51
Posted 19 January 2005, 17:15
yoclaudio, on Jan 19 2005, 10:08 AM, said:
No problem yoclaudio, glad I could be of some simple assistance.
I do that error a lot.
Now, any time I get a "headers already sent" error, I almost have it changed before the site page completes loading.
Paul
PS. what are you using for an editor? Just curious.
#52
Posted 19 January 2005, 17:22
Fourbit, on Jan 19 2005, 06:15 PM, said:
I do that error a lot.
Now, any time I get a "headers already sent" error, I almost have it changed before the site page completes loading.
Paul
PS. what are you using for an editor? Just curious.
I use dreamweaver or notepad, itīs ok?
Thanks again
#53
Posted 19 January 2005, 17:37
yoclaudio, on Jan 19 2005, 10:22 AM, said:
I use dreamweaver or notepad, itīs ok?
Thanks again
Probably your .htaccess file.
Make sure you make the change that is commented on in the .htaccess change.
As Bobby said.
Go back and verify that you did indeed make the changes...the code should look like this:
RewriteEngine On
RewriteBase /
# or, RewriteBase /catalog/ depending on if it is root or folder install
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
And post a link too. If you are still having probs.
Paul
Edited by Fourbit, 19 January 2005, 17:39.
#54
Posted 19 January 2005, 17:42
RW
Fourbit, on Jan 19 2005, 05:15 PM, said:
I do that error a lot.
Now, any time I get a "headers already sent" error, I almost have it changed before the site page completes loading.
Paul
PS. what are you using for an editor? Just curious.
A man who works with his hands and his brain is a craftsman
But a man who works with his hands and his brain and his heart is an artist. - Charles Dickens
#55
Posted 19 January 2005, 18:09
yoclaudio, on Jan 19 2005, 06:22 PM, said:
As long as the program you're using saves the correct charset and don't add extra code that messes things up, it shouldn't matter what program you use.
You should be able to set the charset in any good editor.
Be sure to save documents in the same charset as the one you specify in the meta tags.
You may also want to check to see if your server's sending documents in a default charset, and save your documents accordingly or change the default charset for the server.
In osCommerce, the meta tag charset is set in includes/languages/<yourLanguage>.php.
Eivind
#56
Posted 19 January 2005, 22:59
I have only one thing left.
I turned of SEO urls in the admin module, but I still keep getting the osc sessions in my adress bar, is there a sollution how to fix this?
#57
Posted 20 January 2005, 02:13
I am using EasyPopulate for the site. And when you upload using this nothing will change in the SEO cache file. So, for a quick answer, I just deleted the file in the cache directory. And it magically regenerated with the new product added. (thanks to Bobby's coding). But, I realized that we needed something a bit more automatic. So, I modd'ed the easypopulate.php file.
I added one line at the bottom of the file
require('includes/reset_seo_cache.php');
Now the bottom of the file lookes like this.
// end of row insertion code
}
require('includes/reset_seo_cache.php');
require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Seems to work.
Paul
#58
Posted 20 January 2005, 04:13
Very nice! That will do it...can you post that over in the Easy Populate thread as well? I'm sure they'll appreciate it since it's a one line fix for immediate compatiblity.
Good job!
Bobby
#59
Posted 20 January 2005, 04:13
Quote
Perfect! It looks great!
Now I'm off to try and make my Wishlist work with this. If I get that working, next stop will be to re-incorporate meta tags.
Thanks, Bobby!
-jared
#60
Posted 20 January 2005, 04:18
Don't know much about the wishlist but the meta tags should work without modifications. This contribution is a transparent wrapper.
If you echo $_SERVER[PHP_SELF] it'll be either index.php or product_info.php. If you echo $_GET['products_id'] or $_GET['cPath'] it'll come up with the right values. Thus, it is a transparent wrapper and should not affect the metas.
If you run into issues let me know but I've installed it on 4 or 5 sites with Linda McGrath's Header Tag Controller without a hitch.
Bobby














