php – 在多线程.htaccess之后,Magento中的类别视图(仅)中缺少产
我正在为已经活跃的Magento网站添加额外的网站/店面.
在开发网站上进行设置时,我注意到每当我放入多线圈的.htaccess代码时,所有产品都会从类别视图中消失.但是,我仍然可以通过直接链接获取产品,例如my-domain.com/category/product. 这是我正在使用的.htaccess代码: ## Storefronts # Main Store SetEnvIf Host www.my-domain.com MAGE_RUN_CODE=main-store_code SetEnvIf Host www.my-domain.com MAGE_RUN_TYPE=website SetEnvIf Host ^my-domain.com MAGE_RUN_CODE=main-store_code SetEnvIf Host ^my-domain.com MAGE_RUN_TYPE=website # Second Store SetEnvIf Host second-store.my-domain.com MAGE_RUN_CODE=second_store_code SetEnvIf Host second-store.my-domain.com MAGE_RUN_TYPE=website 我已经设置子域以使用根Magento安装作为其基本目录. Multistore工作,我可以更改主题,设置,产品等. 我已经仔细地浏览了这里看到的所有内容,至少5次:accepted answer has a category troubleshooting checklist 有没有人想知道什么可能导致产品在前端可用而不是在类别视图中?我们正在运行Magento Enterprise 1.12.0.2 编辑:到目前为止我们已经尝试过: >产品被分配到目录中的适当类别/商店. 我们只是得到一个“没有与选择相匹配的产品”.类别视图中的错误. 编辑#2这些是来自list.php故障排除的SQL语句,OSdave指出: 我认为注意到前端没有使用默认存储也是有利的.它只是我们用来导入产品的基础.可见的店面可以在上面的.htaccess文件中看到. #Base store (1)(this works): 2013-10-03T14:12:48+00:00 DEBUG (7): 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 `catalog_product_entity` AS `e` 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='3' 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 ORDER BY `cat_index`.`position` ASC LIMIT 10 #This is from the store2 store (MAGE_RUN_CODE=main-store_code): 2013-10-03T13:35:38+00:00 DEBUG (7): SELECT `e`.*,`price_index`.`tier_price` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=2 AND cat_index.visibility IN(2,4) AND cat_index.category_id='3' INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '2' AND price_index.customer_group_id = 0 AND price_index.stock_id = 15 ORDER BY `cat_index`.`position` ASC LIMIT 10 #This is from the store3 store (RUN_CODE=second_store_code): 2013-10-03T14:48:05+00:00 DEBUG (7): SELECT `e`.*,`price_index`.`tier_price` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=3 AND cat_index.visibility IN(2,4) AND cat_index.category_id='37' INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '2' AND price_index.customer_group_id = 0 AND price_index.stock_id = 1 ORDER BY `cat_index`.`position` ASC LIMIT 9 我在调查差异.乍一看,我注意到网站ID可能已关闭. 编辑#3 我可以通过SQL查询提取商店ID为1的任何产品.其他一切都失败了.我手动验证了传递的值. catalog_product_index_price表中不存在这些产品. 现在怎么办?我试过数据库修复工具…… 编辑#4 解决方法
消息“没有与选择匹配的产品”.如果产品集合为空,则显示:
应用程序/设计/前端/碱/默认/模板/目录/产品/ list.phtml: <?php $_productCollection=$this->getLoadedProductCollection(); $_helper = $this->helper('catalog/output'); ?> <?php if(!$_productCollection->count()): ?> <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p> <?php else: ?> 如您所见,通过getLoadedProductCollection()方法检索产品集合,该方法在app / code / core / Mage / Catalog / Block / Product / List.php中定义(如果不覆盖): public function getLoadedProductCollection() { return $this->_getProductCollection(); } 为了确定什么是错误,暂时编辑这个文件并在返回之前添加一个mysql查询的日志,即: public function getLoadedProductCollection() { Mage::log($this->_getProductCollection()->getSelect()->assemble(),null,'product_collection.log',TRUE); return $this->_getProductCollection(); } 加载类别并转到MAGENTO_ROOT / var / log /并打开product_collection.log文件.在那里你会看到执行的mysql查询. 既然你有mysql查询,我们就可以继续了.有效的查询(第一个)与其他查询之间存在一个区别:AND price_index.stock_id = 1 HTH (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |