Zen Cart Manufacturer Discount
A Zen Cart™ discounting module for discounting the products of specific manufacturers.Background: See the Zen Cart Matrix-o-discounts
Relevance: Zen Cart™ 1.3.7 - 1.3.9, 1.5.x
See interoperability for changes required for Edit Orders.
Current Version: 1.4 (version history)
Support Thread: My commercial software is not supported on the Zen Cart forum. Please email me questions instead.
Cost: $60.00 (Note: this low price covers software only for self-installation.)
Would you like to ask me questions before buying? I'm happy to help likely purchasers make the right decision. Please use my contact form.
Installed Cost: $200.00 (Professional installation by That Software Guy)
Installation Difficulty: Easy
Installation Instructions: click here for installation instructions
Tax Notes: Notes on tax handling
Buy: Buy Manufacturer Discount!
Pre-purchase questions? No problem! Just Please contact me with your question.
FAQ: click here for FAQs
Configuration: Manufacturer Discount is configured on the Admin > Manufacturers and Admin > Modules > Order Total screens.
Marketing Text: click here for marketing text
Promotional Page: free from my website (you must buy Manufacturer Discount separately)
Add-Ons:
Manufacturer Discounts is an order total module, so the discount is not visible until the second page of checkout. If you want to see the discount on the shopping cart page (or sidebox), look at Discount Preview.
Bugs: click here for bugs
Overview:
Manufacturer Discount permits a shop to discount the products of a specific manufacturer by %age.The discounts themselves are entered into the admin panel using Admin > Catalog > Manufacturers in the "Discount" field under the Manufacturer's Name.
The discount is shown on the second page of checkout by default:
However, using the Discount Preview module will allow you to show the discount on the shopping cart page.
Detailed Description:
- Configuration
Manufacturer Discount is installed through the Admin interface (Admin > Modules > Order Total > Table Discount).
This is where the tax settings and sort order are configured.
Once this is done, specific discounts are added to manufacturers using the Admin > Catalog > Manufacturers screen. - Checkout Page User Interface
Manufacturer Discount is an "Order Total" module, which means that by default, the discount is not shown until the second page of checkout (Payment Information). However, using the Discount Preview module will allow you to show the discount on the shopping cart page.
Depending on your configuration, the second page of checkout will look something like this:
- User Exits
Some shops will want to further customize their discounting policy. Additional user exits are provided to permit the following customizations:- Include or exclude certain categories from discounting.
- Include or exclude certain products from discounting.
Specifically:- The function exclude_category() shows you how to add categories to a list of categories to not be discounted.
- The function exclude_product() shows you how to add products to a list of products to not be discounted.
Each of these functions contains a simple example of how to use it using item and category numbers like 99999, 99998, etc. See the FAQ below for more examples.
The user exits are within the Manufacturer Discount extension, inincludes/modules/order_total/ot_manufacturer_discount.php
Installation Instructions:
- Back up everything! Try this in a test environment prior to installing it on a live shop.
- Unzip the file you have received.
- Merge the files below with what you have in your cart. NOTE that these files assume your template name is "custom," so any file with "custom" in its name will need to be renamed if you are using a different template name.
- Run the script discount.sql against your database using your Admin panel under Admin > Tools > Install SQL patches. NOTE: this provides for integer (whole number) discounts like 25%. If you want floating point discounts (e.g. 25.8%), see the faq for instructions.
- Product Info Page - Copy the file
includes/templates/template_default/templates/tpl_product_info_display.php
toincludes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php
if it is not already there. Above the first line of HTML, add these lines:<!-- bof Manufacturer Discount Marketing --> <?php require($template->get_template_dir('/tpl_manufacturer_discount_marketing.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_manufacturer_discount_marketing.php'); ?> <!-- eof Manufacturer Discount Marketing -->
- Manufacturer listing page - Copy the file
includes/templates/template_default/templates/tpl_index_product_list.php
toincludes/templates/YOUR_TEMPLATE/templates/tpl_index_product_list.php
if it is not already there. Above the first line of HTML, add these lines:<!-- bof Manufacturer Discount Listing --> <?php require($template->get_template_dir('/tpl_manufacturer_discount_listing.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_manufacturer_discount_listing.php'); ?> <!-- eof Manufacturer Discount Listing -->
This will show up when they go to index.php?main_page=index&manufacturers_id=some_id. (This is the page that the links in the Manufacturer Sidebox go to.) - Centerbox on main page - Copy the file
includes/templates/template_default/templates/tpl_index_default.php
toincludes/templates/YOUR_TEMPLATE/templates/tpl_index_default.php
Above the lines that say<?php $show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_MAIN);
add these lines:<!-- bof Manufacturer Discount Centerbox --> <?php require($template->get_template_dir('tpl_modules_manufacturer_discount.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_manufacturer_discount.php'); ?> <!-- eof Manufacturer Discount Centerbox -->
- In Admin > Modules > Order Total, select Manufacturer Discount and press the Install button on the right hand side.
- Go to Admin > Catalog > Manufacturers, and start setting your discounts.
Optional Installation Instructions:
- I highly recommend Discount Preview with all my discounting modules. Without Discount Preview, your customers cannot see the price reductions they are entitled to until the second page of checkout (checkout confirmation). Obviously this is a disadvantage, particularly for new customers who need to go through the additional step of creating an account before they can see this information. Sometimes seeing is believing, so here's a video showing Discount Preview in action.
Marketing
What good is having cross selling and upselling specials if you don't advertise them?Manufacturer Discount may be automatically displayed in three places: on the product info page, on the manufacturer listing page, and on the home page. Instructions for each of these marketing template changes are provided as part of the installation file.
The product info page has a small text banner indicating the manufacturer discount as shown below.
The manufacturer listing page uses a similar type of display box. The manufacturer listing page is what is displayed when someone clicks on the Manufacturers Sidebox (added to your page using Admin > Tools > Layout Boxes Controller.)
And finally, the home page shows a centerbox listing the manufacturers which are on sale, along with their images. (If you use this marketing template change, you must add images for the manufacturers you are discounting.)
The other available marketing vehicle is the Manufacturer Discount promotional page. This page is completely optional; it is not included in the Manufacturer Discount zip archive, but it is a free download from my website for people who have purchased Manufacturer Discount. It creates a new page on your site that allows you to display all Manufacturer Discounts. It will look like this:
This new page can be accessed via the URL
YOURSITE.com/index.php?main_page=manufdisc_promoA link to this page may be added to the categories sidebox, the site footer, or the main page content for your site. See Promotional Pages for more information and ideas.
Major Versions
- 1.4 11/12/2019 - Added flag to allow discounting base price only.
- 1.3 12/26/2018 - Updated for Zen Cart 1.5.6.
- 1.2 09/18/2016 - Updated for Zen Cart 1.5.5.
- 1.1 04/01/2013 - Added category and product exclusion user exits
- 1.0 11/05/2011 - Update to Zen Cart 1.5 (No functional changes)
- 1.0 05/01/2011 - First Release
Notes on Taxes
If you don't use embedded taxes, and don't have a mix of taxable and tax-free products, and don't have a different rate of tax for shipping, please skip this section.
However, if you any of the above apply to you, please read my Notes on Taxes.
Be sure that the sort order for the Tax module (set in Admin->Modules->Order Total->Tax) is greater than the largest order total sort order, so that your taxes are shown after all discounts. 399 is a good value for most stores.
Files
(new) ./includes/templates/custom/templates/tpl_modules_manufacturer_discount.php
(new) ./includes/templates/custom/templates/tpl_manufacturer_discount_marketing.php
(new) ./includes/templates/custom/templates/tpl_manufacturer_discount_listing.php
(new) ./includes/templates/custom/css/stylesheet_manufacturer_discount.css
(new) ./includes/modules/order_total/ot_manufacturer_discount.php
(new) ./includes/modules/manufacturer_discount_index.php
(new) ./includes/languages/english/modules/order_total/ot_manufacturer_discount.php
(new) ./includes/functions/extra_functions/manufacturer_discount.php
(mod) ./admin/manufacturers.php
(mod) ./admin/includes/languages/english/manufacturers.php
Interoperability
- If you are using Zen Cart 1.5.x and Edit Orders 4.x along with
Manufacturer Discount,
you must make the following change:
Create a file calledadmin/includes/functions/extra_functions/manufacturer_discount_lookups.php
It should contain this code:<?php if (! function_exists('zen_get_products_manufacturers_id')) { function zen_get_products_manufacturers_id($product_id) { global $db; $product_query = "select p.manufacturers_id from " . TABLE_PRODUCTS . " p where p.products_id = '" . (int)$product_id . "'"; $product =$db->Execute($product_query); return $product->fields['manufacturers_id']; } } function get_manufacturer_discount($manuf) { global $db; $manuf = (int)$manuf; $rate_query = $db->Execute("SELECT discount FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id = " . (int)$manuf); if ($rate_query->RecordCount() > 0) { $rate = $rate_query->fields['discount']; } else { $rate = 0; } return $rate; }
Bugs
-
For recalculate tax = Standard, carts using Edit Orders 4.3.1 will need to change the process() function
in the code file in
includes/modules/order_total
as follows:
Changeif ($this->calculate_tax != 'VAT') { $order->info['total'] -= $od_amount[$key]; }
toif (!IS_ADMIN_FLAG) { if ($this->calculate_tax != 'VAT') { $order->info['total'] -= $od_amount[$key]; } }
FAQ
Q: Don't Big Chooser and Table Discounts already do manufacturer based discounting?A: Yes, but both of them require PHP scripting to configure, whereas Manufacturer Discount works using your existing Zen Cart Admin interface.
Q: Instead of round numbers, I would prefer decimal number discounts for Manufacturer Discount. What should I do?
A: To get decimal numbers instead of integer number discounts, use the following command in your Zen Cart admin panel under Admin > Tools > Install SQL Patches:
ALTER TABLE manufacturers MODIFY COLUMN discount decimal(15,2) default '0.00';
Q: I have hundreds of manufacturers, and I want to discount most of them by 15%. Can I set a default, and hand-tune the exceptions?
A: Yes you can! To set a default of 15%, use the following command in your Zen Cart admin panel under Admin > Tools > Install SQL Patches:
UPDATE manufacturers SET discount = 15;
Then hand-edit the exceptions under Admin > Catalog > Manufacturers.
Q: I can't seem to get Manufacturer Discount to work. What am I doing wrong?
A: Please check the following things:
- Go to Admin > Modules > Order Total. Do you see Manufacturer Discount? If not, then you haven't installed it. Follow the README.
- If you do see it, the circle at the right hand end of the row for Manufacturer Discount should be green. If it's not green, reinstall it.
- Re-read my Guide to Mod Installation on Zen Cart.
Q: I don't want discounts applied to items in category 7 or 8. How do I do this?
A: Update the function exclude_category() in
includes/modules/order_total/ot_manufacturer_discount.php
as follows:
function exclude_category($category) { switch($category) { case 7: case 8: return true; } return false; }
Q: I don't want discounts applied to product numbers 17 and 19. How do I do this?
A: Update the function exclude_product() in
includes/modules/order_total/ot_manufacturer_discount.php
as follows:
function exclude_product($prid) { $id = (int)$prid; switch($id) { case 17: case 19: return true; } return false; }
Q: If I use exclude_category() or exclude_product(), what changes do I need to make so the marketing text reflects this?
A: For category exclusions, change tpl_product_info_display.php from
if ($discount->check() > 0) {to
if ( ($discount->check() > 0) && (!$discount->exclude_category($current_category_id)) ) {For product exclusions, use
if ( ($discount->check() > 0) && (!$discount->exclude_product($_GET['products_id'])) ) {See the category issues page for a more detailed example of exclusions.
I charge a fee of $60 for Manufacturer Discount.
Buy Manufacturer Discount!
The fee covers software only; installation is extra if you require help.
The fee covers software only; installation is extra if you require help.