Jump to content
spidometrs

[CONTRIBUTION] Ultimate SEO URLs v2.1 - by Chemo

Recommended Posts

@Hotclutch

the redirect does not work

if the product is in the database and turned off  or  deleted from the database.

I have tested all possibilities.

it just appends the product_info part to the end of the url

deeply annoying

Share this post


Link to post
Share on other sites

does not make sense. Once you delete the product, there's nothing in the code that would cause that. Unless you have something else going on.

Share this post


Link to post
Share on other sites

Add the redirect above the redirects for this addon and let the code sort it out.

redirect 301 /product-p-800.html https://www.site.com/product_info.php?products_id=900 

 

Share this post


Link to post
Share on other sites

@Jack_mcs

11 hours ago, Jack_mcs said:

Add the redirect above the redirects for this addon and let the code sort it out.


redirect 301 /product-p-800.html https://www.site.com/product_info.php?products_id=900 

 

I tried the above(with my site details) but it goes to a page not found.. i tried turning off your header redirect still goes to stock page not found.. reset seo cache still page not found.. It is ignoring the 301... weird

Share this post


Link to post
Share on other sites

Please ignore the post above

@Jack_mcs

solution

12 hours ago, Jack_mcs said:

Add the redirect above the redirects for this addon and let the code sort it out.


redirect 301 /product-p-800.html https://www.site.com/product_info.php?products_id=900 

 

is absolutely right. I made a mistake with the URL.

Thanks all for your help

Share this post


Link to post
Share on other sites

hello support,

i am using frozen 2341CE, with php 7.1.

trying to install oscom-ultimate-seo-urls-36rDo-CPS2y.

in the instructions it states to find this in: STEP #4 - Edit admin/categories.php

  ////
// Ultimate SEO URLs v2.2d
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
   global $seo_urls;                
   if ( !is_object($seo_urls) ){
    if ( !class_exists('SEO_URL') ){
     include_once('includes/classes/seo.class.php');
    }
    global $languages_id;
    $seo_urls = new SEO_URL($languages_id);
   }
   return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
 }

and add after:

// Ultimate SEO URLs v2.2d
// If the action will affect the cache entries
   if ( preg_match("/(insert|update|setflag)/i", $action) ) include_once('includes/reset_seo_cache.php');

searching for pieces of the code or searching the whole site  for wrapper function I can not find something resembling

the code so 

where do i put the new suggested code???

Z

Share this post


Link to post
Share on other sites
1 hour ago, zpupster said:

it states to find this in: STEP #4 - Edit admin/categories.php

It looks like you mixed step 4 and 5. Please take another look at the instructions.

Share this post


Link to post
Share on other sites

thanks Jack,

what i posted was how it appeared. I reloaded the instructions page and it is now corrected.

TY again

Z

Share this post


Link to post
Share on other sites
Posted (edited)

Hi there

I found a curious issue when this addon is used with a navbar drop down cart in the header.

The urls of the products in the cart drop down look like this

https://www.site.com.au/-p-700.html

instead of 

https://www.site.com.au/name-of-product/-p-700.html

The code to create the cart in the navbar is standard 

<?php      
      $products = $cart->get_products();
      foreach ($products as $k => $v) {
        echo '<li>' . sprintf(MODULE_NAVBAR_SHOPPING_CART_PRODUCT, $v['id'], $v['quantity'], $v['name']) . '</li>';
      }        
      ?>

and the language file

define('MODULE_NAVBAR_SHOPPING_CART_PRODUCT', '<a href="' . tep_href_link('product_info.php', 'products_id=%s') . '">%s x %s</a>');

Just wondered why this is?

 

 

Edited by bonbec
remove real link

Share this post


Link to post
Share on other sites

Try changing the $v['name'] to "test". If test shows up in the url, then the $v['name'] is not set.

Also, to be clear, the url would not have the slash you show so it would be https://www.site.com.au/name-of-product-p-700.html . That was probably a typo but I thought I should mention it.

Share this post


Link to post
Share on other sites
9 hours ago, Jack_mcs said:

Try changing the $v['name'] to "test". If test shows up in the url, then the $v['name'] is not set.

Also, to be clear, the url would not have the slash you show so it would be https://www.site.com.au/name-of-product-p-700.html . That was probably a typo but I thought I should mention it.

Hi there

I did as suggested and the name disappeared from the drop down and was not replaced by the word test.

Url was a typo but the link that currently shows is

https://www.site.com.au/-p-700.html

 

Share this post


Link to post
Share on other sites

The other question I have is

over the years a few people have linked to the site incorrectly  leaving a white space in the url which becomes %20

is there a way to use htaccess or any other method  to strip out any whitespaces  before any other redirects happen.

The url in question is 

https://www.site.com/product_info?cPath=28&(spaceishere)products_id=1000

Share this post


Link to post
Share on other sites

I'm not sure of the precedence order when a sprintf command is used for a function in a language file. I wouldn't code it that way. It might be that the link is being built before the text is added. If all else fails, I would re-code it so there aren't three things going on in one call.

Other than that, the only other thing I can think of is if you are using Header Tags SEO and haven't enabled the option for it in this addon and/or not ran fill tags.

For the url spaces, see this. The code would go before the rewrites for those of this addon.

 

Share this post


Link to post
Share on other sites

Thanks so much for this

I re-coded the shopping cart header module using the code from the column box module so avoided sprintf

 public function getOutput() {
      GLOBAL $cart, $currencies, $PHP_SELF;
      
              $cart_contents_string = '';
      if ($cart->count_contents() > 0) {
        $cart_contents_string = NULL;
        $products = $cart->get_products();
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
          $cart_contents_string .= '<li>';
          $cart_contents_string .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';
          $cart_contents_string .= $products[$i]['quantity'] . '&nbsp;x&nbsp;';
          $cart_contents_string .= $products[$i]['name'];
          $cart_contents_string .= '</a></li>';
        }
      }

and then called 

<?php echo $cart_contents_string; ?>

in the template file

 

 

 

will sort out the htaccess part you have offered when the site is a bit quieter

Share this post


Link to post
Share on other sites

The htaccess bit I couldnt get to work.

i placed it above all the other code. It goes to page not working.

could it be this bit as i don't want to add just remove

# replace spaces by - in between
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]

Share this post


Link to post
Share on other sites
3 hours ago, douglaswalker said:

The htaccess bit I couldnt get to work.

i placed it above all the other code. It goes to page not working.

could it be this bit as i don't want to add just remove

# replace spaces by - in between
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]

This replaces space with a hyphen. If you change $1-$2 to $1$2 it would simply strip the space.

Either will work in the section of url that's ignored (before  -p-). Stripping the space is likely what you need for the query string (your example) but around the p 1000 would need the hyphen


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE).

here: https://github.com/gburton/Responsive-osCommerce/releases

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

@BrockleyJohn

not sure what i am doing wrong here.

I will go through the steps again and write them here to see if anyone can spot the issue

https://www.site.com.au/product_info.php?cPath=28& &(space here)products_id=71

is a link that google has picked up somewhere on the web. It has a space wrongly placed between cPath=28&(space here) products_id=71

This is creating the page to fail and try to redirect over and over.

It ultimately needs to go to 

https://www.mysite.com.au/product-product--toy-p-71.html

once it has passed through SEO urls program

So I am trying to strip the space out of cPath=28&(space here) products_id=71

using htaccess

RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1$2 [L,R]

then send it on its way.

However the htaccess is not working

 

Share this post


Link to post
Share on other sites

@douglaswalker sorry Doug didn't think properly - you need to change the query string rather than the url

RewriteCond %{QUERY_STRING} "^([^\s%20]*)(?:\s|%20)+(.*)$"
RewriteRule ^ %{REQUEST_URI}?%1%2 [L,R]

 


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE).

here: https://github.com/gburton/Responsive-osCommerce/releases

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
22 hours ago, BrockleyJohn said:

@douglaswalker sorry Doug didn't think properly - you need to change the query string rather than the url


RewriteCond %{QUERY_STRING} "^([^\s%20]*)(?:\s|%20)+(.*)$"
RewriteRule ^ %{REQUEST_URI}?%1%2 [L,R]

 

Thank-you that did the trick

Share this post


Link to post
Share on other sites
Posted (edited)

Need help when I hover over links I don't see the seo friendly urls but when I click them it works and goes there? When I create a sitemap it makes it with dynamic links? Using oscommerce 2.2 rc2 - can't upgrade too many mods installed over the years. Any idea where to look? 

Edited by wflynnnn

Share this post


Link to post
Share on other sites
17 minutes ago, wflynnnn said:

Using oscommerce 2.2 rc2

I doubt one of the latest versions of this addon will work for you. Try installing 2.2d-13 or earlier. You'll lose improvements and security fixes but that's the trade-off when running such an old shop.

Share this post


Link to post
Share on other sites

Hello
Thank you for excusing my english
Oscommerce 2.3.4 / ultimate seo url 2.2d18 / php7

Rewriting Works very well, but I see the robots on the following urls
/my-product-name-p-788.html?products_id=788 (for more products)

For manufacturers too
/my-manufacturer-name-m-32.html?manufacturers_id=32

Is it normal ?

Can someone help me
thank you so much


Osc 2.3.4

mts template

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×