OpenCart.my Extension Documentation Collection

Welcome

Thank you for purchasing Product Option Discount extension!

This document contains information for Product Option Discount extension. If you have any questions that are not found in this readme document, please look for contact information in the support section.

Extension info

Product Option Discount

Download Page: www.opencart.com/index.php?route=extension/extension/info&extension_id=1888
Version: 1.7.5
Release Date: 13th May 2016
OpenCart version
compatibility:
1.5.0.5
1.5.1, 1.5.1.1, 1.5.1.2, 1.5.1.3
1.5.2, 1.5.2.1
1.5.3, 1.5.3.1
1.5.4, 1.5.4.1
1.5.5, 1.5.5.1
1.5.6, 1.5.6.1, 1.5.6.2, 1.5.6.3, 1.5.6.4
2.0.0.0, 2.0.1.0, 2.0.1.1, 2.0.2.0, 2.0.3.1
2.1.0.1, 2.1.0.2
2.2.0.0
2.3.0.0, 2.3.0.1, 2.3.0.2
Demo: OpenCart v2.0.3.x
demo.opencart.my/pod
Admin Login: demo.opencart.my/pod/admin
Username: demo
Password: demo
OpenCart v1.5.6.x
demo.opencart.my/pod2
Admin Login: demo.opencart.my/pod2/admin
Username: demo
Password: demo
Author: Hydrowire - More extensions
Contact: [email protected]

Features

Overview

Enable quantity discount on product options.

This extension is useful if you need to apply discount to individual option value in a product.

What's New in v1.7

  1. Added Apply Discount Across Cart to calculate option discount based on quantity for same options across cart.
  2. Added multi customer groups selection.
  3. Added Calculation Method with extra 2 caculation methods to replace Use Option Price as Base Price.
  4. Fixed admin product_option_value_id issue with vQmod's 'iafter' attribute.

Highlights

  1. Discount prices appear as table format on product page.
  2. Able to show option price of each individual option in cart and order.
  3. Able to set option price to calculate based on flat rate or quantity.
  4. Can be used with existing product quantity discount, special price, tax, and other existing pricing related functionality.
  5. Multiple price prefixes to choose from (+, -, =, +%, -%)

Installation

Prerequisite

  1. OpenCart version must be a compatible version. Please refer to the 'OpenCart version compatibility' list stated above in the Extension Info.
  2. Skip to Install only if vQmod is installed and working on your store.
  3. Requires vQmod 2.4.1 minimum for OpenCart v1.5.x. (vQmod 2.5.1 for OpenCart v2.0.x) Get it from here: https://github.com/vqmod/vqmod/releases
  4. Follow instruction in https://github.com/vqmod/vqmod/wiki/Installing-vQmod-on-OpenCart

Install

  1. Copy all contents in 'upload' folder into your store. No files will be replaced.
  2. Login to your admin page, go to Extensions > Modules, and click on the Install button for 'Product Option Discount' module.

Setup

  1. Click on the Edit button for 'Product Option Discount'.
  2. Navigate to Catalog > Products > Edit any product to start creating Option Discount.

Upgrade

Please BACKUP your store database before continuing with the upgrade process.

From Product Option Discount v1.7 to v1.7.x

  1. Upload all files from the 'upload' folder to your store root folder. Only extension files will be replaced.
  2. Navigate to Extensions > Modules > Product Option Discount & click on the Edit button(There's no need to uninstall or reinstall). At this point the upgrade process will be running in the background.
  3. Clear vqcache folder and delete 'mods.cache' file in your /vqmod/ folder.

From Product Option Discount v1.6.x to v1.7

  1. Upload all files from the 'upload' folder to your store root folder. Only extension files will be replaced.
  2. Navigate to Extensions > Modules > Product Option Discount & click on the Edit button(There's no need to uninstall or reinstall). At this point the upgrade process will be running in the background.
  3. Clear vqcache folder and delete 'mods.cache' file in your /vqmod/ folder.

From Product Option Discount v1.6.x to v1.6.2

  1. Upload all files from the 'upload' folder to your store root folder. Only extension files will be replaced.
  2. Navigate to Extensions > Modules > Product Option Discount & click on the Edit button(There's no need to uninstall or reinstall). At this point the upgrade process will be running in the background.
  3. Clear vqcache folder and delete 'mods.cache' file in your /vqmod/ folder.

From Product Option Discount v1.5 to v1.6

  1. v1.6 only supports OpenCart v2.0.x. Therefore a fresh install is required.

From Product Option Discount v1.5 to v1.5.1

  1. Please note that all your previous option discount data will be retained. However, you are advised to backup your store database before continuing with the upgrade process.
  2. Copy all contents from 'upload' folder to your store root folder. Only extension files from previous version will be replaced.
  3. In your admin, navigate to Extensions > Modules > Product Option Discount (MAKE SURE ALL FILES FROM THE LATEST VERSION HAS BEEN UPLOADED COMPLETELY TO YOUR STORE IN STEP 2), click on [ Edit ]. At this point, the extension database will be updated in the background.
  4. Clear all vqcache files in /vqmod/vqcache/ folder and delete 'mods.cache' file from /vqmod/ folder.

From Product Option Discount v1.4 to v1.5

  1. Please note that all your previous option discount data will be retained. However, you are advised to backup your store database before continuing with the upgrade process.
  2. Copy all contents from 'upload' folder to your store root folder. Only extension files from previous version will be replaced.
  3. In your admin, navigate to Extensions > Modules > Product Option Discount (MAKE SURE ALL FILES FROM THE LATEST VERSION HAS BEEN UPLOADED COMPLETELY TO YOUR STORE IN STEP 2), click on [ Edit ]. At this point, the extension database will be updated in the background.
  4. Clear all vqcache files in /vqmod/vqcache/ folder and delete 'mods.cache' file from /vqmod/ folder.

From Product Option Discount v1.3.1 to v1.4

  1. Please note that all your previous option discount data will be retained. However, you are advised to backup your store database before continuing with the upgrade process.
  2. Copy all contents from 'upload' folder to your store root folder. Only extension files from previous version will be replaced.
  3. In your admin, navigate to Extensions > Modules > Product Option Discount (MAKE SURE ALL FILES FROM THE LATEST VERSION HAS BEEN UPLOADED COMPLETELY TO YOUR STORE IN STEP 2), click on [ Uninstall ], then click [ Install ] again.
  4. Clear all vqcache files in /vqmod/vqcache/ folder and delete 'mods.cache' file from /vqmod/ folder.

From Product Option Discount v1.3 to v1.3.1

  1. Please note that all your previous option discount data will be retained. However, you are advised to backup your store database before continuing with the upgrade process.
  2. Copy all contents from 'upload' folder to your store root folder. Only extension files from previous version will be replaced.
  3. There's no need to Uninstall or re-install from the admin Extensions.
  4. Clear all vqcache files in /vqmod/vqcache/ folder and delete 'mods.cache' file from /vqmod/ folder.

From Product Option Discount v1.2.1 to v1.3

  1. Please note that all your previous option discount data will be retained. However, you are advised to backup your store database before continuing with the upgrade process.
  2. Copy all contents from 'upload' folder to your store root folder. Only extension files from previous version will be replaced.
  3. Login to your admin page, go to Extensions > Modules, and click on [ Install ] for 'Product Option Discount' module. At this point, the upgrade will be done automatically in the background.
  4. Clear all vqcache files in /vqmod/vqcache/ folder and delete 'mods.cache' file from /vqmod/ folder.
  5. Follow the steps under Installation section to install Product Option Discount.

If you encounter any error during the upgrade, please contact support for further assistance.

Usage

Configuring Option Discount Settings

  1. Login to your store admin, navigate to Catalog > Products, and Edit a product that you want to add option discount to it.
  2. While editing a product in admin, click the Option tab to edit product options.
  3. Add an option by typing the option name and click on the drop-down item as such:
  4. Please keep in mind that Option Discount is only available for the following option types:
    • Select
    • Radio
    • Checkbox
    • Image
  5. Upon adding an option, you will immediately notice 11 additional settings.

Show Option Discount Price on Product Page

Set to No if you do not want to display any option discount price table for this option on product page.

Please checkout the following extension if you would like to have Live Price Update feature which will update the product price upon selection of options:
https://www.opencart.com/index.php?route=extension/extension/info&extension_id=12489

Show Option Price on Cart

Set to Yes to show option price on shopping cart page, checkout page, and in order history page.

For example, the Select & Checkbox options are set to Yes while the Radio option is set to No.

Show Final Price

If set to Yes, option price will be displayed as the final calculated price of product price and option price, depending on the option discount price prefix chosen.

For example, the Radio option is set to Yes while the Checkbox option is set to No.

Use Flat Rate on Price & Points

If set to Yes, option price & points will be calculated as flat rate regardless of quantity ordered.

For example: product A price = $100
Option B = $20
(Use Flat Rate on Price & Points = No) 3x product A with Option B = $360
(Use Flat Rate on Price & Points = Yes) 3x product A with Option B = $320

Use Flat Rate on Weight

If set to Yes, option weight will be calculated as flat rate regardless of quantity ordered.

For example: product A weight = 10 kg
Option B = 3 kg
(Use Flat Rate on Weight = No) 3x product A with Option B = 39 kg
(Use Flat Rate on Weight = Yes) 3x product A with Option B = 33 kg

Apply Discount Across Cart

If set to Yes, option discount will be applied based on the total quantity of the same product added to shopping cart that contains identical options.

Prices Include Tax

Set the option discount prices to be displayed either with or without tax included, or both.

For example, Radio is set to Yes, Select is set to No, while Checkbox is set to Both.

Price Table Style

Set the style of the option discount pricing table.

For example, Radio is set to Horizontal while Checkbox is set to Vertical.

Price Format

Set the price format of the option discount price in table.

  • Unit - Option discount prices will be shown as the amount of each item divided by quantity
  • Total - Option discount prices will be shown as the total price multiplied by quantity
  • Both - Show both Unit & Total price

For example, Select is set to Unit, Radio is set to Total, while Checkbox is set to Both.

Show Quantity Column

Set the Quantity column on or off. It is recommend to turn off only when there is a single price column.

For example, Radio is set to Yes while Checkbox is set to No.

Quantity Format

Set the format of the quantity values.

For example, Radio is set to Single while Checkbox is set to Range.

Show Stock Column

Set the Stock column on or off.

For example, Radio is set to No while Checkbox is set to Yes.

Option value with out of stock are disabled and cannot be selected by customer as seen in the example screenshot above.

Show 'Add to Cart' Column

Allow each individual option value to have its own Add to Cart button.

For example, the Radio option values in the screenshot below can now be added to cart individually with the additional 'Order' column that contains the quantity text field and Add to Cart button. You will also notice that the option values control(radio buttons) has been removed together with the default quantity text field and default Add to Cart button for the product as they are no longer necessary in such setup.

Show 'Add to Cart' Column will not work when there are more than 1 Required option in a single product because the option value Add to Cart buttons only allow for a single option value to be added at a time. So, any other Required option that are not added will cause the 'Add to Cart' process to fail due to missing Required option.

You can now have more than 1 options while using Show 'Add to Cart' Column. However, logically, only 1 of the option in a product can have Show 'Add to Cart' Column set to Yes.

Creating an Option Discount

After adding your desire option and option value, you can add option discounts directly under each option value, as shown here:

Just click on the Add Discount button to add a new row of option discount entry.

Customer Group

Select Customer Groups to restrict the current option discount for the selected customer groups(login required). If none selected, no Customer Groups restriction will be applied. If all selected, then only logged in customers will be able to view option discount prices.

Quantity

Number of item required to be added into cart for discount price to take effect. Works just like product discount.

Please note that the default Quantity column field in the original option row is for stock control, while the Quantity column field in the option discount rows is for quantity discount.

Calculation Method

Select a calculation method for the option discount.

  • Product - Use product base price to calculate.
  • Product + Option - Use product base price and option base price to calculate.
  • Option - Use option base price to calculate.

Price

Option discount price for the current quantity.

Please see below for more option discount pricing setup examples.

Special

Option discount special price for the current quantity. The previous option discount price will appear as crossed out in red. For example, Radio:Large for quantity 2, 3, & 4 has special price added:

To disable option discount Special, just set special to 0 and special prefix to -.

Use Option Points as Base Points

If checked, the option discount points will use the original option value points as a base points for calculation instead of the product points.

Points

Points required to purchase the current option.

Priority

Set the display order of discount quantity.

Special Date Start / Date End

The starting & ending date of the current option discount Special price. Leave it blank or as 0000-00-00 to disable the start or end date.

Remove

To remove an option discount, simple click on the Remove button on each option discount row.

Save

Please click the Save button to save your product after you are done editing.

Option Discount Pricing Setup Examples

Assuming the following:

  • Product Price: $250.00
  • Option Price: +$20.00

Use Flat Rate Quantity Calculation Method Option Discount Price Prefix & Price Calculation Total
No 3 Product +30 ($250.00 + $30.00) x 3 $840.00
No 3 Product -30 ($250.00 - $30.00) x 3 $660.00
No 3 Product =30 $30.00 x 3 $90.00
No 3 Product +%30 [$250.00 + ($250.00 x 30 / 100)] x 3 $975.00
No 3 Product -%30 [$250.00 - ($250.00 x 30 / 100)] x 3 $525.00
No 3 Product + Option +30 ($250.00 + $20.00 + $30.00) x 3 $900.00
No 3 Product + Option -30 ($250.00 + $20.00 - $30.00) x 3 $720.00
No 3 Product + Option =30 ($20.00 + $30.00) x 3 $150.00
No 3 Product + Option +%30 [$250.00 + $20.00 + (($250.00 + $20.00) x 30 / 100)] x 3 $1053.00
No 3 Product + Option -%30 [$250.00 + $20.00 - (($250.00 + $20.00) x 30 / 100)] x 3 $567.00
No 3 Option +30 ($250.00 + $20.00 + $30.00) x 3 $900.00
No 3 Option -30 ($250.00 + $20.00 - $30.00) x 3 $720.00
No 3 Option =30 ($250.00 + $30.00) x 3 $840.00
No 3 Option +%30 [$250.00 + $20.00 + ($20.00 x 30 / 100)] x 3 $828.00
No 3 Option -%30 [$250.00 + $20.00 - ($20.00 x 30 / 100)] x 3 $792.00
Yes 3 Product +30 ($250.00 x 3) + $30.00 $780.00
Yes 3 Product -30 ($250.00 x 3) - $30.00 $720.00
Yes 3 Product =30 $30.00 x 1 $30.00
Yes 3 Product +%30 ($250.00 x 3) + ($250.00 x 30 / 100) $825.00
Yes 3 Product -%30 ($250.00 x 3) - ($250.00 x 30 / 100) $675.00
Yes 3 Product + Option +30 ($250.00 x 3) + ($20.00 + $30.00) $800.00
Yes 3 Product + Option -30 ($250.00 x 3) + ($20.00 - $30.00) $740.00
Yes 3 Product + Option =30 ($20.00 + $30.00) x 1 $50.00
Yes 3 Product + Option +%30 ($250.00 x 3) + [$20.00 + (($250.00 + $20.00) x 30 / 100)] $851.00
Yes 3 Product + Option -%30 ($250.00 x 3) + [$20.00 - (($250.00 + $20.00) x 30 / 100)] $689.00
Yes 3 Option +30 ($250.00 x 3) + ($20.00 + $30.00) $800.00
Yes 3 Option -30 ($250.00 x 3) + ($20.00 - $30.00) $740.00
Yes 3 Option =30 ($250.00 x 3) + $30.00) x 1 $780.00
Yes 3 Option +%30 ($250.00 x 3) + [$20.00 + ($20.00 x 30 / 100)] $776.00
Yes 3 Option -%30 ($250.00 x 3) + [$20.00 - ($20.00 x 30 / 100)] $764.00

Option Value Price

By default, option value name will show its price in bracket if option value price is set. To disable showing option value price in bracket, just set option value price to 0.

For example, Radio:Small has its price set as +20 while Radio:Medium price is set as +0

Customization

Custom Language

To customize admin module text such as table column names and button text, please perform the following steps (assuming 'spanish' is the custom language folder name):

  1. Make a copy of the following file:
    • /admin/language/english/module/myocpod.php
  2. Paste it into your custom language folder:
    • /admin/language/spanish/module/myocpod.php
  3. Open and edit the text in the newly copied file /admin/language/spanish/module/myocpod.php according to your custom language.

To customize store front table text such as 'Quantity', 'Unit', 'Total', etc., please perform the following steps (assuming 'spanish' is the custom language folder name):

  1. Make a copy of the following file:
    • /catalog/language/english/myoc/pod.php
  2. Paste it into your custom language folder:
    • /catalog/language/spanish/myoc/pod.php
  3. Open and edit the text in the newly copied file /catalog/language/spanish/myoc/pod.php according to your custom language.

Custom Template

The following steps provide a basic guide in customizing Product Option Discount for your custom template on your store.

Please note that:

  • It is to be performed after installation.
  • All files listed below are from your store server.
  • Assuming custom template folder is 'custom_theme'.
  • Might not work on some custom template.
  1. Copy the folder 'myoc' in /catalog/view/theme/default/template/ and paste it into /catalog/view/theme/custom_theme/template/
  2. Open and edit the file you just copied: /catalog/view/theme/custom_theme/template/myoc/pod.tpl
  3. Modify the CSS or HTML table classes to suit your custom template.
  4. If option discount price is not showing on cart page or cart pop-up, open and edit /vqmod/xml/myoc_pod.xml
  5. Search for line 688:
    <search position="replace"><![CDATA[<?php echo $option['value']; ?>]]></search>
  6. Make sure in your custom template /catalog/view/theme/custom_theme/template/checkout/cart.tpl and /catalog/view/theme/custom_theme/template/module/cart.tpl file that the text in between the <search> tag exists.
    <?php echo $option['value']; ?>
  7. If not, you need to modify the text to match exactly with the code that exists in your custom template cart.tpl file.
  8. Do the same for line 714 for /catalog/view/theme/custom_theme/template/checkout/confirm.tpl template file if required.
  9. If option discount table is not showing on product page, open and edit /vqmod/xml/myoc_pod.xml
  10. Search for line 730:
    <search position="replace"><![CDATA[<select name="option[]]></search>
  11. Make sure in your custom template /catalog/view/theme/custom_theme/template/product/product.tpl file that the text in between the <search> tag exists.
    <select name="option[
  12. If not, you need to modify the text to match exactly with the code that exists in your respective custom template file.
  13. Do the same for line 737 if required.
  14. If option discount 'Add to Cart' buttons in the option discount table is not working or there's error on product page, open and edit /vqmod/xml/myoc_pod.xml
  15. Search for line 744:
    <search position="after"><![CDATA[cart').on('click', function() {]]></search>
  16. Make sure in your custom template /catalog/view/theme/custom_theme/template/product/product.tpl file that the text in between the <search> tag exists.
    cart').on('click', function() {
  17. If not, you need to modify the text to match exactly with the code that exists in your custom template product.tpl file.
  18. Do the same for line 759, 769, 773.

Troubleshoot

Q: Installation failed.

A: Make sure your current store database user account have permission to 'CREATE', 'INSERT', SHOW', 'RENAME', 'ALTER', and 'DROP' tables in your MySQL database.

Q: Extension is not working or not showing correctly after installation.

A: Please make sure the following:

  1. vQmod is installed and working correctly.
  2. The settings for option discount is set correctly. Please see Usage section for more details on setting up an option discount.
  3. If you are using a custom template, you might require to customize the extension. Please see Customization > Custom Template.

Q: Option Discount data missing after a certain number of rows reached.

A: The problem may due to the number of form elements on the product edit page has exceeded your server PHP config 'max_input_vars'. The default is just 1000. More info: https://php.net/manual/en/info.configuration.php#ini.max-input-vars
You need to increase it to a higher value in your /admin/php.ini config file. Then, verify it through phpinfo();
However, some hosting provider may prevent customer from changing the value. You may need to contact your hosting provider for further support if changing through php.ini doesn't work.

Uninstall

Please follow the steps below to uninstall Product Option Discount from your store.

  1. Login to your store admin and navigate to Extensions > Modules.
  2. Click on the Uninstall button for Product Option Discount module. WARNING: All option discount data will be erased.
  3. Remove the following 8 files from your store.
    1. /admin/controller/module/myocpod.php
    2. /admin/language/english/module/myocpod.php
    3. /admin/model/myoc/pod.php
    4. /admin/view/template/myoc/pod.tpl
    5. /catalog/controller/myoc/pod.php
    6. /catalog/language/english/myoc/pod.php
    7. /catalog/view/theme/default/template/myoc/pod.tpl
    8. /system/library/myocpod.php
    9. /vqmod/xml/myoc_pod.xml

Changelog

Version 1.7.5

Release Date: 13th May 2016

  1. Support latest OpenCart v2.2.0.0
  2. Reduced database load by loading option discount data only when needed.
  3. Fixed checkbox option bug
  4. Updated Customer Group selection behaviour
  5. Modified "=" prefix calculation method to increase variations

Version 1.7.4

Release Date: 10th March 2016

  1. Support latest OpenCart v2.1.0.x
  2. Fixed addslashes for admin product copy
  3. Fixed admin copy product options sanitize product name

Version 1.7.3

Release Date: 30th June 2015

  1. Fixed admin product copy customer group error.

Version 1.7.2

Release Date: 29th June 2015

  1. Added separate settings for option weight flat rate.

Version 1.7.1

Release Date: 19th June 2015

  1. Added option discount bulk copy tool.
  2. Added flat rate calculation for option weight.

Version 1.7

Release Date: 8th June 2015

  1. Added Apply Discount Across Cart to calculate option discount based on quantity for same options across cart.
  2. Added multi customer groups selection.
  3. Added Calculation Method with extra 2 caculation methods to replace Use Option Price as Base Price.
  4. Fixed admin product_option_value_id issue with vQmod's 'iafter' attribute.

Version 1.6.2

Release Date: 23rd April 2015

  1. Added setting to include / exclude tax.
  2. Fixed customer group cache.
  3. Fixed option without stock not hidden.
  4. Fixed login display price.
  5. Fixed error not showing when NaN is entered in qty field.

Version 1.6.1

Release Date: 21st January 2015

  1. Fixed mysqli_insert_id error.

Version 1.6

Release Date: 23rd December 2014

  1. Support latest OpenCart v2.0.x
  2. Added caching to reduce database call

Version 1.5.1

Release Date: 19th June 2015

  1. Added caching to reduce database call
  2. Added setting to include / exclude tax.
  3. Added Calculation Method with extra 2 caculation methods to replace Use Option Price as Base Price.
  4. Added multi customer groups selection.
  5. Added Apply Discount Across Cart to calculate option discount based on quantity for same options across cart.
  6. Fixed mysqli_insert_id error.
  7. Fixed error not showing when NaN is entered in qty field.
  8. Fixed login display price.
  9. Fixed option without stock not hidden.
  10. Fixed customer group cache.
  11. Fixed admin product_option_value_id issue with vQmod's 'iafter' attribute.

Version 1.5

Release Date: 25th June 2014

  1. Added quantity range
  2. Added stock column
  3. Add to Cart button for individual option value can now be used with other options
  4. Fixed Special price date issue
  5. Fixed Copy checkbox bug

Version 1.4

Release Date: 5th September 2013

  1. Support latest OpenCart v1.5.6
  2. Add to Cart button for individual option value
  3. Option Special price
  4. New additional price prefixes (=, +%, -%)
  5. Option Discount prices can be based on option price or product price

Version 1.3.1

Release Date: 2nd March 2013

  1. Support for latest OpenCart v1.5.5.x.
  2. Show Option Price setting will now also hides option prices on product page.

Version 1.3

Release Date: 10th October 2012

  1. First option column with quantity 1 can be disabled.

Version 1.2.1

Release Date: 7th April 2012

  1. Fixed option price not showing correctly when option price is 0.

Version 1.2

Release Date: 26th March 2012

  1. Added support for OpenCart 1.5.2.x.
  2. Added '%' for option value price and option value discount price.
  3. Fixed product discount calculation.

Version 1.1

Release Date: 3rd January 2012

  1. Added support for OpenCart 1.5.0.5 - 1.5.1.3
  2. Able to show option price of each individual option in cart and order.
  3. Able to show final price of product + option instead of showing '+' & '-'.

Version 1.0

Release Date: 14th April 2011

  1. Product Option Discount released.

Support

Questions

If you have any questions regarding this extension, please email to [email protected]

Professional Service

We provide a variety of professional services for your OpenCart store.

  • Extension Customization
  • Extension Integration
  • Custom Template Integration

Please email your request to [email protected] and see how we can help you.

Comments and Feedbacks

You can always post your comments, feedback, or suggestion on the extension page here: www.opencart.com/index.php?route=extension/extension/info&extension_id=1888