Originally Posted by
mc12345678
That certainly is a more tried and true method to evaluate the condition of the database. I will note that the above text content incorrectly states concern with categories_id 75 instead of 74 as shown in the image and previously referenced. Likely a keyboard slip and provides some useful information.
What the image indicates is that when the database is queried for products_id of 2337 that the category identified on the browser (74) has that product identified. This is important for the query that is generated at least in a default store which is something similar to the below:
Code:
$products_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_quantity, p.products_price, p.products_status, p.products_model, p.products_sort_order,
p.master_categories_id";
$products_query_raw .= $extra_select;
$products_query_raw .= " FROM " . TABLE_PRODUCTS . " p";
$products_query_raw .= $extra_from;
$products_query_raw .= " LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id = p.products_id)";
$products_query_raw .= $extra_joins;
$where = " WHERE pd.language_id = " . (int)$_SESSION['languages_id'];
$where .= $extra_ands;
if ($search_result && $action != 'edit_category') {
$where .= " AND (pd.products_name LIKE '%:search%'
OR pd.products_description LIKE '%:search%'
OR p.products_id = ':search'
OR p.products_model LIKE '%:search%'
) ";
$where = $db->bindVars($where, ':search', $_GET['search'], 'noquotestring');
} else {
$products_query_raw.= " LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ON (p2c.products_id = p.products_id) ";
$where .= " AND p2c.categories_id=" . (int)$current_category_id;
}
$products_query_raw .= $where . $order_by;
Because the above browser path did not include search criteria, then the query ends with: " LEFT JOIN products_to_categories p2c ON (p2c.products_id = p.products_id) AND p2c.categories_id=74" So, having the above image associated with that database, if that database is really and truly the same one that is referenced by the store, it seems that perhaps there is some observer that is listening to the notifier in admin/category_product_listing.php and causing problem(s) described. The result appears to be that when the query is executed, $current_category_id is expected to be 74, $_SESSION['languages_id'] is expected to be 1, but could be whatever value that exists for the language(s) installed. Even then, it appears (I haven't run my own testing) that it could even basically be a non-existent language designation and still give expected results. Right now it is given a result of zero matching items, but even that doesn't seem right..
Thank you for spending so much time on this :)
Apologies for my typo; 75 not 74 , fat fingers :)
For other products it works OK, like products_filter=2785¤t_category_id=159 & products_filter=1654¤t_category_id=146
I have a workaround when I enter the following into my browser when logged into admin for product 2337, id74 then I can edit my attributes OK.
Code:
https://www.simmar.ch/catalog/caNdy-shD-dArts/index.php?cmd=attributes_controller&products_filter=2337¤t_category_id=74
If I use the linked id 163 in the following browser link then I can also edit my attributes OK.
Code:
https://www.simmar.ch/catalog/ADMIN/index.php?cmd=attributes_controller&products_filter=2337¤t_category_id=163
I turned on the optional logging and got (multiple times)
Code:
[09-Jun-2022 10:59:56 Europe/Zurich] Request URI: /catalog/Admin/index.php?cmd=category_product_listing&cPath=163&pID=2337&action=attribute_features&page=2, IP address: 88.151.150.206
#1 require(/Admin/category_product_listing.php) called at [/ADMIN/index.php:11]
--> PHP Notice: Undefined variable: pInfo in /ADMIN/category_product_listing.php on line 960.
[09-Jun-2022 10:59:56 Europe/Zurich] Request URI: /ADMIN/index.php?cmd=category_product_listing&cPath=163&pID=2337&action=attribute_features&page=2, IP address: 88.151.150.206
#1 require(/ADMIN/category_product_listing.php) called at [/ADMIN/index.php:11]
--> PHP Notice: Trying to get property 'products_id' of non-object in /ADMIN/category_product_listing.php on line 960.
The ADMIN/category_product_listing.php on line 960 is the last line of code below;
Code:
// attribute features
case 'attribute_features':
$copy_attributes_delete_first = '0';
$copy_attributes_duplicates_skipped = '0';
$copy_attributes_duplicates_overwrite = '0';
$copy_attributes_include_downloads = '1';
$copy_attributes_include_filename = '1';
$heading[] = array('text' => '<h4>' . TEXT_INFO_HEADING_ATTRIBUTE_FEATURES . $pInfo->products_id . '</h4>');
$contents[] = array('align' => 'center', 'text' => '<strong>' . TEXT_PRODUCTS_ATTRIBUTES_INFO . '</strong>');
$contents[] = array('align' => 'center', 'text' => '<strong>' . zen_get_products_name($pInfo->products_id, $_SESSION['languages_id']) . ' ID# ' . $pInfo->products_id . '</strong>');
$contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=attributes_preview' . '&products_filter=' . $pInfo->products_id . '¤t_category_id=' . $current_category_id) . '" class="btn btn-info" role="button">' . IMAGE_PREVIEW . '</a> <a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $pInfo->products_id . '¤t_category_id=' . $current_category_id) . '" class="btn btn-primary" role="button">' . IMAGE_EDIT_ATTRIBUTES . '</a>');
$contents[] = array('align' => 'left', 'text' => '<strong>' . TEXT_PRODUCT_ATTRIBUTES_DOWNLOADS . '</strong>' . zen_has_product_attributes_downloads($pInfo->products_id) . zen_has_product_attributes_downloads($pInfo->products_id, true));
$contents[] = array('align' => 'left', 'text' => TEXT_INFO_ATTRIBUTES_FEATURES_DELETE . '<strong>' . zen_get_products_name($pInfo->products_id) . ' ID# ' . $pInfo->products_id . '</strong> <a href="' . zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_attributes' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '" class="btn btn-danger" role="button">' . IMAGE_DELETE . '</a>');
$contents[] = array('align' => 'left', 'text' => TEXT_INFO_ATTRIBUTES_FEATURES_UPDATES . '<strong>' . zen_get_products_name($pInfo->products_id, $_SESSION['languages_id']) . ' ID# ' . $pInfo->products_id . '</strong> <a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=update_attributes_sort_order' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '" class="btn btn-primary" role="button">' . IMAGE_UPDATE . '</a>');
$contents[] = array('align' => 'left', 'text' => TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_PRODUCT . '<strong>' . zen_get_products_name($pInfo->products_id, $_SESSION['languages_id']) . ' ID# ' . $pInfo->products_id . '</strong><a href="' . zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=attribute_features_copy_to_product' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '" class="btn btn-primary" role="button">' . IMAGE_COPY_TO . '</a>');
$contents[] = array('align' => 'left', 'text' => '<br>' . TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_CATEGORY . '<strong>' . zen_get_products_name($pInfo->products_id, $_SESSION['languages_id']) . ' ID# ' . $pInfo->products_id . '</strong> <a href="' . zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=attribute_features_copy_to_category' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '" class="btn btn-primary" role="button">' . IMAGE_COPY_TO . '</a>');
$contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '" class="btn btn-default" role="button">' . IMAGE_CANCEL . '</a>');
break;
Bookmarks