Use/Enable a payment method for back-end/admin-end orders only

In Magento, somtimes we need to enable the payment-method only for back-end orders.payment-methods
For this you can create new module in local and overwrite the payment method model in your local folder.
Following are the steps:
Note: You have enabled the method in the configuration for single/differnt store-views.
Create a new module and extend it from the class Mage_Payment_Model_Method_MethodName.
Change the variables:
protected $_canUseInternal = true;  // use in admin
protected $_canUseCheckout = false;  // use in frontend onepage checkout
protected $_canUseForMultishipping = false; // use in frontend multishippping checkout
$_canUseInternal  this variable responsible to show/hide payment method(s) for back-end orders.
$_canUseCheckout this varible is responsible to show/hide payment method(s) for frontend orders in case of onepage checkout.
$_canUseForMultishipping is responsible to show/hide payment method(s) for frontend orders in case of multishippping checkout.


Magento as a commerce platform, allow us create and maintain various kind of products with its attributes. Magento DB follows a EAV structure to maintain the products with its appropriate attributes.

Sometime we need to update the attributes of the existing products for which we have defined functions in Magento .
For Example: Default Magento way to update the website:
$website_ids = array(1, 2, 3);

$products = Mage::getModel('catalog/product')

foreach( $products as $_product) {
	$_product = Mage::getModel('catalog/product')->load($_product->getEntityId());
    	try {

   	 } catch(Exception $e) {
        echo $e->getMessage();


In the above example Magento would fetch each product object and update its the website. This process is correct but its time taking. So we can use this method for updating it few products, but when you have large inventory it would be a problem.

For large inventory, it would be better to update directly in DB. For DB update the we need know the table responsible to store all the website details “mage_catalog_product_website”.

This table contains 2 columns: product_id and the website id.

Now we can write a simple Magento query or direct MySQL query to update the website details.

Following is a exmaple which would directly add/update the website option for all products.

You can fetch products ids from the table ‘Mage_Catalog_Product_Entity’. Or you can use default Magento function to fetch the entity.

$website_ids = array(1,2,3,5,6);

$read = Mage::getSingleton('core/resource')->getConnection('core_read'); //initialize a read method
$write = Mage::getSingleton('core/resource')->getConnection('core_write'); //initialize a write method

//execute a read method

$resultquery= $read->query(" SELECT * FROM `mage_catalog_product_entity` ");

 $row = $resultquery->fetchAll(); //fetch all the records

foreach($website_ids as $web_id){

     $insertProductQuery = "INSERT INTO `mage_catalog_product_website`
     ( `product_id` , `website_id` ) VALUES ( '$productId', '$web_id');";
      $write->query($insertProductQuery);// Execute write the query


I find this method more useful and faster for updating 1000+ records in less time. Hope this would be help to you also.