Monthly Archives: November 2013

Magento Convert session from file to Database

One of the key concept of Magento is the session either customer session OR core session .Magento can be fully customized the way we require.Main concept of session is to store Data and used whenever require.Magento supports the complex and simple way that’s the Magento professional Way

Session can be stored in Magento in two ways

1.File based session
2.Database based session

File based session – Are the session which are stored in files under var/session folder.At the time of installation magento ask where you need to store session and without knowing any thing we just simply select the file system from Drop down.File based session are simple, stable and durable. Simple because do not need any kind of setup.Durable because if system restart you will not lose your data.

Database based session – Are the session which get store in Database. One of the key benefit of storing session in database is easy sharing of session data. Database provides this capability quite easily and Normally we did not choose this because we forgot to select “Database session” form drop down list at the time of magento installation.

It also gives stability and durability.

Now if we want to change the session where to save so simply we need to in app/etc/local.xml. session_save tag tells about the type of session.

For file based session -
<session_save><![CDATA[files]]></session_save>
For database based session -
<session_save><![CDATA[db]]></session_save>

so once your clear the cache and refresh the site you will get session saved where you want as per local.xml

hope this will help you

Magento Get Shipping Address Outside Magento

Magento one of the most powerful tool in E-commerce which allow us to access the core Functionlity outside the Root directory also where magento been installed.
We have try to get the shipping address of customer whose order are under processing ,outside the Magento in .doc Format

Create a file in root where magento install and add the below code you will get the shipping address.In order to customize more you can bring product data also

<?php
require_once("app/Mage.php");
Mage::app('default');

$_orders = Mage::getModel("sales/order")->getCollection()
->addAttributeToSelect('*')
->addFieldToFilter('status', 'processing');

header("Cache-Control: ");
header('Content-Description: File Transfer');
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=exportorder.doc");

echo "<html>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">";
echo "<body>";
echo "<table width=100%>";
echo "<tr width=49px>";
$i = 0;
foreach($_orders as $order) {
foreach($order->getAllItems() as $item){

if ($i % 3 === 0) {
echo '</tr><tr>';
}

echo "<td width=25px>"
.$order->getShippingAddress()->getFirstname().' '.$order->getShippingAddress()->getLastname() .'['.(int)$order->getTotalQtyOrdered().' '.$item->getSku().']'.'<br>'
.$order->getShippingAddress()->getStreetFull() .'<br>'
.$order->getShippingAddress()->getCity() .','.$order->getShippingAddress()->getRegion().'<br>'
.$order->getShippingAddress()->getCountry() .','.$order->getShippingAddress()->getPostcode()
."</td>";
$i++;
}

}

echo "</tr>";
echo "</table>";
echo "</body>";
echo "</html>";

?>

Hope this will help you

Magento Not found Meta Robots

Upgrading from magento from Old version to new verison will allow us to give error “Source model “metarobots/product_attribute_source_unit” not found for attribute “meta_robots”

This because new version doen’t allow metarobots because yoast extension in order to solve this we need to

Delete the attribute

DELETE FROM `eav_attribute` WHERE `eav_attribute`.`attribute_code` = 'meta_robots';
DELETE FROM `core_resource` WHERE CODE = 'metarobots_setup';

Hope this will help you!

Magento Error parsing body – doesn’t seem to be a chunked message

Some time Magento installation is big headache on live server specially on  Nginx Server.Recently face issues of

The URL {URL} is not accessible.
Error parsing body - doesn\’t seem to be a chunked message.

This happens because we run both Apache and NginX on our servers to give you maximum performance. Apache handles the PHP code while NginX is used to serve static content such as images and javascript faster than Apache can.so in order to fix this error

just whiele installing  Magento enable “Skip Base URL Validation Before the Next Step” in the installation and your install should proceed without the error.

Hope this will help you

Magento Dashborad Issues

One of the headache in Magento is cache management so every time we need to refresh .Same issue will occur when you don’t see sales graph ,besetseller,Most viewed Items on Dashboard .Same with Reports module .So in Order to Fix we need to Refresh the Statistics which is the life Time statistics .Just Clear that and you will able to see products and Graph

Hope this will help you.