Magento redirect functions

/* Redirect to certain url */
_redirectUrl($url)

/* Redirect to certain path */
_redirect($path, $arguments=array())

/* Redirect to success page */
_redirectSuccess($defaultUrl)

/* Redirect to error page */
_redirectError($defaultUrl)

/* Set referer url for redirect in response */
_redirectReferer($defaultUrl=null)

/* Identify referer url via all accepted methods (HTTP_REFERER, regular or base64-encoded request param) */
_getRefererUrl()

/* Check url to be used as internal */
_isUrlInternal($url)

Magento urls and paths

Below are the ways to access magento urls and paths :

URLS:

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK)

http://www.domain.com/index.php/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)

http://www.domain.com/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)

http://www.domain.com/skin/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS )

http://www.domain.com/js/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)

http://www.domain.com/media/

Paths :

base Mage::getBaseDir()
Mage::getBaseDir(‘base’) /var/www/magento/
app Mage::getBaseDir(‘app’) /var/www/magento/app/
code Mage::getBaseDir(‘code’) /var/www/magento/app/code
design Mage::getBaseDir(‘design’) /var/www/magento/app/design/
etc Mage::getBaseDir(‘etc’) /var/www/magento/app/etc
lib Mage::getBaseDir(‘lib’) /var/www/magento/lib
locale Mage::getBaseDir(‘locale’) /var/www/magento/app/locale
media Mage::getBaseDir(‘media’) /var/www/magento/media/
skin Mage::getBaseDir(‘skin’) /var/www/magento/skin/
var Mage::getBaseDir(‘var’) /var/www/magento/var/
tmp Mage::getBaseDir(‘tmp’) /var/www/magento/var/tmp
cache Mage::getBaseDir(‘cache’) /var/www/magento/var/cache
log Mage::getBaseDir(‘log’) /var/www/magento/var/log
session Mage::getBaseDir(‘session’) /var/www/magento/var/session
upload Mage::getBaseDir(‘upload’) /var/www/magento/media/upload
export Mage::getBaseDir(‘export’) /var/www/magento/var/export

EBS Payment module for Magento

As E-Billing Solutions (EBS) Payment gateway is one of the latest payment methodology used in India now days  as it provides a consultative approach to Indian Merchants for facilitating suitable online payment solutions and benefit from the exponential growth witnessed in E-commerce. Magento is one of the most popular E-commerce open source and its capturing the Indian Market as well . It help us to have the development faster and with advance features .We can provide as an extension also.

If you need the  E-Billing Solutions (EBS) Payment Module for Magento site I can provide you.
If you have any queries please contact me at my
Email address : surjan.negi@treewalker.in
Skype: treewalker.technologies
Gtalk: treewalker.technologies@gmail.com
Phone: 080-65832315
Mobile: +91-9916024769

customers in admin taking too much time to load

In magento if you have many customers and trying to load the products in admin under customers > manage customers , it takes too long to load or in some case it hangs the system .

I faced this problem in on of the project and after debugging the issue , i found that the issue is caused because of the  sql query created to load the customers in grid . In the sql query if you remove the “order by” clause then it loads the products without any problem

To make it work I just comment one line  at this path “app\code\core\Mage\Adminhtml\Block\Customer”

From the below code comment this line “$this->setDefaultSort(‘entity_id’);”

public function __construct()
{
parent::__construct();
$this->setId(‘customerGrid’);
$this->setUseAjax(true);
//$this->setDefaultSort(‘entity_id’);
$this->setSaveParametersInSession(true);
}

Try this ,i think it would help

Skip import row, is not valid value “” for field “type”

While trying the magento bulk import , we come across some of the issues . One of the issue which come across while updating the product which existing sku is as follow :

” Skip import row, is not valid value “” for field “type” ”

The reason for this is that the data which you are trying to update using the sku , does not exist, so magento display this error.

I hope this will help ..

Skip Import Row, Required Field “sku” Not Defined

While importing the bulk import of products in magento  we usually face this issue.

“Skipping import row, required field “sku” is not defined.”

The reason for this is that if the csv is not saved in UTF-8 format and you are using some special characters in the csv like some other language names . To avoid this you must save the csv using UTF-8 format .

To create a csv in UTF -8 format you just download the Open Office Org and when you are on the save screen, tick the “Edit filter settings” box and then once you click save you will be given the option of choosing the encoding format.

Hope this will fix the problem

upgrade magento to 1.5 or latest version

To upgrade the magento from 1.3.x ,1.4.x to 1.5.x or 1.6.x:
Take the backup of the site and database
Download the magento
$ wget http://www.magentocommerce.com/downloads/assets/1.5.1.0/magento-1.5.1.0.tar.gz
Extract it
$ tar xvfz magento-1.5.1.0.tar.gz
Flush Cache
$ rm -rf var/cache/*
$ rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
Remove the ‘downloader’ and ‘app/design/frontend/base’ directory
$ rm -rf downloader
$ rm -rf app/design/frontend/base

Copy ‘downloader’ and ‘app/design/frontend/base’ folder from magento-1.5.1.0
$ cp -a magento/downloader .
$ cp -a magento/app/design/frontend/base/ app/design/frontend/

$ cp magento/mage .
$ chmod 550 ./mage

Upgrade now :
$ ./mage mage-setup .
$ ./mage sync –force
$ ./mage install http://connect20.magentocommerce.com/community Mage_All_Latest –force
$ rm -rf var/cache/* var/session/*
$ rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
$ chmod 755 mage
$ php shell/indexer.php reindexall
$ ./mage upgrade-all –force
( NOTE: you may skip this ‘upgrade-all’ step if you just went ahead and did the following:

$ yes | cp -Rf magento/* . #this copies over all the magento files you extracted over your current installation

-----
To know more about the upgrade , follow this link:
Upgrade magento

Reindexing in Magento using command line

When running Magento is dealing with the indexes that it relies on. Usually you can do this from the admin panel by going to System -> Index Management.

When indexing fails from the admin panel you get a message saying that it failed with no reason why it failed. Now in most cases you cannot ignore this.

Admin & Frontend turned 404 Error after website change

Sometime after the magento upgrade , magento shows 404 error for the when we try to access the frontend and admin .
To fix this issue, you can follow 2 steps :

In the index.php page in your root directory change :
Mage::run();
by
Mage::run(’default’);

or

Run the below query , but take the db dabckup before you run the query
SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code=’admin’;
UPDATE `core_store_group` SET group_id = 0 WHERE name=’Default’;
UPDATE `core_website` SET website_id = 0 WHERE code=’admin’;
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code=’NOT LOGGED IN’;
SET FOREIGN_KEY_CHECKS=1;