Tuesday, February 21, 2012

GET CKEDITOR VALUE JQUERY

   jQuery("#cke_contents_comments iframe").contents().find("body").text();

In my case the textarea id was comments so i have used #cke_contents_comments

Wednesday, February 15, 2012

jQuery restrict upload file types

  var  ExtensionList = ['jpeg', 'jpg', 'png', 'gif', 'bmp'];

           jQuery("#file").change(function () {

               if (jQuery.inArray(jQuery(this).val().split('.').pop().toLowerCase(),  ExtensionList  ) == -1) {

                   alert("Only \'jpeg\', \'jpg\', \'png\', \'gif\', \'bmp\' are allowed.");
  jQuery(this).val('');

               }
               });

Tuesday, February 14, 2012

SET DEFAULT STORE VIEW FOR CATEGORY AND PRODUCT LIST IN ADMIN MAGENTO


adminhtml/default/default/template/store/switcher.phtml
CHANGE  THE FOLLOWING LINE OF  CODE
<option value="<?php echo $store->getId() ?>"<?php if($this->getStoreId() == $store->getId()): ?> selected="selected"<?php endif; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $store->getName() ?></option>


TO



<option value="<?php echo $store->getId() ?>"<?php if($this->getStoreId() == $store->getId()): ?> selected="selected"<?php elseif($store->getId()==4):echo "selected='selected'"; endif; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $store->getName() ?></option>

PROTOTYPE /JQUERY CONFLICT IN MAGENTO.

  To rectify the error just open the jquery’s js file ,scroll down to bottom and write
  jQuery.noConflict();
 at the end of file.

REMOVE WARNING : event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.


Use the following code:
jQuery(function(){
    // remove layerX and layerY
    var all = jQuery.event.props,
        len = all.length,
        res = [];
    while (len--) {
      var el = all[len];
      if (el != 'layerX' && el != 'layerY') res.push(el);
    }
    jQuery.event.props = res;
}());

CHANGE LANGUAGE DROPDOWN INTO LINKS MAGENTO

GOTO: /app/design/frontend/*/template/page/switch   
There You will find languages.phtml


Replace the code with:


<?php if(count($this->getStores())>1): ?>
<div class="form-language cls-lang">
  <ul class='cls-ul-lang'>
<?php foreach ($this->getStores() as $_lang): ?>
        <?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
       <li>
  <a href="<?php echo $_lang->getCurrentUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/flags/' . $this->htmlEscape($_lang->getCode()) . '.jpg') ?>" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/></a>
  </li>
    <?php endforeach; ?>
    </ul>
</div>
<?php endif; ?>




Now in the frontend you will see links instead of dropdown.
upload images for the links in the path by inspecting those links.


create flags folder under
/skin/frontend/base/default/images/
and upload images there




Removing cart from magento home page

Using toplinks in footer or in any phtml file

 <?=$this->getLayout()->getBlock('top.links')->toHtml()?>