I am using magento 1.9.
I want to retrieve data from sales_flat_quote_address
table in onepagecheckout, after saved the shipping method
. I have used the following codes. But no result.
Code 1:
$quote_address = Mage::getModel('sales/quote_address')->getCollection();
$quote_address->addFieldToFilter("address_type", array("eq" => "shipping"));
$quote_address->addFieldToFilter("quote_id", array("eq" => $quote_c->getId()));
Code 2:
$resource = Mage::getSingleton('core/resource');
$connRead = $resource->getConnection('core_read');
$sqlCdnImageName = "SELECT shipping_method FROM
sales_flat_quote_address
WHEREaddress_type
= 'shipping' ANDquote_id
= " .$quote_c->getId() . ";";$results = $connRead->fetchAll($sqlCdnImageName);
Code 2 generates this query:
SELECT shipping_method FROM
sales_flat_quote_address
WHEREaddress_type
= 'shipping' ANDquote_id
= 123
But the data is not coming. please help to solve this.
Update: This quote data comes out when user doing checkout by logged in. But the data returns empty when guest checkout at the first time. After refresh the page(i mean 2nd time) the data comes out.
I found the updated time changes in the data printed and the data comes in the phpMyAdmin by executing the query. Is this affect the result in any way?
Data comes from the Model and query in the Phtml file:
[created_at] => 2017-03-09 09:50:06
[updated_at] => 2017-03-09 09:51:04
Data from PhpMyAdmin SqlQuery:
[created_at] => 2017-03-09 09:50:06
[updated_at] => 2017-03-09 09:51:51