我有两个完全相同的网站,一个在本地机器上,一个在线。当我试图将最好的产品放到右侧边栏时,本地机器上的产品工作正常,但实时网站会引发以下错误
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
&#34 ;; 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。 ..',数组)
#4 /var/www/vhosts/.../httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(428):Zend_Db_Adapter_Pdo_Abstract-> query(' SELECT SUM(orde。 ..',数组)
#5 /var/www/vhosts/.../httpdocs/lib/Zend/Db/Adapter/Abstract.php(734):Varien_Db_Adapter_Pdo_Mysql->查询(' SELECT SUM(orde ... ',数组)
#6 /var/www/vhosts/.../httpdocs/lib/Varien/Data/Collection/Db.php(734):Zend_Db_Adapter_Abstract-> fetchAll(' SELECT SUM(orde ... ',数组)
#7 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1047):Varien_Data_Collection_Db-> _fetchAll(&#39) ; 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。 ..&#39)
#12 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(272):Mage_Core_Block_Template-> fetchView(' frontend / defaul) ...&#39)
#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&#39 ;,真实)
#19 /var/www/vhosts/.../httpdocs/app/design/frontend/default/ma_pharmacy/template/page/2columns-right.phtml(59):Mage_Core_Block_Abstract-> getChildHtml(&#39)右&#39)
#20 /var/www/vhosts/.../httpdocs/app/code/core/Mage/Core/Block/Template.php(241):include(' / var / www / vhosts。 ..&#39)
#p /#/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / ...&#39)#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),&# 39;家用&#39)
#28 /var/www/vhosts /.../httpdocs/app/code/core/Mage/Cms/controllers/IndexController.php(45):Mage_Cms_Helper_Page-> renderPage(Object(Mage_Cms_IndexController),&# 39;家用&#39)
#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(&#39) ;索引&#39)
#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}&#34 ;; s:3:" url&#34 ;; s:1:" /&#34 ;; s:11:" script_name&# 34 ;; S:10:" /index.php" ;; S:4:"皮肤&#34 ;; S:7:"默认&#34 ;;}
我不太清楚问题出在哪里。我会感激一些帮助,我应该在哪里看。
非常感谢。
答案 0 :(得分:2)
使用此步骤
system->config->catalog->frontend
将Use Flat Catalog Category
,Use Flat Catalog Product
设置为否。
它对我有用。
答案 1 :(得分:0)
正如我上面所说,问题出在 - > addOrderedQty()和 - > setOrder(' ordered_qty',' desc')修复程序可以在这里找到{{3 }}