Tuesday 26 February 2013

Magento billing and shipping details in sucess.phtml page


Use this code in sucess.phtml page


$order =  Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$shipping_address_data    = $order->getShippingAddress();
$billing_address_data   = $order->getBillingAddress();


    echo "customer ID".$shipping_address_data['customer_id'];
    echo "customer firstname".$shipping_address_data['firstname'];
    echo "customer lastname".$shipping_address_data['lastname'];
    echo "customer street".$shipping_address_data['street'];
    echo "customer city".$shipping_address_data['city'];
    echo "customer region".$shipping_address_data['region'];
    echo "customer region_id".$shipping_address_data['region_id'];
    echo "customer postcode".$shipping_address_data['postcode'];
    echo "customer telephone".$shipping_address_data['telephone'];
    echo "customer country_id".$shipping_address_data['country_id'];
  
    echo "Billing customer ID".$billing_address_data['customer_id'];
    echo "Billing customer firstname".$billing_address_data['firstname'];
    echo "Billing customer lastname".$billing_address_data['lastname'];
    echo "Billing customer street".$billing_address_data['street'];
    echo "Billing customer city".$billing_address_data['city'];
    echo "Billing customer region".$billing_address_data['region'];
    echo "Billing customer region_id".$billing_address_data['region_id'];
    echo "Billing customer postcode".$billing_address_data['postcode'];
    echo "Billing customer telephone".$billing_address_data['telephone'];
    echo "Billing Billing Add Country ID".$billing_address_data['country_id'];

Wednesday 13 February 2013

Magento cache,session folder delete



Please pu this file in magento root and give 777 permission for this file,give any

name for this page

<?php
$xml = simplexml_load_file('app/etc/local.xml', NULL, LIBXML_NOCDATA);

$db['host'] = $xml->global->resources->default_setup->connection->host;
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
$db['user'] = $xml->global->resources->default_setup->connection->username;
$db['pass'] = $xml->global->resources->default_setup->connection->password;
$db['pref'] = $xml->global->resources->db->table_prefix;

clean_var_directory();

function clean_log_tables() {
    global $db;
   
    $tables = array(
        'catalogindex_aggregation',
        'catalogindex_aggregation_tag',
        'catalogindex_aggregation_to_tag',
        'catalogsearch_fulltext',
        'dataflow_batch_export',
        'dataflow_batch_import',
        'log_customer',
        'log_quote',
        'log_summary',
        'log_summary_type',
        'log_url',
        'log_url_info',
        'log_visitor',
        'log_visitor_info',
        'log_visitor_online',
        'report_event'
    );
   
    mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
    mysql_select_db($db['name']) or die(mysql_error());
   
    $message = "Working!! 1\nLine 2\nLine 3";

    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
   
    // Send
    mail('jagadckap@gmail.com', 'My Subject', $message);
   
   
    foreach($tables as $v => $k) {
        mysql_query('TRUNCATE `'.$db['pref'].$k.'`') or die(mysql_error());
    }
}

function clean_var_directory() {
    $dirs = array(
        'downloader/.cache/*',
        'downloader/pearlib/cache/*',
        'downloader/pearlib/download/*',
        'var/cache/',
        'var/locks/',
        'var/log/',
        'var/report/',
        'var/session/',
        'var/tmp/'
    );
   
    foreach($dirs as $v => $k) {
        exec('rm -rf '.$k);
    }
}

?>

Tuesday 5 February 2013

Shipping method comments


 Follow this site it is easy to create Shipping method comments

http://www.demacmedia.com/ecommerce/mini-tutorial-adding-column-to-orders-grid-in-magento-backend/