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

Apache Virtual Host and Setting it up on Ubuntu Linux

The term Virtual Host refers to the practice of running more than one web site (such as www.company1.com and www.company2.com) on a single machine. Virtual hosts can be “IP-based“, meaning that you have an IP address for each web site, or “name-based“, meaning that you have more than one web site per IP address. The … 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

PHP: Easily send email with PHPMailer

PHPMailer is a PHP class for PHP that provides a package of functions to send email. It is an efficient way to send e-mail within PHP. The following are some features of PHPMailer:- – Sending HTML email – Sending email with attachments – Sending email to multiple recepients via to, CC, BCC, etc – Supports … Read more

Magento: Create CMS Page & Static Block programmatically

You can manually create CMS Pages in Magento from CMS -> Pages. Similarly, you can create Static Blocks from CMS -> Static Blocks. This article will show how to create CMS pages and Static blocks programmatically from code. Create CMS Page Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $cmsPage = array( 'title' => 'Test Page', 'identifier' => 'test-page', 'content' => 'Sample … Read more

Magento: Get Best Selling products by category and date time

This article will show you how to get best selling products. You will see how to get overall best selling products as well as best selling products by category and by date time range. Here is the code:- Get overall Bestselling products public function getBestsellingProducts() { // number of products to display $productCount = 5; … Read more

Javascript: Show Hide textbox text on focus

This might be simple one but it is a very handy code. Generally, I see this being used in Search textbox where there is some text like ‘search…’ by default. And, when you put the mouse cursor on the textbox, the text is removed and then you can type your desired search text. For this, … Read more