How to delete all reviews & ratting – magento 1.9

Hello Friends,

When ever you are developing online store for your client, You are inserting some demo products / reviews / categories. But this all are for demo only..

So now when you do store online with real products and categories you must need to delete review & ratting that you have inserted for demo purpose.

Here is SQL Query for delete all reviews and ratting.

truncate table `rating_option_vote`; 
truncate table `rating_option_vote_aggregated`;
truncate table `review`; 
truncate table `review_detail`; 
truncate table `review_entity_summary`; 
truncate table `review_store`;

Don’t forgot to insert “FOREIGN_KEY_CHECKS = 0” before start query. If you are not set FOREIGN_KEY_CHECKS = 0 it maybe give error because of foreign key relation in tables.
And please visit “How to delete all review and ratting one by one from admin panel” if you want to delete it manually.

Hope you have deleted all reviews and ratting after read this blog.. Now next is to delete all products and categories. so you can read here “How to delete all products” & “How to delete all categories“.

Thanks for read, Please comment below!!!

How to search products category wise in magento 1.9

In magento, Search is working fine when there are limited products and categories. But problem come when there are lots of products in different kind of categories.

And now customers are finding products with specific categories and tags. So if you want to increase sells you must need to provide category wise search for find product easily..

And good news is.. you can do this functionality easily. you need to replace code. Below code available for category wise search in magento :).

$category = Mage::getModel('catalog/category');
	$current_category_path = array();
$children_string = $category->getChildren();
$children = explode(',',$children_string);
foreach($children as $c){
	$selected = (in_array($c, $current_category_path))?'SELECTED':'';
	$extra_options.= '<option value="' . $c . '" ' . $selected . '>' . $category->load($c)->getName() . '</option>' . "\n";
<form id="search_mini_form" action="<?php echo $this->helper('catalogSearch')->getResultUrl() ?>" method="get">
		<legend><?php echo $this->__('Search Site') ?></legend>
		<div class="mini-search">
			<input id="search" type="text" class="input-text" name="<?php echo $this->helper('catalogSearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogSearch')->getEscapedQueryText() ?>" />
			<select name="cat" id="cat" class="input-text">
			<option value="">All Departments</option>
			<?= $extra_options ?>
			<input type="submit" value="Go" style="border: 1px solid #808080;" alt="<?php echo $this->__('Search') ?>" />
			<div id="search_autocomplete" class="search-autocomplete"></div>
			<script type="text/javascript">
				var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('search site...') ?>');
				searchForm.initAutocomplete('<?php echo $this->helper('catalogSearch')->getSuggestUrl() ?>', 'search_autocomplete');

NOTE: Have tested in magento 1.9.4

Category manage page broken in magento 1.9

Hello Friend,

Recent i was facing one error in my admin panel when open category management page. My category page was totally broken and display like not CSS and JS apply.

And i found solution from one popular site, Now i like to share solution here in my blog so my followers and other developer can get solution.

So solution is :

You need to go in file: app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php.

And bottom of file just add below method :

public function getRowUrl($row) 
return $this->getUrl('*/*/edit', array('page_id' => $row->getId())); 

Now refresh admin panel. Hope its working fine.

Note:- Still not working then please try to clear catch and then try.


How to move block left to right

Magento is flexible for move blocks from one position to other. its very easy to move block using XML.

if you want to move any block from left to right then you just need to change name=”left” to name=”right” Below is example code.

<reference name="right">
    <block type="cms/block" name="sample_block" before="-">
        <action method="setBlockId"><block_id>sample_block</block_id></action>

Here is in example have set name=”right” that means this block display in right side.

3 Different way to call Newsletter block in magento 1.9

Newsletter is the main block when you are creating online store for sell products. Using Newsletter you can invite new customer for visit store and also its help to keep attached your current customers.

You can call newsletter block and even other default block using 3 methods.

1.) Call Direct in CMS page or static block

2.) Call in .phml file

3.) Call using XML reference.

For Call direct in CMS you can use below code.

{{block type="core/template" template="newsletter/subscribe.phtml"}}

You can use below code for display direct in .phtml file

<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newslettersubscribe.phtml')->toHtml(); ?>

Also you can use below XML code.

<reference name="footer>
<block type="newsletter/subscribe" before="-" name="right.newsletter" template="newsletter/subscribe.phtml"/>

Get base URL, Media URL, JS URL, Skin URL, Store URL, and Current URL

Basic Questions in magento’s developer mind when start theme development.

  • How to get Base URL in .phtml file.
  • How to get Skin URL in .phtml file.
  • How to display image in CMS page or Static Block.
  • How to get Media URL.
  • How to get JS URL.
  • How to get Store URL.
  • How to get Current URL.

Below are answer available for all above Questions.

Get URL in phtml files.

  1. Get Base Url :


  2. Get Skin Url :


    • Unsecure Skin Url :


    • Secure Skin Url :

      $this->getSkinUrl('images/imagename.gif', array('_secure'=>true));

  3. Get Media Url :


  4. Get Js Url :


  5. Get Store Url :


  6. Get Current Url :


Get URL in static block or CMS page.

  1. Get Base Url :

    {{store url=""}}

  2. Get Skin Url :

    {{skin url='images/imagename.jpg'}}

  3. Get Media Url :

    {{media url='/imagename.jpg'}}

  4. Get Store Url :

    {{store url='mypage.html'}}