Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. $helper = Mage::helper('warehouse');
  3. $productHelper = Mage::helper('warehouse/catalog_product');
  4. $stockIds = $helper->getStockIds();
  5.  
  6. $qty = 0;
  7.  
  8. foreach ($stockIds as $stockId) {
  9. $qty = $qty + $productHelper->getQuoteMaxQty($_product, $stockId);
  10. }?>
  11.  
  12. class Amasty_Feed_Model_Attribute_Compound_Qty extends Amasty_Feed_Model_Attribute_Compound_Abstract
  13. {
  14. function prepareCollection($collection){
  15. $collection->joinQty();
  16. }
  17.  
  18. function getCompoundData($productData){
  19. return $productData['qty'];
  20. }
  21.  
  22. function hasCondition(){
  23. return true;
  24. }
  25.  
  26. function prepareCondition($collection, $operator, $condVal, &$attributesFields){
  27. $collection->joinQty();
  28.  
  29. $attributesFields[] = array(
  30. 'attribute' => 'qty',
  31. $operator => $condVal
  32. );
  33. }
  34.  
  35. function hasFilterCondition(){
  36. return true;
  37. }
  38.  
  39. function validateFilterCondition($productData, $operator, $valueCode){
  40. return Amasty_Feed_Model_Field_Condition::compare($operator, $productData['qty'], $valueCode);
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement