ShipWorks and Zen Cart Discounts

I just discovered that ShipWorks does not properly handle the many possible discounts that can be created for ZenCart by independent software developers (like your humble servant).

Fortunately, it’s an easy fix. Just edit your admin/shipworks3.php file.

Locate the block:

                    if ($class == "ot_coupon" ||
                                    $class == "ot_gv" ||
                                    $class == "ot_lev_discount" ||
                                    $class == "ot_group_pricing" ||
                                    $class == "ot_quantity_discount")
                    {
                            $impact = "subtract";
                    }

and change it to:

                    $textvalue = $total->fields['text'];
                    if (strpos($textvalue, "-") !== false)
                    {
                            $impact = "subtract";
                    }

I have passed this fix on to the ShipWorks team so hopefully they will integrate it into the supported version of the Zen Cart integration soon.

osCommerce users – you will likely need a similar change.

osCommerce sessions table HUGE?

If your osCommerce sessions table is the largest table in your database and seems to have grown without bounds, don’t worry – the fix is simple.

Edit the file includes/functions/sessions.php and modify the function tep_session_start. At the top of the function, you want to add

@ini_set('session.gc_probability', 1);
@ini_set('session.gc_divisor', 2);

Once this file has been installed, and once a few visitors have come to your osCommerce store, the table will be smaller. But wait! You’re not done yet.

Go into PHPMyAdmin and select your store’s database. Select the sessions table, and at the bottom of the list of tables, press the “With selected:” dropdown and select “Optimize table”. This will take a minute to run, and once it’s complete, you’ll see a big reduction in the size of your sessions table.

How the osCommerce sessions table looked before (1G)
How the table looked before (1G)
How the table looked after (48 Kb)
How the table looked after (48 Kb)

Photo credit: image by James Hammond on Unsplash.

Posting your Zen Cart inventory in Google Merchant

You want to sell your wares in Google Shopping?  Great!  By all means, build a feed from Zen Cart for Google Merchant and get started.  But remember the rules: Google wants you to list shipping costs along with your products for every region you advertise in.

Here are the most common ways to do this:

Shipping option Description
Free Simple to configure and maintain
Flat rate Simple to configure and maintain
Carrier rate (UPS, USPS, Fedex) Rates are automatically calculated based on carrier rates for all users (not negotiated rates). Only available in some countries (USA, AUS). You may add a surcharge (% or fixed amount).
Percentage of order total Simple to configure and maintain and allows for varied shipping rates based on price
Unique shipping costs for one particular product Specify the shipping price within the feed using the
shipping attribute.
Allows you to manually override account settings for a product with unique shipping rates

Google maintains a team of auditors who will compare what’s in the feed to what is shown on your website in the Shipping Estimator, and complain about any variance between the two. Now according to their own rules, you are allowed to “overestimate” the shipping cost in the feed (see rule below), but even then, I have received complaints from them. Per Google,

“To show ads to a particular country or region, you must offer shipping and correctly set up shipping costs for that area. The shipping costs that you submit to Merchant Center must match the costs you charge on your website or at least overestimate those costs.”

In other words, it’s ok for the feed to show a higher shipping cost than your website. It’s not ok for your website to show a higher shipping cost than the feed.

Potential Problems

        • If you determine shipping costs algorithmically using your own logic, you’re going to have to figure out some way of mapping this to one of the techniques in the table above for the purposes of the Google feed. Again, per Google,

          “Keep in mind that if you dynamically choose where to ship from at the time the user checks out, there is currently no way that this can be configured in Google Shopping.”

        • You quote negotiated rates (for example, using the Zen Cart upsxml shipping module). If you use Carrier Rates in Google Shopping, they will retrieve non-negotiated rates; this will cause the rate shown in Google Shopping to be higher than what is on your website. Although this is permitted according to their rules, you may have to argue with them about this.
        • You have enabled multiple shipping modules, or multiple services within a carrier. In this case, you may be forced to show all relevant rates, not just the lowest or most common one.

Zen Cart 2.0: the great renaming

Many moons ago, the “next” version of Zen Cart was given the name 1.6.0. As time moved on and features were added to the code for this release, it became clear that it was going to be different enough from the 1.5.x branch of Zen Cart that a bump in the major number made sense. So the release name was changed to 2.0. But many other things still used the old name – which was kind of confusing.

As of today though, the renaming is done:

Zen Cart 1.5.6 – Upgrade Drivers

There’s a new release of Zen Cart – but why should you upgrade?  I’ll review some of the key reasons in this post.

  • Compatibility with PHP 7.2 and 7.3: PHP is constantly changing, and as new versions are introduced, older ones fall by the wayside.  This means they no longer receive bug fixes or even security patches for issues which are discovered by researchers and hackers.  If you look at the PHP supported versions page, you’ll see that versions prior to PHP7 won’t even receive security patches after January 2019.  To stay secure, you must update your PHP, which means you must update your Zen Cart software.
  • All security patches released in Zen Cart 1.5.5 and before included: if your Zen Cart hasn’t been actively maintained, you may have missed the PHPMailer security patch, the Trustwave patch, or any of the other Zen Cart security patches which has been released in the last few years.  Upgrading to Zen Cart 1.5.6 gets you all those patches without any extra work.
  • All prior bugfixes from ZenCart 1.5.5 and below are included: how many times have you struggled with an issue, only to find that it has been resolved in a newer release? Upgrading means you’re using the latest fixes.
  •  Improved admin appearance: the Zen Cart 1.5.6 admin is much easier on the eyes than the older versions.  Works great on mobile too!  
Mobile product editing in Zen Cart 1.5.6
Product Editor Screen in Zen Cart 1.5.6 on Mobile
Mobile customer edit screen in Zen Cart 1.5.6
Customer Editor Screen in Zen Cart 1.5.6 on Mobile
Zen Cart 1.5.6 Product/Category creation screen
Looks good on the desktop too! 

WordPress 5.0.1 – Update Time!

Open Source but powerful, but with great power comes great responsibility – notably, your responsibility to keep your software updated!  If you haven’t upgraded to WordPress 5 yet, this WordPress security announcement should get you into gear.  We all knew we’d have to learn Gutenberg some day, it just seems that someday came sooner than we had planned!