Related
This query:
sqldf("select * from dataset2 where timeA='2016-11-29 08:00:00' or timeA='2016-11-29 09:00:00' or timeA='2016-11-29 10:00:00' or timeA='2016-11-29 11:00:00' or timeA='2016-11-29 12:00:00' and id<900000", method="dataset2")
produces this result:
[1] number id location timearriving timeleaving timeA timeL person
<0 rows> (or 0-length row.names)
But instead it should give me some rows. Is the syntax of the query wrong or there is something else I didn't notice?
I also tried modifying the query by putting .000 at the end of timeA like this: timeA='2016-11-29 08:00:00.000' but its still the same result with no rows shown.
Here is a sample of the dataset:
number,id,location,timearriving,timeleaving,timeA,timeL,person
223248,124924,1002.18G,NULL,NULL,2016-11-28 08:00:00.000,2016-11-28 10:00:00.000,Student
223268,124425,SK-2.04,09:02:28,NULL,2016-11-28 09:00:00.000,2016-11-28 10:00:00.000,Student
223269,123366,SK-2.07,NULL,NULL,2016-11-28 10:00:00.000,2016-11-28 13:00:00.000,Student
223419,900234,1002.18G,07:57:13,09:50:41,2016-11-29 08:00:00.000,2016-11-29 10:00:00.000,Teacher
223419,124924,1002.18G,NULL,NULL,2016-11-29 08:00:00.000,2016-11-29 10:00:00.000,Student
223419,124510,1002.18G,08:06:54,NULL,2016-11-29 08:00:00.000,2016-11-29 10:00:00.000,Student
223419,124509,1002.18G,08:06:52,NULL,2016-11-29 08:00:00.000,2016-11-29 10:00:00.000,Student
223443,123398,101-01,NULL,NULL,2016-11-29 10:00:00.000,2016-11-29 12:00:00.000,Student
223443,123375,101-01,09:59:01,NULL,2016-11-29 10:00:00.000,2016-11-29 12:00:00.000,Student
223439,122904,1002.05,NULL,NULL,2016-11-29 09:00:00.000,2016-11-29 10:00:00.000,Student
223439,122903,1002.05,NULL,NULL,2016-11-29 09:00:00.000,2016-11-29 10:00:00.000,Student
223439,122887,1002.05,NULL,NULL,2016-11-29 09:00:00.000,2016-11-29 10:00:00.000,Student
223439,122875,1002.05,NULL,NULL,2016-11-29 09:00:00.000,2016-11-29 10:00:00.000,Student
223439,120742,1002.05,NULL,NULL,2016-11-29 09:00:00.000,2016-11-29 10:00:00.000,Student
223440,900213,1002.04,NULL,NULL,2016-11-29 10:00:00.000,2016-11-29 11:00:00.000,Teacher
224272,123324,SK-2.04,12:01:53,NULL,2016-12-06 12:00:00.000,2016-12-06 14:00:00.000,Student
224307,124345,101-05,NULL,NULL,2016-12-06 13:00:00.000,2016-12-06 14:00:00.000,Student
224307,124334,101-05,NULL,NULL,2016-12-06 13:00:00.000,2016-12-06 14:00:00.000,Student
224307,124321,101-05,13:04:34,NULL,2016-12-06 13:00:00.000,2016-12-06 14:00:00.000,Student
224307,124312,101-05,12:55:26,NULL,2016-12-06 13:00:00.000,2016-12-06
I have a set of tweets where I want to calculate the number of replies a user got using Pig.
My pig script looks like (Assuming y1 has the required json):
y2 = GROUP y1 BY in_reply_to_user_id_str;
y3 = FOREACH y2 GENERATE group AS in_reply_to_user_id_str, COUNT(y1) AS number_of_replies_to_user;
y4 = FOREACH y3 GENERATE in_reply_to_user_id_str, number_of_replies_to_user;
y5 = JOIN y1 BY user_id LEFT OUTER, y4 BY in_reply_to_user_id_str;
STORE y5 INTO '$DATA_OUTPUT' USING JsonStorage()
Now, my output looks like:
{"y1::user_id":"9642792"............"y4::in_reply_to_user_id_str":"9642792","y4::number_of_replies_to_user":1}
Whereeas I was expecting something like:
{"user_id":"9642792"..............."number_of_replies_to_user":1}
I donot want the alias names y1 and y5. I deleted some unwanted fields that are not required to answer the question, just to make it more readable.
How can I do that? My Pig version (0.15) does not support $0...
Also, is there a better way of calculating this value? SQL seems very straight forward but Pig is really confusing.
Add an additional step to generate the fields you need from y5 and then store the resulting y6 relation
y5 = JOIN y1 BY user_id LEFT OUTER, y4 BY in_reply_to_user_id_str;
y6 = FOREACH y5 GENERATE y1::$0,y1::$1,y1::$2,..........y4::$0,y4::$1;
STORE y6 INTO '$DATA_OUTPUT' USING JsonStorage();
I have data in csv format as shown below.
The data has the below format
"first_name","last_name","company_name","address","city","county","postal","phone1","phone2","email","web"
The sample data named under User.csv. The file contains below data.
"Aleshia","Tomkiewicz","Alan D Rosenburg Cpa Pc","14, Taylor St","St. Stephens Ward","Kent","CT2 7PP","01835-703597","01944-369967","atomkiewicz#hotmail.com","http://www.alandrosenburgcpapc.co.uk"
"Evan","Zigomalas","Cap Gemini America","5, Binney St","Abbey Ward","Buckinghamshire","HP11 2AX","01937-864715","01714-737668","evan.zigomalas#gmail.com","http://www.capgeminiamerica.co.uk"
"France","Andrade","Elliott, John W Esq","8 Moor Place","East Southbourne and Tuckton W","Bournemouth","BH6 3BE","01347-368222","01935-821636","france.andrade#hotmail.com","http://www.elliottjohnwesq.co.uk"
When I try the same to load using PigStorage
user = LOAD '/home/abhijit/Downloads/User.csv' USING PigStorage(',');
DUMP user;
The output of it is like :
("Aleshia","Tomkiewicz","Alan D Rosenburg Cpa Pc","14 Taylor St","St. Stephens Ward","Kent","CT2 7PP","01835-703597","01944-369967","atomkiewicz#hotmail.com","http://www.alandrosenburgcpapc.co.uk")
("Evan","Zigomalas","Cap Gemini America","5, Binney St","Abbey Ward","Buckinghamshire","HP11 2AX","01937-864715","01714-737668","evan.zigomalas#gmail.com","http://www.capgeminiamerica.co.uk")
("France","Andrade","Elliott, John W Esq","8 Moor Place","East Southbourne and Tuckton W","Bournemouth","BH6 3BE","01347-368222","01935-821636","france.andrade#hotmail.com","http://www.elliottjohnwesq.co.uk")
I want to do a group by on city. So I have written
grp = group user by $4;
dump grp;
I get the output as :
( Binney St",{("Evan","Zigomalas","Cap Gemini America","5, Binney St","Abbey Ward","Buckinghamshire","HP11 2AX","01937-864715","01714-737668","evan.zigomalas#gmail.com","http://www.capgeminiamerica.co.uk")})
("8 Moor Place",{("France","Andrade","Elliott, John W Esq","8 Moor Place","East Southbourne and Tuckton W","Bournemouth","BH6 3BE","01347-368222","01935-821636","france.andrade#hotmail.com","http://www.elliottjohnwesq.co.uk")})
("St. Stephens Ward",{("Aleshia","Tomkiewicz","Alan D Rosenburg Cpa Pc","14 Taylor St","St. Stephens Ward","Kent","CT2 7PP","01835-703597","01944-369967","atomkiewicz#hotmail.com","http://www.alandrosenburgcpapc.co.uk")})
The company_name and address is creating a problem as it contains ',' as part of it. for example "14, Taylor St" in address or "Elliott, John W Esq" in company_name.
so my $4 is treated for "Taylor St" and not the "St. Stephens Ward"
So because of the extra delimiter in the address data or the company_name data is not loaded properly or seperated properly and the group by fuction is not giving correct result.
How can I achieve the group by output as below
("Abbey Ward",{("Evan","Zigomalas","Cap Gemini America","5, Binney St","Abbey Ward","Buckinghamshire","HP11 2AX","01937-864715","01714-737668","evan.zigomalas#gmail.com","http://www.capgeminiamerica.co.uk")})
("St. Stephens Ward",{("Aleshia","Tomkiewicz","Alan D Rosenburg Cpa Pc","14, Taylor St","St. Stephens Ward","Kent","CT2 7PP","01835-703597","01944-369967","atomkiewicz#hotmail.com","http://www.alandrosenburgcpapc.co.uk")})
("East Southbourne and Tuckton W",{("France","Andrade","Elliott, John W Esq","8 Moor Place","East Southbourne and Tuckton W","Bournemouth","BH6 3BE","01347-368222","01935-821636","france.andrade#hotmail.com","http://www.elliottjohnwesq.co.uk")})
grp = group a by $5 ;
It won't be the solution for me. I already thought of it.
The problem is that PigStorage does not take escaping into account, so creates columns for fields that should not be columns (each time an entry contains a comma).
Using CSVExcelStorage will solve this as this storage can deal with escaping, thus creating the right amount and sequence of columns.
When I use the dropdown and select sort by "New Products" which is:
?dir=asc&limit=8&order=newest, the site gives the usual:
"There has been an error processing your request
Exception printing is disabled by default for security reasons."
The report contains this:
a:5:{i:0;s:864:"SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `mage_catalog_product_entity` AS `e`
INNER JOIN `mage_catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '13' AND cat_index.is_parent=1
INNER JOIN `mage_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 ORDER BY `FIElD(e`.`entity_id, -1) DESC, created_at` DESC LIMIT 10
";i:1;s:5523:"#0 /home/mexicanos/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/mexicanos/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/mexicanos/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/mexicanos/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `e`.*, `...', Array)
#4 /home/mexicanos/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `e`.*, `...', Array)
#5 /home/mexicanos/public_html/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `e`.*, `...', Array)
#6 /home/mexicanos/public_html/lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECT `e`.*, `...', Array)
#7 /home/mexicanos/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1045): Varien_Data_Collection_Db->_fetchAll('SELECT `e`.*, `...')
#8 /home/mexicanos/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#9 /home/mexicanos/public_html/app/code/core/Mage/Review/Model/Observer.php(78): Mage_Eav_Model_Entity_Collection_Abstract->load()
#10 /home/mexicanos/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Review_Model_Observer->catalogBlockProductCollectionBeforeToHtml(Object(Varien_Event_Observer))
#11 /home/mexicanos/public_html/app/code/core/Mage/Core/Model/App.php(1311): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Review_Model_Observer), 'catalogBlockPro...', Object(Varien_Event_Observer))
#12 /home/mexicanos/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('catalog_block_p...', Array)
#13 /home/mexicanos/public_html/app/code/core/Mage/Catalog/Block/Product/List.php(164): Mage::dispatchEvent('catalog_block_p...', Array)
#14 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Catalog_Block_Product_List->_beforeToHtml()
#15 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#16 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('product_list', true)
#17 /home/mexicanos/public_html/app/code/core/Mage/Catalog/Block/Category/View.php(90): Mage_Core_Block_Abstract->getChildHtml('product_list')
#18 /home/mexicanos/public_html/app/design/frontend/base/default/template/catalog/category/view.phtml(70): Mage_Catalog_Block_Category_View->getProductListHtml()
#19 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mexica...')
#20 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/base/d...')
#21 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#22 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#23 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#24 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#25 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#26 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#27 /home/mexicanos/public_html/app/design/frontend/mexicanos/default/template/page/2columns-left.phtml(57): Mage_Core_Block_Abstract->getChildHtml('content')
#28 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mexica...')
#29 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/mexica...')
#30 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#31 /home/mexicanos/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#32 /home/mexicanos/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#33 /home/mexicanos/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#34 /home/mexicanos/public_html/app/code/core/Mage/Catalog/controllers/CategoryController.php(161): Mage_Core_Controller_Varien_Action->renderLayout()
#35 /home/mexicanos/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_CategoryController->viewAction()
#36 /home/mexicanos/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#37 /home/mexicanos/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#38 /home/mexicanos/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#39 /home/mexicanos/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#40 /home/mexicanos/public_html/index.php(87): Mage::run('', 'store')
#41 {main}";s:3:"url";s:36:"/food/raw.html?dir=asc&order=newest";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
but if I order using any other option like by price, position, name it works. I've already spent 2 hours searching for a solution, nothing seems to work: I cleared cache, restored old database and still no success and I don't understand why only that option doesn't work. Any help would be appreciated. Thank you!
I checked your report in it Query, check back quote(`) given in the query in
**ORDER BY FIELD(`e`.`entity_id`, -1) DESC, `created_at` DESC LIMIT 10**
Seem you modify Magento or some plugin so I don't know exactly how to resolve it. But in query ' FIElD(e.entity_id, -1) DESC, created_at' this segment is wrong.
Please search this text FIElD(e.entity_id, -1) and remove it. Or simpler, you can rollback everything and try this solution if you want to sort product by newest
http://magebase.com/magento-tutorials/magento-sort-by-newest-products-made-easy/
Try this extension http://www.magentocommerce.com/magento-connect/sort-by-date.html. This may help you.
Or you can do it using "created_at" attribute.
http://yourdomain.com/category/sort-by/created_at/sort-direction/asc.html
I have two exactly same sites, one is on local machine and one is live. When I'm trying to get best products into right sidebar the one that is on local machine is working fine but the live site throws the following error
a:5:{i:0;s:2382:"SELECT SUM(order_items.qty_ordered) AS `ordered_qty`, `order_items`.`name` AS `order_items_name`, `order_items`.`product_id` AS `entity_id`, `e`.`entity_type_id`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`sku`, `e`.`has_options`, `e`.`required_options`, `e`.`created_at`, `e`.`updated_at`, `e`.`entity_id`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`cost`, `e`.`created_at`, `e`.`enable_googlecheckout`, `e`.`gift_message_available`, `e`.`has_options`, `e`.`image_label`, `e`.`is_imported`, `e`.`is_recurring`, `e`.`links_exist`, `e`.`links_purchased_separately`, `e`.`links_title`, `e`.`name`, `e`.`news_from_date`, `e`.`news_to_date`, `e`.`price`, `e`.`price_type`, `e`.`price_view`, `e`.`recurring_profile`, `e`.`required_options`, `e`.`shipment_type`, `e`.`short_description`, `e`.`sku`, `e`.`sku_type`, `e`.`small_image`, `e`.`small_image_label`, `e`.`special_from_date`, `e`.`special_price`, `e`.`special_to_date`, `e`.`tax_class_id`, `e`.`thumbnail`, `e`.`thumbnail_label`, `e`.`updated_at`, `e`.`url_key`, `e`.`url_path`, `e`.`visibility`, `e`.`weight`, `e`.`weight_type`, `e`.`msrp`, `e`.`msrp_display_actual_price_type`, `e`.`msrp_enabled`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `e`.`name`, `e`.`price`, `e`.`small_image`, `cat_index`.`position` AS `cat_index_position` FROM `sales_flat_order_item` AS `order_items`
INNER JOIN `sales_flat_order` AS `order` ON `order`.entity_id = order_items.order_id AND `order`.state 'canceled'
LEFT JOIN `catalog_product_entity` AS `e` ON (e.type_id NOT IN ('grouped', 'configurable', 'bundle')) AND e.entity_id = order_items.product_id AND e.entity_type_id = 4
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '2' WHERE (parent_item_id IS NULL) GROUP BY `order_items`.`product_id` HAVING (SUM(order_items.qty_ordered) > 0) ORDER BY `ordered_qty` desc LIMIT 9
";i:1;s:5232:"#0 /var/www/vhosts/.../httpdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/vhosts/.../httpdocs/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/vhosts/.../httpdocs/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /var/www/vhosts/.../httpdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT SUM(orde...', Array)
#4 /var/www/vhosts/.../httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT SUM(orde...', Array)
#5 /var/www/vhosts/.../httpdocs/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query('SELECT SUM(orde...', Array)
#6 /var/www/vhosts/.../httpdocs/lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECT SUM(orde...', Array)
#7 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1047): Varien_Data_Collection_Db->_fetchAll('SELECT SUM(orde...')
#8 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#9 /var/www/vhosts/.../httpdocs/lib/Varien/Data/Collection.php(752): Mage_Eav_Model_Entity_Collection_Abstract->load()
#10/var/www/vhosts/.../httpdocs/app/design/frontend/default/ma_pharmacy/template/magentothem/bestsellerproductvertscroller/bestsellerright.phtml(42): Varien_Data_Collection->count()
#11 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/vhosts...')
#12 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#13 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#14 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Abstract.php(886): Mage_Core_Block_Template->_toHtml()
#15 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#16 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Abstract.php(886): Mage_Core_Block_Text_List->_toHtml()
#17 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Abstract.php(605): Mage_Core_Block_Abstract->toHtml()
#18 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Abstract.php(549): Mage_Core_Block_Abstract->_getChildHtml('right', true)
#19 /var/www/vhosts/.../httpdocs/app/design/frontend/default/ma_pharmacy/template/page/2columns-right.phtml(59): Mage_Core_Block_Abstract->getChildHtml('right')
#20 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/vhosts...')
#21 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#22 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#23 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Abstract.php(886): Mage_Core_Block_Template->_toHtml()
#24 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#25 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#26 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#27 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#28 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#29 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#30/var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#31 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#32 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#33 /var/www/vhosts/.../httpdocs/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#34 /var/www/vhosts/.../httpdocs/index.php(87): Mage::run('', 'store')
#35 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
I don't quite understand where is the problem. Would appreciate some help, where should I look.
Thanks a lot.
use this steps
system->config->catalog->frontend
set Use Flat Catalog Category, Use Flat Catalog Product both to no.
It works for me.
As I said above the issue was in ->addOrderedQty() and ->setOrder('ordered_qty', 'desc') the fix can be found here Magento 1.7 sorting by ordered quantity - bestseller products issues