Get all active Payment method magento

External script to check which payment method is Active in Magento.
Below is the code to display all payment method.

create new file in root of the magento source and add below code in that file

require_once('app/Mage.php');
umask(0);
Mage::app();
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$payMethods = array();
foreach ($payments as $paymentCode=>$paymentModel)
{
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
$payMethods[$paymentCode] = $paymentTitle;
}
echo "<pre>";
print_r($payMethods);

Get all active Shipping method magento

External script to check which shipping method is Active in magento.
Below is the code to display all shipping method.

create new file in root of the magento source and add below code in that file

require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
$shipMethods = array();
foreach ($methods as $shippigCode=>$shippingModel)
{
$shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
$shipMethods[$shippigCode] = $shippingTitle;
}
echo "<pre>";
print_r($shipMethods);

Get product collection in magento

To get product collection we can use following code :

< ?php $_productCollection = Mage::getModel('catalog/product') ->getCollection()
->addAttributeToSort('created_at', 'DESC')
->addAttributeToSelect('*')
->load();
foreach ($_productCollection as $_product){
echo $_product->getId().'';
echo $_product->getName().'';
echo $_product->getProductUrl().'';
echo $_product->getPrice().'';
}
?>

Explain different types of sessions in Magento

Magento have main 3 session which are listed below :

1) Customer Session
2) Checkout Session
3) Core Session

– Customer sessions stores data related to customer.
– Checkout session stores data related to quote and order.
– They are actually under one session in an array. So first name in customer/session will be $_SESSION[‘customer’][‘firstname’] and cart items count in checkout/session will be $_SESSION[‘checkout’][‘items_count’].

Reason reason why we store data in different session types:
The reason Magento uses session types separately is because once the order gets placed, the checkout session data information should get flushed which can be easily done by just unsetting $_SESSION[‘checkout’] session variable. So that the session is not cleared, just session data containing checkout information is cleared and reset all the session types are still intact.

Change magento admin password from database

To change admin password need to follow below steps:

1) Login to Cpanel or access Database
2) Go to phpmyadmin
3) click on sql section
4) Run below query

(Note: please update NEWPASSWORD with your new password and ADMINUSER with your admin name).

UPDATE `admin_user` SET `password` = MD5('NEWPASSWORD') WHERE `username` = 'ADMINUSER';

Basic features of Magento

Basic features of Magento includes

  • Reporting and Analytics
  • Product and Catalog Browsing
  • Customer Accounts
  • Order Management
  • Payment
  • Site Management
  • Shipping
  • Search engine optimization
  • Marketing promotions and tools
  • Checkout
  • International Support

Clearing Magento Log Data

To improve magento store performance we can TRUNCATE following tables in Magento database :

Login to your cpanel then goto phpmyadmin using SQL run below query to clear logs

TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;
TRUNCATE index_event;

 

How we add our own codepool ?

This is easy to create custom code pool in magento. Just follow the following step:

Open Mage.php that is located in directory app/Mage.php
Find include paths that was added as
$paths = array();

$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘local’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘community’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘core’;
$paths[] = BP . DS . ‘lib’;

Edit this section to:

$paths = array();

$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘custom’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘local’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘community’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘core’;
$paths[] = BP . DS . ‘lib’;

How to implement EAV database model

If you’ve ever added a new product to Magento, you know that you’ve had to add some title, description and price to it (there are more attributes but we are using 3 for this example). When you saved your product, you used a total of 3 tables to save that information (a few more, but those are irrelevant for our example). First, a new Entity was added to DB, second, In Attribute table, you saved attributes (title, description and price) attached to that product, and finally to Value table, you saved 3 rows, attached to that product’s attributes.