Skip to main content

Posts

Display Categories in Magento

Here, I will show you how you can get list of all categories of your Magento Shop. You might want to display all categories in homepage or any CMS page. There are different ways to get the category listing. Here are some:- Get all categories The following code will fetch all categories (both active and inactive) that are present in your Magento Shop. $categories   = Mage::getModel( 'catalog/category' )                      ->getCollection()                      ->addAttributeToSelect( '*' ); Get all active categories The following code will fetch all active categories that are present in your Magento Shop. Thus filtering the inactive categories. $categories   = Mage::getModel( 'catalog/category' )                      ->getCollection()                      ->addAttributeToSelect( '*' )                      ->addIsActiveFilter(); Get active categories of any particular level The following code w

MySQL query get first and last day of month

# For current month SELECT DATE_FORMAT(CURDATE(), '%Y-%m-01') AS `First Day Of Current Month`; SELECT LAST_DAY(CURDATE()) AS `Last Day Of Current Month`; # For previous month SELECT DATE_FORMAT(CURDATE() - INTERVAL 1 MONTH, '%Y-%m-01') AS `First Day Of Previous Month`; SELECT LAST_DAY(CURDATE() - INTERVAL 1 MONTH) AS `Last Day Of Previous Month`; # For next month SELECT DATE_FORMAT(CURDATE() + INTERVAL 1 MONTH, '%Y-%m-01') AS `First Day Of Next Month`; SELECT LAST_DAY(CURDATE() + INTERVAL 1 MONTH) AS `Last Day Of Next Month`;

Magento : onepage checkout scrolling issue.

Open opcheckout.js and find gotoSection function and replace this function as follow. gotoSection: function(section) { var sectionElement = $('opc-'+section); sectionElement.addClassName('allow'); this.accordion.openSection('opc-'+section); this.reloadProgressBlock(section); jQuery("html, body").delay(10).animate({scrollTop: jQuery("#opc-"+section).offset().top }, 1000); },

Magento Observer Event list

File Line Event /app/code/core/Mage/Admin/Model/Session.php 104 admin_session_user_login_success /app/code/core/Mage/Admin/Model/Session.php 112 admin_session_user_login_failed /app/code/core/Mage/Admin/Model/User.php 337 admin_user_authenticate_before /app/code/core/Mage/Admin/Model/User.php 354 admin_user_authenticate_after /app/code/core/Mage/Adminhtml/Block/Api/User.php 52 api_user_html_before /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php 160 adminhtml_catalog_category_edit_prepare_form /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php 157 adminhtml_catalog_category_tabs /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php 291 adminhtml_catalog_category_tree_is_moveable /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php 328 adminhtml_catalog_category_tree_can_add_root_category /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php 348 adminhtml_catalog_category_tree_can_add_sub_category /app/code/core/Ma