Wednesday, September 5, 2012

Sql query for getting Category id and name from magento database table


SELECT `entity_id`,`value` FROM `catalog_category_entity_varchar` WHERE `attribute_id` = 3 and
`entity_id` IN(SELECT distinct(`entity_id`)  FROM `catalog_category_entity` WHERE `path` LIKE
'%1/xxx%')
For more than one store
Take the root category id  of store from admin and put it in place of 1/xxx as 1/categoryid
Also you have to search in table `catalog_category_entity_varchar'  for attribute_id  by giving the name of you store root category in place of value field.

SELECT  `attribute_id`   FROM `catalog_category_entity_varchar` WHERE `value` = "your category name";

Monday, April 23, 2012

How to Create different store view with different sub-domain in magento

How to create store view


1. Go to admin then select tab System->manage stores
2.Click create store view and complete the form and save store view
then you will be able to see in the list.

How to Change the Base URL for each Store view


1.. Go to admin then select tab System->configuration
2.On the left side of the page General under that select web but before that you have to change the Current Configuration Scope to your store view name
3. Edit the base url to you subdomain(eg: http://en.yourdomain.com)
4.click save config.

How to change .htaccess for redirecting to store view if you call the subdomain


1.Your .htaccess file is at the root folder of magento.
2.Search for "RewriteEngine on" word  in .htaccess file and write the code below it

RewriteCond %{HTTP_HOST} ^en.yourdomain.com
RewriteRule ^ - [E=MAGE_RUN_CODE:english]
RewriteCond %{HTTP_HOST} ^fr. yourdomain .com
RewriteRule ^ - [E=MAGE_RUN_CODE:french]

 then save the .htaccess file and try to clear all cache and browsing history from your browser as well as from magento

Tuesday, February 14, 2012

magento the shipment email is not sent


Solution Works For Me
Go to -> Mage_Sales_Model_Order_Shipment and copy the file Api.php
Make a path like this in local folder app/code/local/Mage/Sales/Model/Order/Shipment
Edit Api.php 
In function Create comment the sendEmail function call
try { 
$transactionSave = Mage::getModel(’core/resource_transaction’) 
->addObject($shipment) 
->addObject($shipment->getOrder()) 
->save(); 
/*$shipment->sendEmail($email, ($includeComment ? $comment : ‘’));*/ 
} catch (Mage_Core_Exception $e) { 
$this->_fault(’data_invalid’, $e->getMessage()); 

In function addTrack add function call sendEmail
try { 

$shipment->save(); 
$track->save(); 
$email=true; 
$shipment->sendEmail($email,’’); 
} catch (Mage_Core_Exception $e) { 
$this->_fault(’data_invalid’, $e->getMessage()); 
}
Now you Shipment Email will be send as usual email with tracking number