Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ultimate SEO URLs - by Chemo


Guest

Recommended Posts

Hiya

 

I had a similar problem - for some reason I would have a product page i.e http://www.ngrcomputers.co.za/leadtek-nvid...2mb-p-2119.html

 

for some reason google was spidering them as

http://www.ngrcomputers.co.za/leadtek-nvid...ge=5&sort=2 or something like that!

 

URL still works but it meant it kicked me into supplementals obviously for Duplicate content. Looked high and low but now idea how its happening.

 

So outa frustration, i have done a 301 redirect to the "proper page"

 

In application top, just under this:

// Ultimate SEO URLs v2.1

include_once(DIR_WS_CLASSES . 'seo.class.php');

$seo_urls = new SEO_URL($languages_id);

 

I pasted this:

 

if (basename($_SERVER['SCRIPT_NAME']) == 'product_info.php') {

$incoming_url = $_SERVER['REQUEST_URI'];

 

$test = substr($incoming_url,strpos($incoming_url,'.html')+6,20);

 

$compare1 = substr($incoming_url,1,strpos($incoming_url,'.html')-1);

$compare2 = substr(str_replace(HTTP_SERVER,'',tep_href_link(basename($_SERVER['SCRIPT_NAME']), 'products_id='.$_GET['products_id'])),1,strpos(str_replace(HTTP_SERVER,'',tep_href_link(basename($_SERVER['SCRIPT_NAME']), 'products_id='.$_GET['products_id'])),'.html')-1);

 

if ($compare1 != $compare2) {

$location = tep_href_link(basename($_SERVER['SCRIPT_NAME']),'products_id='.$_GET['products_id'].tep_get_all_get_params(array('products_id')), $request_type);

header("HTTP/1.0 301 Moved Permanently");

header("Location: $location");

} else {

if ($test != '') {

$location = tep_href_link(basename($_SERVER['SCRIPT_NAME']),'products_id='.$_GET['products_id']);

header("HTTP/1.0 301 Moved Permanently");

header("Location: $location");

}}

 

}

 

if (basename($_SERVER['SCRIPT_NAME']) == 'index.php') {

if (isset($_GET['cPath'])) {

$incoming_url = $_SERVER['REQUEST_URI'];

$compare1 = substr($incoming_url,1,strpos($incoming_url,'.html')-1);

$compare2 = substr(str_replace(HTTP_SERVER,'',tep_href_link(basename($_SERVER['SCRIPT_NAME']), 'cPath='.$_GET['cPath'])),1,strpos(str_replace(HTTP_SERVER,'',tep_href_link(basename($_SERVER['SCRIPT_NAME']), 'cPath='.$_GET['cPath'])),'.html')-1);

if ($compare1 != $compare2) {

$location = tep_href_link(basename($_SERVER['SCRIPT_NAME']),'cPath='.$_GET['cPath']. tep_get_all_get_params(array('cPath')), $request_type);

header("HTTP/1.0 301 Moved Permanently");

header("Location: $location");

}

}

}

 

Works for me - might work for you!

 

Anyone see a potential problem with this?

 

yes, that "test" stuff is not very smart and not necessary.

all parameters including valids like language and currency and session ids get lost.

 

you could have just set:

 

$location = tep_href_link(basename($_SERVER['SCRIPT_NAME']),'products_id='.$_GET['products_id'].tep_get_all_get_params(array('products_id','page','sort')), $request_type);

Treasurer MFC

Link to comment
Share on other sites

  • Replies 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

I installed the ultimate SEO package and now I can not add products. The form is incomplete. The last text is Products SEO URL: but there is no text box. Can anyone help me???

 

Below is what I have if I click on New Products link under admin.

 

 

 

New Product in "Top"

Products Status: In Stock Out of Stock

Date Available:

(YYYY-MM-DD)

Products Manufacturer:

Products Name: English

Products SEO URL:

 

 

 

 

 

 

 

If I look at my source, it appears that the form is being cut off early. Any idea where to look for this?

 

 

 

//--></script>

<form name="new_product" action="http://www.thejesusclub.com/admin/categories.php?cPath=&action=new_product_preview" method="post" enctype="multipart/form-data"> <table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

 

<td class="pageHeading">New Product in "Top"</td>

<td class="pageHeading" align="right"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="1"></td>

</tr>

</table></td>

</tr>

<tr>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

 

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main">Products Status:</td>

<td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <input type="radio" name="products_status" value="1" CHECKED> In Stock <input type="radio" name="products_status" value="0"> Out of Stock</td>

</tr>

<tr>

 

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

<tr>

<td class="main">Date Available:<br><small>(YYYY-MM-DD)</small></td>

<td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

</tr>

<tr>

 

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

<tr>

<td class="main">Products Manufacturer:</td>

<td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <select name="manufacturers_id"><option value="" SELECTED>--none--</option><option value="10">Crown of Thorns</option></select></td>

</tr>

<tr>

 

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

<tr>

<td class="main">Products Name:</td>

<td class="main"><img src="/includes/languages/english/images/icon.gif" border="0" alt="English" title=" English "> <input type="text" name="products_name[1]"></td>

</tr>

<tr>

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

 

</tr>

 

<tr>

<td class="main">Products SEO URL:</td>

<td class="main">

Link to comment
Share on other sites

I found the issue. In the additional installation instrcutions there is some code to add to the globals.php; which I could have sworn I added, but a second check over all code updates showed it was missing. Guess I forgot to save my original changes. Anyways when I applied the code I now have the rest of the form.

 

I still need to test the rest of the functionality, but so far it looks like a very good addition!

 

Thanks.

 

 

 

I installed the ultimate SEO package and now I can not add products. The form is incomplete. The last text is Products SEO URL: but there is no text box. Can anyone help me???

 

Below is what I have if I click on New Products link under admin.

New Product in "Top"

Products Status: In Stock Out of Stock

Date Available:

(YYYY-MM-DD)

Products Manufacturer:

Products Name: English

Products SEO URL:

 

If I look at my source, it appears that the form is being cut off early. Any idea where to look for this?

//--></script>

<form name="new_product" action="http://www.thejesusclub.com/admin/categories.php?cPath=&action=new_product_preview" method="post" enctype="multipart/form-data"> <table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

 

<td class="pageHeading">New Product in "Top"</td>

<td class="pageHeading" align="right"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="1"></td>

</tr>

</table></td>

</tr>

<tr>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

 

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main">Products Status:</td>

<td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <input type="radio" name="products_status" value="1" CHECKED> In Stock <input type="radio" name="products_status" value="0"> Out of Stock</td>

</tr>

<tr>

 

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

<tr>

<td class="main">Date Available:<br><small>(YYYY-MM-DD)</small></td>

<td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

</tr>

<tr>

 

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

<tr>

<td class="main">Products Manufacturer:</td>

<td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <select name="manufacturers_id"><option value="" SELECTED>--none--</option><option value="10">Crown of Thorns</option></select></td>

</tr>

<tr>

 

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

</tr>

<tr>

<td class="main">Products Name:</td>

<td class="main"><img src="/includes/languages/english/images/icon.gif" border="0" alt="English" title=" English "> <input type="text" name="products_name[1]"></td>

</tr>

<tr>

<td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10"></td>

 

</tr>

 

<tr>

<td class="main">Products SEO URL:</td>

<td class="main">

Link to comment
Share on other sites

Hi,

 

Everything is working fine on the user end, however, in the admin area I'm having 2 issues (most likely an error on my part).

 

The first minor problem arises when I try to add a new category. This is the error I receive:

 

----------------------------

Fatal error: Call to undefined function: categories_seo_url() in /home/socalsur/public_html/admin/categories.php on line 1018

----------------------------

 

Here's the respective code (from /admin/categories.php), starting on line 1007:

 

	  case 'new_category':
	$heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_CATEGORY . '</b>');

	$contents = array('form' => tep_draw_form('newcategory', FILENAME_CATEGORIES, 'action=insert_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"'));
	$contents[] = array('text' => TEXT_NEW_CATEGORY_INTRO);

	$category_inputs_string = '';
	$languages = tep_get_languages();
	for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
	  $category_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_name[' . $languages[$i]['id'] . ']');
	  // HTC BOC
	  $category_htc_title_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field(categories_seo_url('categories_htc_title_tag['.$languages[$i]['id'].']'));
	  $category_htc_desc_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_htc_desc_tag[' . $languages[$i]['id'] . ']');
	  $category_htc_keywords_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_htc_keywords_tag[' . $languages[$i]['id'] . ']');
	  $category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'hard', 30, 5, '');
	  // HTC EOC
	}

	for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
	  $category_seo_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_seo_url[' . $languages[$i]['id'] . ']');
	}

	$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_NAME . $category_inputs_string);
	$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_SEO_URL . $category_seo_string);
	$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));
	$contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));
	// HTC BOC
	$contents[] = array('text' => '<br>' . 'Header Tags Category Title' . $category_htc_title_string);
	$contents[] = array('text' => '<br>' . 'Header Tags Category Description' . $category_htc_desc_string);
	$contents[] = array('text' => '<br>' . 'Header Tags Category Keywords' . $category_htc_keywords_string);
	$contents[] = array('text' => '<br>' . 'Header Tags Categories Description' . $category_htc_description_string);
	// HTC EOC
	$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
	break;

 

The second problem appears when I try to duplicate a product to another category. This is the error I receive:

----------------------------

1136 - Column count doesn't match value count at row 1

 

insert into products_description (products_id, language_id, products_name, products_seo_url, products_description, products_head_title_tag, products_head_desc_tag, products_head_keywords_tag, products_url, products_viewed) values ('590', '1', 'Ebomb 3-2 mm Wetsuit', 'Aquaban liquid taped. Batwing barrier system. Blast Proof knees. External key pocket. 100% Elastomax. Seemless shoulder panel. 3/4 gridlock zip.', 'Ebomb 3-2 mm Wetsuit', 'Ebomb 3-2 mm Wetsuit', 'Ebomb 3-2 mm Wetsuit', '', '0')

 

[TEP STOP]

----------------------------

 

I'm assuming the above is a database issue, perhaps I need to edit one of the tables/fields?

 

Any help is always appreciated. Thanks for the support..

 

Thanks.

JHouse

Link to comment
Share on other sites

Hello JHouse,

 

For problem 1 check you have included that function in the admin general.php file.

 

For problem 2 - check line 306 from the categories.php in the contrib file - as it looks like yours is missing the value:

 

, '" . tep_db_input($description['products_seo_url']) . "'

 

Cheers,

Emmett

Your online success is Paramount.

Link to comment
Share on other sites

Hello JHouse,

 

For problem 1 check you have included that function in the admin general.php file.

 

For problem 2 - check line 306 from the categories.php in the contrib file - as it looks like yours is missing the value:

 

, '" . tep_db_input($description['products_seo_url']) . "'

 

Cheers,

Emmett

Thanks Emmett for the quick support.

 

Regarding problem 2, I assume you're talking about the admin>categories.php file? Yes?

 

I'm gonna tackle these problems now and provide feedback.

 

Thanks again.

 

JHouse.

 

I'm gonna see if I can fix problem 2 right now, then tackle 1.

JHouse

Link to comment
Share on other sites

From the looks of it, the function is included in my admin general.php file. Here's the code, before the last ?> :

 

 

 // Function to reset SEO URLs database cache entries 
// Ultimate SEO URLs v2.1
function tep_reset_cache_data_seo_urls($action){		
	switch ($action){
			case 'reset':
					tep_db_query("DELETE FROM cache WHERE cache_name LIKE '%seo_urls%'");
					tep_db_query("UPDATE configuration SET configuration_value='false' WHERE configuration_key='SEO_URLS_CACHE_RESET'");
					break;
			default:
					break;
	}
	# The return value is used to set the value upon viewing
	# It's NOT returining a false to indicate failure!!
	return 'false';
}

 function tep_get_category_seo_url($category_id, $language_id) {
$category_query = tep_db_query("select categories_seo_url from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id . "'");
$category = tep_db_fetch_array($category_query);

return $category['categories_seo_url'];
 }


 function tep_get_products_seo_url($product_id, $language_id = 0) {
global $languages_id;

if ($language_id == 0) $language_id = $languages_id;
$product_query = tep_db_query("select products_seo_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
$product = tep_db_fetch_array($product_query);

return $product['products_seo_url'];
 }

 

Since the function is there, maybe this is problem of mashing the Header Tags Controller and Ultimate SEO URL's around line 1018 in the admin categories.php file. Yes, no, maybe so??? I don't know...

 

Thanks again for the help.

 

JHouse.

JHouse

Link to comment
Share on other sites

1st off, thanks for everyone that is supporting this thread, very helpful.

 

I am seeing a very strange URL output for my 2 root categories, which neither should have a parent category. It is showing the parent category for these 2 categories as a category name that I have changed weeks ago, and should no longer exist!

 

Here is a link to show what I mean, site is not live, still in testing:

http://www.o-cnick.info/test4/catalog

 

The links for the 2 main categories "Parts" & "Whole Goods" are being displayed with a parent category like this:

catalog/jandy-valve-actuator-kits-parts-c-21.html

 

That category name "Jandy Valve Actuator Kits" was edited weeks ago and changed to "JVA Parts - 2440 Style" and was never a "parent" category. It's path was Parts -> Jandy -> JVAs -> Jandy Valve Actuator Kits.

 

All the links work and go to the right places, but I do not want that very strange URL output for my 2 root categories to stay.

 

Any ideas on what could cause this?

Link to comment
Share on other sites

Doh, no post edit feature.

 

My problem can be resolved by disabling the "Add parent category to URL". But I would like to keep this feature enabled, since it makes the URLs more specific to the content of the page.

 

Hi,

 

Did you try resetting the SEO URL Cache in admin? Could be that the old URL got stored in cache, and as such isn't being re-checked.

 

Regards,

Chris

Link to comment
Share on other sites

The function name for the Ultimate SEO URLs contribution should be:

 

tep_get_categories_seo_url

 

So this function, listed in the admin general.php file, is named incorrectly?

 

  function tep_get_category_seo_url($category_id, $language_id) {
$category_query = tep_db_query("select categories_seo_url from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id . "'");
$category = tep_db_fetch_array($category_query);

return $category['categories_seo_url'];
 }

 

And thus it should be???

 

" function tep_get_categories_seo_url "

 

I would test this out before asking, but for misc. valid reasons, I'm unable to do so at this time.

 

Thanks Emmett.

JHouse

Link to comment
Share on other sites

Did you try resetting the SEO URL Cache in admin? Could be that the old URL got stored in cache, and as such isn't being re-checked.
Yep, I clear the URL cache every time I change something. One other strange part of this, is that I had changed that category name before I even installed this SEO contrib. I don't know where it is pulling that old name from.
Link to comment
Share on other sites

Not sure what contrib you are using that is looking for:

 

categories_seo_url()

 

That's actually part of the Ultimate SEO URLs contrib. I just re-checked the original code I got from this contrib (in the admin>includes>functions>general.php) and yep, categories_seo_url() is towards the end.

 

Anyways, I'm still getting the same error when I try and add a new category. If anybody has any further help, or if someone has the Header Tags Controller and Ultimate SEO URLs contribs working together seamlessly, I'd love to see your admin> general.php and categories.php files please.

 

Thanks.

JHouse

Link to comment
Share on other sites

Installed this contribution and I'm having this problem which goes away when I turn off SEO URL's.

 

On the page where it lists products and gives Buy Now buttons, when you click the Buy Now button it takes you to the cart, but doesn't add the product, and if there happens to be anything else in the cart already, it wipes it out, so in effect it empties the cart.... it doesn't seem to matter whether I have it go to cart or not after doing a buy now.

 

Has anyone experienced this problem?

 

Josh

Link to comment
Share on other sites

Hello,

 

this is my first message on this forum. First of all, sorry for my poor english... i speak french.

 

I have a problem with SEO Utlimate 2.1d...

 

1 - I have installed this contribution : http://www.oscommerce.com/community/contributions,2823 (29 nov 06)

2 - without problem except a modification of SQL request :

I replace :

ALTER TABLE `categories_description` ADD `categories_seo_url` VARCHAR( 100 ) NOT NULL ;

ALTER TABLE `products_description` ADD `products_seo_url` VARCHAR( 100 ) NOT NULL ;

 

by adding osc_ prefix to tables :

 

ALTER TABLE `osc_categories_description` ADD `categories_seo_url` VARCHAR( 100 ) NOT NULL ;

ALTER TABLE `osc_products_description` ADD `products_seo_url` VARCHAR( 100 ) NOT NULL ;

 

3 - When

on my page product :

http://www.mywebsite.com/eau-de-vie-de-poireC3%A9-p-55.html

 

When I just want to add this product to my shopping cart, by clicking on "add to shopping cart", nothing's happen... I've this URL :

http://www.mywebsite.com/eau-de-vie-de-poi...ion=add_product

 

But the shopping cart is not update. Exactly the same problem if I want to change the language of my website by clicking on little flag... nothing happen.

 

If I click a second time :

http://www.mywebsite.com/eau-de-vie-de-poi...ion=add_product

 

Someone can help me, because I read some forums, and I have tried amendments from edgecrush3r and bchecketts... It's the same problem. I know some french people have the same problem without answer.

 

(please, can you use easy words just for me :P

 

Thanks to Chemo, for this contribution

 

Mali

Link to comment
Share on other sites

my folders are :

 

www.mywebsite.com/

images/

includes/

admin/

index.php

 

etc

 

Maybe, there are something to change cause my catalog is directly at the root. Please.

 

Do I must install a old version of SEO Ultimate ? and uninstall 2.1d ?

 

Mali

Link to comment
Share on other sites

Now it's OK. I find answer :

 

http://forums.oscss.org/viewtopic.php?id=188

 

includes/functions/general.php

 

find :

// Return all HTTP GET variables, except those passed as a parameter
 function tep_get_all_get_params($exclude_array = '')

 

and comment :

// return str_replace('&', '&', $get_url);

 

And, now, I can add products in cart. :thumbsup:

 

Thanks.

Kenavo.

Link to comment
Share on other sites

Hi,

 

I'm a newbie here.

 

Tryed to install Ultimate SEO URL's and something's going wrong, I don't know how to solve this issue.

 

The first page looks ok, but when i'm clickin on a category i got 404 error. The link in the IE bar looks like this:

 

http://www.orbitalcomputers.ro/catalog/cal...plsdlo7sbds0a05

 

Even if I delete th part wth "?oscid=hqdmmkdojb5plsdlo7sbds0a05" I got that 404 error.

 

Could anyone help me pls?

 

Thanks in advance

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...