Zen Cart Big Spender adds discounting by subtotal with filtering

One of my customers want to discount by dollars spent but NOT discount any product on sale, and also not discount specific products selectable by category, product id or manufacturer.  So I added set_cart_discount_products() to Big Spender 1.2.17, which starts from the product  subtotal and then allows you to filter out specific products (using the filters indicated above) with the cart_filter_product() function.

Here’s an example configuration, in the setup() function

 $this->add_threshold(500, 'Spend over $500, get 30% off', false);

 $this->add_threshold(250, 'Spend over $250, get 25% off', false);

 $this->add_threshold(100, 'Spend over $100, get 20% off', false);

 $this->add_threshold(50, 'Spend over $50, get 20% off', false);


Zen Cart Free Gift Chooser now has Edit functionality

Zen Cart Free Gift Chooser is a discounting module (buy some items, get some other items at a discount) with a built-in admin panel. I just added the ability to edit discounts, and set the “deal id” feature on discounts to link them together (so only one will be applied).  The edit capability in particular is a huge step forward in usability, and I hope you like it.

That Software Guy’s 2015 Retrospective

These were the highlights of my year with Zen Cart:

Hope it was a great e-commerce year for you too!

Mod List

Zen Cart Mod List shows you information about the modifications that have been made to your cart:

  • New admin pages which your mods have created.
  • New database tables which your mods have created.
  • New modules (shipping, payment, and order total)
  • Admin configuration groups which exist but do not have a corresponding menu item (indicating an incomplete upgrade from 1.3.9 or prior).

Turning off the Zen Cart Shopping Cart Sidebox on Specific Pages

I believe it is potentially confusing to show the shopping cart sidebox on pages which already display the shopping cart contents. Zen Cart has a built in feature to turn off the shopping cart sidebox on the shopping cart page (Go to Admin->Configuration->Layout Settings->Shopping Cart Box Status, and set this value to 2.). However, turning it off on additional pages is not difficult, and I recommend doing so. Here are the steps:

  1. If you do not have a includes/modules/sideboxes/YOUR_TEMPLATE/shopping_cart.php file, create one by copying the file includes/modules/sideboxes/shopping_cart.php.
  2. Above the line
       if ($show_shopping_cart_box == true) {

    add this block

         if ($show_shopping_cart_box == true) { 
            if (($current_page_base == "shopping_cart") || 
                ($current_page_base  == "account_history_info") ||
                ($current_page_base  == "checkout") ||
                ($current_page_base  == "checkout_payment") ||
                ($current_page_base  == "checkout_confirmation") 
               ) { 
                  $show_shopping_cart_box = false;

    I did not turn the sidebox off on the checkout shipping page, but you certainly may do so by adding that as a case.

Supporting Fractional Quantities for specific categories in Zen Cart

What if just some of the products in your Zen Cart can be added as fractional quantities?  This is the issue I faced.  I wanted my services to be able to be purchased fractionally, so someone could purchase (say) 2.5 hours of support.  Here are the required steps, with the categories to be supported for fractional products being 10 and 11, with units of 0.25 being the increments.  You should start by making a complete backup of your database.

  1. In PHPMyAdmin, run the commands
    UPDATE products SET products_quantity_order_units = 0.25 where master_categories_id in (10,11);
    UPDATE products SET products_qty_box_status = 1 where master_categories_id in (10,11);
  2. In Zen Admin, set Configuration->Stock->Product Quantity Decimals to 2.  This allows quantities to be set to 2 decimal places, which units of 0.25 requires.
  3. In Zen Admin, set Configuration->Product Listing->Display Product Add to Cart Button to 1.  This allows people to add to cart from the listing page, but without adjusting quantity.  You may skip this step if you wish to add the logic in the next  step to the file includes/modules/YOUR_TEMPLATE/product_listing.php.
  4. In includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php, right before the if statement that checks $products_qty_box_status, add this line of code:
    $products_qty_box_status = product_has_decimal_units($_GET[‘products_id’]);
  5. Create a function in includes/functions/extra_functions that implements product_has_decimal_units() by checking the product master category id for the specified product (and returns true if it’s 10 or 11).
  6. If your template uses the HTML5 input type=”number” option for quantity, you’ll need to add step=”0.25″ to the input element.