I'm working on a store running Magento 1.9 with the Amasty Product Feed extension installed. The product feed works well, but it is only pulling the inventory qty for one warehouse. There are four warehouses total, so I am trying to correct this.
I already have a helper file used by other extensions that combines all warehouse qtys. Here is the code to call that helper:
<?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);
}
?>
The /app/code/local/Amasty/Feed/Model/Attribute/Compound/Qty.php file contains this code:
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);
}
}
I am unsure of the best way to populate the Amasty code with my $qty variable. Is anyone familiar with this extension that could help?