Skip to main content

Posts

Show category Image in main Navigation in magento

In Model file. (/app/code/core/Mage/Catalog/Model/Observer.php) Update following code in Function Name: _addCategoriesToMenu $categoryData = array ( 'name' => $category -> getName (), 'id' => $nodeId , 'url' => Mage :: helper ( 'catalog/category' )-> getCategoryUrl ( $category ), 'is_active' => $this -> _isActiveMenuCategory ( $category ), 'thumbnail' => Mage :: getModel ( 'catalog/category' )-> load ( $category -> getId ())-> getThumbnail () ); Then go into Html folder. (app/code/core/Mage/Page/Block/Html/Topmenu.php) Update the following line of code at line 131 in Function name: _getHtml replace : $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';             $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '>

Magento admin login not working in chrome but works fine for firefox

I think there is the problem with  session cookie  with the chrome browser. So just go through this directory  /app/code/core/Mage/Core/Model/Session/Abstract/Varien.php  file and comment out the line from 85 to 92 in magento (1.7.2 for my case). Like this // session cookie params /* $cookieParams = array( 'lifetime' => $cookie->getLifetime(), 'path' => $cookie->getPath(), 'domain' => $cookie->getConfigDomain(), 'secure' => $cookie->isSecure(), 'httponly' => $cookie->getHttponly() ); */ And use your credentials to logged in. Hope that should works for you!!!

Showing all category and subcategory in magento

 <select class="select" id="option" value="option" name="option" onchange="short_cat(this.value)"> <option value="*">Select Category</option> <?php $_helper = Mage::helper('catalog/category') ; $_categories = $_helper->getStoreCategories(); $currentCategory = Mage::registry('current_category') ; if (count($_categories) > 0): ?> <?php foreach($_categories as $_category): $selected=''; if($_REQUEST['catid']==$_category->getId()) { $selected='selected'; } ?> <option value="<?php echo $_category->getId() ?>"<?php echo $selected ?>><?php echo $_category->getName() ?></option>             <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>             <?php $_subcategories =

Add Image in Magento Admin Product Grid

Step 1:   First you need to copy the core block to local. Copy Grid.php from        app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php  to    app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php Here you'll find a method named _prepareColumns(), add the below code within this method  If yoy edit in Notepad++ go to the line number  145.          $this->addColumn('product_image', array(               'header'    => Mage::helper('catalog')->__('Image'),               'align'     =>'left',               'index'     => 'entity_id',               'width'     => '100px',               'renderer'  => 'Mage_Adminhtml_Block_Catalog_Product_Renderer_Image'         )); Step 2:       Now create the renderer file named Image.php in the following path      app/code/local/Mage/Adminhtml/Block/Catalog/Product/Renderer/Image.php      Here add the below code..     cla

Getting the subDirectory of root folder and download it

INDEX.Php <?php $mydir = "../var/export"; if ($handle = opendir($mydir)) {     while (false !== ($file = readdir($handle))) {         if ($file != '.' && $file != '..') { ?>            <a href="download.php?f=<?php echo $file ?>" target="_blank"><?php echo $file ?></a><br/> <?php         }     }     closedir($handle); } ?> Download.php---- <?php $filename = $_GET['f']; // set this to the path where your zipped files are located $filepath = "../var/export/" . $filename; // a little security if (file_exists($filepath)){     // make sure the browser knows what it's getting, and what to do with it      header('Cache-Control: public');     header('Content-Type: application/zip');     header('Content-Disposition: attachment; filename=' . $filename);     readfile($filepath);     die(); } else {     die('Error: Fi

How to display Image in grid

Write this code in Grid.php:- $this->addColumn("data", array( "header" => Mage::helper("userdesign")->__("Design"), "index" => "image", 'align'     =>'center', 'renderer'  => 'userdesign/Adminhtml_Userdesign_Renderer_Image' )); Then make a "Renderer" folder in module( location - Grid.php) In Renderer Make a PHP file , Named Image.php and put this code <?php class Userdesign_Userdesign_Block_Adminhtml_Userdesign_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{           public function render(Varien_Object $row)     { $designUrl=Mage::getBaseUrl('web').'design/designs/';         $html = '<img width="75" height="75" ';          $value = $row->getData('designId');       $html.= 'src="' . Mage::getBaseUrl('web').'

How to add category value in dropdown of another module in magento

Put this line in your drop down attribute: 'values'   => DesignerToolSetting_Baseproduct_Block_Adminhtml_Baseproduct_Grid::getValueArray(), after that make a function in your grid.php public function getValueArray(){ $valuearray = Array(); $fontcat = Mage::getModel("baseshapes/baseshapes")->getCollection(); //echo '<pre>'; //print_r($fontcat); //echo '</pre>';die; //$fontcat->addFilter('status',0); foreach($fontcat as $categ){ $valuearray[$categ->getId()] = $categ->title; } return $valuearray; }