Ctrl+Alt+Life: Hacking life, tech, and beyond.

  • Boost Magento page speed

    1. Enable cache 2. Enable Zend Full page cache 3. zlib.output_compression on 4. turn on all compression of mod_deflate.c 5. “ExpiresActive On” in mod_expires.c 6. add some more cache and compression # YEAR Header set Cache-Control “max-age=29030400” # WEEK Header set Cache-Control “max-age=604800” # 45 MIN Header set Cache-Control “max-age=86400” mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include…

  • Scroll to top button without any additional jquery plugins

    jQuery(‘#back-to-top’).bind(‘click’, function () { var item_top = jQuery(“body”).offset().top; jQuery(“body”).animate({scrollTop:item_top}, 1000); });

  • Magento add to cart product with custom options by Ajax

    Add to Cart Add product to cart from any page of magento by Ajax get the custom option ids from admin panel by inspecting html elements // load product by id jQuery(“#buy_now”).click(function(){ var urls = ”; // radio custom options var txt = jQuery(‘.color_pro:checked’).val(); var cov = jQuery(‘.cover_pro:checked’).val(); if (txt !== ”) { jQuery(‘#pro_pop’).html(‘Loading… Please…

  • Magento collection pagination

    $pager = 1; if (isset($_GET[‘page’])) { $pager = $_GET[‘page’]; } $collection = Mage::getModel(‘customer/customer’) ->getCollection() ->setPageSize(9) ->setCurPage($pager) ->addAttributeToSelect(‘*’); /*->addFieldToFilter(‘group_id’, 4);*/ $count = Mage::getModel(‘customer/customer’)->getCollection()->getSize(); $page_num = ceil($count / 9);

  • Magento change category list and product details page template

    Create category and add Custom Layout Update catalog/product/adlist.phtml catalog/product/adview.phtml Select “Yes” in “apply to products” drop-down.      

Need tech consultancy?