Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

2.3.4 general.php - malformed if statement?


lee the bean

Recommended Posts

from update 2.3.4     catalog/includes/functions/general.php

 

around line 918        // Construct a category path to the product

 

what does this line 934/935 do (it don't look right - but I'm not a php expert)

 

      if (tep_not_null($cPath)) $cPath .= '_';
      $cPath .= $category['categories_id'];

 

 

Link to comment
Share on other sites

Nothing wrong with that.

 

 

 

if (tep_not_null($cPath)) $cPath .= '_';
$cPath .= $category['categories_id'];

 

is the same as:

 

 

if (tep_not_null($cPath)) {
  $cPath .= '_';
}
$cPath .= $category['categories_id'];

 

The second line of code is nothing to do with the "if" ...

Link to comment
Share on other sites

@@lee the bean It's building the category ID. It first checks if the category ID exists and, if so, adds an underscore to it. Then it adds the category ID to that. So you end up with an ID of something like 23 or 23_45, or whatever the numbers would be.

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks guys, I found the alternate syntax on http://php.net/manual/en/control-structures.alternative-syntax.php

 

I think we need a test and redirect for an empty category id ie

 

/product_info.php?cPath=&products_id=1594. This can cause a 'back button' link problem, as the cPath parameter is added.

 

As we may be aware Bing loves to add parameters where none should be, and doesn't always get them correct as reported below:

 

http://answers.microsoft.com/en-us/bing/forum/bing_other-bing_dev/bing-crawlers-never-drop-crawling-a-non-existing/9c56f5f2-4d80-4095-87b2-99ffdb346785

 

(can't find an answered button on post - but this is question is answered - thanks)

Link to comment
Share on other sites

The function the code you mentioned already checks for an existing ID. But that is different than the 404/410 problem you mention. See my Header Status Handler to fix that.

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...