Magento Expert Forum - Improve your Magento experience

Results 1 to 6 of 6

Get started with magento programming by simple steps

  1. #1
    Moderator shunavi's Avatar
    Join Date
    Mar 2013
    Posts
    124
    Thanks
    9
    Thanked 26 Times in 17 Posts

    Thumbs up Get started with magento programming by simple steps

    1.How to get CMS page id in Magento?

    Actually you can easily manage CMS page from an admin panel. However, you are able to insert blocks in it. For example we have 2 cms pages: contacts and FAQ, these pages include block with banner which appears on each of these 2 pages, but content for this block is based on some PHP code. And if block content somehow depends on the page, we have to use following method.

    PHP Code:
                function getCurrentCmsPage() {

                
    $pageId Mage::getBlockSingleton('cms/page')->getPage()->getIdentifier();

                return 
    $pageId;

                } 

    Done

    2.How to filtrate Magento category collection by rank?

    Sometimes you need to get a list of all categories with a particular level for a custom navigation menu. This can be done as follows:


    PHP Code:
                $model=Mage::getModel('catalog/category');

                
    $categories=$model->getCollection()->;addLevelFilter(2)

                ->
    addAttributeToSelect(' ')->addIsActiveFilter(); 

    However, this is not always correct. I think I should explain why, right?

    If I will enter request to a base I will get the following:

    Code:
     SELECT main_table. FROMcatalog_category_flat_store_1 AS main_table WHERE (main_table.level <= 2) AND (is_active = ’1′)
    It is very visible that condition <= is in use, what doesn't fit, because filtering categories of 3 rd level we will also get categories with 2 nd level.

    Due to this we should do filtration in the following way:
    PHP Code:
                $categories=$model->;getCollection()->;addAttributeToFilter('level',2)

                ->;
    addAttributeToSelect(' ')->;addIsActiveFilter(); 

    After this we can do whatever we want with the collection.

    3. 404 error appears when entering Magento admin panel.
    Sometimes migration to the other server can cause some problems such as error 404. The most frequent reason is a hosting switching.

    And if you want to fix it, first of all you have to commit the next query:


    Code:
    SET FOREIGN_KEY_CHECKS=0;
    
    			UPDATE `core_store` SET store_id = 0 WHERE code='admin';
    
    			UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
    
    			UPDATE `core_website` SET website_id = 0 WHERE code='admin';
    
    			UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGEDIN';
    
    			SET FOREIGN_KEY_CHECKS=1;
    Next, clear your cache folder in / var / cache /. If you own enterprise version or FPC has been installed – then folder /var/full_page_cache/ needs to be cleared as well.

    Source: webinse

    View more threads in the same category:


  2. #2
    New member
    Join Date
    Mar 2014
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Thanks a lot for providing this, it would really be a big help to a newbie like me. looking forward to more tutorials/ info from you

  3. #3
    Junior Member Ocodewire's Avatar
    Join Date
    Jan 2014
    Location
    India
    Posts
    244
    Thanks
    10
    Thanked 16 Times in 15 Posts

    Default

    CMS pages in Magento site is one of the most important part that makes your website complete with the additional content. Actually, magento has a fully-featured CMS system integrated in it. In order to manage your web site pages you need to navigate to the CMS section in the Magento admin area. For more information, visit http://goo.gl/TIwW43

  4. #4
    New member
    Join Date
    Apr 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It is really nice information thank you for sharing. I am a designer and design recruitment websites for recruiters. But i never design in magento now I will definitely try it on.

  5. #5
    Junior Member
    Join Date
    Sep 2017
    Posts
    47
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    This post helps me to begin my Programming in Magento platform.

  6. #6
    Junior Member Snyderphil's Avatar
    Join Date
    Oct 2016
    Posts
    115
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot for providing this info. Great

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •