Programatically get all currency of store in opencart

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency ORDER BY title ASC");
if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
   $connection = 'SSL';
  } else {
   $connection = 'NONSSL';

  $action = $this->url->link('module/currency', '', $connection);

<form action="<?php echo $action; ?>" method="post" name="currency_form" enctype="multipart/form-data">
      <?php foreach ($query->rows as $result) { ?>
          <li><a onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $result['code']; ?>'); document.currency_form.submit();"><?php echo $result['code']; ?></a></li>
      <?php } ?>
    <input type="hidden" name="currency_code" value="" />

Thats it.... Enjoy Chandresh rana's Coding... :)
Today i need to show some message when internet connection lost. So I define this interceptor in httpProvider in my app.js file, so its return an error when a call does not happen successfully due to internet connection lost. This Interceptor return status= "-1" when ajax call is failed. So i set a variable online= true here and in my html i display a message if online=true. See below my html code as well

angular.module('YourAppName', []).config([
function($q,$rootScope) {
return {
responseError: function(res){
//Angular returns "success" by default, but we will call "error" if data were not obtained.
if( == null && res.status === -1 && res.statusText === ""){
$ = true;
return $q.reject(res) //callback error()
return res //return default success()

Now i need to show some message when $ = true;
Below i check that online variable is true then show a message "Your have lost your internet connection. Check your internet connection and reload your page again." other wise not.

<!--Below message is showing when internet connection is lost. --> 
<div class="alert alert-error" ng-if="online"><i class="btn-icon-only icon-warning-sign"></i>
Your have lost your internet connection. Check your internet connection and reload your page again.<button ng-click="reloadRoute()"><i class="icon-refresh"></i> Reload</button>

If you see my above html there i also add a reload button to reload the page to do this i create a function and i call this on click of reload button Below is my function :

// This function Is use to reload the active page.
$rootScope.reloadRoute = function() {

Now in the last step you need to hide the above message automatically when internet connection is coming again to do this i just put $ = false; when view content loaded like below :

// To set the view online message false.
$rootScope.$on('$viewContentLoaded', function() {
$ = false;

Preview :

If you like this post or you have any problem during implementation don't to leave a comment below i will definitely reply you back as soon as possible.

Chears :)

Happy coding

Display image column in manage category grid magento admin

Here i will show you how to create image column in admin mangage category grid magento.

First open app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php file.

You can copy this file in your local folder so that magento core functionality will not be override.

Put the below code in _prepareColumns() function to create image column in grid.

    $this->addColumn('image', array(
        'header' => Mage::helper('catalog')->__('Image'),
        'align' => 'left',
        'index' => 'image',
        'width'     => '100',
        'renderer'  => 'adminhtml/Catalog_Category_Grid_Render_Image',

You can check in code we have created renderer to fetch product image. Now as per renderer create the Grid folder then Render folder and then Image.php file in app/code/core/Mage/Adminhtml/Block/Catalog/Category/ folder

Copy and paste the below code in Image.php file

class Mage_Adminhtml_Block_Catalog_Category_Grid_Render_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
    public function render(Varien_Object $row)
$products = Mage::getModel('catalog/product')->load($row->getEntityId());
  $imgSrc = Mage::helper('catalog/image')->init($products, 'small_image')->resize(100);
catch(Exception $e) {
  $imgSrc = Mage::getDesign()->getSkinUrl('images/catalog/product/placeholder/image.jpg',array('_area'=>'frontend'));
return '<img src="'.$imgSrc.'" alt="'.$strBannerTitle.'" title="'.$strBannerTitle.'" width="100px">';

Now you can check in admin panel image shows in image column like below: