Showing posts with label How to Access key values from Magento's getData() method. Show all posts
Showing posts with label How to Access key values from Magento's getData() method. Show all posts

Thursday, 25 April 2013

Magento - How to Access key values from Magento->getData() method?

 - If we want to get values from Magento->getData() method return array,


$_items = $order->getItemsCollection();

foreach ($_items as $one_item) {

            Zend_Debug::dump($one_item->getData()); 
}

for above we got respons like below,

array(82) {
  ["item_id"] => string(2) "58"
  ["order_id"] => string(2) "45"
  ["parent_item_id"] => NULL
  ["quote_item_id"] => string(2) "61"
  ["store_id"] => string(1) "1"
  ["created_at"] => string(19) "2012-11-21 07:14:43"
  ["updated_at"] => string(19) "2012-11-21 07:14:43"
  ["product_id"] => string(2) "52"
  ["product_type"] => string(6) "simple"
  ["product_options"] => string(179) "a:1:{s:15:"infost";a:3:{s:4:"uc";s:88:"aHR,,";s:7:"product";s:2:"52";s:3:"qty";i:1;}}"
  ["weight"] => string(7) "50.0000"
  ["is_virtual"] => string(1) "0"
  ["sku"] => string(4) "1112"
  ["name"] => string(5) "Chair"
  ["description"] => NULL
  ["applied_rule_ids"] => NULL
  ["additional_data"] => NULL
  ["free_shipping"] => string(1) "0"
  ["is_qty_decimal"] => string(1) "0"
  ["no_discount"] => string(1) "0"
  ["qty_backordered"] => NULL
  ["qty_canceled"] => string(6) "0.0000"
  ["qty_invoiced"] => string(6) "0.0000"
  ["qty_ordered"] => string(6) "1.0000"
  ["qty_refunded"] => string(6) "0.0000"
  ["qty_shipped"] => string(6) "0.0000"
  ["base_cost"] => string(7) "50.0000"
  ["price"] => string(8) "129.9900"
  ["base_price"] => string(8) "129.9900"
  ["original_price"] => string(8) "129.9900"
  ["base_original_price"] => string(8) "129.9900"
  ["tax_percent"] => string(6) "0.0000"
  ["tax_amount"] => string(6) "0.0000"
  ["base_tax_amount"] => string(6) "0.0000"
  ["tax_invoiced"] => string(6) "0.0000"
  ["base_tax_invoiced"] => string(6) "0.0000"
  ["discount_percent"] => string(6) "0.0000"
  ["discount_amount"] => string(6) "0.0000"
  ["base_discount_amount"] => string(6) "0.0000"
  ["discount_invoiced"] => string(6) "0.0000"
  ["base_discount_invoiced"] => string(6) "0.0000"
  ["amount_refunded"] => string(6) "0.0000"
  ["base_amount_refunded"] => string(6) "0.0000"
  ["row_total"] => string(8) "129.9900"
  ["base_row_total"] => string(8) "129.9900"
  ["row_invoiced"] => string(6) "0.0000"
  ["base_row_invoiced"] => string(6) "0.0000"
  ["row_weight"] => string(7) "50.0000"
  ["gift_message_id"] => NULL
  ["gift_message_available"] => NULL
  ["base_tax_before_discount"] => NULL
  ["tax_before_discount"] => NULL
  ["weee_tax_applied"] => string(6) "a:0:{}"
  ["weee_tax_applied_amount"] => string(6) "0.0000"
  ["weee_tax_applied_row_amount"] => string(6) "0.0000"
  ["base_weee_tax_applied_amount"] => string(6) "0.0000"
  ["base_weee_tax_applied_row_amnt"] => string(6) "0.0000"
  ["base_weee_tax_applied_row_amount"] => string(6) "0.0000"
  ["weee_tax_disposition"] => string(6) "0.0000"
  ["weee_tax_row_disposition"] => string(6) "0.0000"
  ["base_weee_tax_disposition"] => string(6) "0.0000"
  ["base_weee_tax_row_disposition"] => string(6) "0.0000"
  ["ext_order_item_id"] => NULL
  ["locked_do_invoice"] => NULL
  ["locked_do_ship"] => NULL
  ["price_incl_tax"] => string(8) "129.9900"
  ["base_price_incl_tax"] => string(8) "129.9900"
  ["row_total_incl_tax"] => string(8) "129.9900"
  ["base_row_total_incl_tax"] => string(8) "129.9900"
  ["hidden_tax_amount"] => NULL
  ["base_hidden_tax_amount"] => NULL
  ["hidden_tax_invoiced"] => NULL
  ["base_hidden_tax_invoiced"] => NULL
  ["hidden_tax_refunded"] => NULL
  ["base_hidden_tax_refunded"] => NULL
  ["is_nominal"] => string(1) "0"
  ["tax_canceled"] => NULL
  ["hidden_tax_canceled"] => NULL
  ["tax_refunded"] => NULL
  ["base_tax_refunded"] => NULL
  ["discount_refunded"] => NULL
  ["base_discount_refunded"] => NULL
}

- From the above we can access data like below, (ex. we need to get orderid)

 "
$one_item->getOrderId();

             (OR)

$one_item->getData('order_id')  "

- Likewise we can access the other datas from that array.