How to find the Opencart version that you are running?

The easiest way to find the Opencart version that you are running is to see at the admin footer. Go to your site http://YOUR_URL/admin then see at the footer and you will be able to know which version of opencart it is because most of the programmer did not remove it, so it will be easy to find it out.

get the opencart version

If you were not able to find it there then another option is to open the index.php of the root folder and look for

// Version
define('VERSION', '3.0.3.2');

The VERSION is the named constant for the Opencart version, here in the above example it is 3.0.3.2

Similarly, there are other places where we can find the Opencart version. We can also find it out by seeing the coding style also. One of the most changed styles is as below,

Open ../catalog/controller/module/latest.php, look at line 3

If it says: protected function index($module) { then you have 1.5.0.x

If it says: protected function index($setting) { then you have 1.5.1.x

Similarly, you can find out the opencart version, let us know if you are having any issues and we will help you on those.

E-commerce Module: Replace of fancy box in Opencart with the color box

I love the opencart but I am worried using the fancy box for image enlargement in the product details page, so I think to change the way to show the image enlargement with the use of the color box.

Download the following zip files, upload those files and folders in the root folder like in the image below:

download button

colorbox-in-opencart
colorbox-in-opencart

Go to the catalog/view/theme/default/template/product.tpl and place the code below, below the <?php echo $header; ?>

<link rel="stylesheet" href="colorbox.css" /> <script src="colorbox/jquery.colorbox.js"></script> <script> $(document).ready(function(){ $(".group1").colorbox({rel:'group1'}); $("#click").click(function(){ $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here."); return false; }); }); </script>

module for free in opencart, image magnification
module for free in opencart, image magnification

Now find “facybox” and replace with the “group1” and save, then bingo, things works.

fancy color box for opencart
fancy color box for opencart

Features of ColorBox

  • Supports photos, grouping, slideshow, ajax, inline, and framed content.
  • Lightweight: 10KB of JavaScript (less than 5KBs gzipped).
  • Appearance is controlled through CSS so it can be restyled.
  • Can be extended with callbacks & event-hooks without altering the source files.
  • Completely unobtrusive, options are set in the JS and require no changes to existing HTML.
  • Preloads upcoming images in a photo group.

Find out the example how the colorbox works out as the fancy box with some extra things.

http://www.jacklmoore.com/colorbox/example3/

How to insert the You Save price in opencart 3? – Opencart 3 module free

Opencart tips and tricks post which shows you how we can show or insert the “you save” price. For the demo, you can check the site http://www.starpetshub.com/

You save price code in opencart

We have managed to show the You Save in modules as well but we have hard-code it so we have to change in the controller of each module and in the product controller and the category controller. To make it work we have to Edit or insert product >> Click on Special tab >> Add your special price amount >> then Save it. Go to your site and click on the product. You will see a regular and discounted value with the discounted amount and You save as shown in the above image.

First, we are going to show how to insert the “You Save” on the category page.

Find the following line of codes in the catalog/controller/product/category.php

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
    $price = false;
}

and paste the following code after if (($this->config->get(‘config_customer_price’) && $this->customer->isLogged()) || !$this->config->get(‘config_customer_price’)) {

$save =$this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')) -$this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));

and on the same page find the following code and add ‘save’ => $save in the product array

$this->data['products'][] = array(
 'product_id' => $result['product_id'],
 'thumb' => $image,
 'name' => $result['name'],
 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
 'price' => $price,
 'special' => $special,
 'save' => $save,
 'tax' => $tax,
 'rating' => $result['rating'],
 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])
 );

Now go to the catalog/view/theme/default/template/product/category.tpl and replace the price section and paste the following and things work out in the category page.

<?php if ($product['price']) { ?>
 <div class="price">
 <?php if (!$product['special']) { ?>
 <?php echo $product['price']; ?>
 <?php } else { ?>
 <span class="price-old">Retail Price: <?php echo $product['price']; ?></span><br /> <span class="price-new"><b>Our Price:<?php echo $product['special']; ?></b> <br />You Save:<?php echo $product['save']; ?> </span>
 <?php } ?>
 <?php if ($product['tax']) { ?>
 <br />
 <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
 <?php } ?>
 </div>
 <?php } ?>

How to show you save price in the featured module of Opencart?

Find the following line of codes in the catalog/controller/module/featured.php

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
 $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
 } else {
 $price = false;
 }

and paste the following code

$save =$this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')) -$this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));

and on the same page

$this->data['products'][] = array(
 'product_id' => $product_info['product_id'],
 'thumb' => $image,
 'name' => $product_info['name'],
 'price' => $price,
 'special' => $special,
 'save' => $save,
 'rating' => $rating,
 'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
 'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
 );

insert the ‘save’ => $save, as in the above in the product array.

Now go to the catalog/view/theme/default/template/module/featured.tpl and replace the price section and paste the following and things work out in the category page.

<?php if ($product['price']) { ?>
 <div class="price">
 <?php if (!$product['special']) { ?>
 Our Price:<?php echo $product['price']; ?>
 <?php } else { ?>
 <span class="price-old">Retail Price: <?php echo $product['price']; ?></span><br /> <span class="price-new"><b>Our Price:<?php echo $product['special']; ?></b> <br />You Save:<?php echo $product['save']; ?> </span>
 <?php } ?>
 </div>
 <?php } ?>

Likewise, you can make the changes in the latest module, category module, special module, make some changes as in the featured module and things will work like in the demo site.

We have not made the language and other settings, for now, we will make the free module for you all till then take care of the above coding style.

This forum post may be helpful for you as well

http://forum.opencart.com/viewtopic.php?f=131&t=39597

You can directly download the module here

http://forum.opencart.com/download/file.php?id=6861

Hope you liked this post, let us know if you have any questions or suggestions. Please subscribe to our YouTube Channel for Opencart video tutorials. You can also find us on Twitter and Facebook. Enjoy!

the amount that customer saves, right under the price, when there is a special price for the product, shows the amount in an amount that customer saves, customer save modules, You save this module for all modules, discount % or amount of $ right under the picture on front page modules

Auto-scrolling of carousel in opencart, now manufacturer images

Opencart tips and tricks to add auto-scrolling of carousel in opencart. We will show it to the manufacturer’s images.


Edit file catalog/view/theme/yourtheme/template/module/carousel.tpl, find the below code

vertical: false,

and add after it

auto: 3,
wrap: 'circular',

Here auto represents the time span to scroll, with the above after three seconds the carousel will move and it will go on moving.

file transfer server, corrupt images when uploaded through FTP

1

corrupt images when uploaded through ftp but works fine by uploading from the cpanel

I used Filezilla 3.5.3 to upload images and files. When i upload the other files it work but when i upload the images then no images are shown in the server but it is working fine in the localhost. After uploading the updates I noticed that images were corrupt. I verified that images worked on my system, uploaded them and tried to view, but nothing.

Then I downloaded the image and tried to view it on my laptop, but the downloaded image was corrupt as well. I finally used the built in Windows Explorer to upload the PNG files and that worked, so I know the issue is in Filezilla.

I have not had this issue in the past with Filezilla.

I finally find out that the file transfer server software, Filezilla have the setting from where there is

I mistakenly set the file transfer type to ASCII by which the images are not uploaded but other files are uploaded. Again setting to the Auto I am now able to transfer the images as well.

Bold the last breadcrumb element in the opencart, custom breadcrumb in opencart

Custom breadcrumb in opencart

Just insert the code below in the footer.tpl and the last breadcrumb will be bold as in the image above

<script type="text/javascript">// <![CDATA[
$(document).ready(function () {
$(".breadcrumb a:last-child").css('font-weight','bold');
});
// ]]></script> 

Send mail when reviews are given to the product in opencart

This is opencart 2 guides to send an email when reviews are given to the product. Changes to be done in the module’s product.php is shown in the following images

Send mail when review is done in opencart

Likewise, we have to change the product.tpl, type the code for the form as per your need

Email functionalities in review

Now to the javascript part of the product.tpl which pass the data to the model and return whether the review is successfully added or not.

JS to send email in Opencart

We hope you will get it because writing a post and long stories I feel bored just post things that we have done and shown you the logic we used in opencart to send mail to the specified mail.

We have not focused on the languages so sorry for that as well will update this post when we will get the time cheers.

Show related products at the cart page in the Opencart site

For the up-sell strategy, we can show recommended or related products on the cart page, we show the added related products as per the products in the cart as recommended products for now.

We are confused about whether to show products like the featured products or show the related product in the cart that is related to the products in the cart. Following is the steps of code changes and addition we have done in the Opencart:

For Opencart version 2

Open catalog/view/theme/default/template/checkout/cart.tpl and find <?php echo $content_bottom; ?> and paste following code:

<?php
$this->load->model('catalog/category');
foreach ($products as $product) {
    $arrs[] = $results = $this->model_catalog_product->getProductRelated($product['key']);
}
if ($arrs) {
	foreach ($arrs as $arr) {
		foreach ($arr as $lastarr) {
			echo $lastarr['name'];
		}
	}
}
?>

How the above code works?

$this->load->model(‘catalog/category’);

This will just load the model for retrieving the data from the database.

foreach ($products as $product) {
$arrs[ ] = $results = $this->model_catalog_product->getProductRelated($product[‘key’]);
}

This lines detect the products in the cart and retrieve the related products as in the cart and keep things in the array $arrs.

if($arrs){

This checks whether there is related products or not, related with the products in the cart.

foreach ($arrs as $arr) {
foreach ($arr as $lastarr) {
echo $lastarr[‘name’];
}
}

This just prints the name of the related products related to the products in the cart. Module and Vqmod will be published soon. Let us know if need any support. Please subscribe to our YouTube Channel for Opencart video tutorials and get lots of other Opencart free modules. You can also find us on Twitter and Facebook also.

how to show modules in all pages of opencart 1.5

With the current Layout System we can:

  1. Set module to show on all page.
  2. Set different module to show on different page (based on route).
  3. Set different module (maybe Banner) to different Category, Product and Information page.
  4. If you have multi-store, you can set all feature above for different store.

Overview: How it works?

  1. First, opencart will check is there any Layout specifically for Category, Product or Information Page. Then apply it.
  2. When the first check above return false, opencart will check is their Layout based on route URL is available.
  3. When the second check above return false, opencart use Store Layout as a “fallback”.

Layout system in opencart, a specific module to a specific page

How the layout system works is explained well in the following links by Qahar from Indonesia. Thanks to him.

http://forum.opencart.com/viewtopic.php?f=138&t=37119

Increase the speed of loading the opencart sites

I am working as the opencart programmer for 6 months and found out that opencart as the best open source for the e-commerce site.
Yet some of the things to be taken into consideration which obviously increases the speed of the opencart sites.

We all know that indexing the table increases the performance of the database so creating the following index really increase the speed in the opencart sites. Run the query below and enjoy some little speed on loading your sites.

ALTER TABLE `category` ADD INDEX ( `parent_id` ) ;
ALTER TABLE `category` ADD INDEX ( `top` ) ;
ALTER TABLE `category` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `category` ADD INDEX ( `status` ) ;
ALTER TABLE `option` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `option_description` ADD INDEX ( `name` ) ;
ALTER TABLE `option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `option_value_description` ADD INDEX ( `option_id` ) ;
ALTER TABLE `order` ADD INDEX ( `customer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `model` ) ;
ALTER TABLE `product` ADD INDEX ( `sku` ) ;
ALTER TABLE `product` ADD INDEX ( `upc` ) ;
ALTER TABLE `product` ADD INDEX ( `manufacturer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `product` ADD INDEX ( `status` ) ;
ALTER TABLE `product_option` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_value_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `tag` ) ;
ALTER TABLE `url_alias` ADD INDEX ( `query` ) ;
ALTER TABLE `url_alias` ADD INDEX ( `keyword` ) ;
ALTER TABLE `user` ADD INDEX ( `username` ) ;
ALTER TABLE `user` ADD INDEX ( `password` ) ;
ALTER TABLE `user` ADD INDEX ( `email` ) ;

Likewise, we have to remove unnecessary queries which obviously increase the speed of the site.

Queries that can be removed are the category count in the opencart

Use the steps below to remove the category count:

Go to the file:
/catalog/controller/module/category.php
1.Search CODE:

‘name’ => $child[‘name’] . ‘ (‘ . $product_total . ‘)’,

Replace with CODE:

‘name’ => $child[‘name’],

2.Search CODE:

‘name’ => $category[‘name’] . ‘ (‘ . $product_total . ‘)’,

Replace with CODE:

‘name’ => $category[‘name’],
3. Search CODE:
‘name’=> $result[‘name’] . ‘ (‘ . $product_total . ‘)’,
Replace with CODE:
‘name’  => $result[‘name’],
This will remove the product count in the category module.
If there is product count in the top menu bar then you can remove them as well.
For the top bar go to /catalog/controller/common/header.php

Search CODE:

‘name’  => $child[‘name’] . ‘ (‘ . $product_total . ‘)’,
And Replace with CODE:
‘name’ => $child[‘name’],