@surbhiiagr How can i add if condition for foreach loop,
<?php
class Gta_GetOrderDetails_Model_Observer
{
public function getdetailsafterorder($Observer)
{
$order = $Observer->getEvent()->getOrder();
$items = $order->getAllItems();
$shipping_state = $Observer->getEvent()->getOrder()->getShippingAddress();
// Mage::log($shipping_state->getRegion(),null,'event.log');
if($shipping_state()->getRegion() == 'Tamil Nadu')
{
foreach($items as $item){
$sku = $item->getSku();
$name= $item->getName();
$qty = $item->getQtyOrdered();
$price = $item->getPrice();
$loggerInfo = ['sku' => $sku, 'name' => $name, 'qty' => $qty, 'price' => $price];
Mage::log(json_encode(print_r($loggerInfo, true)), null, 'event.log', true);
}
}
### start test observer ###
// $order = $Observer->getEvent();
// Mage::log($order->getName(),null,'event.log');
### end test observer ###
}
}
?>
above not working.