一种方法是通过观察目录产品的collection_load_after事件:
<catalog_product_collection_load_after>
<observers>
<Your_Module_Observer>
<type>model</type>
<class>your_module/Observer/class>
<method>modifyPrices</method>
</Your_Module_Observer>
</observers>
</catalog_product_collection_load_after>
Run Code Online (Sandbox Code Playgroud)
然后,您可以遍历集合并获取每个产品的价格,并根据需要进行更改:
$products = $observer->getCollection();
foreach( $products as $product )
{
$product->setPrice( $myCustomPrice );
}
Run Code Online (Sandbox Code Playgroud)
不确定这是否正是您正在寻找的,但希望它指出您正确的方向.