Thursday 25 August 2016

Programatically get all currency of store in opencart

Programatically get all currency of store in opencart

<?php
$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">
    <ul>
      <?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 } ?>
    </ul>
    <input type="hidden" name="currency_code" value="" />
</form>

Thats it.... Enjoy Chandresh rana's Coding... :)

No comments: