Zen Cart Order Total Edit

Sometimes you just need to change the line items on an order- increase a discount, reduce a shipping cost, or whatever, to keep a client happy.

You may or may not be able to do this with Edit Orders, but even if you can, this mod removes and replaces the records in the orders_products table, which may not be desirable (if you have additional fields in that table which are set using custom logic, as is the case for dropshippers).

Now you have a new option: Zen Cart Order Total Edit. Hope it helps your business!

Zen Cart 1.5.6b Release Cutoff

The long awaited Zen Cart 1.5.6b Release is scheduled to be initiated on 4/30 (no more changes to Github, file labeling applied), with a zip file created later that week. Here’s the announcement.

1.5.6b promises better interoperability with PHP 7.2+ as well as a number of bug fixes from earlier 1.5.6 releases. The change set from Zen Cart 1.5.6a to the current HEAD is large, containing almost 400 commits!

**WARNING** flashing on tab title in Zen Cart 1.5.6

After the timeout specified in Admin->Configuration->My Store->Admin Session Time Out in Seconds has expired, the tab you are running your Zen Cart Admin in begins to flash **WARNING**.  This is quite a horrible experience – it’s as bad as the old <blink> tag in web pages from the mid 1990s. It’s a blight and a distraction. But the good news is, it’s also really easy to kill!

Edit the file admin/includes/keepalive_module.php

Around line 29, just after


add the line

    'flashTitle' : false,

Refresh your admin, and from then on, no blinking!

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: