|
| 1 | +--- |
| 2 | +title: "Calculator - Sort by Price" |
| 3 | +sidebar_label: "Calculator - Sort by Price" |
| 4 | +sidebar_position: 7 |
| 5 | +description: "Automatically apply the lowest available price to customers based on their user group, order quantity, and date — ideal for stores with multiple price levels." |
| 6 | +--- |
| 7 | + |
| 8 | +# Calculator - Sort by Price |
| 9 | + |
| 10 | +The Calculator - Sort by Price plugin adds an alternative pricing calculator to J2Commerce. When a product has multiple price levels set up in its **Additional Pricing** table, this calculator automatically finds and applies the **lowest matching price** for each customer based on three factors: their Joomla user group, the quantity they are ordering, and the current date. |
| 11 | + |
| 12 | +This is useful for stores that offer tiered pricing, wholesale discounts, time-limited promotions, or group-specific pricing. Without this plugin, J2Commerce uses the **Standard** calculator, which only uses the base variant price. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +- J2Commerce installed and enabled |
| 17 | +- At least one product with multiple price levels defined in **Additional Pricing** |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +This plugin is a separate add-on available from the [J2Commerce Extensions Store](https://www.j2commerce.com). It is not included with the core J2Commerce component. |
| 22 | + |
| 23 | +1. Purchase and download the `app_calculatorsortbyprice.zip` package from the J2Commerce website. |
| 24 | +2. Go to **System** -> **Install** -> **Extensions**. |
| 25 | +3. Upload the `app_calculatorsortbyprice.zip` package file. |
| 26 | +4. The plugin installs and enables automatically. |
| 27 | + |
| 28 | +After installation: |
| 29 | + |
| 30 | +1. Go to **J2Commerce** -> **Apps**. |
| 31 | +2. Find **Calculator - Sort by Price** in the list and confirm it shows **Enabled**. |
| 32 | + |
| 33 | +<!-- SCREENSHOT: J2Commerce Apps view showing Calculator - Sort by Price enabled --> |
| 34 | + |
| 35 | +## How Pricing Calculators Work |
| 36 | + |
| 37 | +Every product variant in J2Commerce has a **Pricing Calculator** setting that controls how the final price is determined. By default, all products use the **Standard** calculator. Once this plugin is installed, a second option — **Sort by Price** — becomes available. |
| 38 | + |
| 39 | +| Calculator | Behavior | |
| 40 | +|------------|----------| |
| 41 | +| **Standard** | Uses the base variant price only. Additional pricing rules are ignored. | |
| 42 | +| **Sort by Price** | Evaluates all additional pricing rules and selects the lowest price that matches the customer's group, quantity, and the current date. | |
| 43 | + |
| 44 | +The calculator is set **per product**, so you can use Standard pricing on some products and Sort by Price on others. |
| 45 | + |
| 46 | +## Setting Up a Product to Use Sort by Price |
| 47 | + |
| 48 | +### Step 1: Open the Product |
| 49 | + |
| 50 | +1. Go to **J2Commerce** -> **Catalog** -> **Products**. |
| 51 | +2. Click the product you want to configure. |
| 52 | +3. Select the **Price** tab. |
| 53 | + |
| 54 | +<!-- SCREENSHOT: Product edit form showing the Price tab selected --> |
| 55 | + |
| 56 | +### Step 2: Change the Pricing Calculator |
| 57 | + |
| 58 | +1. Find the **Pricing Calculator** dropdown in the Price tab. |
| 59 | +2. Change it from **Standard** to **Sort by Price**. |
| 60 | + |
| 61 | +<!-- SCREENSHOT: Pricing Calculator dropdown showing Sort by Price selected --> |
| 62 | + |
| 63 | +### Step 3: Add Price Levels |
| 64 | + |
| 65 | +The Sort by Price calculator only works when you have additional pricing rules defined. To add them: |
| 66 | + |
| 67 | +1. In the same **Price** tab, click the **Additional Pricing** button. |
| 68 | +2. A modal window opens showing your existing price rules (if any) and a form to add new ones. |
| 69 | +3. Fill in the fields for each price level: |
| 70 | + |
| 71 | +<!-- SCREENSHOT: Additional Pricing modal with sample pricing rules --> |
| 72 | + |
| 73 | +| Field | Description | Example | |
| 74 | +|-------|-------------|---------| |
| 75 | +| **Quantity From** | Minimum quantity for this price to apply. Set to `0` for no minimum. | `10` | |
| 76 | +| **Quantity To** | Maximum quantity for this price to apply. Set to `0` for no maximum. | `50` | |
| 77 | +| **Date From** | Start date for this price. Leave empty for no start restriction. | `2026-01-01` | |
| 78 | +| **Date To** | End date for this price. Leave empty for no end restriction. | `2026-12-31` | |
| 79 | +| **Customer Group** | The Joomla user group this price applies to. Select **All** to apply to every customer. | `Wholesale` | |
| 80 | +| **Price** | The price amount for this rule. | `15.00` | |
| 81 | + |
| 82 | +4. Click **Save** to add the rule. |
| 83 | +5. Repeat for each price level you need. |
| 84 | +6. Close the modal and click **Save** on the product. |
| 85 | + |
| 86 | +## Example: Multiple Price Levels in Action |
| 87 | + |
| 88 | +Suppose you sell a product with a base price of $25.00 and you set up these additional pricing rules: |
| 89 | + |
| 90 | +| Rule | Quantity | Group | Price | |
| 91 | +|------|----------|-------|-------| |
| 92 | +| 1 | 1 – 9 | All | $25.00 | |
| 93 | +| 2 | 10 – 49 | All | $20.00 | |
| 94 | +| 3 | 50+ | All | $15.00 | |
| 95 | +| 4 | 1+ | Wholesale | $18.00 | |
| 96 | + |
| 97 | +With the **Sort by Price** calculator, here is what each customer would pay: |
| 98 | + |
| 99 | +- **A retail customer ordering 5 units:** Rule 1 matches ($25.00). Final price: **$25.00 per unit**. |
| 100 | +- **A retail customer ordering 25 units:** Rule 2 matches ($20.00). Final price: **$20.00 per unit**. |
| 101 | +- **A retail customer ordering 100 units:** Rule 3 matches ($15.00). Final price: **$15.00 per unit**. |
| 102 | +- **A wholesale customer ordering 25 units:** Rules 2 ($20.00) and 4 ($18.00) both match. The calculator picks the lowest: **$18.00 per unit**. |
| 103 | +- **A wholesale customer ordering 100 units:** Rules 3 ($15.00) and 4 ($18.00) both match. The calculator picks the lowest: **$15.00 per unit**. |
| 104 | + |
| 105 | +The key behavior is that **when multiple rules match, the customer always gets the best (lowest) price**. |
| 106 | + |
| 107 | +## How the Calculator Evaluates Rules |
| 108 | + |
| 109 | +When a customer views or adds a product to the cart, the Sort by Price calculator: |
| 110 | + |
| 111 | +1. Retrieves all additional pricing rules for that product variant. |
| 112 | +2. Filters out rules that do not match: |
| 113 | + - **Quantity:** The customer's quantity must fall within the rule's quantity range. |
| 114 | + - **Date:** Today's date must fall within the rule's date range (if one is set). |
| 115 | + - **Customer Group:** The customer must belong to the rule's user group, or the rule must be set to **All**. |
| 116 | +3. Sorts the remaining matching rules by price, lowest first. |
| 117 | +4. Applies the lowest price. |
| 118 | + |
| 119 | +If no rules match, the product's base variant price is used as a fallback. |
| 120 | + |
| 121 | +## Tips |
| 122 | + |
| 123 | +- You do not need to create a rule that matches the base price. If no additional pricing rules match, the standard base price is used automatically. |
| 124 | +- Use date ranges for seasonal sales or limited-time promotions. The calculator will only apply those prices during the specified period. |
| 125 | +- Combine quantity tiers with group-specific pricing for maximum flexibility. The calculator will always find the best deal for the customer. |
| 126 | +- You can switch a product back to **Standard** at any time without deleting your additional pricing rules. The rules are preserved but ignored until you switch back to **Sort by Price**. |
| 127 | + |
| 128 | +## Troubleshooting |
| 129 | + |
| 130 | +### The product still shows the base price even though I added pricing rules |
| 131 | + |
| 132 | +**Cause:** The product's Pricing Calculator is still set to **Standard**. |
| 133 | + |
| 134 | +**Solution:** |
| 135 | + |
| 136 | +1. Edit the product and go to the **Price** tab. |
| 137 | +2. Change the **Pricing Calculator** dropdown from **Standard** to **Sort by Price**. |
| 138 | +3. Click **Save**. |
| 139 | + |
| 140 | +### A customer is not getting the expected discounted price |
| 141 | + |
| 142 | +**Cause:** The customer's quantity, date, or user group may not match any of the pricing rules. |
| 143 | + |
| 144 | +**Solution:** |
| 145 | + |
| 146 | +1. Open the product and click **Additional Pricing** to review the rules. |
| 147 | +2. Verify that the customer's order quantity falls within the **Quantity From** and **Quantity To** range of the intended rule. |
| 148 | +3. Check that today's date is within the **Date From** and **Date To** range (if set). |
| 149 | +4. Confirm the customer belongs to the correct Joomla user group. You can check this under **Users** -> **Manage** in the Joomla admin. |
| 150 | + |
| 151 | +### The plugin does not appear in the Apps list |
| 152 | + |
| 153 | +**Cause:** The plugin may not be installed or discovered. |
| 154 | + |
| 155 | +**Solution:** |
| 156 | + |
| 157 | +1. Go to **System** -> **Manage** -> **Extensions** and search for `calculatorsortbyprice`. |
| 158 | +2. If it does not appear, go to **System** -> **Install** -> **Extensions** and re-upload the package. |
| 159 | +3. If it appears but is disabled, click the status icon to enable it. |
| 160 | + |
| 161 | +## Related Topics |
| 162 | + |
| 163 | +- [Product Pricing](../catalog/product-pricing.md) |
| 164 | +- [Bulk Discount](app_bulkdiscount.md) |
0 commit comments