CREATE TABLE `items` ( `id` int(11) NOT NULL auto_increment, `item_name` varchar(50) default NULL, PRIMARY KEY (`id`) );
-- now our item attributes
CREATE TABLE `item_attributes` ( `id` int(11) NOT NULL auto_increment, `item_id` int(11) NOT NULL default '0', `attribute_name` varchar(50) default NULL, PRIMARY KEY (`id`), KEY `item_id_attribute_name` (`item_id`,`attribute_name`) );
-- now finally our attribute values
CREATE TABLE `attribute_values` ( `attribute_id` int(11) NOT NULL default '0', `attribute_value` varchar(100) default NULL, UNIQUE KEY `attribute_id` (`attribute_id`,`attribute_value`) );
$attributes = array('name'=> $name'store_id'=> store_id);
$model = mage::getmodel('module/modelname')->loadbyattributes($attributes);
Step 2:public function loadbyattributes($attributes)
{
$this->setdata($this->getresource()->loadbyattributes($this,$attributes));
return $this;
}
Step 3:public function loadbyattributes(Custom_Ccms_Model_Ccms $ccmsObj, $attributes)
{
$adapter = $this->_getreadadapter();
$where = array();
foreach ($attributes as $attributecode=> $value) {
$where[] = sprintf('%s=%s', $attributecode, '"'.$value.'"');
}
$select = $adapter->select()->from($this->getmaintable())->where(implode(' and ', $where));
$binds = $attributes;
$id=$adapter->fetchOne($select,$binds);
if($id){
$this->load($ccmsObj, $id);
}
return $this;
}
Mage::app()->getRequest()->getModuleName();
Route nameMage::app()->getRequest()->getRouteName();
Controller nameMage::app()->getRequest()->getControllerName();
Action nameMage::app()->getRequest()->getActionName();
Consider extension 'Redirect Visitors by Country IP'
-
Get this extension key from the http://www.magentocommerce.com/magento-connect/redirect-visitors-by-country-ip.html
- Go System -> Magento connect -> Magento Connect Manager
- Paste your extension key in the 'Paste extension key to install' text box and click instal button
- After clicking install button, you can view 'Extension dependencies' table with 'Cancel installation' and 'Proceed' button
- Click the 'Proceed' button.
- Now you can see the 'black' section at the end of the 'Magento connect Manager' page in which you see installing progress
- After you getting 'cache cleaned successfully' message in 'black' section, click refresh button
- Now logout admin panel and login.
- Now you can this extension in your admin panel.
- Thanks for viewing this post