Zen Cart Logo
Forums / Basic Configuration / Links Broken _info not product_info

Links Broken _info not product_info

Views: 1,360

Results 1 to 2 of 2
6 Mar 2013, 2:25 AM
#1
paul69 avatar

paul69

Zen Follower

Join Date:
Jan 2010
Posts:
124
Plugin Contributions:
0

Links Broken _info not product_info

I just wanted to lend a hand for anyone experiencing this problem. After searching to no end I found the cause finally in the \includes\functions\functions_lookups file in the following line:

  function zen_get_info_page($zf_product_id) {
    global $db;
    $sql = "select products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$zf_product_id . "'";
    $zp_type = $db->Execute($sql);
    if ($zp_type->RecordCount() == 0) {
      return 'product_info';
    } else {
      $zp_product_type = $zp_type->fields['products_type'];
      $sql = "select type_handler from " . TABLE_PRODUCT_TYPES . " where type_id = '" . (int)$zp_product_type . "'";
      $zp_handler = $db->Execute($sql);
      return $zp_handler->fields['type_handler'] . '_info';
    }
  }

Note the else statement showing NO records found indicating no product type. The page returned will cause the link to the product page to appear as "_info" NOT "product_info" if no type found. So the root cause, yup plain old operator error. You MUST load a product type and sometimes this is easily missed when doing mass loads. So if your links are broken and product pages are giving 404 errors due to the URL construct of "_info" without the word "product" in the link, then most likely you have not specified a product type when loading data or doing sql updates.

The function "zen_get_info_page" is called in multiple areas and will return the same without the product type. Hope I saved someone frustration by finding a simple error!!! :smile:

LINK LOOKS LIKE: Link would read something like /index.php?main_page=_info&cPath=16_43&products_id=2493

SHOULD BE: /index.php?main_page=product_info&cPath=16_43&products_id=2493

6 Mar 2013, 4:08 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Links Broken _info not product_info

Paul69:

So the root cause, yup plain old operator error. You MUST load a product type and sometimes this is easily missed when doing mass loads. So if your links are broken and product pages are giving 404 errors due to the URL construct of "_info" without the word "product" in the link, then most likely you have not specified a product type when loading data or doing sql updates.
Correct. Thanks for confirming that those symptoms are a direct result of bad data.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.