Showing posts with label Opencart. Show all posts
Showing posts with label Opencart. Show all posts

Friday 11 July 2014

Remove white space from Image in Opencart


Remove white space from Image in Opencart

Note : vqmod need to be install to fix this issue...

Create a xml file named white-space.xml and paste belowe code in this xml file...

<modification>
<id><![CDATA[Fixes white excess for non-proportional image resize]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[]]></vqmver>
<file name="system/library/image.php">
<operation>
<search position="replace"><![CDATA[$this->image = imagecreatetruecolor($width, $height);]]></search>
<add><![CDATA[$this->image = imagecreatetruecolor($new_width, $new_height); /* MX]]></add>
</operation>
<operation>
<search position="replace" offset="4"><![CDATA[imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);]]></search>
<add><![CDATA[MX */
imagecopyresampled($this->image, $image_old, 0, 0, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);

imagedestroy($image_old);
         
$this->info['width']  = $new_width;
$this->info['height'] = $new_height;
// MX End ]]></add>
</operation>
</file>
</modification>

Now open your opencart directory go to vqmod/xml and paste here above xml file..

That's it enjoy chandresh rana coding... :)

Monday 7 July 2014

Get Current Category in opencart


Get Current Category in opencart

if(isset($this->request->get['path'])) {
    $path = $this->request->get['path'];
    $cats = explode('_', $path);
    $cat_id = $cats[count($cats) - 1];
}
echo $cat_id;

Thursday 3 July 2014

How to make a login/logout functionality in opencart


How to make a login/logout functionality in opencart

<?php if (!$logged) { ?>
      <a class="tr_login" href="<?php echo str_replace('&', '&amp;', $login); ?>" title="<?php echo $text_login; ?>"><?php echo $text_login; ?></a>
      <?php } else { ?>
      <a class="tr_logout" href="<?php echo str_replace('&', '&amp;', $logout); ?>" title="<?php echo $text_logout; ?>"><?php echo $text_logout; ?></a>
<?php } ?>

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

Tuesday 1 July 2014

Call image in opencart


Call image in opencart

I have defined here how to call image in opencart. Please try to use blow small code..

catalog/view/theme/<?php echo $this->config->get('config_template'); ?>/images/image.png

Example :

<img src="catalog/view/theme/<?php echo $this->config->get('config_template'); ?>/images/image.png" width="100" height ="100" />

Get Currency symbol in opencart


Get Currency symbol in opencart

You can get currency symbol by using the below code :

<?php echo $this->currency->getSymbolRight($this->session->data['currency']) ?>

OR

<?php echo $this->currency->getSymbolLeft($this->session->data['currency']) ?>

Get Cart total in opencart


Get Cart total in opencart

<?php echo $cart_total = $this->cart->getTotal(); ?>