Display sub categories on main category page+Magento

Magento
display sub-categories instead of products on main category page+magento If you want to display Sub Categories list on main category or parent category in magento. So this artical may be help ful to you for design and display subcategories on parent category page+magento. => Copy the Category.php file from core to local. Create any directories required under app/code/local. (This is so images can be displayed) [sourcecode language="plain"] $ cp app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php app/code/local/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php [/sourcecode] => Add -addAttrbuteToSelect('image') to getChildrenCategories function [sourcecode language="plain"] public function getChildrenCategories($category) { $collection = $category->getCollection(); /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */ $collection->addAttributeToSelect('url_key') ->addAttributeToSelect('name') ->addAttributeToSelect('image') ->addAttributeToSelect('all_children') ->addAttributeToSelect('is_anchor') ->addAttributeToFilter('is_active', 1) ->addIdFilter($category->getChildren()) ->setOrder('position', 'ASC') ->joinUrlRewrite() ->load(); return $collection; } [/sourcecode] => Add or modify the category view template app/design/frontend/yourdiractory_path/default/template/catalog/category/view.phtml [php] <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $rootcat = $_category->entity_id; $cat =…
Read More

How to install magento on local server

Magento
Magento Installation | Magento Installation Process | Magento Installation On Localserver Step 1: Open php.ini file for apache C:/xampp/apache/bin/php.in Find php_curl.dll and remove comment(;) From the following line [sourcecode language="plain"]extension=php_curl.dll[/sourcecode] Same way make changes in C:/xampp/php/php.ini file Restart apache server from xampp control panel Step 2: If database connection error occurs "InnoDB Engine" Open file xampp\mysql\bin\my.cnf (Drag and Drop that file to Notepad or notepad++ program) Find code: [sourcecode language="plain"] # Comment the following if you are using InnoDB tables skip-innodb #innodb_data_home_dir = "/xampplite/mysql/" #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = "/xampplite/mysql/" #innodb_log_arch_dir = "/xampplite/mysql/" ## You can set .._buffer_pool_size up to 50 - 80 % ## of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M ## Set .._log_file_size to 25 % of buffer pool…
Read More

How to call static block in magento

Magento
What is static block in magento? Static blocks can be used throughout your theme wherever you want to make small updates to a section of a page. Typical uses would be for promotional banners/callouts in sidebars or for some custom text in the middle of your home page. Static blocks can also be inserted into CMS pages or included in category pages. Creating s static block => Login in into your magento admin panel. => Navigate to CMS->Static blocks => Click Add new block => Give your block title (Title: A descriptive name to identify this block) => Give your block identifier (Identifier: The identifer will allow you to call this block from your template files or using the Magento markup tags. Typically this would be programmer friendly name with…
Read More

Magento Invalid Method Mage Catalog Model Product IsDuplicable

Magento
New version theme is not working in old version. After upgrading magento or when I design theme in magento 1.5.0.1 and use that theme in magento 1.4.2 that time my product page shows error like Invalid method Mage_Catalog_Model_Product::isDuplicable I find the solutin and its work for me. Copy your product.php file from this path: app\code\core\Mage\Catalog\Model\product.php and replace in your maegnto folder. [JWD-Magento-Development]
Read More

How to get Current page url in magento.

Magento
Get Current page url in magento or you can find catalog url using below code. With the help of this code you can easily find current page url in magento [php] <?php $current_page = ''; /* * Check to see if its a CMS page * if it is then get the page identifier */ if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'): $current_page = Mage::getSingleton('cms/page')->getIdentifier(); endif; /* * If its not CMS page, then just get the route name */ if(empty($current_page)): $current_page = Mage::app()->getFrontController()->getRequest()->getRouteName(); endif; /* * What if its a catalog page? * Then we can get the category path :) */ /* * Or you can check all values * $current_page_array = Mage::registry('current_category'); * $current_page_array['url_path'] */ if($current_page == 'catalog'): $current_page = 'path-' . preg_replace('#[^a-z0-9]+#', '-', strtolower(Mage::registry('current_category')->getUrlPath())); endif; ?> [/php] Also if you…
Read More

Check home page URL in magento

Magento
Check current page is home page in magento If you want to check current page is home page or not in magneto below code is helpful to you. [php] <?php if( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ) : ?> [/php] The other way you can check current page is home page or not in magento [php] <?php if($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))): echo "Homepage"; else: echo "Not in Homepage"; endif; ?> [/php] [JWD-Magento-Development]
Read More

Call to undefined method Mage_Adminhtml_Block_Widget::getrowurl

Magento
If you install new magento or upgrade your magento with latest version or you got the error like below: Fatal error: Call to undefined method Mage_Adminhtml_Block_Widget::getrowurl() in C:\xampp\htdocs\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php on line 1622 Read this for the solution that workes for me: Go To app/code/core/Mage/Adminhtml/Block/Widget/Grid.php Look at on line no 1620 on magento 1.5.01 public function getRowUrl($item) { $res = parent::getRowUrl($item); return ($res ? $res : '#'); } And replace this line $res = parent::getRowUrl($item); to $res = parent::getUrl($item); So your new function look like this: public function getRowUrl($item) { $res = parent::getUrl($item); return ($res ? $res : '#'); } [JWD-Magento-Development]
Read More

Magento Bug Call to a member function loadPriceData

Magento
Magento 1.5.0.1 Bug: Call to a member function loadPriceData() on a non-object Please do follow steup for solve this error: Open app\code\core\Mage\Catalog\Model\Product\Attribute\Backend\Tierprice.php Comment out lines from 202 to 219 Error:Fatal error: Call to a member function loadPriceData() on a non-object in E:\wamp\www\magento\app\code\core\Mage\Catalog\Model\Product\Attribute\Backend\Tierprice.php on line 202 [htmlscript] <?php /* $data = $this->_getResource()->loadPriceData($object->getId(), $websiteId); foreach ($data as $k => $v) { $data[$k]['website_price'] = $v['price']; if ($v['all_groups']) { $data[$k]['cust_group'] = Mage_Customer_Model_Group::CUST_GROUP_ALL; } } if (!$object->getData('_edit_mode') && $websiteId) { $rates = $this->_getWebsiteRates(); $full = $data; $data = array(); foreach ($full as $v) { $key = join('-', array($v['cust_group'], $v['price_qty'])); if ($v['website_id'] == $websiteId) { $data[$key] = $v; $data[$key]['website_price'] = $v['price']; } else if ($v['website_id'] == 0 && !isset($data[$key])) { $data[$key] = $v; $data[$key]['website_id'] = $websiteId; if ($object->getPriceModel()->isTierPriceFixed()) { $data[$key]['price'] = $v['price'] * $rates[$websiteId]['rate']; $data[$key]['website_price'] =…
Read More