Products Search Sort By Bestsellers Error_Occurred

Action:

mydomain.com/index.php?dispatch=products.search&features_hash=A1&sort_by=bestsellers&sort_order=desc



Error:


Unknown column 'cscart_product_sales.amount' in 'order clause' (1054)
Query: SELECT SQL_CALC_FOUND_ROWS products.*, descr1.product as product, MIN(IF(prices.percentage_discount = 0, prices.price, prices.price - (prices.price * prices.percentage_discount)/100)) as price, descr1.short_description, IF(descr1.short_description = '', descr1.full_description, '') as full_description, GROUP_CONCAT(IF(products_categories.link_type = 'M', CONCAT(products_categories.category_id, 'M'), products_categories.category_id)) as category_ids, products_categories.position, cscart_seo_names.name as seo_name FROM cscart_products as products LEFT JOIN cscart_product_features_values ON cscart_product_features_values.product_id = products.product_id AND cscart_product_features_values.lang_code = 'FA' LEFT JOIN cscart_product_options_inventory as inventory ON inventory.product_id = products.product_id AND inventory.amount >= 1 LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = 'FA' LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id AND prices.lower_limit = 1 INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id AND (cscart_categories.usergroup_ids = '' OR FIND_IN_SET(0, cscart_categories.usergroup_ids) OR FIND_IN_SET(1, cscart_categories.usergroup_ids)) AND cscart_categories.status IN ('A', 'H') LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = products.product_id AND cscart_seo_names.type = 'p' AND cscart_seo_names.dispatch = '' AND cscart_seo_names.lang_code = 'FA' WHERE 1 AND products.company_id = 0 AND IF(products.tracking = 'O', inventory.amount >= 1, products.amount >= 1) AND (products.usergroup_ids = '' OR FIND_IN_SET(0, products.usergroup_ids) OR FIND_IN_SET(1, products.usergroup_ids)) AND products.status IN ('A') AND prices.usergroup_id IN (0, 0, 1) GROUP BY products.product_id ORDER BY cscart_product_sales.amount desc LIMIT 0, 20




no problem on table:

cscart_product_sales

cscart_seo_names

cscart_sessions



Please Help me to fix this error,

Thanks you All!

see this problem on all products list sorted by bestsellers



example:

mydomain.com/category-33.html?sort_by=bestsellers&sort_order=desc

see this problem on all products list sorted by bestsellers



example:

mydomain.com/category-33.html?sort_by=bestsellers&sort_order=desc

Try to re-install the Bestsellers module.



(!) Data in the cscart_product_sales table will be lost

[quote name='eComLabs' timestamp='1440149453' post='227467']

Try to re-install the Bestsellers module.



(!) Data in the cscart_product_sales table will be lost

[/quote]



Are you sure?

The table data should be erased?

You can go to phpMyAdmin and run the following query:



ALTER TABLE cscart_product_sales ADD `amount` mediumint(8) unsigned NOT NULL default '0';

[quote name='eComLabs' timestamp='1440151034' post='227479']

You can go to phpMyAdmin and run the following query:



ALTER TABLE cscart_product_sales ADD `amount` mediumint(8) unsigned NOT NULL default '0';


[/quote]



Thanks ecomlabs for reply



run query response:

[img]http://markazkala.com/phpmyadmin/themes/dot.gif[/img] #1060 - Duplicate column name 'amount'



“amount”,“product_id”,“category_id” columns is filled and normal [!]

and repair the table “ok”.



Surprisingly, products block filling by bestsellers in side block is normal work!

I have reviewed the initial query. For some reason the cscart_product_sales is not joined, but the system tries to perform sorting by the column from this table. It is required to examine the issue directly on your server.