Wednesday, 29 February 2012

magento "No shipping information available" in orders

I have problem of shipping description not display in order and order email. After search for that and nothing found and finally i have do that. Its because i have code changed in file app\code\core\Mage\Sales\Model\Quote\Address\Total\Shipping.php in line no 168. i have put something like that.

$shippingDescription = ""; // $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();

Than I have remove this do as it default see below.

$shippingDescription = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();

I have do this stuff because i want remove shipping info display in cart page total box where i want only display "Shipping & Handling".

And goto above file around line no 189 and i comment out below code and its hide info of shipping in cart page total box.

//if ($address->getShippingDescription()) {
//      $title .= ' (' . $address->getShippingDescription() . ')';

Friday, 24 February 2012

How To Change Order Status in Magento1.6

I searched all around to find this solution. In Magento Commerce, there is no provision for manually changing order status from the admin panel. I have also try to change in Magento\app\code\core\Mage\Sales\etc\config.xml file but i cant change in magento1.6. so finally i got below solution i hope this work for you.

Open file app\design\adminhtml\default\default\template\sales\order\view\history.phtml in this file.

Also replace the code.

<?php foreach ($this->getStatuses() as $_code=>$_label): ?>
            <?php endforeach; ?>


                $selected = "";
                foreach (Mage::getSingleton('sales/order_config')->getStatuses() as $_code=>$_label): 
                            $selected = 'selected="selected"';
                    echo "";

Its works perfectly for me i hope its work for you.

Monday, 20 February 2012

Magento Fatal error: Call to a member function is Shipping Labels Available() on a non-object

When I click the Ship button, I get this error in the lower right corner, where there should be a button:

Fatal error: Call to a member function isShippingLabelsAvailable() on a non-object in /var/www/limp/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php on line 132

Here i got solution for it just replace text shown in below.

change line 1214 of app/code/core/Mage/Sales/Model/Order.php from

$shippingMethod = parent::getShippingMethod(); 


$shippingMethod = $this->getData('shipping_method'); 

I hope this work for you.

Thursday, 16 February 2012

Sort a category and subcategory list array alphabetically in Magento

If you are dealing with magento category i am very sure that you’ll face this problem .Magento category fetching is not an issue its a child play but sorting thse categories is little tricky. see below code for category sort in alphabetic order.
$cats = Mage::getModel('catalog/category')->load(2)->getChildren();
$catIds = explode(',', $cats);

$categories = array();
$subCategories = array();
foreach ($catIds as $catId) {
    $category = Mage::getModel('catalog/category')->load($catId);
    $categories[$category->getName()] = $category->getUrl();

    $subcats = Mage::getModel('catalog/category')->load($catId)->getChildren();
    $subcatIds = explode(',', $subcats);
    if ($subcats) {
        foreach ($subcatIds as $subcatId) {
            $subCategory = Mage::getModel('catalog/category')->load($subcatId);
            $subCategories[$category->getName()][$subCategory->getName()] = $subCategory->getUrl();
        ksort($subCategories[$category->getName()], SORT_STRING);

ksort($categories, SORT_STRING);
    <?php foreach ($categories as $name => $url): ?>
  • <?php echo $name; ?> <?php foreach ($subCategories as $key => $values) { if($name == $key) { echo '"; } } ?>
  • <?php endforeach; ?>