Magento themes and extensions

Magento – Get Shipping Address Details Of Order

Share
Posted on May 19th, 2013 | Posted by admin

Magento – Get Shipping Address Details Of Order

To get the shipping address details of the order.

<?php
$order_id = 2314; //use your own order id
$order = Mage::getModel("sales/order")->load($order_id); //load order by order id
$shipping_address = $order->getShippingAddress();
echo $shipping_address->getTelephone();
echo $shipping_address->getPostcode();
//use print_r($shipping_address->getData()); to get all the available elements of the object
?>

Programatically change products quantity after order cancelled Magento

Share
Posted on February 3rd, 2013 | Posted by admin

Programatically change products quantity after order cancelled Magento

include $_SERVER['DOCUMENT_ROOT'].'/app/Mage.php';
02 Mage::app('default');
03
04 /**
05 * it may be case that admin has enabled product add in stock, after product sold,
06 * he set is_in_stock = 0 and if order cancelled then we need to update only qty not is_in_stock status.
07 * make a note of it
08 */
09 function change_product_qty_after_order_cancel($product_id,$qty){
10 $curr_date = date('Y-m-d H:i:s');
11 $product = Mage::getModel('catalog/product')->load($product_id);
12
13 $stock_obj = Mage::getModel('cataloginventory/stock_item')->load($product_id);
14 $stockData = $stock_obj->getData();
15 $product_qty_before = (int)$stock_obj->getQty();
16
17 $product_qty_after = (int)($product_qty_before + $qty); //annet-pk just added qty update here (+)
18
19 $stockData['qty'] = $product_qty_after;
20
21 /*
22 * it may be case that admin has enabled product add in stock, after product sold,
23 * he set is_in_stock = 0 and if order cancelled then we need to update only qty not is_in_stock status.
24 * make a note of it
25 if($product_qty_after != 0)
26 {
27 $stockData['is_in_stock'] = 1;
28 }
29 else{
30 $stockData['is_in_stock'] = 0;
31 }
32 */
33 $productInfoData = $product->getData();
34 $productInfoData['updated_at'] = $curr_date;
35 $product->setData($productInfoData);
36 $product->setStockData($stockData);
37 $product->save();
38 }
39 change_product_qty_after_order_cancel (1,12);

How to List Orders by Order Status using Magento API

Share
Posted on February 20th, 2012 | Posted by admin

Magento Core API allows us to retrieve the Orders Placed in a Magento Store. In this example we will be filtering the orders based on its status. Magento Webservices allows us to use Both Soap and XMLRPC for accessing the Core API, for this example i have used both in the below code snippet.

<?php
$soapclient = new SoapClient('');
$sessionId = $soapclient->login('YourAPIUser', 'YourAPIKey'); /
/Webservice User and API Key

How to change Default Sort Order Magento

Share
Posted on January 5th, 2012 | Posted by admin

I’ll be clear… Magento is not good as you could imagine. In fact sucks in so many ways.

Today i’m showing you one. There is no backend option to change the Default Sort Order in your product listing (catalog).

Lucky there is an easy solution.

The Toolbar

Look for the file toolbar.php located in:

/app/code/core/Mage/Catalog/Block/Product/List

Order statuses “improvement” in 1.5

Share
Posted on July 9th, 2011 | Posted by admin

I took some time to install and do the quick check on Magento 1.5.0.0-alpha1. There was one thing that is impossible to miss: Improved order statuses.
I remember the days when people requested that feature all over ther forum. Oh yes… what feature? Custom order statuses
So, we have it out of the box finally! Or do we? Let’s see…

No more configuration files! That’s cool. Everything is stored in database now.
Users are able to create their own statuses and assign those statuses to some predefined order state.
They can choose if they want it to be default status which is also cool.
Let’s see how it looks…

Page 1 of 3123»