Tips & Tricks

Beware of zencart debug logger!

In the recent versions of Zencart (I think starting from 1.3.9h) you will find that includes/extra_configures/enable_error_logging.php exists by default. This file will turn on the debug switch and will put the logs into your /cache folder. The problem is that it also puts lots of WARNINGS and such inside this, and ZC does generate lots of those. Within a short amount of time (depending on the number of visitors you have and number of warnings etc), this folder will be flooded with log files and will more than likely lead to many performance issues and such.

I recommend that you rename this to enable_error_logging.php.bak and only rename it backs when you want to check for an issue.

Read More →

Exclude zenid query parameter from your Google Analytics to get better site reports

To track the customers and save their information, Zencart utilizes cookie and session. You will see Zencart usually automatically appends a random string to the end of your links on the very first page of your visit to your site.

For example, if you are not on your website now and you open it in a new window, you will the links look like this:

If set up correctly, when you click on one of those links, on the next page load you will see all link appear without the zenid string. Also, if set up correctly, those links with zenid appended to them should never be displayed to search engine (check your settings under Admin-Configuration: Prevent spider sessions should be set to True).

However, that setting does not prevent zenid appears in some of your reports you get from Google Analytics however (assume that you use G.A). For example, if you check your “site overlay” you might be in for a surprise, most of your links might have a 0% click rate, and you know this cannot be true. If you look closer, however, you will discover that the zenid is in those links. This perhaps can be explained by 2 reasons:

1. Although zenid is never shown to search engine spiders, it does get shown to normal visitors for the reason given above.
2. In any case, the links with zenid are recorded by Google Analytics and since each customer is assigned a different zenid per visit session, the links then appear to be different links

(from Google Analytics point of view, the 2 links above are totally different)

The cure to this is surprisingly easy. Google knows that some parameter(s) in your links should be ignored, and it allows you to do so by the Exclude query parameters setting which only takes a few minutes to do. For all Zencart store, zenid the one you MUST exclude, and depend on the customization you have done on your store you may decide to exclude some other params as well.

I hope this info will help you to use G.A more effectively in the future.

Read More →

Move your Zencart store to a new domain/subfolder – SEO Tip

This is a very common issue, as much as you would try to avoid doing it, sometimes you have to move your zencart folder somewhere else, either to a new subfolder or to a new domain. In such cases, it is very important to redirect all visits to the old links to the new locations.

Below is a nice snippet that will help you accomplish the dirty job.

// index.php on old site
// Get the requested page and redirect to new site url
// from skipwater - yellow1912 - gjh42 20081213
   $new_domain = ""; // if you do not change domain, simply enter the current domain here
    * example 1:
    * site: -> $new_store_path = "";
    * example 2:
    * site: -> $new_store_path = "sub1/sub2/";
    * example 3:
    * site: -> $new_store_path = "sub1/";

   $new_store_path = "store/";
   // do not edit code below
   $request_type = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == '1') || (isset($_SERVER['HTTP_X_FORWARDED_BY']) && strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_BY']),'SSL')) || (isset($_SERVER['HTTP_X_FORWARDED_HOST']) &&  strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']),'SSL')) || (isset($_SERVER['SCRIPT_URI']) && strtolower(substr($_SERVER['SCRIPT_URI'], 0, 6)) == 'https:') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' )   )  ? 'http' : 'https';
   $qstring = ($_SERVER['QUERY_STRING'] != '') ? '?'.$_SERVER['QUERY_STRING'] : '';
   header('HTTP/1.1 301 Moved Permanently');
   header("Location: {$request_type}://{$new_domain}/{$new_store_path}{$qstring}");

Place the snippet above in your oldsite/path-to-zencart/index.php (you should rename the current index.php to index.php.back and create a new index.php file just for this purpose).

Read More →

Can’t login to your Zencart admin? Here is the solution

Today we installed a new Zencart for our client at and we ran into a very annoying problem: we keeps getting redirected back to the admin login page without any error at all. Thinking it’s the usual cache error of Zencart, I cleared out the browser’s cache. That didn’t help. At this point, we suspect it might be a session error, so we use the Fix cache key module which save us many times before. The cache path is now updated but we still can’t login @_@.

At the same time, on the front page we also had this error (with Zencart debug turned on)

Fatal error: Call to a member function add_current_page() on a non-object in /path…./autoload_func.php on line 90

Read More →

Zencart SEO Problem – Is your site indexed?

Has your store been open for months and still not get listed in search engines? Do you see a sudden drop in search traffic after updating your cart or changing your store template? Perhaps Google is not indexing your Zencart store?

Problem 1: incorrect robots meta tag

You may be a victim of “noindex” misuse!

Here is how to check:

  1. First, go to your store, right click and choose “view source” or “view page source”
  2. See if you can find this string: . The string is usually located just above the tag
  3. See if the string above appears on the main page on your store

The string above is telling search engines to avoid indexing and thus listing your site on the search results.

Read More →

How to easily edit your Zencart template

In this post I will show you how to use the 3 most powerful tools to tweak and edit your Zencart! Please note that I make some foolish assumptions here: I assume you know a bit about php and are familiar with HTML and CSS.

First, if you have never used Firefox, it’s time to get the fox
Once you have Firefox installed on your computer, you can now grab the bug

Read More →

Zencart SSL/TLS – do you really need it?

Ehh? SSL? What is it?

SSL: Secure Sockets Layer (this is the predecessor of TLS)
TLS: Transport Layer Security

What are they: cryptographic protocols that provide security and data integrity for communications over networks such as the Internet. TLS and SSL encrypt the segments of network connections at the Transport Layer end-to-end. (wikipedia)

Why is it important (technically): The TLS protocol allows client/server applications to communicate across a network in a way designed to prevent eavesdropping, tampering, and message forgery. TLS provides endpoint authentication and communications confidentiality over the Internet using cryptography. (please view the wikipedia link above for more info)

Read More →

Short Description for Zencart products – A simpler alternative

ONCE upon a time not so long ago, one partner wanted to display a “short description” for the product, which is totally different from the description used in the product page. There are several good reasons for that:

  1. By default Zencart can help you to display the first X characters, however this cannot help you to give the customers a good summary of the product (good for customers)
  2. Using a customized short description can let you craft your own keyword-rich description on the listing page (good for seo, if you don’t overdo it)

Read More →

Speed up your Zencart site by minifying your CSS and JS files

There are two important things you can do about your css/js files to improve your page load (and remember, faster page load = more satisfied customers = less cart abandon)

  1. Reduce the total number of file size (there are many tips regarding best practices for css coding out there on the web. If you want to get a summary of the  BEST css practices for Zencart let me know)
  2. Reduce the total number of css/js files (or requests)

As I have mentioned in Zencart Performance Optimization Guide, you can combine all your css files (per page) into 1 single file and also minify(*) that file to get the best performance.

However, there are potential problems with minification: remember that CSS requires that you move @import command to the top of a css file, if you combine multiple css files and one of those files has @import command then this @import command will not run properly (Tabbed Product Pro is one of Zencart modules that uses @import).

Read More →

Secure your Zencart – A time consuming yet easy task

I have run Windows XP for years without any virus/trojan/spyware problem. How, you ask? I apply security patches regularly, I use the free Avast! anti virus to keep the viruses and trojans out, I use ZoneAlarm’s free firewall to keep the hackers at bay, I use Firefox with ads block plugin to stop spam, and obviously I know what I’m doing so I just don’t go and click on any popup saying “Security Alert! Scan your computer for FREE”.

Alright, my rant about Windows stops here, what I meant to say was: if you actively protect yourself then the chance that someone can harm your computer or your website is really low. Last week, I have received a message from a user on Zencart forum asking me this:

Hi yellow can you explain what is going on with hundreds and hundreds of zen cart stores ? If you read my6 thread possible hack in the security section you will see what i mean. This is getting worse aswell.

BTW, if you haven’t known yet, I go by the nick yellow1912 on Zencart forum.

Below is the rest of our conversation:

Read More →