| Characteristics | |
| OpenCart | 3.0 |
| XML modification | Yes |
| Localization | English, Ukrainian, Russian |
| Statistics | 3311 48 |
| Added | 28.02.2025 |
| Updated | 28.02.2025 · 1 years ago |
| Files | im-discount_oc3x.ocmod.zip |
The IMDiscount (OC 3) Discount Strategy module is a powerful tool for organizing a flexible discount system in OpenCart. It allows you to create cumulative discounts and discounts for the current order, and also supports mass generation of standard discounts and promotions. This module is suitable for online stores that want to stimulate repeat purchases and flexibly manage prices.
In general, the order of creating strategies is similar to the usual OpenCart view, but taking into account that in the module almost everything is done using ajax (without the need to reload the page).
IMPORTANT! - All adjustments are applied immediately!
Since version 1.4.0, you can create strategies or their copies in the corresponding tabs, without necessarily creating them through the "All strategies" tab. To do this, you need to click the "Add" button instead of "Save".
The calculation is carried out in two stages, which allows you to build very flexible discount strategies (an example of the calculation is below).
Then, within each strategy, it is determined how to select the "Type of percentage formation" (a larger value, a smaller value, or the total of all values in the discount table from the first stage). Accordingly, from the previously calculated discounts in the table, the resulting discount of the strategy is formed (in accordance with the selected setting).
IMPORTANT! The discount cannot be greater than the value BEFORE the IMDiscount module was applied. This is done to avoid orders with negative value.
Let's say you need to take into account two types of discounts. The first is the discounts that are formed based on accumulated orders and are applied to the total amount of all goods in the order (1% for every 1,000 rubles, up to 10%). The second is an additional discount within the current order only for goods without promotions and discounts (also 1% for every 1,000, up to 10%). In this case, the discounts need to be summed up.
Accordingly, the following settings are set in the module. Accumulation type (Global) - summation. So that the discounts of the strategies are summed up. Two strategies are created and filled in - one in "Cumulative discount", the second in "Current order". For each strategy, a discount table is also filled in indicating the percentage and fixed amount (in the example, the latter is 0, since the task does not require it).
The buyer makes an order for 3456 rubles, of which 1000 rubles are discounted goods. The buyer has already made several orders for a total of 7000 rubles.
The following calculation occurs:
Step 1: Since only percentages are applied, a percentage will always be selected for each row of the discount strategy table.
Based on the data, all items from 1% to 7% are suitable in the first strategy table. The maximum is selected, i.e. 7%. In the second discount strategy, only regular goods are taken into account (RUB 2,456), i.e. only discounts from the 1% and 2% table are suitable. Accordingly, the maximum of 2% is selected.
Second stage. Look at the global parameter, and there is summation. It turns out 7% of 3456 + 2% of 2456 = 241.92 + 49.12 = 291.04.
As you can see, a complex calculation scheme is easily implemented by the module.
There are three types of amounts in general (for N-items see below):
Accordingly, depending on the selected option, the percentage is calculated.
If you need to organize discounts for each N-item in sorting from the most expensive to the cheapest or vice versa from the cheapest, then this can be done.
For example, for every second pair of gloves, provide a 50% discount in order from expensive to cheap. In this case, if the customer added 20 simple gloves and 8 gloves with some expensive pattern to the cart (i.e. discount for 14 items = 28 / 2), then the discount will be calculated as follows: 0.5 * cost of 8 expensive gloves with a pattern + 0.5 * cost of 6 simple gloves (since there are only 8 gloves with a pattern).
Within the framework of this calculation, the type of calculation of the quantity of goods is also taken into account, so that it is possible to exclude goods that already have discounts (from quantity; promotions). Plus, the entire calculation algorithm according to the discount table and other mechanisms is preserved.
If settings are not specified for any of the items (for example, products are not specified), then only one item (in which settings are specified) becomes the selection criterion. If no settings are specified at all, then filtering is not performed - in other words, it is considered that all products are suitable (in case of exclusion with an empty filter, filtering is not applied).
For prices. If the value of the cost filter is equal to or less than zero, then it is considered that there are no restrictions for this price filter. For example, the cost FROM equal to 10 and the cost TO equal to 0 means that the cost of the product must be greater than or equal to 10. Note that prices are set in the base currency.
Effective price means that the price displayed in the shopping cart is used for checking. For example, if an item with a price of 100 after standard discounts and applying options costs 120, then the value 120 will be used for filtering.
It is worth noting that filtering is applied to all product-specific settings. This means that when calculating amounts and quantities (both for the row table estimate and for forming the percentage), the only thing that is not recalculated is the "Received amount before applying IMDiscount" option.
For example, there were two items in the basket: A for 500 and B for 200. After the filter, only item B for 200 remained. The settings indicate that the percentage applies to all items. This means that when calculating the amounts from the discount table, only item B will be taken into account. For example, if 10% is set in the discount table, then it will not be (500 + 200) * 0.1 = 70, but (200 * 0.1) = 20.
For example, product X is excluded and the discount is applied to products. When calculating completed orders, no filtering will be performed. But in the basket, product X will be filtered (the discount will not be applied to it).
Otherwise, the logic is similar to how the calculation occurs in the Current Order strategy.
If settings are not specified for any of the items (for example, products are not specified), then only one item (in which settings are specified) becomes the selection criterion. If no settings are specified at all, then filtering is not performed - in other words, it is considered that all products are suitable (in case of exclusion with an empty filter, filtering is not applied).
For prices. If the value of the cost filter is equal to or less than zero, then it is considered that there are no restrictions for this price filter. For example, the cost FROM equal to 10 and the cost TO equal to 0 means that the cost of the product must be greater than or equal to 10. Note that prices are set in the base currency.
Effective price means that the price displayed in the shopping cart is used for checking. For example, if an item with a price of 100 after standard discounts and applying options costs 120, then the value 120 will be used for filtering.
It is worth noting that filtering is applied to all product-specific settings. This means that when calculating amounts and quantities (both for the row table estimate and for forming the percentage), the only thing that is not recalculated is the "Received amount before applying IMDiscount" option.
For example, there were two items in the basket: A for 500 and B for 200. After the filter, only item B for 200 remained. The settings indicate that the percentage applies to all items. This means that when calculating the amounts from the discount table, only item B will be taken into account. For example, if 10% is set in the discount table, then it will not be (500 + 200) * 0.1 = 70, but (200 * 0.1) = 20.
The module can be displayed in two versions:
The display settings in the user part that you set in the Cumulative Discount and Current Order strategies themselves are also taken into account. For example, a discount may not be displayed (since the display was disabled), but it will still be applied.
You can also add your CSS and JS directly to the module.
Please note that mass generation is not a strategy, so they are created directly in the tab and are not displayed in the general list (as in the IMDiscount display modules, etc.).
Please note that if generation is required ONLY for individual products, then you must make sure that the filters for the first item are empty (no prices are set in the filters, no manufacturers and categories are specified, and no status is specified).
For prices. If the value of the cost filter is equal to or less than zero, then it is considered that there are no restrictions for this price filter. For example, the cost FROM equal to 10 and the cost TO equal to 0 means that the cost of the product must be greater than or equal to 10. Note that prices are set in the base currency.
In other words, if you have not specified filters, then when clearing by button (or as part of generation) standard discounts or promotions for all products (depending on what mass generation is used for) will be deleted! Similarly, when generating discounts or promotions from the table (depending on what mass generation is used for) will be added for all products.
Based on this data, [the adjustment value] is formed. In the case of a fixed number, this is just a number, and in the case of a percentage, this is the price multiplied by the percentage and divided by 100.
For example, the number 50 for "." it will be 50. And in case of "%" it will be [price] * 50 / 100.
Modifier "=". Formula [next_price] = [value to adjust]
Modifier "-". Formula [next_price] = [price] - [value to adjust]
Modifier "+". Formula [next_price] = [price] + [value to adjust]
Modifier "*". Formula [next_price] = [price] * [value to adjust]
Modifier "/". Formula [next_price] = [price] / [value to adjust]
This also applies to negative prices. The standard mechanism of OpenCart considers this quite correct in many versions (at least in 2.x, 3.0). For understanding: you can set both the price of the product and discounts with promotions negative, and they will be used in the calculation, including the basket and checkout.
Therefore, the module does not perform additional checks for prices, in terms of negative values. You never know, as a client, whether you use this feature. Therefore, be careful and attentive!
Logging is enabled in the "Settings" tab. The log file is located in the "storage/logs" directory (DIR_LOGS).
However, even regular users can use it. In the log file, you need to look for the phrase "After calculateDiscounts". Just above it, the user and group IDs are displayed, as well as the full name. Just below it, summary information on calculated discounts of current strategies for the current basket is displayed (before applying the global discount calculation setting).
In the module settings, you can disable the application of IMDiscount discounts (strategies) for the case when a coupon is specified. However, for this to happen, the coupon module must be applied BEFORE the IMDiscount module is applied. In other words, the sort order of the IMDiscount module must be greater than the sort order of the coupon module.
The setting applies globally, that is, to all discounts at once.
IMPORTANT! If you do not specify the correct sorting order in the IMDiscount module, the calculations may be incorrect! At a minimum, the discount calculation should occur after calculating the sum of goods (sub_total).
| File Name | Added | Modified |
|---|---|---|
im-discount_oc3x.ocmod.zip Size: 280.38 KB | 28.02.2025 | 28.02.2025 |
Leave your review about this product