Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9302879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:21:20+00:00 2026-06-18T23:21:20+00:00

SOLVED See my answer below. BACKGROUND Anyone familiar with zen cart will know that

  • 0

SOLVED

See my answer below.

BACKGROUND

Anyone familiar with zen cart will know that it comes complete with the worlds most pointless product sort option aka the alpha drop down sorter.

Essentially what this does is allow you to select products by the letter/number they start with. Well, the starting letter of an item is rarely a useful criteria when I am shopping so I’m trying to create a more useful product sorter which will sort on date added, price and product name. and then filter based on attributes category.

PROBLEM

So I have managed to coerce the sorter to do my own query, which is working on everything except price.

Here is the SQL produced by my current set up for the price drop down:

SELECT DISTINCT p.products_id, p.products_type, p.master_categories_id
               ,p.manufacturers_id, p.products_price, p.products_tax_class_id
               ,pd.products_description
               ,IF(s.status = 1, s.specials_new_products_price, NULL)
                  AS specials_new_products_price
               ,IF(s.status =1, s.specials_new_products_price, p.products_price)
                  AS final_price
               ,p.products_sort_order
               ,p.product_is_call
               ,p.product_is_always_free_shipping
               ,p.products_qty_box_status

  FROM products p
  LEFT JOIN specials s on p.products_id = s.products_id
  LEFT JOIN products_description pd on p.products_id = pd.products_id
  JOIN products_to_categories p2c on p.products_id = p2c.products_id

  WHERE p.products_status = 1
    and pd.language_id = '1'
    and p2c.categories_id = '1'

  GROUP BY p.products_id
  ORDER BY final_price ASC 

As you can see I am trying to sort based on final price which is an alias for either the normal price or the special price (if set). This works fine through phpmyadmin. Unfortunately this isn’t working through zen cart, I get the php error:

PHP Fatal error: 1054:Unknown column ‘final_price’ in ‘order clause’
:: SELECT p.products_id, p.products_price_sorter,
p.master_categories_id, p.manufacturers_id FROM products p LEFT JOIN
specials s on p.products_id = s.products_id LEFT JOIN
products_description pd on p.products_id = pd.products_id JOIN
products_to_categories p2c on p.products_id = p2c.products_id WHERE
p.products_status = 1\r\n and pd.language_id = ‘1’\r\n and
p2c.categories_id = ‘1’ GROUP BY p.products_id ORDER BY final_price
ASC in /var/www/includes/classes/db/mysql/query_factory.php on line
101

So I looked at line 101 and it refers to an error handling method in the database abstraction class. Does anyone have any ideas what is going wrong here and how I might go about solving it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:21:21+00:00Added an answer on June 18, 2026 at 11:21 pm

    Thank you to all who looked at this. I managed to solve this. Not sure why but I noticed from my error message that the alias was not making it through to the db abstraction class. However, somewhere along the way it is producing p.products_price_sorter. So i managed to sort on price by using :

    ORDER BY p.products_price_sorter
    

    Hope this helps someone

    UPDATE

    After I spent several days getting this to work and play nicely, this plugin was suggested by Scott Wilson:
    http://www.zen-cart.com/downloads.php?do=file&id=1612
    So if you are reading this it may be worth checking out – it allows for custom sorting of your products on advanced search and category pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: SOLVED!!! Please see the answer I added below Does anyone know if there
SOLVED See my answer below. Question left unchanged for anyone else who has trouble
EDIT 2 : I have solved the problem (see answer below) Please note that
SOLVED: See my answer below I'm experiencing the same issue that Austin Hyde experienced
[SOLVED] See my answer below. I am trying to use stringstream (named ss) to
[EDIT: Problem solved. Please see my answer below.] In my app I call the
[SOLVED (see answer below)] I am using SpreadsheetWorker API to make working with Open
Update: Solved, with code I got it working, see my answer below for the
EDIT: SOLVED, was accidentally creating instead of extending the ember view. See answer below.
[SOLVED] Please see below for application of accepted answer and source code for functioning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.