脚本宝典收集整理的这篇文章主要介绍了php – 在多线程.htaccess之后,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
编辑:到目前为止我们已经尝试过:
>产品被分配到目录中的适当类别/商店.
>产品已启用. (我们尝试过批量启用/禁用)
>产品有数量.
>产品设置为“有库存”
>管理库存操作系统设置为关闭
>显示缺货设置为是.
>正在使用多个网站,并且已将产品分配到目标网站.
>我们已刷新,删除然后禁用缓存
>我们通过管理和命令行重新编制索引.
>我们已经执行了各种var_dumps来检查正确的商店ID
>我们已检查USER_NOT_LOGGED_IN的数据库组.它应该是0.
>如果您直接导航到产品,产品会知道它们所在的商店和功能.
>我们运行了一个数据库修复工具
>我们运行数据库与新数据库工具进行比较. (这发现了两个小的索引问题)我们再次重新编制索引,但没有运气.
>我们已禁用缓存关闭的每个非必要模块.
我们只是得到一个“没有与选择相匹配的产品”.类别视图中的错误.
编辑#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
我已经比较了所有三个查询并稍微使用了它们.我发现看来我的catalog_product_index_price表似乎缺少了90%的产品和每个不是商店id = 1的产品
我可以通过SQL查询提取商店ID为1的任何产品.其他一切都失败了.我手动验证了传递的值. catalog_product_index_price表中不存在这些产品.
现在怎么办?我试过数据库修复工具……
编辑#4
Stock_ID来自Multi-Warehouse,我们用来管理航运区域的innoexts插件.
<?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
在本机EE 1.12中,catalog_product_index_price表没有stock_id列.
这让我觉得有人在某种程度上改变了代码来添加它:我会调查代码以查看它的来源,并从那里采取措施来解决这个问题
HTH
以上是脚本宝典为你收集整理的php – 在多线程.htaccess之后,Magento中的类别视图(仅)中缺少产品全部内容,希望文章能够帮你解决php – 在多线程.htaccess之后,Magento中的类别视图(仅)中缺少产品所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。