Jump to content
Latest News: (loading..)

Archived

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

lee the bean

2.3.4 general.php - malformed if statement?

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'];

 

 

Share this post


Link to post
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" ...


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
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.

Share this post


Link to post
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)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×