Saturday, November 30, 2013

Fine Search v.1.0 - Improves Opencart search feature to find relevant

Fine Search improves your opencart search and increase your product sales.

You can easily find your relevant products on the search results.

For instance, you have searched for ‘iphone 4S’. It will display ‘iphone 3’ on top of ‘iphone 4S’ on the result list. This is confusing. This module will bring you the appropriate search results relevant to your keyword. This will increase your sales and will satisfy your customers.

This module supports partial word matching; like if you type keyword ‘App’, it will also bring ‘Apple’ in the search results with the proper order.

You can even search with a minimum of a single character. If you type ‘A’, it will bring the results starting with ‘A’.

You can control your search from the admin panel. This provides an admin interface to define the fields which will be matched against the typed keyword. You can also set the sort order from the admin panel.

*  Easily find your relevant products on the search results.

*  Supports partial word matching.

*  Search with a minimum of a single character.

*  Admin interface to define the fields to match keyword.

*  Set the sort order from the admin panel.

*  100% compatible with any theme.

*  Multilingual support.

*  Free installation if needed.

 

If you want to have the module installed in your system, email me at tahsin352(at)gmail(dot)com.





List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Monday, November 4, 2013

OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart

Using OpenSSLCOMMERZ module you can pay with the authorized payment processor of SSLCOMMERZ. For this, you need to get registered with SSLCOMMERZ first.

Simple, single step installation.
Step by step documentation.
All the payment gateways are supported by SSLCOMMERZ. Please first get registered with SSLCOMMERZ.
Secure and fast payment processing.

  • It verifies an user with the store id provided by SSLCOMMERZ.
  • It has both live environment and test environment.
  • It collects information and then submits the gathered one using POST method.

If you want to have the module installed in your system, email me at tahsin352(at)gmail(dot)com.




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Thursday, October 3, 2013

Product Based Quantity Wise Shipping for Opencart

Product Based Quantity Wise Shipping module allows users to set shipping cost for each product according to their product quantity. You can create as many product based rate as you need. Admin can enter shipping cost for each product in administrative panel. You can set the shipping price according to the product quantity. It will display shipping price for each different different product.

If you want to have the module installed in your system, email me at tahsin352(at)gmail(dot)com.

Price: $50




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Sunday, September 1, 2013

How to rename a branch in git

Recently, I have come across to a need to rename an existing git branch. I googled and found the way to do it. Basically, it's a three step procedure.

First, we rename the old branch into the new one.
git branch -m master master-old
Then we will remove the old branch from the remote repository.
git push remote :master # delete master
And now we push our newly created branch to the repository.
git push remote master-old # create master-old on remote




See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

truncate html with tags

I was working on truncating rich contents on HTML editors. On the server side, we need to count the number of characters, then we need to truncate the string with keeping the HTML tags intact.

There is a class to truncate a rich text on the specific number of character or word number: http://www.pjgalbraith.com/2011/11/truncating-text-html-with-php/. This class uses php's DOMDocument. It parses each DOM element and count the characters appropriately. I have updated the pattern in the regular expression to allow all non space characters.
preg_match_all('/[\d\w ]+/us',$newEle->textContent,$m);
The textContent method only returns the text contents within a DOM.



See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

How to "Merge" Specific Files from Another Branch

Sometimes, we need to merge some specific files to a central working branch from our feature local branches. At that time, we also don't want to move all the changed files from our local workplace.

Here, we need a way to bring only our needed files from that branch.

First of all, we will be in the destination branch.
git checkout source_branch ...
We can simply give git checkout the name of the feature branch and the paths to the specific files that we want to add to our master branch.



See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Saturday, August 24, 2013

caching mechanism in opencart

Opencart caches the data at every page load. we have caching on currencies, languages, categories, products, category product counts, weight classes, tax classes, etc.

In front-end models, when fetching data from database, OpenCart looks for the cached data prior to querying the database. They are stored in plain text files using PHP's function serialize(). If system gets any cached data, they are fetched and unserialized and returned to the controller without querying the database.

Thus the fetching should be much quicker. If there are no cached data, then the database is queried and these data are then serialized using PHP's function serialize() and saved to the corresponding cache file.

Here is one small problem that may occur. After You have edited the data directly in the database, (using phpMyAdmin, may the reason be whatever for this) the change is not present at frontend. This is because, there are older data cached that are fetched when asked for them. If You have to do such editing, then do not forget to manually delete corresponding cache file(s).

The cache is instantiated and registered within index.php. it is then accessible in both controllers and models as $this->cache; while methods set(), get() and delete() are callable. The cache class itself could be found at system/library/cache.php and is quite simple and straight forward.

Now, in the administration (backend) part of models, when editing or adding data (category, product, currencies, weight classes, etc), after the data is successfully stored to the database the corresponding cache file is immediately deleted. So it could be re-created at frontend containing up-to-date data.

The cache files could be find at /system/cache/ folder.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

view unpushed git commits

Git version control system is gained very much popularity in recent times. It is a distributed version control system. Today we will see about how to see our unpushed local git commits.

We have done some coding in our local work machine and we had committed those in several times in past few days. Now, we want to see what commits are still waiting to go to the remote repository.

We can get the commit with log comments using the comparison between master and HEAD.

git log origin/master..HEAD

You can also view the difference using the same syntax with the same comparison between master and HEAD.

git diff origin/master..HEAD


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

character count while copying from other document

we have strlen or mb_strlen to count normal strings or multibyte UTF-8 encoded strings. When we have HTML elements into our strings, then we need to remove the elements.

And if we want to copy rich content text from other websites, then we need to consider the white space characters. we need to replace newline, carriage return and tabs etc.

Here, we first strips the tags from content.
$description = trim(strip_tags(html_entity_decode($this->request->post['description'])));


Then we replace the carriage returns and newlines in the contents.

$description = str_replace("\r\n",'', $description);


Now, we will remove the tabs.

$description = str_replace("\t",'', $description);


Finally, we count our processed content.
echo mb_strlen($description);


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

strip selected html tags

Using strip_tags we can remove HTML element from a string. But we want to remove selected tags from a string. we can use regular expression to implement this feature.

The below regular expression provide us a way to remove the selected HTML tags from the string.
preg_match_all('/<'.$tag.'[^>]*>(.*)<\/'.$tag.'>/iU', $text, $found)

Then we replace the matched pattern with the matched text string of preg_match_all. The PREG_PATTERN_ORDER returns the matched tag pattern in the first array and returns text pattern on the second pattern.
$text = str_replace($found[0],$found[1],$text);
The complete function becomes like this:
function strip_selected_tags($text, $tags = array())
    {        
        foreach ($tags as $tag){
            if(preg_match_all('/<'.$tag.'[^>]*>(.*)<\/'.$tag.'>/iU', $text, $found)){
                $text = str_replace($found[0],$found[1],$text);
          }
        }

        return $text;
    }
 

  echo htmlentities(strip_selected_tags('
Person:
Salavert', array('strong', 'div')));


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Sunday, July 7, 2013

Search keyword in comments of git commit

We set comment messages on per commit in git version control system. after a lot of commit, we can't remember or scroll down every comments to find our desired one. we can search our specific commits with matching some keywords in the comments. Following is the git command:

git log --oneline | grep PATTERN


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Saturday, July 6, 2013

Remove untracked files from git

Sometimes we have untracked files. At times, we want to delete those untracked files. Below are a list of commands to delete untracked files from git.
  • To remove untracked files from git:
    git clean -f
    
  • To remove untracked files with directories from git:
    git clean -f -d
    
  • To remove ignored files from git:
    git clean -f -X
    
  • To remove ignore and non-ignored files from git:
    git clean -f -x
    


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Sunday, June 2, 2013

This week in js date

Recently, we need to calculate the start and end date of a specific week for a given date. We need to keep in mind that a week might overlap into two consecutive months, two consecutive years.

We have used two javascript functions for this purpose. The getDay() method returns the day of the week (from 0 to 6) for the specified date.

The getDate() method returns the day of the month (from 1 to 31) for the specified date.

We subtracted the getDay value from the getDate function. This returns our start and end date of a specific week.
var curr = new Date;
var firstday = new Date(curr.setDate(curr.getDate() - curr.getDay()));
var lastday = new Date(curr.setDate(curr.getDate() - curr.getDay()+6));


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

How to pass an array or object into a hidden input field in Javascript

We pass different kind of values through hidden input field in a form. But if we want to pass an array into a hidden field how we will do this. Let's see the steps below:

For example, we have the below input field.
To input an array or an object like post_array, you need to populate the field using the below code block.
$('#data').val(post_array);
This might produce some erroneous behavior in response. Because, hidden input fields normally expects string values. So, to stay safe, it is best to stringify the array or object.

Below code block is safest:
$('#data').val(JSON.stringify(post_array));

On server side, you need to decode your data:

$data = json_decode($_POST['data']);


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Wednesday, May 8, 2013

Installing memcached 1.4.4 on windows

Recently, I was working on memcached with windows machine. Memcached is built for linux platform. It's latest stable version is 1.4.15. But we haven't found the compatible windows binary file for the latest version. I have found binary for memcache 1.4.5, but it was providing errors while installing with the command:
memcache.exe -d install

It hung up on the window. I googled and found that '-d' option is no longer supported. They are suggesting to use memcache 1.4.4. Then I download memcache 1.4.4 from here.

    Now, follow the below steps:
  • 1.Extract the downloaded files and unzip it.
  • 2.Open CMD and go to the downloaded folder.
  • 3.Run memcache.exe -d install.
  • 4.Now go to Start->Administrative Tools->Services.
  • 5.Double click on the memcache list.
  • 6.Press the Start button.
  • 7.Now we need to download the .dll file for vc9 from here.
  • 8.We will put the .dll file under php/ext folder under xampp.
  • 9.Also we will write extension=php_memcache.dll on the php.ini file under php folder.
  • 10.Now we will restart Apache.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Friday, May 3, 2013

How to remove provisioning profiles

Some times you want to delete some old unused provisioning profiles from your mac osx. We can remove those files in several different ways. One way is delete manually using finder. The provisioning profiles are stored under the below file location

~/Library/MobileDevice/Provisioning Profiles

Remove the file from this folder.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Wednesday, April 24, 2013

How to migrate from SVN to GIT

Currently, Git is getting popularity as a distributed version control system. Many Subversion repository is moving from SVN to Git. I have recently moved a SVN repository under GIT version control system.

Git has come up with built in support for svn switching. We will us the git svn command in this regard. First we will get the codebase from SVN with the below command
git svn clone http://path_to_repository folder_name

With the below command you will see all the log history are also carried to the Git repository

git log

To remove svn tags to be more proper tags on git:
git for-each-ref refs/remotes/tags | cut -d / -f 4- | grep -v @ | while read tagname; do git tag "$tagname" "tags/$tagname"; git branch -r -d "tags/$tagname"; done

Next, we will move the remaining references to /remote/references
git for-each-ref refs/remotes | cut -d / -f 3- | grep -v @ | while read branchname; do git branch "$branchname" "refs/remotes/$branchname"; git branch -r -d "$branchname"; done

Now, we will add the origin to the Git URL
git remote add origin https://path_to_git_repo

Finally, you need to push your changes to the remote repository:
git push origin --all



See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Saturday, April 20, 2013

How to install nginx

Nginx is a very lightweight and highly scalable server. If we don't want to use all of the modules of Apache, then we can go for nginx.

To install nginx, we will follow the below ways:
  • From apptitude: We can get nginx from the ubuntu package distribution. At the moment, we will get nginx 1.3.12. we need to add the ppa. you will find the ppa information here. To add the ppa, type this command:
    sudo add-apt-repository ppa:nginx/development[stable]
    

    Now, we add the sources to the source list file: /etc/apt/sources.list.
    deb http://ppa.launchpad.net/nginx/development/ubuntu quantal main 
    deb-src http://ppa.launchpad.net/nginx/development/ubuntu quantal main 
    

    Here, we will update the apptitude and install nginx:
    apt-get update 
    apt-get install nginx
    

  • From source: we can also get it from source.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Monday, April 15, 2013

How to compress a website with gzip

Gzip compression is one of the way to optimize site performance. A client browser sends a header request of Accept-encoding: gzip, deflate. Then server knows that his client is gzip enabled. It compresses it's contents and sends back Content-encoding: gzip, deflate.

    There are several ways to gzip compress a website.
  • Using .htaccess: We can enable gzip compression with .htaccess file. For that we need to enable mod_deflate or mod_gzip. It's pretty simple to work with mod_deflate. To enable it, please uncomment the load module line in httpd.conf file.
    LoadModule deflate_module modules/mod_deflate.so
    

    Now restart apache. You are all set to go with deflate module.
    Please open your .htaccess file and add the below code block:
    
    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    
    # remove browser bugs
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent 
    
    

    First of we set the file content types which will be process with deflate module to compress. we compress text, html, javascript, css, xml and css files.
    Then, we add some exceptions. like for Mozila version 4, we only compress text files. And also for IE, we will not gzip our contents. Because there is some bug with compression in those user agents.
  • If we don't have mod_deflate enabled or we don't have proper permission to write .htaccess files, then we can compress files using php ob_gzhandler function.

    
    

    We check the "Accept-encoding" header and return a gzipped version of the file; otherwise the regular version.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

HTML classes are removed in CKeditor 4.1

Recently, I was working with ckeditor 4.1. It has some security updates. I was posting some HTML contents using the editor. When I go to Design mode from Source mode, and then again come back to Source mode, I found the class attached to the HTML elements were missing.

Ckeditor 4.1 introduces Advanced Content Filter. This filter outs suspicious HTML elements with CSS class, JS attributes. To disable ACF, we need to add the allowedContent property to true on the configuration file.

There are two configuration file in Drupal module. One is the config.js under ckeditor/ckeditor folder and another one is ckeditor.config.js under ckeditor folder. In my case, the later one worked. I have added the below line into the config file

config.allowedContent = true;


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Friday, March 8, 2013

How to manipulate JSON in Javascript?

We needed to manipulate JSON values on Client side. We searched the web. There are some very good options available for JSON manipulation.
We can use the stringify and parse function for this purpose.
json_flat = {"page":"1","total":"2","ids":[{"id":"3085"},{"id":"3086"}]}; // your flat json
json_object = JSON.parse(json_flat); //convert to an object

//Manipulation
json_object.page = 6; //change values
delete json_object.total; //delete a value

json_flat = JSON.stringify(json); //convert back to flat



See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Tuesday, February 19, 2013

How to convert .app file to .ipa file

I was working with Corona SDK. It generates .app files of applications for iOS devices. We might need the .ipa files for iOS application. To convert .app files into .ipa files, we need to follow the below simple steps:
  • 1. Extract the .app zip file
  • 2. Place the .app file under a Payload (case-sensitive) folder.
  • 3. Now zip compress the Payload folder and then rename it with .ipa extension.
  • 4. We are done. We get the equivalent .ipa files.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Thursday, January 31, 2013

!important is not working in outlook email

I was working with email templates and found that !important CSS property is not working in Outlook email template. It works correctly in Gmail and Yahoo!. So, it's better to remove !important property from the email template when we create one.
Again, Background-color CSS property is not working in Gmail. It works in Yahoo. We need to use Background property in this regard. Like below:
background:#fff;


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Tuesday, January 29, 2013

How to remove missing files from svn?

I accidentally removed files from my local machine. But they are listed on SVN repository. Hence, those images are showing as '!' in svn status.
To remove those missing files, just run the below command:
svn status | grep '^\!' | cut -c8- | while read f; do svn rm "$f"; done

Then just commit your changes. Fixed.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Sunday, January 27, 2013

how to remove ajax cart from opencart

I was working with opencart. And I was facing problem with removing ajax enabled shopping cart feature from opencart. Prior to 1.5, Opencart provides an option on the admin panel to turn off the ajax cart feature. But this option is no longer exists.
To remove this feature, we need to add some code on the common.js file. There is a function addToCart(). We have added a custom function RedirectToCart().
function RedirectToCart(){
   window.location='index.php?route=checkout/cart';
}

Hence, our addToCart() function becomes like this:
function addToCart(product_id, quantity) {
 quantity = typeof(quantity) != 'undefined' ? quantity : 1;

 $.ajax({
  url: 'index.php?route=checkout/cart/add',
  type: 'post',
  data: 'product_id=' + product_id + '&quantity=' + quantity,
  dataType: 'json',
  success: function(json) {
   $('.success, .warning, .attention, .information, .error').remove();
   
   if (json['redirect']) {
    location = json['redirect'];
   }
   
   if (json['success']) {
    $('#notification').html('');
    
    $('.success').fadeIn('slow');
    
    $('#cart-total').html(json['total']);
    
    $('html, body').animate({ scrollTop: 0 }, 'slow'); 
   }
                        RedirectToCart();
  }
 });
}


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Friday, January 18, 2013

How to test on multiple versions of Firefox

Utilu MFC provides us way to test our website on multiple versions of Firefox web browser. It ranges from versions 2 to 21.

You can set the URL to open in to multiple versions or you can manually chose which browser to open. Again, we can open up multiple URLs also into multiple versions. We need to use spaces when we will define multiple URLs on the text box.

Utilu MFC includes Firefox Web developer addons into each browser versions. You can also run the tool from command line.
This software is mainly targeted for developers. But others can use Utilu Slient Setup.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Wednesday, January 16, 2013

How to add multiple user to git repository

Git is an excellent system for version controlling. We create one user to set up git repository for ubuntu or unix. But we always need multiple users to access git.
    To create multiple users, we have two ways:
  • 1. Create each user manually on the system.
  • 2. Use gitosis to share access on the private/public key.


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

How to add Icon@2x.png to svn

I was getting below error message while adding a Icon@2x.png to svn:
svn: warning: 'Icon' not found

You can solve the problem with the below command:
svn add Icon@2x.png@



See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Saturday, January 12, 2013

mhash error for commenting in PHP

I have faced an error while running a php file on command line. I was getting the below error:
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mhash.ini on line 1 in Unknown on line 0

I googled it and found a solution for this error. Now mhash has been removed, so, it is no longer a required feature.
I run the below command:
sudo dpkg -P php5-mhash

It solved the error.

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide