Magento: How to access email from magento database with respect to order id.

March 16th, 2010

Problem: In accessing the email address from database, developers face a problem that this email address is not stored in the same table where all other billing and shipping informations to be stored.

Solution: So for accessing this email address we need to use three different tables named as following

  • sales_flat_order_item

  • sales_flat_quote_item

  • sales_flat_quote_address

  1. From sales_flat_order_item table we will get “quote_item_id” from “order_id”

  2. From sales_flat_quote_item table we will get the “quote_id” from “quote_item_id”

  3. From sales_flat_quote_address table we will get the “email’ from “quote_id”

Php syntex:

$myQuery = ” SELECT quote_item_id FROM sales_flat_order_item WHERE order_id = ‘ ” . $order_id . ” ‘ “;

$quote_item_id = Mage::getSingleton(’core/resource’) → getConnection(’core_read’) → query($myQuery) → fetchObject() → quote_item_id;

By this code we can find the quote_item_id from order_id and this quote_item_id will help in fetching quote_id and quote_id will help in fetching email address

$myQuery = ” SELECT email FROM sales_flat_quote_address WHERE quote_id = (SELECT quote_id FROM sales_flat_quote_item WHERE item_id = ‘ ” . $quote_item_id . ” ‘ ) “;

$email = Mage::getSingleton(’core/resource’) → getConnection(’core_read’) → query($myQuery) → fetchObject() → email;

Now you have email address of customer which he entered in billing information while ordering the product.

Enjoy!!!

Saurabh Gupta


INSTALLATION OF MAGENTO

February 10th, 2010

ABOUT MAGENTO:

MAGENTO is e-commerce open source solution.Magento contains many tools for Easy Developing on-line shop cart application.Magento offer’s to developer too easy set up and lot’s of tools ,that is not enough it also Added GUI Facilities by click we deal with many tool related to E-commerce consist in magento . With little knowledge of PHP,apache,linux, could be developed secure and well look application but if you have strong web concept it added advantage.  well in shortly Mangento is product provides platform  to  develop  on-line shop cart solution with easiness and efficient way.

MAGENTO INSTALLATION:

MAGENTO INSTALLATION  first  we have to  download Magento package.
From official website of Magento :http://www.magentocommerce.com/download and
then we have to follow  some step for proper  installation of magento.

NOTE:You should know magento requires  PHP 5.2 and MySQL 5 or above to run properly.

Step :1 On hosting account Upload the package through your “cPanel -> File Manager” or By FTP client.

You can put your Magento file by two  option:

> under the public_html folder, which is the main one for your web site content
> under a sub folder. for example if your domain name is  domainname.com and you place magento script in the public_html/magento folder, then you will open the web site at: http://domainname.com/magento.

Once you placed the package, you can extract it through your cPanel -> File Manager.

Step:2 After uploading  package
> For access(read and write) to Magento folder you have to set permission.you can use command prompt  and change to 0777.
>  GO  to php.ini file  and   active mycript and curl  in php.ini

Step:3 Now you create  MySql database and  Assign user to it. and keep it  detail . It will use at script installation time.For example: Database_name.

step:4 when you have completed  all those task. just  go on your  browser and navigate to http://domainname.com/magento .
Then A Magento Installation wizard will be appear.

>Check on check box of “I agree to the above terms and conditions”
>Click on Continue button

Step:5 Then “Localization” form will appear.

>Choose the preferred Time Zone, Locale and Currency.
>Click on Continue button

Step:6 Then “Configuration” form will appear

>Enter The  your Database  detail when  you  got at  Database creation time .
For example:Database Name, User Name and User Password.you can leave  other optional fields
>Check on the check box next to “Skip Base URL validation before next step”.
>Click on Continue button.

Step:7 Then you will reach at  “Create Admin Account” Form.

>Enter personal details
>Enter admin login details and keep it for further use.
>You can leave blank Encryption Key field ,Script will generate for you.
>Click on Continue button.

Step: 8 After click Continue button  you  will reach “you’re all set” form which  show’s end  of installation of magento
on this page one Encryption Key would be  appeared  *note it . Because It will be used for Magento to encrypt passwords, credit cards and other confidential information.
>Navigate front end and back end

congartes!!!!  you have finished  installation.