OKU changes 07 – Add Jquery library to Magento

jQuery.noConflict();
  • Rename the file to jquery-1.2.6.noConflict.min.js
  • Copy the file to the directory js/jquery/
  • In page.xml, add it to the list of js files:
<action method="addJs">jquery/jquery-1.2.6.noConflict.min.js</action>

Use it

– 1st way (notice the function($))

  jQuery(function($){
      // Use jQuery with $(...)
      $('div').show();
  });
  // Use Prototype with $(...)
   $('id').hide();

– 2d way

jQuery(function(){
    // Use Prototype with $(...)
    $('id').hide();
    // Use jQuery with jQuery(...)
    jQuery('div').show();
});

Happy jQuery, jQuery plugins & jQuery UI 😉

 

Source: http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/javascript_related/how_to_use_jquery_1.2.6_lastest_with_prototype

OKU changes 06 – Show categories and subcategories on homepage

In /app/design/frontend/default/modern/template/page/my_homepage.phtml I inserted the following code:

[php]

<?php //Begin Code insertion by DANIEL:: SHOW CATEGORIES AND SUBCATEGORIES?>
<?php $_helper = Mage::helper(‘catalog/category’) ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry(‘current_category’) ?>
<?php if (count($_categories) > 0): ?>
<ul>
<?php foreach($_categories as $_category): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>
</a>
<?php $_category = Mage::getModel(‘catalog/category’)->load($_category->getId()) ?>
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php //End Code insertion by DANIEL::?>

[/php]

And it shows this: