Example #1
0
 /**
  * @param null|Varien_Object $dataObject the data object to use
  * @return Xcom_Xfabric_Model_Message_Request the outbound message
  */
 public function _prepareData(Varien_Object $dataObject = null)
 {
     $avroDataObject = Mage::getModel('xcom_chronicle/message_inventory_stock_item', array('stock_item' => $dataObject->getStockItem(), 'product_sku' => $dataObject->getProductSku()));
     $data = array('stockItems' => array($avroDataObject->toArray()));
     $this->setMessageData($data);
     return parent::_prepareData($dataObject);
 }
 public function render(Varien_Object $row)
 {
     $orderedQty = $row->getordered_qty();
     $stock = $row->getstock();
     if ($stock == '') {
         $stock = $row->getqty();
     }
     if ($stock == '') {
         if ($row->getStockItem()) {
             $stock = $row->getStockItem()->getQty();
         }
     }
     $retour = (int) $stock - (int) $orderedQty;
     if ($retour <= 0) {
         $retour = "0";
     }
     return $retour;
 }