Many times I need to test some elements in some web pages which I don’t own. If that webpage uses jQuery then it’s quite easy for us to do our testing; but if jQuery is not there, it’s a headache to do kinds of stuff with native JavaScript, because jQuery is always a better DOM Full Article…
Jquery – Start FancyBox on page load without clicking
When you want to open a popup on page load without click by using Fancybox, you can use this script: window.jQuery(document).ready(function() { $.fancybox.open('#popup_box'); }); Hope it will help ^^
Magento – Product Collection
In this blog, we will see some important function in magento product collection class. Product Collection class in magento is Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection. Lets look at the important functions Get All Products of a category 1 2 3 $collection = Mage::getResourceModel('catalog/product_collection') ->setStoreId($this->getStoreId()) ->addCategoryFilter($category); Tn this the addCategoryFilter() function, is used to get all products of a particular Full Article…
Magento – Functions cheatsheet
General functions Function Description $this->getRequest()->getServer(‘HTTP_REFERER’); Get the referer URL Product related functions Function Description $product->getName() Get product name $product->getSku() Get product sku Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($_product)->getQty() Get product stock $product->getResource()->getAttribute(‘color’)->getFrontend()->getValue($product) Get a product attribute value (like color/size) $product->isSaleable() checks if a product is salable $product->isisAvailable() checks if a product type is salable Mage::getModel(‘catalogrule/rule’)->calcProductPriceRule($product,$product->getPrice()) Gets the product final price Full Article…
Magento – Set the default direction or ordering for category-pages
On Magento category-pages you can select how to view the available products: By price, name or relevance, and ascending or descending. Within the Magento backend, the default ordering (price, name or relevance) can be configured but strangely enough the default direction (ascending or descending) not. Here is a XML layout update that allows you to Full Article…
Css – Meaning of numbers in col-md-4 , col-xs-1 , col-lg-2 in bootstrap
Meaning of numbers in col-md-4 , col-xs-1 , col-lg-2 in bootstrap Here's an attempt at a simple explanation: Ignoring the letters (xs, sm, md, lg) for now, I'll start with just the numbers… the numbers (1-12) represent a portion of the total width of any div all divs are divided into 12 columns so, col-*-6 spans 6 of 12 Full Article…
How to style checkbox using CSS?
You can achieve quite a cool custom checkbox effect by using the new abilities that come with the :after and :before pseudo classes. The advantage to this, is: You don't need to add anything more to the dom, just the standard checkbox. Note this will only work for compatible browsers, I believe this is related to the fact that Full Article…
Change the color of selected radio button’s center circle
You can bind radio-button to label, than you can hide radio-button and style label whatever you like.Example. div { background-color: #444444; display: flex-column; display:webkit-flex-column; } input { margin: 10px; position: absolute; left: 100px; } label { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; margin: 10px; display: block; width: 30px; height: 30px; border-radius: 50%; -webkit-border-radius: 50%; background-color: Full Article…
jQuery – Get & format HTML tags from a simple string
I have a String variable say strHTML = "<div class='abc'> This is a test <span class='xyz'> String </span> </div> " that i m receiving from server. When I use $('#container').append(strHTML); or $('#container').text(strHTML); it is displaying the whole string including HTML tag in "container". What i want is to take each HTML tag as HTML element Full Article…
Magento – How to redirect to previous page
Sometimes you will want to redirect to previous page after executing a function. You can try this: $this->_redirectReferer(); It does a little more than redirect to the previous page. If you specify in the url a parameter uenc it will consider that as the referrer.