我正在一家运行Magento 1.9的商店中安装了Amasty产品Feed扩展。产品Feed运作良好,但仅能拉动一个仓库的库存数量。一共有四个仓库,所以我正在尝试纠正这个问题。
我已经有一个由其他扩展程序使用的帮助程序文件,该文件结合了所有仓库数量。这是调用该助手的代码:
<?php
$helper = Mage::helper('warehouse');
$productHelper = Mage::helper('warehouse/catalog_product');
$stockIds = $helper->getStockIds();
$qty = 0;
foreach ($stockIds as $stockId) {
$qty = $qty + $productHelper->getQuoteMaxQty($_product, $stockId);
}
?>
/app/code/local/Amasty/Feed/Model/Attribute/Compound/Qty.php文件包含以下代码:
class Amasty_Feed_Model_Attribute_Compound_Qty extends Amasty_Feed_Model_Attribute_Compound_Abstract
{
function prepareCollection($collection){
$collection->joinQty();
}
function getCompoundData($productData){
return $productData['qty'];
}
function hasCondition(){
return true;
}
function prepareCondition($collection, $operator, $condVal, &$attributesFields){
$collection->joinQty();
$attributesFields[] = array(
'attribute' => 'qty',
$operator => $condVal
);
}
function hasFilterCondition(){
return true;
}
function validateFilterCondition($productData, $operator, $valueCode){
return Amasty_Feed_Model_Field_Condition::compare($operator, $productData['qty'], $valueCode);
}
}
我不确定用$ qty变量填充Amasty代码的最佳方法。有人熟悉此扩展程序可以提供帮助吗?