在启用 FPC 的 magento ee 1.12.0 上的任何产品页面上都会出现相同的追加销售产品
The same upsell products appear at any product page on magento ee 1.12.0 with FPC enabled
我不是 100% 确定,但这似乎是 magento 为 up-sell/related 产品内置的打孔实现中的一个错误。
我查看了代码,发现 upsell/related 产品的容器取决于客户会话,而不是当前查看的产品。
Class 负责 upsell/related 个名为 Enterprise_PageCache_Model_Container_CatalogProductList
的产品缓存,它扩展了 Enterprise_PageCache_Model_Container_Advanced_Quote
。此 class (CatalogProductList) 不会覆盖 _getCacheId
和 _getAdditionalCacheId
方法。因此,此缓存仅取决于客户的会话,因此每当任何访问者访问尚未在缓存中的产品页面时,magento 都会为该特定产品重建加售块,然后在该客户的每个产品页面上使用它。
作为临时解决方案,我将以下方法添加到 CatalogProductList class 中,它解决了问题。我知道这是一个糟糕的解决方案,我会改变它,但我想问问是否有人遇到过这样的问题,解决方案是什么。
添加的方法是
public function applyWithoutApp(&$content)
{
return false;
}
在我看来,Magento EE 将布局中的标准 product.info.upsell
和 catalog.product.related
块替换为 design/frontend/enterprise/default/layout/targetrule.xml
中 Enterprise_TargetRule
扩展的版本:
<catalog_product_view>
<reference name="product.info">
<!-- remove name="catalog.product.related" / -->
<block type="enterprise_targetrule/catalog_product_list_related" name="catalog.product.related" as="relatedProducts" template="targetrule/catalog/product/list/related.phtml">
<action method="setColumnCount"><columns>3</columns></action>
<block type="enterprise_targetrule/catalog_product_item" name="catalog.product.related.item" template="targetrule/catalog/product/list/related/item.phtml" />
</block>
<!-- remove name="product.info.upsell" / -->
<block type="enterprise_targetrule/catalog_product_list_upsell" name="product.info.upsell" as="upsell_products" template="targetrule/catalog/product/list/upsell.phtml">
<action method="setColumnCount"><columns>4</columns></action>
<block type="enterprise_targetrule/catalog_product_item" name="catalog.product.upsell.item" template="targetrule/catalog/product/list/upsell/item.phtml" />
</block>
</reference>
</catalog_product_view>
对我来说突出的是它针对旧版本 catalog/product_list_related
和 catalog/product_list_upsell
使用 Enterprise_PageCache_Model_Container_CatalogProductList
容器:
<catalog_product_list_related>
<block>catalog/product_list_related</block>
<name>catalog.product.related</name>
<placeholder>CATALOG_PRODUCT_LIST_RELATED</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductList</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_list_related>
<catalog_product_list_upsell>
<block>catalog/product_list_upsell</block>
<name>product.info.upsell</name>
<placeholder>CATALOG_PRODUCT_LIST_UPSELL</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductList</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_list_upsell>
但它也针对它使用更复杂的容器创建的新块 Enterprise_PageCache_Model_Container_CatalogProductItem
,该容器确实将产品包含在缓存键中:
<catalog_product_item_related>
<block>enterprise_targetrule/catalog_product_item</block>
<name>catalog.product.related.item</name>
<placeholder>CATALOG_PRODUCT_ITEM_RELATED</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductItem</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_item_related>
<catalog_product_item_upsell>
<block>enterprise_targetrule/catalog_product_item</block>
<name>catalog.product.upsell.item</name>
<placeholder>CATALOG_PRODUCT_ITEM_UPSELL</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductItem</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_item_upsell>
因此,这让我想知道您是否将 targetrule.xml
中的那些布局更新包含在您当前的主题中?如果不是,那就可以解释为什么使用旧块而不是新块。
我不是 100% 确定,但这似乎是 magento 为 up-sell/related 产品内置的打孔实现中的一个错误。
我查看了代码,发现 upsell/related 产品的容器取决于客户会话,而不是当前查看的产品。
Class 负责 upsell/related 个名为 Enterprise_PageCache_Model_Container_CatalogProductList
的产品缓存,它扩展了 Enterprise_PageCache_Model_Container_Advanced_Quote
。此 class (CatalogProductList) 不会覆盖 _getCacheId
和 _getAdditionalCacheId
方法。因此,此缓存仅取决于客户的会话,因此每当任何访问者访问尚未在缓存中的产品页面时,magento 都会为该特定产品重建加售块,然后在该客户的每个产品页面上使用它。
作为临时解决方案,我将以下方法添加到 CatalogProductList class 中,它解决了问题。我知道这是一个糟糕的解决方案,我会改变它,但我想问问是否有人遇到过这样的问题,解决方案是什么。
添加的方法是
public function applyWithoutApp(&$content)
{
return false;
}
在我看来,Magento EE 将布局中的标准 product.info.upsell
和 catalog.product.related
块替换为 design/frontend/enterprise/default/layout/targetrule.xml
中 Enterprise_TargetRule
扩展的版本:
<catalog_product_view>
<reference name="product.info">
<!-- remove name="catalog.product.related" / -->
<block type="enterprise_targetrule/catalog_product_list_related" name="catalog.product.related" as="relatedProducts" template="targetrule/catalog/product/list/related.phtml">
<action method="setColumnCount"><columns>3</columns></action>
<block type="enterprise_targetrule/catalog_product_item" name="catalog.product.related.item" template="targetrule/catalog/product/list/related/item.phtml" />
</block>
<!-- remove name="product.info.upsell" / -->
<block type="enterprise_targetrule/catalog_product_list_upsell" name="product.info.upsell" as="upsell_products" template="targetrule/catalog/product/list/upsell.phtml">
<action method="setColumnCount"><columns>4</columns></action>
<block type="enterprise_targetrule/catalog_product_item" name="catalog.product.upsell.item" template="targetrule/catalog/product/list/upsell/item.phtml" />
</block>
</reference>
</catalog_product_view>
对我来说突出的是它针对旧版本 catalog/product_list_related
和 catalog/product_list_upsell
使用 Enterprise_PageCache_Model_Container_CatalogProductList
容器:
<catalog_product_list_related>
<block>catalog/product_list_related</block>
<name>catalog.product.related</name>
<placeholder>CATALOG_PRODUCT_LIST_RELATED</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductList</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_list_related>
<catalog_product_list_upsell>
<block>catalog/product_list_upsell</block>
<name>product.info.upsell</name>
<placeholder>CATALOG_PRODUCT_LIST_UPSELL</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductList</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_list_upsell>
但它也针对它使用更复杂的容器创建的新块 Enterprise_PageCache_Model_Container_CatalogProductItem
,该容器确实将产品包含在缓存键中:
<catalog_product_item_related>
<block>enterprise_targetrule/catalog_product_item</block>
<name>catalog.product.related.item</name>
<placeholder>CATALOG_PRODUCT_ITEM_RELATED</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductItem</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_item_related>
<catalog_product_item_upsell>
<block>enterprise_targetrule/catalog_product_item</block>
<name>catalog.product.upsell.item</name>
<placeholder>CATALOG_PRODUCT_ITEM_UPSELL</placeholder>
<container>Enterprise_PageCache_Model_Container_CatalogProductItem</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_product_item_upsell>
因此,这让我想知道您是否将 targetrule.xml
中的那些布局更新包含在您当前的主题中?如果不是,那就可以解释为什么使用旧块而不是新块。