Monthly Archives: March 2010

Solution of “Error: element.dispatchEvent is not a function Source” Error

When u r facing this type of error “Error: element.dispatchEvent is not a function Source”. It means a problem of conflict of the jQuery . It can easy to over come to reduce the error

   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
     // Put all your code in your document ready area
       // Do jQuery stuff using $
     // Use Prototype with $(...), etc.


Use URL in footer.phtml

It is quit impossible to use the store or skin or other url in footer. so we can use this

<a href="<?php echo $this->getUrl('')?>catalog/seo_sitemap/category">Site Map</a>
<a href="<?php echo $this->getUrl('')?>catalogsearch/term/popular">Popular search</a>
<a href="<?php echo $this->getUrl('')?>catalogsearch/advanced">Advanced search</a>

for skin 
/*$this->getSkinUrl('give the name which url u want');
<img src="<?php echo $this->getSkinUrl('images/pictos/panier.gif') ?>" alt="Mon panier">

Show all category under a category named “Product”

Go to your template folder and open Catalog/navigation/top.phtml
and add this

<?php $URL= Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
	  // echo $URL;
<div class="header-nav-container">
    <div class="header-nav">
        <h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4>
        <ul id="nav">
		<li><a href="<?php echo $this->getUrl() ?>"><?php echo $this->__('Home') ?></a></li>
        <?php /*?><?php foreach ($this->getStoreCategories() as $_category): ?>
            <?php echo $this->drawItem($_category) ?>
        <?php endforeach ?><?php */?>
		<li onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)">
            <a href="<?php echo $this->getUrl('') ?>"><?php echo $this->__('Products') ?></a>
				<?php foreach ($this->getStoreCategories() as $_category): ?>
				    <?php echo $this->drawItem($_category) ?>
				<?php endforeach ?>
		<li><a href="<?php echo $URL?>customer/account/login/" >Log in</a></li>
        <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('menu')->toHtml(); ?>
    <?php echo $this->getChildHtml('topLeftLinks') ?>

Retrieving URL paths in magento

Magento comes with built in function for retrieving URL paths. Function is called getBaseUrl() and its located under Mage class. However, function is not documented as it should be. Documentation only states that function retrieves $type parametar which is by default equal to “base”.

Here is the list of all the available parameters I found. As you can see, they all come from Mage_Core_Model_Store.


Where http://magesite.extension/ is the url of your site. If you don’t provide any parameters to getBaseUrl() function you would retrieve the same path as with URL_TYPE_LINK parametar.

Remember, you need to echo out these statements to the browser, because they each return a string, so you need to output that string like

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
%d bloggers like this: