Forums / Upgrading to 1.5.x / Product Description: Does not Show up in All Products and other Pages

Product Description: Does not Show up in All Products and other Pages

Started by celextel108 on 26 Oct 2022, 7:18 AM · Views: 1,504

Results 1 to 4 of 4
26 Oct 2022, 7:18 AM
#1
celextel108 avatar

celextel108

New Zenner

Join Date:
Sep 2022
Location:
Chennai
Posts:
38
Plugin Contributions:
0

Product Description: Does not Show up in All Products and other Pages

Dear Friends,

We are currently using Zen Cart 1.5.8 under PHP 8.1.9 Version at www.celextel.com.

Product Description does not show up in the following Pages:
https://www.celextel.com/products_all.html
https://www.celextel.com/featured_products.html
https://www.celextel.com/products_new.html

We have not made changes to any of these Files in the Template and other folders.

Configuration settings are as follow:
PRODUCT_LIST_DESCRIPTION 150
PRODUCT_ALL_LIST_DESCRIPTION 150
PRODUCT_NEW_LIST_DESCRIPTION 150
PRODUCT_FEATURED_LIST_DESCRIPTION 150

Please guide us as to what to do in this regard.

Thanks,

Lakshmanan

26 Oct 2022, 10:16 AM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,131
Plugin Contributions:
56

Re: Product Description: Does not Show up in All Products and other Pages

Thank you for the report. I've identified the source of your issue as a bug in the zen_get_products_description function, present in /includes/functions/functions_products.php.

To correct, see the changes posted here (https://github.com/zencart/zencart/pull/5350). For brevity, make a backup copy of the functions_products.php file, then edit that file to find:

function zen_get_products_description($product_id, $language_id = 0)
{
    global $db;

    if (empty($language_id)) $language = $_SESSION['languages_id'];

    $product = $db->Execute("SELECT products_description
                             FROM " . TABLE_PRODUCTS_DESCRIPTION . "
                             WHERE products_id = " . (int)$product_id . "
                             AND language_id = " . (int)$language_id, 1);
    if ($product->EOF) return '';
    return $product->fields['products_description'];
}

and change that to

function zen_get_products_description($product_id, $language_id = 0)
{
    global $db;

    if (empty($language_id)) {
        $language_id = $_SESSION['languages_id'];
    }

    $product = $db->Execute("SELECT products_description
                             FROM " . TABLE_PRODUCTS_DESCRIPTION . "
                             WHERE products_id = " . (int)$product_id . "
                             AND language_id = " . (int)$language_id, 1);
    return ($product->EOF) ? '' : $product->fields['products_description'];
}

The underlying issue is that the function (as present in the zc158 distribution) was setting a variable named $language if no language-id was passed, but the following database query uses a variable named $language**_id** ... so the description was always returned as an empty string.

26 Oct 2022, 1:07 PM
#3
celextel108 avatar

celextel108

New Zenner

Join Date:
Sep 2022
Location:
Chennai
Posts:
38
Plugin Contributions:
0

Re: Product Description: Does not Show up in All Products and other Pages

Product Description is showing up now in all these Pages after applying the change suggested by you.

We appreciate your fast response with solution.

We thank all of you who are involved in this.

With Best Wishes,

Lakshmanan

26 Oct 2022, 4:01 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,131
Plugin Contributions:
56

Re: Product Description: Does not Show up in All Products and other Pages

Thanks for confirming that the change (which will be in the next point-release of zc158) corrected the issue you posted.