Posts

Showing posts from October, 2015

Google map comes partially, grey area comes instead of images from google server

Sometimes google map comes partially with other area getting grayed out. This style solved my problem #map_canvas img { max-width: none !important; } #map_canvas id of the map It forces the browser to allow the map to be as wide as it needs to be.

ultimate module creater configuration

Auto hide footer on scroll using jquery

##--First include jQuery 1.10 version file--## ##--Place these property in CSS File--## footer {     position: fixed;     bottom:0px;     height: 40px;     width: 100%;     margin: 0 auto;     text-align: center;     border-top:2px solid #6ce6d5;     background: white;     z-index: 100; } #underfooter {     position: fixed;     bottom: -44px;     background: blue;     width: 100%;     height: 40px;     z-index: 90; } ##----------------------------------## ##------------Content---------------## <footer> Your Content </footer> <div id="underfooter"></div> ##----------------------------------## ##---------Place the script--------## <script> $(function(){     $('footer').hide();     if($(document).height() ...

How to speed up your magento

Image
One of the drawbacks of Magento is currently its speed if default configuration is used. There are certain ways of making it run faster. The best one is to enable GZip compression by changing .htaccess file a little. You just need to uncomment part of the code. In my case, the speed increase was exactly 235%. Let’s start speeding up Magento! Find the following lines in your Magento .htaccess file and replace them with the following code. ############################################ ## enable apache served files compression ## http://developer.yahoo.com/performance/rules.html#gzip # Insert filter SetOutputFilter DEFLATE # Netscape 4.x has some problems… BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don’t compress images SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make ...

Read and Write XML Files In Magento

You can use  Varien_Simplexml_Element class  to  read and write xml nodes . In magento the location of class file is lib/Varien/Simplexml/Element.php Below is a sample of an XML file which I will read through Magento code. And after that i will also add an xml node into it. <? xml version = "1.0" ?> <config> <modules> <MyNamespace_MyModule> <version> 0.1.0 </version> </MyNamespace_MyModule> </config> </modules> Here is the Magento/PHP code to read the XML data. I have kept the XML file in the root directory of Magento installation. The XML file is named  test.xml . At first, the XML file is loaded and then it’s node are read with getNode function. Then, I have printed the result. $xmlPath = Mage :: getBaseDir (). DS . 'test.xml' ; $xmlObj = new Varien_Simplexml_Config ( $xmlPath ); $xmlData = $xmlObj -> getNode (); echo "<pre>" ...

How to get product rating and review in magento

/**Getting reviews collection object**/ $productId = $product->getId(); $reviews = Mage::getModel('review/review') ->getResourceCollection() ->addStoreFilter(Mage::app()->getStore()->getId()) ->addEntityFilter('product', $productId) ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED) ->setDateOrder() ->addRateVotes(); /**Getting average of ratings/reviews**/ $avg = 0; $ratings = array(); if (count($reviews) > 0) { foreach ($reviews->getItems() as $review) { foreach( $review->getRatingVotes() as $vote ) { $ratings[] = $vote->getPercent(); } } $avg = array_sum($ratings)/count($ratings); }

To find the URL path in Array

$currentUrl = Mage::helper('core/url')->getCurrentUrl(); $url = Mage::getSingleton('core/url')->parseUrl($currentUrl); $path = $url->getPath(); $blogPaths = array('/checkout/onepage/','/checkout/cart/','/checkout/onepage/index/'); if(in_array($path,$blogPaths)) { }

Move layered navigation block between product list toolbar and product list

Add this code to your layout XML : <?xml version="1.0"?> <layout version="0.1.0"> <catalog_category_layered> <reference name="left"> <action method="unsetChild"><alias>catalog.leftnav</alias></action> </reference> <reference name="product_list"> <action method="insert"><blockName>catalog.leftnav</blockName></action> </reference> </catalog_category_layered> </layout>      In list.phtml File Call this <?php echo $this->getChildHtml('catalog.leftnav'); ?>

Count Up Timer jquery

<div id="bestPrice"></div> <script src="js/countUp.js"></script> <script>         jQuery( document ).ready(function () {             var bestAnim = new countUp("bestPrice", 0, "<?php echo $price_in_format;?>", 2, 1.5);             bestAnim.start();                         });      </script>