Php Web Development Company Blog
HOME || SERVICES || HIRE DEDICATED DEVELOPERS || CONTACT US

23.1.10

Beat the competition – useful tips for Magento developer.

For an aspiring Magento developer or a struggling magneto developer this article is dedicated to the sleepless nights you have spent on working on Magento ecommerce development.

  • Always follow The official Twitter account from Magento Commerce by Varien from Los Angeles, California.

  • How to extend an existing class to add new functionality to satisfy a specific requirement in Magento:

    Ans: There are 4 basic steps in the process:
    • Create a PHP file for the extended class in the /local code repository
    • Create an XML file to let Magento know about this extended class
    • Create a PHP template to utilize the output of the extended class
    • Modify the XML layout files to bring in the new template

  • For a magento developer that wants to display subcategories in the main body of a category page rather than them being restricted solely to the navigation bar.

Ans:        * 1. Upload this page to your installation at:

               *              /app/design/frontend/[INTERFACE]/[THEME]/template/catalog/navigation/custom-category.phtml

               *

               * 2. Enter the following code in a static block:

               *                             {{block type="catalog/navigation" name="catalog.navigation" template="catalog/navigation/custom-category.phtml"}}

               *

               * 3. Select the static block as the content source for the categories you require

               *

               * 4. Create new CSS styles as required

               *

               **/

?>

<?php $_categories=$this->getCurrentChildCategories() ?>

<?php if($_categories->count()): ?>

<ul class="category-links">       

               <?php foreach ($_categories as $_category): ?>

        <?php if($_category->getIsActive()): ?>

        <li class="<?php echo $this->htmlEscape($_category->getUrlKey()) ?>">

           <a href="<?php echo $this->getCategoryUrl($_category) ?>">

              <?php echo $this->htmlEscape($_category->getName()) ?>

           </a>

        </li>

        <?php endif; ?>

    <?php endforeach ?>

</ul>

<? endif; ?>

  • A custom module that will allow user to browse products by attribute options and categories.

Ans: app/code/local/MageDev/Filter - location of filter module files

app/code/local/MageDev/Filter/etc - config data

app/code/local/MageDev/Filter/controllers - custom controllers

app/code/local/Block - here goes blocks logic

app/code/local/Helper - general functionality

  • For setting redirection anywhere in Magento code.
 Ans: Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'));

  • For Writing custom write custom query
Ans: 
01 <?php

02 // For Read

03

04 // fetch read database connection that is used in Mage_Core module

05 $read= Mage::getSingleton('core/resource')->getConnection('core_read');

06 $value=$read->query("SE...");

07 $row = $value->fetch();

08

09 print_r($row); // As Array

10

11 // For Write

12

13 // fetch write database connection that is used in Mage_Core module

14 $write = Mage::getSingleton('core/resource')->getConnection('core_write');

15

16 // now $write is an instance of Zend_Db_Adapter_Abstract

17 $write->query("insert into tablename values ('aaa','bbb','ccc')");

18

19 ?>

 I strongly suggest all the Magento developers that you keep this article a hush hush!

Labels: , ,


Bookmarks:
Add this site to Stumble Upon Add this site to Digg Add this site to Delicious Add this site to Reddit Add this site to Newsvine  Add this site to Blinklist Add this site to Furl Add this site to Google

0 Comments:

Post a Comment

<< Offshore Web Application Development Blog