Keeping your Zen Cart Downloads folder safe

The default folder for Zen Cart downloads is <your_store_root>/download.  The problem with this is that if you have non-free downloads, and some bad guy guesses the names of your zip files, they can just download them for free.

The fix is easy; simply relocate your downloads folder outside of your public_html directory.  So if your DIR_FS_CATALOG entry in includes/configure.php is ‘/home/scott/public_html/shop’, just do this:

  1. Move your /public_html/shop/download folder to /download (i.e. above public_html)
  2. Set DIR_FS_DOWNLOAD to ‘/home/scott’ in includes/configure.php and YOUR_ADMIN/includes/configure.php

Some more details on this are discussed in this Zen Cart tutorial.

Building a static site on Github with Hugo

The cool kids are using Hugo to build static websites, so I wanted to give it a try myself.   It was easy enough to use locally, but the instructions on the website for Hugo hosting on Github pages were too complicated for me.  So I used what I think is a simpler workflow, and documented it in my site’s  Here you go:

  1. Install Hugo.
  2. Use
    hugo new site my-site-name

    to create the site. Change directory to my-site-name.

  3. Grab a template you like from HugoThemes. Create the directory themes and install it there.
  4. Run
    hugo server -w

    to start looking at your site locally. Add content until you’re happy.

  5. Fiddle with config.toml until you’re happy. Remember you have to restart “hugo server” each time you change configuration; the LiveReload doesn’t handle this.
  6. Create a .gitignore and add “public” to it.
  7. Add your site to a new git repository. For reference, mine is
  8. Run

    to generate the final copy of your site. (I assume you have added your template to the config.toml file; if not, you will need to use “hugo -t your-template”.) Change directory to “public”.

  9. Add this directory to a new repository, with the name Again, for reference, mine is
  10. You’re done! Your site will be live shortly at

Customizing Optional Payment Method for Zen Cart

My Optional Payment Method for Zen Cart mod allows you to configure a payment module so that it is only available to certain customers.  But what if you want it available for purchases over a certain amount as well?  Here’s the code to add to the payment method of the payment class.  Right above where the mod has you add

 // bof optional payment module logic

change this to

 $payment_threshold = 400;
 global $order; 
 // Enable if total > threshold.
 if ($class_ok->fields['optional_payment_1'] != 1) {
    if ($order->info['total'] >= $payment_threshold) {
       $class_ok->fields['optional_payment_1'] = 1;
 // bof optional payment module logic

This turns it on for all transactions over $400. To turn it on for all transactions over $400 AND where the customer has been configured to use the payment method, do this instead:

 $payment_threshold = 400;
 global $order; 
 // Enable if total > threshold AND customer enabled
 if ($class_ok->fields['optional_payment_1'] == 1) {
    $class_ok->fields['optional_payment_1'] = 0;
    if ($order->info['total'] >= $payment_threshold) {
       $class_ok->fields['optional_payment_1'] = 1;
 // bof optional payment module logic

Switch Skin for Zen Cart

Zen Cart Switch Skin allows you or your customers to dynamically change the template on the catalog side of your cart.   An example implementation is given in the zip file and can be seen on my demo4 store.   You can switch between a basic desktop template and Picaflor Azul’s Responsive Sheffield Blue template in this example.

I will product additional example integrations in the future.