Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ultimate SEO URLs - by Chemo


Guest

Recommended Posts

Hi, guys

 

Installed this contrib... works like a Swiss watch. Now, eeee, I have one stupid q: How many files should be in the cache directory?  :blush:  I have only one file - seo_english.cache. Is that OK?

 

Thanks

Just one file...that's all it needs. Of course, if you have other languages installed there will be other files similiarly name (seo_spanish.php, etc)

Bobby,  Thank you for the Ultimate SEO contribution :-D it is truly awesome!

 

I have two questions for you about duplicate URLs:

1. Froogle Data Feed

Does your Data Feed contribution submit stock osC URLs for product pages, similar to the basic Froogle Exporter?

If so, it there a way to submit Ultimate SEO URLs? 

 

2. Site Map MS2-2.2 (abstracted from 2.2-MS3 CVS snapshot)

This excellent Site map displays sub-category URLs as standard osC format, Example: Pens Site Map 

I tried including sitemap.php in your .htaccess, but it did not change anything. Does a reference to Ultimate SEO need to be included in the classes file used for building the category tree " included/classes/category_tree.php"?

 

Again, many thanks for your contributions.

With kind regards,

EricK

1. I do not recommend my Froogle feeder. I started it as a base class for extending other feeds but the interest in it by the members never materalized. Hence, it has not been developed into a mature, production ready contribution. It is a great concept and nice base class but not the level needed for production stores.

 

2. I don't know...I'll download the contribution and take a look. As long as the URL's are being constructed with tep_href_link() they should be SEO'd.

...

And only on the admin side.  Any idea why this might happen?

Those symptoms do not sound like they are cause by this contribution. The only change on the admin side is including the file to delete the cache. It does not affect functinality or other code on the admin side.

 

I would guess that you botched the admin code installation or have another contribution that is causing this.

 

Bobby

Link to comment
Share on other sites

  • Replies 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

Can the SEO url be truncated?

...

ta

john

Yes they can! Very good suggestion and I'll put that into the next release!

 

First, add this function to includes/html_output.php:

function short_name($str, $limit=3){
$foo = explode('-', $str);
foreach($foo as $index => $value){
 switch (true){
	 case ( strlen($value) <= $limit ):
   continue;
	 default:
   $container[] = $value;
   break;
 }  
} # end foreach
$container = implode('-', $container);
return $container;
}

You should change the default value of the $limit parameter to meet your needs. As set it will filter all words that are 3 letters and less leaving only words with 4 letters or more.

 

Next, make these changes in tep_href_link() located in html_output.php:

 

$rewrite_page_product = constant('PRODUCT_NAME_'.$p2[1]) . '-p-' . $p2[1] . '.html';

becomes:

$rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-p-' . $p2[1] . '.html';

 

$rewrite_page_category = constant('CATEGORY_NAME_'.$p2[1]) . '-c-' . $p2[1] . '.html';

becomes:

$rewrite_page_category = short_name(constant('CATEGORY_NAME_'.$p2[1])) . '-c-' . $p2[1] . '.html';

 

$rewrite_page_manufacturer = constant('MANUFACTURER_NAME_'.$p2[1]) . '-m-' . $p2[1] . '.html';

becomes:

$rewrite_page_manufacturer =  short_name(constant('MANUFACTURER_NAME_'.$p2[1])) .  '-m-'  . $p2[1] . '.html';

 

Notice: all we did was add a function called "short_name" to html_output.php and then called that function for each product, category, or manufacturer name in REWRITE only. Do not perform those steps for the cName option!

 

I'll update the install file directly.

 

Bobby

Link to comment
Share on other sites

I'm not having a lot of success today with search engine-friendly contribs... I completely backed out of SEF earlier today, after having lots of trouble. Then I found yours, and the documentation is excellent. However, I'm still having a problem.

 

The error I'm getting is

 

Warning: implode(): Bad arguments. in /www/s/susanrm1/htdocs/catalog/includes/functions/html_output.php on line 33

 

I've used the replacement code you're supposed to use if cache is off, which it is. I've tried deleting and replacing the code several times, but no luck. I've gone through every step several times, no luck, and I didn't see anything about it on the forum. Otherwise, the URLs are turning out correct.

 

Interestingly, by experimenting, I found the error went away with cname-type URLs. This suggests there *may* be an issue with my .htaccess file. Here are the lines I added - I can quote the whole file if requested:

 

RewriteEngine On

# Change "folder" to your catalog directory name

RewriteBase /catalog/

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}

 

The cname URLs will work for me for now, though ideally I'd like to use the other format. Have I found a bug? ;)

 

My site is http://www.aspiring-arts.com/catalog/ if you want to check it out.

Link to comment
Share on other sites

On further investigation, I'm seeing that the error turns up in the code you just added today, to shorten the product URLs. Line 33 in my html_output file is

 

$container = implode('-', $container);

 

I also notice that the code changes are slightly different from the ones you posted here on the forum. Could this error be related to those?

 

Thanks again,

Susan

Link to comment
Share on other sites

The only time that I can recreate the error is if I set the filter list limit so it cuts every word out of the URL. For example, if I set the limit to 15 characters it will filter all the words out and thereby not have anything to implode.

 

Even if there is just 1 word in the array after the filter it will implode successfully...so it leads me to believe that you have the limit set too high. Try setting the value at 0 which effectively disables it.

 

Bobby

Link to comment
Share on other sites

The only time that I can recreate the error is if I set the filter list limit so it cuts every word out of the URL.  For example, if I set the limit to 15 characters it will filter all the words out and thereby not have anything to implode.

 

Even if there is just 1 word in the array after the filter it will implode successfully...so it leads me to believe that you have the limit set too high.  Try setting the value at 0 which effectively disables it.

 

Bobby

 

Well, I left it at the default of 3, but I'll try 0 and see what happens.

 

I did set it at 0, and that did seem to stop the trouble, but the explanation doesn't make sense, as the characters were set at 3.

 

One other question, less urgent: I don't really need or like the abbreviated category numbers appearing at the ends of the URLs. Is there an easy way to get rid of them?

 

Thanks so much for all of your help!

 

Susan

Link to comment
Share on other sites

The abbreviated numbers at the end of the URL are needed by the code to properly pass the parameter off in the .htaccess file. In this manner I could keep from performing a database lookup and maintain as much performance as possible.

 

It can be removed but will sacrifice speed for aesthetics. IMO, it is better to keep resources to a minimum and performance high.

 

Bobby

Link to comment
Share on other sites

Is this contribution in any way going to cause my site to be penalised for duplicate content and what is going to happen to the page rank of each individual page eventually? Are you recommending this contribution for a site that is already established (3 years +)?

Link to comment
Share on other sites

Is this contribution in any way going to cause my site to be penalised for duplicate content and what is going to happen to the page rank of each individual page eventually? Are you recommending this contribution for a site that is already established (3 years +)?

 

Bobby,

 

Is one method cName/pNname vs rewrite safer for not running in to problems with duplicates with SE like google?

 

I have been thinking about this alot since we talked last, as some of my sites are indexed w/ SE already.

 

Chris

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Link to comment
Share on other sites

i got a problem, when i access the allmanufacturers page i get this message:

 

Warning: implode(): Bad arguments. in /home/oscarg/public_html/includes/functions/html_output.php on line 33

 

i think it has something to do with my allmanufacturers add on as i pretty much search all the pages and didnt get the error again. a link to the site problem is My Webpage.

 

i looked around the add on code but i cant really debug it or anything, i read the whole 7 pages and didnt see anything alike... :S

 

once again great contrib thanks chemo!

 

<!-- all manufacturers begin //-->
<?php
   $row = 0;
   $manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name" );
   while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
     $row++;
  echo '<td align="center" valign="top" width="25%" class="smallText">';
   echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name'], 'NONSSL', false) . '">'. $manufacturers['manufacturers_name'] . ' <br> ' . tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name']) . "</a><br><br>\n";
  echo '</td>';

     if ((($row / 3) == floor($row / 3))) {
?>
         </tr>
         <tr>
         <?php
     }
   }
?>
	 <!-- all manufacturers end //-->

 

if necessary i much rather uninstall all manufacturers... thx again.

O.

Cheers,

O.

Link to comment
Share on other sites

can i use Page Cache v1.5- MS2 together with Ultimate SEO URLs

Yes...directions are included.

Is this contribution in any way going to cause my site to be penalised for duplicate content and what is going to happen to the page rank of each individual page eventually? Are you recommending this contribution for a site that is already established (3 years +)?

There may be issues but will take several months to a full year to be penalized. The next release or so will have 301 redirects from the old URLs to the new URLs. Given all the feedback from various information sources it will take at least 6 months to be tagged for dup content so I wanted to get the contribution out and tested for functionality...then add all the finer stuff.

Bobby,

 

Is one method cName/pNname vs rewrite safer for not running in to problems with duplicates with SE like google?

 

I have been thinking about this alot since we talked last, as some of my sites are indexed w/ SE already.

 

Chris

No...they may both be viewed as duplicate content if given enough time.

i got a problem, when i access the allmanufacturers page i get this message:

 

Warning: implode(): Bad arguments. in /home/oscarg/public_html/includes/functions/html_output.php on line 33

 

i think it has something to do with my allmanufacturers add on as i pretty much search all the pages and didnt get the error again. a link to the site problem is My Webpage.

 

i looked around the add on code but i cant really debug it or anything, i read the whole 7 pages and didnt see anything alike... :S

 

once again great contrib thanks chemo!

 

if necessary i much rather uninstall all manufacturers... thx again.

O.

The error I get when I access your site is this:

Warning: main(includes/languages/english/allmanufacturers.php): failed to open stream: No such file or directory in /home/oscarg/public_html/allmanufacturers.php on line 26

Warning: main(includes/languages/english/allmanufacturers.php): failed to open stream: No such file or directory in /home/oscarg/public_html/allmanufacturers.php on line 26

Fatal error: main(): Failed opening required 'includes/languages/english/allmanufacturers.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/oscarg/public_html/allmanufacturers.php on line 26

...which tells me it can't find the script.

 

However, the original problem is that the manufacturers name is less than the number set in the admin control panel for "Filter Short Words". Set the number lower and it'll be OK.

 

I'll add some error checking to the code to get around the implode issue if all the words were stripped.

 

Bobby

Link to comment
Share on other sites

For everyone having problems with the new filter short words / implode code here is the patch:

 

Find the short_name() function in includes/html_output.php and replace it with this:

function short_name($str, $limit=3){
if (defined('SEO_URLS_FILTER_SHORT_WORDS')) $limit = SEO_URLS_FILTER_SHORT_WORDS;
$foo = explode('-', $str);
foreach($foo as $index => $value){
 switch (true){
	 case ( strlen($value) <= $limit ):
   continue;
	 default:
   $container[] = $value;
   break;
 }  
} # end foreach
$container = ( sizeof($container) > 1 ? implode('-', $container) : $str );
return $container;
}

It adds some simple error checking for the filtered array. If it has more than 1 element it will implode the array. However, it if has 1 or less (removed all the words) it will return the original string.

 

Just find the old function and replace it with that one...problem solved.

 

Bobby

Link to comment
Share on other sites

This is just like the error I was having. Ha! Not just me! And Bobby, I did include my URL on one of my messages, but here it is again: Aspiring Arts

 

Could it be anything to do with the fact that I have NO manufacturers? And yes, it was appearing on all pages, and a detail I forgot to mention, it appeared in the Categories box, before the Categories list.

 

Susan

Link to comment
Share on other sites

For some reason I didn't see your last post, Bobby, before posting mine, and the forums wouldn't let me edit the text of my last reply.

 

The fix worked! Thanks so much. I'm okay with leaving the end characters on now.

 

Small addition: file is in directory /includes/functions/, for those who might need more detail like me. :)

Link to comment
Share on other sites

 

Im not used to this Board hense my message being still here... is there a way to delete messages?

 

 

For everyone having problems with the new filter short words / implode code here is the patch:

 

Find the short_name() function in includes/html_output.php and replace it with this:

function short_name($str, $limit=3){
if (defined('SEO_URLS_FILTER_SHORT_WORDS')) $limit = SEO_URLS_FILTER_SHORT_WORDS;
$foo = explode('-', $str);
foreach($foo as $index => $value){
 switch (true){
	 case ( strlen($value) <= $limit ):
   continue;
	 default:
   $container[] = $value;
   break;
 }  
} # end foreach
$container = ( sizeof($container) > 1 ? implode('-', $container) : $str );
return $container;
}

It adds some simple error checking for the filtered array.  If it has more than 1 element it will implode the array.  However, it if has 1 or less (removed all the words) it will return the original string.

 

Just find the old function and replace it with that one...problem solved.

 

Bobby

 

I had this problem but your new function stopped the error message. Just want to say Thanks for this contribution. seems to work well and now i will go test it further.

 

Thnx Bobby

Alex :rolleyes:

Its Only Me

Alex

Link to comment
Share on other sites

Just installed the contrib and took me not more than 5 minutes. A great work not only code but documentation too.

 

It works great.

 

As someone else asked about the Froogle Data Feed. I also use the Froogle Data feed which is sent to froogle periodically using corn jobs.

 

The initial links that were sent to froogle were like ?product_id=2334 but I changed to product_info.php/product_id/2334

 

Now I am wondering if someone else using the Froogle Data Feed with the Ultimate SEO URLs mod? If someone else has already modified it then it'll save me a lot of time, if not then I'll try to modify it. I think a couple of query changes will be needed and may be would need to check for the short word function (though I have disabled it.)

 

If it has been already created then plss post the code or I'll post it when am done with it.

 

Thanks again for the contrib, I'll wait fir the next, where you add 301 redirects.

 

BTW oscarg if you use a couple of random blocks on a page then actually the 2 pages (SEOed and Non- SEOed) will be different.

Link to comment
Share on other sites

Hi

 

I have the Ultimate URL contribution installed here: www.apexdog.com, running oscmax 1.7

 

Everything seems to work fine but I am receiving an intermittent fatal error:

Fatal error: Cannot redeclare strip() (previously declared in /home/apexdog2/public_html/includes/seo_cache.php:40) in /home/apexdog2/public_html/includes/seo_cache.php on line 40

 

It seems to happen in IE, but not firefox. IE will load the page if you hit the refresh button.

 

Update: It happens in firefox as well....

 

Any ideas?

Edited by apexdog
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...