Database (Error) in v2.2.5

Hi bros and sis I have moved to amazon ec2 and have some strange thing in the log



Cscart is 2.25 and was working perfect with futurehosting without any error



Thanks a lot Marian



[color=#000000][font=Tahoma, Arial, Verdana,]Error: Unknown column 'cscart_product_sales.amount' in 'order clause' (1054)[/font][/color]

[color=#000000][font=Tahoma, Arial, Verdana,]Query: SELECT SQL_CALC_FOUND_ROWS products.*, descr1.product as product, MIN(prices.price) 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_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = 'EN' 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 = 'EN' WHERE 1 AND cscart_categories.category_id IN (182) AND products.company_id = 0 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, 10[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]

Backtrace››[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]

/var/www/html/core/fn.database.php (db_error): 259

/var/www/html/core/fn.database.php (db_query): 29

/var/www/html/core/fn.catalog.php (db_get_array): 3794

/var/www/html/controllers/customer/categories.php (fn_get_products): 69

/var/www/html/core/fn.control.php (include): 580

/var/www/html/core/fn.control.php (fn_run_controller): 434

/var/www/html/index.php (fn_dispatch): 28[/font][/color]

hi,



it is not about Amazon or smth

It looks like a third-party module or customization which makes products to be sorted by sales amount and at the same time it does not build correct MySQL query to make this sorting.



This issue is needed to be analyzed by specialists so please don't hesitate to contact us.



Best regards,

WSA team

Please create the fix.sql file in the var/database/backup directory, put the following contain there and restore the file from the admin panel:



ALTER TABLE `cscart_product_sales` ADD `amount` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0';

woow thanks a lot I am going to try that btw could be this done because I turned off the Wg Custom Dynamic Search Engine Optimization (CDSEO) ? I think this error in db ?

Hello I did try the restore but nothing has changed at all :-( I installed back the wq toms cdseo but still same



[color=#000000][font=Tahoma, Arial, Verdana,]Error: Unknown column ‘cscart_product_sales.amount’ in ‘order clause’ (1054)[/font][/color]

[color=#000000][font=Tahoma, Arial, Verdana,]Query: SELECT SQL_CALC_FOUND_ROWS products.*, descr1.product as product, MIN(prices.price) 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_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = ‘EN’ 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 = ‘EN’ WHERE 1 AND cscart_categories.category_id IN (174) AND products.company_id = 0 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 asc LIMIT 0, 10[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]

Backtrace››[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]

/var/www/html/core/fn.database.php (db_error): 259

/var/www/html/core/fn.database.php (db_query): 29

/var/www/html/core/fn.catalog.php (db_get_array): 3794

/var/www/html/controllers/customer/categories.php (fn_get_products): 69

/var/www/html/core/fn.control.php (include): 580

/var/www/html/core/fn.control.php (fn_run_controller): 434

/var/www/html/index.php (fn_dispatch): 28[/font][/color]

If I tried backup the db and had a look there, I could see this table in the db

Try this query in this case:



DROP TABLE IF EXISTS cscart_product_sales;
CREATE TABLE `cscart_product_sales` (
`category_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`product_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`amount` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`category_id`,`product_id`),
KEY `pa` (`product_id`,`amount`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;