New PHP Versions and Better Together Admin / Combination Discounts Admin

If you are using Better Together Admin (Zen Cart or osCommerce) and getting a log message that looks like this:

Only variables should be assigned by reference in YOUR_ADMIN/includes/xajax/xajax_core/ on line 268

or this:

PHP Strict Standards:  Non-static method xajaxPluginManager::getInstance() should not be called statically, assuming $this from incompatible context in YOUR_ADMIN/includes/xajax/xajax_core/ on line 269

Then please refer to the instructions for fixing this issue on the Better Together Admin help page.

The same instructions apply for Combination Discounts Admin.

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.

Looking for broken downloads in your Zen Cart

Zen Cart has a feature called the Downloads Manager (admin->catalog->downloads manager), which allows you to easily spot missing downloadable files.  If the file isn’t present in your downloads directory, the icon goes bright red.

Screen Shot 2015-05-25 at 11.17.39 AM

The problem is, this doesn’t always work.  If you created the file attribute, but forgot to specify the file, the download manager won’t identify the missing file.

If you believe this might be a problem for you, you may do an audit of your database, looking for products with this problem.

Here’s how to do the audit:

1) Go to admin->catalog->option name manager to verify the option id for File Format.  It will normally be “1”.

2) From PHPMyAdmin:

SELECT * FROM `products_attributes` pa where options_id = 1 and not exists (select * from products_attributes_download pad where pa.products_attributes_id = pad.products_attributes_id)

Of course you will need to prefix table names with your prefix if you are using one, and change the options_id value if it’s other than 1.

Once found, you can add back these missing files in the attributes controller (admin->catalog->attributes controller) simply by editing the attribute, and entering the filename at the bottom of the form.