Posts

Showing posts from June, 2012

Close fancy box after some time

if you want to close your fancy box pop-up window Automatically after some time then  setTimeout(" parent.jQuery.fancybox.close(); ", 5000); in red portion we can set any thing which works delay after 5 second,

Hyperlink within iframe and open page on parent window not in iframe

If any one give a hyperlink in iframe, then genrally this link opened within iframe , but if you want to open that hyperlink in parent browser window then do this and enjoy :) (helps to handle iframe type fancybox also) ie hyper links which opens in parent window not in iframe. <a class= "fancybox-close" onclick= "parent.document.location='some_url’ ></a>

Display new arrivals by category in Magento

Some times clients demand to show new arrivals product on home page or product listing page in magento store. Then its very easy to show that For this load product collection and apply these filters <?php   /*Find the current date */   $todayDate = Mage :: app () -> getLocale () -> date () -> toString (Varien_Date :: DATETIME_INTERNAL_FORMAT );  /*Making collection of new arrivals*/   $_productCollection = Mage :: getModel ( 'catalog/product' ) -> getCollection () -> addAttributeToSelect ( '*' ) -> setStoreId ( $storeId ) -> addStoreFilter ( $storeId ) -> addCategoryFilter ( $category ) -> addAttributeToFilter ( 'news_from_date' , array ( 'date' => true , 'to' => $todayDate )) -> addAttributeToFilter ( 'news_to_date' , array ( 'or' => array ( 0 => array

change precision of price in magento

By default Magento show price with two decimal points like Rs. 25.00 , if you want to change the precision of  Price then In line 62 in /lib/zend/Currency.php you can change the precision for all  prices in your shop. <?php protected $_options = array( 'position' => self::STANDARD, // position for the currency sign 'script' => null, // script for output 'format' => null, // locale for numeric output 'display' => self::NO_SYMBOL, // currency detail to show 'precision' => 0, // precision for currency 'name' => null, // name for this currency 'currency' => null, // 3 lettered international abbreviation 'symbol' => null // currency symbol ); and /app/code/core/Mage/Core/Model/Store.php Change the roundPrice function to: public function ro

Change price symbol in magento store

Change price symbol in magento store  If you want to change symbol of Indian currency in your Magento store  find  root.xml in <your site root> /lib/Zend/Locale/Data <currency type= "INR" <symbol > Rs </symbol> </currency>

Sort Products by popularity count in Magento

Advance shorting option for category/list page in magento Note: Please Make  folder structure app/code/local  and place all files in same structure in this folder ,If you make changes in core files its your risk.please make proper backup for core files if you modify that . Step -1. For Advance shorting option you have to create new collection by overriding Collection class. Overrride the collection class(/app/code/core/Mage/Catalog/Model/Resource/Product/collection.php and create a new function <?php   public function sortByReview ( $dir ){ $table = $this -> getTable ( 'review/review' ); $entity_code_id = Mage :: getModel ( 'review/review' ) -> getEntityIdByCode (Mage_Rating_Model_Rating :: ENTITY_PRODUCT_CODE );    $cond = $this -> getConnection () -> quoteInto ( 't2.entity_pk_value = e.entity_id and ' , '' ) . $this -> getConnection () -> quoteInto ( 't2.entity_id = ? ' , $entity_code_id );    $this -

Get magento default session messages

Hi friends, I spend much time on this , You can render magento default session message.You can also render these  message and call them by Ajax. <?php    /*Brings checkout sessions message*/ $messages = Mage :: getSingleton ( "checkout/session" ) -> getMessages ();   /*Get layout and render default message*/ echo this -> getLayout () -> createBlock ( "core/messages" ) -> setMessages ( $messages ) -> getGroupedHtml (); Note: If you want another session's message then  modify your Singleton: $messages = Mage :: getSingleton ( " customer / session") -> getMessages (); or $messages = Mage :: getSingleton ( " core / session " ) -> getMessages (); or $messages = Mage :: getSingleton ("checkout / session") -> getMessages (); ?> All done Enjoy!! =========