Displaying wishlist products in alphabetical order

To do this for the storefront:
  1. Open the fn_cart.php file located in the core directory of your CS-Cart installation.
  2. Find and replace the following part of code there:
    $_prods = db_get_hash_array("SELECT * FROM $db_tables[user_session_products] WHERE user_id='$user_id' AND type='$type' AND user_type = '$user_type' AND item_type IN ('".implode("','", $item_types)."')", 'item_id');

    with this one:
    if ($type == 'C')
            {
            $_prods = db_get_hash_array("SELECT * FROM $db_tables[user_session_products] WHERE user_id='$user_id' AND type='$type' AND user_type = '$user_type' AND item_type IN ('".implode("','", $item_types)."')", 'item_id');
            }
            else
            {
            $_prods = db_get_hash_array("SELECT *, $db_tables[product_descriptions].product FROM $db_tables[user_session_products] LEFT JOIN $db_tables[product_descriptions] ON $db_tables[user_session_products].product_id = $db_tables[product_descriptions].product_id AND $db_tables[product_descriptions].lang_code='$cart_language' WHERE $db_tables[user_session_products].user_id='$user_id' AND $db_tables[user_session_products].type='$type' AND $db_tables[user_session_products].user_type = '$user_type' AND $db_tables[user_session_products].item_type IN ('".implode("','", $item_types)."') ORDER BY $db_tables[product_descriptions].product", 'item_id');
            }
  3. Save the file.
    NOTE: To see the changes you need to re-log in to the store.
To do this for the administrator panel:
  1. Open the cart.php file located in the addons/wishlist/include/admin directory of your CS-Cart installation.
  2. Find and replace the following part of code there:
    $products = db_get_array("SELECT $db_tables[user_session_products].product_id, $db_tables[user_session_products].item_type, $db_tables[user_session_products].amount, $db_tables[user_session_products].price, $db_tables[product_descriptions].product FROM $db_tables[user_session_products] LEFT JOIN $db_tables[product_descriptions] ON $db_tables[user_session_products].product_id = $db_tables[product_descriptions].product_id AND $db_tables[product_descriptions].lang_code='$descr_sl' WHERE $db_tables[user_session_products].user_id = '$user_id' AND $db_tables[user_session_products].type='W' AND $db_tables[user_session_products].item_type IN ('".implode("','", $item_types)."')");

    with this one:
    $products = db_get_array("SELECT $db_tables[user_session_products].product_id, $db_tables[user_session_products].item_type, $db_tables[user_session_products].amount, $db_tables[user_session_products].price, $db_tables[product_descriptions].product FROM $db_tables[user_session_products] LEFT JOIN $db_tables[product_descriptions] ON $db_tables[user_session_products].product_id = $db_tables[product_descriptions].product_id AND $db_tables[product_descriptions].lang_code='$descr_sl' WHERE $db_tables[user_session_products].user_id = '$user_id' AND $db_tables[user_session_products].type='W' AND $db_tables[user_session_products].item_type IN ('".implode("','", $item_types)."') ORDER BY $db_tables[product_descriptions].product");
  3. Save the file.

Noticed an error in the article or it is not clear enough? Any suggestions to improve it? Please let us know by filling in the feedback form. Click here.