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.
* /app/design/frontend/[INTERFACE]/[THEME]/template/catalog/navigation/custom-category.phtml
*
* 2. Enter the following code in a static block:
* {{block 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 >
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<li "<?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; ?>
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
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!
- 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.
* /app/design/frontend/[INTERFACE]/[THEME]/template/catalog/navigation/custom-category.phtml
*
* 2. Enter the following code in a static block:
* {{block 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 >
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<li "<?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.
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.
For Writing custom write custom query
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!