Viewing 1 to 10 of 35 items
Archive | Front-end RSS feed for this section

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…


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.