Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Duplicate content - cPath issue - Bug?


Recommended Posts

Hello,

I saw since v2.2rca until 2.3.4BS that cPath can be changed in url, this changed url works and show same content than valid url.

I saw this issue in almost two differents stores, and I find this issue beacuse I see Googlebot in "who's online" accesing this wrongs urls.

For example this url:

https://demo.oscommerce.com/index.php?cPath=3_10 (DVD -> Action) Exists

https://demo.oscommerce.com/index.php?cPath=3_10_1 (DVD -> Action - Hardware) Don't exists

https://demo.oscommerce.com/index.php?cPath=3_10_1_14 (DVD -> Action - Hardware -> Thriller) Don't exists

And you can nested categories "to infinity and beyond"

 

Probably anyone can say that only a crazy man find this wrong urls, but... If Google can find and indexed... And I see that he do....

Check in your store to look that you have this issue.

 

Best regards.

Link to comment
Share on other sites

Likely something in your store is producing them - check webmaster tools for references

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

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

Link to comment
Share on other sites

2 minutes ago, burt said:

How could Google find such URLs ?

This issue has been giving me headaches over time - saw it at least eight  years ago for the first time ... I never found an answer other then probably a mistake in an addon .. Really don't know ...

I kind of fixed it eventually with a new function (tep_get_canonical_path) that is always calculating the correct path for canonical.

Link to comment
Share on other sites

16 minutes ago, burt said:

This is what the Canonical URL module solves.  Does it not?

It ought to be - but within the module it's just taking the cpath and putting it in the link, so probably not. What we need is

5 minutes ago, azpro said:

tep_get_canonical_path

 

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

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

Link to comment
Share on other sites

I don't think that module has ever had much attention other than adding "view=all".

So...change these two lines:

https://github.com/gburton/Responsive-osCommerce/blob/master/includes/modules/header_tags/ht_canonical.php#L37-L38

To:

if (isset($cPath) && tep_not_null($cPath) && ($category_depth == 'products')) {
  $canonical = [];
  tep_get_parent_categories($canonical, $current_category_id);
  $canonical[] = $current_category_id;
          
  $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link('index.php', 'view=all&cPath=' . implode('_', $canonical), 'NONSSL', false) . '" />' . PHP_EOL, $this->group);

And report back your findings.

Link to comment
Share on other sites

Works correctly if

($category_depth == 'products')

But it

$category_depth = 'nested'; // navigate through the categories

(extracted from index.php) are missing and if this category have subcategories don't show meta canonical

will this

if (isset($cPath) && tep_not_null($cPath) && ($category_depth == 'products')) {

need to be?

if (isset($cPath) && tep_not_null($cPath) && ($category_depth == 'products' || $category_depth == 'nested')) {
	$oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link('index.php', ($category_depth == 'products' ? 'view=all&' : '') . 'cPath=' . $cPath, 'NONSSL', false) . '" />' . PHP_EOL, $this->group);

 

Link to comment
Share on other sites

I like this:

    function execute() {
      global $PHP_SELF, $cPath, $oscTemplate, $category_depth;
      global $current_category_id, $OSCOM_category;

      if (basename($PHP_SELF) == 'product_info.php') {
        $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link('product_info.php', 'products_id=' . (int)$_GET['products_id'], 'NONSSL', false) . '" />' . PHP_EOL, $this->group);
      } elseif (basename($PHP_SELF) == 'index.php') {
        if (isset($cPath) && tep_not_null($cPath) && ($category_depth != 'top')) {
          $canonical = $OSCOM_category->buildBreadcrumb($current_category_id);
         
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link('index.php', 'view=all&cPath=' . $canonical, 'NONSSL', false) . '" />' . PHP_EOL, $this->group);
        } elseif (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link('index.php', 'view=all&manufacturers_id=' . (int)$_GET['manufacturers_id'], 'NONSSL', false) . '" />' . PHP_EOL, $this->group);
        } else {
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link('index.php', null, 'NONSSL', false) . '" />' . PHP_EOL, $this->group);
        }
      }
      else {
        $view_all_pages = array('products_new.php', 'specials.php');
        if (in_array(basename($PHP_SELF), $view_all_pages)) {
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link($PHP_SELF, 'view=all', 'NONSSL', false) . '" />' . PHP_EOL, $this->group);
        }
      }  
    }

 

Link to comment
Share on other sites

Damn, this is still popping up. I swear I seen it before and I had a fix, but my store is so hacked...gonna have to look and if I ever remember it I'll let you know.

 

On 4/26/2018 at 9:37 AM, PiLLaO said:

Hello,

I saw since v2.2rca until 2.3.4BS that cPath can be changed in url, this changed url works and show same content than valid url.

I saw this issue in almost two differents stores, and I find this issue beacuse I see Googlebot in "who's online" accesing this wrongs urls.

For example this url:

https://demo.oscommerce.com/index.php?cPath=3_10 (DVD -> Action) Exists

https://demo.oscommerce.com/index.php?cPath=3_10_1 (DVD -> Action - Hardware) Don't exists

https://demo.oscommerce.com/index.php?cPath=3_10_1_14 (DVD -> Action - Hardware -> Thriller) Don't exists

And you can nested categories "to infinity and beyond"

 

Probably anyone can say that only a crazy man find this wrong urls, but... If Google can find and indexed... And I see that he do....

Check in your store to look that you have this issue.

 

Best regards.

 

Link to comment
Share on other sites

To be clear, google can't find them if there isn't a link to them. Check in your webmaster tools account and look at the links (they should be broken). Google will show how they got to the page. That should tell you where they are coming from.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

3 hours ago, Jack_mcs said:

To be clear, google can't find them if there isn't a link to them. Check in your webmaster tools account and look at the links (they should be broken). Google will show how they got to the page. That should tell you where they are coming from.

I Jack,

Search Console only show you a notice if the links get you a 404, these links works correctly and don't show any notice in search console, at least I never found those notices

Link to comment
Share on other sites

In your first post, you said "Googlebot in "who's online" accesing this wrongs urls". When google visits a page, if they find it is a valid page, they list it unless told not to. If they list it, it will be in your webmaster tools. If it isn't there, especially if no such link is on your site, then the entry you saw in who's online was probably someone spoofing. If you see that again, check the IP to make sure it is a google IP.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

My shop is with oscommerce since 2003 , i would like to stay and upgrade to the Edge version but i cannot find a clear Demo of it. (Always a 404 at Burt’s Site) . i think this is nessescary to have a clear address of a working demo if you want to attract new users and  to inform existing users about the improvements  of the Community Edge version. 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...