Disable admin notification popup in Magento

Every time you log in to the Magento Admin Panel, you see an admin notification popop message telling you there's a new Magento version. As a developer, it's best to stay informed about new releases by reading blogs, tweets and lots of other news channels - besides this, upgrades should never be taken lightly. It's possible to remove this notification popup message.


To remove this notification popup message.
  • Login to your Magento Admin Panel
  • Go to System >> Configuration >> Advanced
  • Disable the Mage_AdminNotification module


How to create custom page layout in magento

To create a new custom column layout, you need to place a new file in the Magento theme. With the Magento default theme, you could use the folder app/design/frontend/default/default/template/page, but of course - when building your own site - it is recommended to have your own theme-directory.

In the tutorial, the file 1column.phtml is copied to the file 1columnfp.phtml (where "fp" stands for the front page). To make this new page reckognizable you wll need to add a new XML-definition. In the tutorial the following code is added to the file app/code/core/Mage/Page/etc/config.xml. copy this module in local exp app/code/local/Mage/Page/etc/config.xml

    
    
    page_one_column_fp

However, with a Magento upgrade this change could be gone. The same XML could also be added to your app/etc/local.xml file instead:

Customizing Magento email templates

Emails (or often referred to as transactional emails) are - just like the entire Magento theme - based on files in the filesystem: If you open up the folder app/locale/en_US/template/email you will numerous files. Don't edit them directly, because any Magento upgrade will override your changes. Instead, the purpose of these files is to override them. You can override these email templates either using the Magento Admin Panel, or by copying them to your Magento theme. The first approach allows for easy editing using the Magento Admin Panel, but this interface lacks nice editing features like syntax highlighting or code completion. Ofcourse, you can copy the textarea contents ofcourse to your local editor modify things there and copy the code back into the textarea once you're done.

Change order status in WooCommerce for specific payment method

Copy this code in your theme's function.php file
<?php
/* Reset status of new orders from "pending" to "completed" */
add_action( 'woocommerce_thankyou', 'changeOrderStatus' );
function changeOrderStatus($order_id) {
    global $woocommerce;
     if (!$order_id )
        return;
 $billing_paymethod = get_post_meta($order_id,'_payment_method',true);
  $order = new WC_Order( $order_id );
  /* put here your specific payment method */
 if($billing_paymethod == 'paypal')
 {
   /* put here your specific  order status */
       $order->update_status( 'completed' );
    }
    else
    {
     /* put here your specfic default order status for all payment method */
  $order->update_status( 'processing' );   
    }
}
?>

Get Upsell products list using Product Id in Magento

Using Product ID you can get list of Upsell product. Copy following code and place it in you custom file.
<?php
   // Get product object.
   $object = Mage::getModel('catalog/product');
   
   /* Get product detail using product id   : $_product->getId() */
   $product = $object->load($_product->getId()); 
  
   // Fetch list of upsell product using query.
   $upsell_product = $product->getUpSellProductCollection()->addAttributeToSort('position', Varien_Db_Select::SQL_ASC)->addStoreFilter(); 

   //check if record is empty or not
   $count = count($upsell_product); 
   if(empty($count)) : 
       //if empty
       echo "Record not found";

   else:

     //if result is not empty then get  upsell product detail using foreach loop
      foreach($upsell_product as $_upsell):
         
         //get detail of single upsell prdocut using upsell product id
         $upsp = $object->load($_upsell->getId());

         echo "Product Name : ". $upsp->getName();
         echo "Poduct url : ". $upsp->getProductUrl();
         echo "Product regular price : ". $upsp->getPrice();
         
       endforeach;
   
   endif;

?>