Showing posts with label get order customer billing and shipping info. Show all posts
Showing posts with label get order customer billing and shipping info. Show all posts

shipping order tracking table name in magento.

If you want to add programmatically order tracking number in magento than you need to use below code.

$orderId = '100001780';
$order1 = Mage::getModel('sales/order')->load($orderId );

$incrementId = $order1->getIncrementId();
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);

if($order->canShip())
{
$itemQty =  $order->getItemsCollection()->count();
$ship = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
$ship = new Mage_Sales_Model_Order_Shipment_Api();
$shipmentId = $ship->create($incrementId);
}

$shipment_collection = Mage::getResourceModel('sales/order_shipment_collection');
$shipment_collection->addAttributeToFilter('order_id', $orderId );

foreach($shipment_collection as $sc) {
    $shipment = Mage::getModel('sales/order_shipment');
    $shipment->load($sc->getId());
    if($shipment->getId() != '') {
        $track = Mage::getModel('sales/order_shipment_track')
                 ->setShipment($shipment)
                 ->setData('title', $type)
                 ->setData('number', $code)
                 ->setData('carrier_code', 'custom')
                 ->setData('order_id', $shipment->getData('order_id'))
                 ->save();
        }
}


For add programatically order tracking number you also need this requirement.
Order Id,
Customer Id
Shipping Address Id
Billing Address Id
Store Id.

you can get all the requirement info for order tracking table here

how to get store config value in Magento?


<?php echo Mage::getStoreConfig('isis/isis_order_setting/enable_isis'); ?>

In 2 ways you can find the path of store config value .

1) open Database and see the "core_config_data" table and see the "path" column. find you're module here. and use path value.

2)  open System.xml file and find section, groups and fields values.
you can find this file on app/code/<pool>(community,local,core)/Namespace/Model Name/etc/system.xml
 this is my system.xml file path app/code/local/Magentoo/Isis/etc/system.xml

Below is our dummy system.xml file
<config>
   <sections>
      <isis translate="label">
<groups>
            <isis_order_setting translate="label">
  <fields>
                  <enable_isis translate="label comment">
 </enable_isis>
</fields>
           </isis_order_setting>
         </groups>
     </isis>
  </sections>
</config>