Magento: Adding OR and AND query condition to collection

Here is a quick tip to add OR query and AND query to collection object. I am implementing this on product collection. Getting product collection // PRODUCT COLLECTION $collection = Mage::getModel('catalog/product')->getCollection(); Adding AND query condition Filtering collection to select only those products whose sku is like ‘ch’ AND status is equal to 1 (i.e. enabled … Read more

Magento: A small bug on module creator

Module Creator helps in building basic module structure in Magento. It can be used as a standalone application or a Magento module in the process of creating a new Magento module. You can download and find more about it here: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table I found a small bug while working with a module created through Module Creator. … Read more

Magento: How to get product stock quantity & other stock information?

Here is a quick code to get any product’s stock information like quantity (qty), minimum quantity (min_qty), stock availability (is_in_stock), minimum and maximum sale quantity (min_sale_qty and max_sale_qty), etc. First load the product. Product can be loaded in different ways. Here are the two different ways to load any product in Magento:- 1. Load product … Read more

Magento: Show/Hide Demo Store Notice

A demo store is where there are products but the order done by customer is not processed. If your website is in development mode then it is better to enable demo store notice. Enabling demo store notice in Magento is very simple. You just need to select an option in configuration settings in admin panel. … Read more

Magento: Show/Hide website to search engines by adjusting robots meta tag

The Robots META Tag is meant to provide users who cannot upload or control the /robots.txt file at their websites, with a last chance to keep their content out of search engine indexes and services. <meta name="robots" content="robots-terms"> The content=”robots-terms” is a comma separated list used in the Robots META Tag that may contain one … Read more

Magento: How to get actual price and special price of a product?

Here is a quick and useful code on getting actual price and special price of any product in Magento. The actual price is the real price assigned to the product and special price is the price after any discount is applied to the product. Loading Product $_productId = 52; $_product = Mage::getModel('catalog/product')->load($_productId); Get Actual Price … Read more

Magento: How to get product rating and review?

Here is the code to get ratings and reviews for any particular product. /** * 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) … Read more

Magento: How to setup Ogone Payment Method? [IMAGES]

Ogone is one of the leading European Payment Service Providers with more than 28.000 clients across 40 countries. Ogone is connected through certified links to more than 200 European banks/acquirers that enable handling of international payment methods like Visa, MasterCard, American Express, Diners Club and JCB as well as local ones like iDEAL and Machtigingen … Read more

Magento: Reindex Data Programmatically

This article shows how to reindex Magento Data Programmatically (through code). You can manually reindex data from System -> Index Management. However, this article is concerned how this can be done through code/programming. Currently, there are 9 indexes. They are as under (with their respective key number):- 1. Product Attributes 2. Product Prices 3. Catalog … Read more