By default, CS-Cart does not have the ability to work with fractional values of product balances; this causes great inconvenience for owners of grocery stores, construction materials stores, and printing houses. Any product where you need to operate with fractional values.
Another problem is selling goods in packages; you can set the product quantity step, but it will not be clear how many packages the client will receive. Or you sell goods in packages, but count them in the warehouse in pieces, or in weight (kg, g, t) or volume (m3, l3)
Our add-on solves 2 problems at once and allows you to sell goods in fractional parts and packages
You can flexibly configure the add-on for each product individually or for the entire store as a whole, or add exceptions.
The add-on supports displaying the unit of measurement of the quantity of goods, setting the step for selecting quantity, the minimum and maximum quantity of goods to order. It solves the problems of displaying available products on the site and simplifies the sales process.
Selling goods in packages is now very flexible and understandable for both the store owner and the client. You can:
- Sell only in packages and display packages;
- Sell in packages and show how many units of goods the client will receive;
- Sell in pieces and show and let you add the product to your cart in packages.
In this case, you will count the goods individually (in whole numbers or fractions) and you can configure this individually for each product.
Add-on features
- Sale of goods in fractional units;
- Setting the unit of measurement for the quantity of goods. Both globally and locally;
- Disable fractional balance for units included in exceptions;
- Setting the step for selecting the quantity of goods to order;
- Setting the minimum and maximum values for the order;
- Customizable display for sale in packages;
- Customizable display of the quantity in the cart;
- Compatible with Unitheme and Youpi templates.
- Store Builder
- Store Builder Ultimate
- Multi-Vendor
- Multi-Vendor Plus
- Multi-Vendor Ultimate
- Buyers
- Owners
- Vendors
- English
- Русский
- 4.17.X
- 4.16.X
- 4.15.X
- 4.14.X
- 4.13.X
- 4.12.X
Installation
After downloading the add-on, its installation is performed using standard CS-Cart tools on the page Admin Panel → Add-ons→ Add-ons Management → Download and install the add-on (+).
For CS-Cart version 4.13.1 and higher, the Admin Panel → Add-ons→ Downloaded add-ons → Gear button → Manual installation.
Installing hooks
To work correctly, you need to install hooks according to the instructions. The information is collected in the add-on tab Information.
This operation for adding hooks is relevant for the current version of the v add-on .2.5.13 and later, in future versions, this operation may no longer be necessary.
To display the quantity of the product in the cart, you need to add 3 hooks to the file “fn.cart.php”:
- Open the file fn.cart.php (the file will be located at the path: app/functions/fn.cart.php );
- In the opened file, find the line with the code (approximately between lines 6057-6062):
- After the found line, insert the code:
- As a result, you should get the following:
- Next, find the line with the code in the file (approximately between lines 6522-6524):
- After the found line, insert the code:
- As a result, you should get the following:
- Next, find the line with the code in the file (approximately between lines 9340-9342):
- After the found line, insert the code:
- As a result, you should get the following:
- Save the changes to the file;
- Clear the cache:
- In the admin panel, select Administration → Storage → Clear Cache.
if (!empty($product['qty_step']) && $product['qty_step'] > $min_qty) {
$min_qty = $product['qty_step'];
fn_set_hook('check_amount_in_stock_min_qty', $product, $min_qty, $product_id);
if (!empty($product['qty_step']) && $product['qty_step'] > $min_qty) {
$min_qty = $product['qty_step'];
}
**fn_set_hook('check_amount_in_stock_min_qty', $product, $min_qty, $product_id);**
$cart_amount_changed = false;
$amount = fn_normalize_amount(@$data['amount']);
fn_set_hook('add_product_to_cart_post_normalize_ammount', $product_id, $amount, $data);
$amount = fn_normalize_amount(@$data['amount']);
**fn_set_hook('add_product_to_cart_post_normalize_ammount', $product_id, $amount, $data);**
if (!isset($data['extra']['exclude_from_calculate'])) {
$amount = fn_normalize_amount($v['amount']);
fn_set_hook('update_cart_products_normalize_amount_post', $amount, $v);
$amount = fn_normalize_amount($v['amount']);
**fn_set_hook('update_cart_products_normalize_amount_post', $amount, $v);**
$v['extra'] = empty($cart['products'][$k]['extra']) ? array() : $cart['products'][$k]['extra'];
To work with commerceml, you need to add a hook to the file “OrderConvertor.php ”:
- Open the file OrderConvertor.php (the file will be located along the path: app/addons/commerceml/src/Convertors/OrderConvertor.php);
- In the opened file, find the line with the code (approximately between lines 44-46):
- After the found line, insert the code:
- As a result, you should get the following:
- Save the changes to the file;
- Clear the cache:
- In the admin panel, select Administration → Storage → Clear Cache.
$order->id->external_id = $element->getAsString('id');
fn_set_hook('commerceml_order_convertor_convert_pre', $element, $import_storage, $order);
$order->id->external_id = $element->getAsString('id');
**fn_set_hook('commerceml_order_convertor_convert_pre', $element, $import_storage, $order);**
foreach ($element->get('products/product', []) as $item) {
Setting
Add-ons Settings (Global Settings)
Go to the section Add-ons → Downloaded add-ons→ Fractional stock→ Settings tab
Basic Settings:
The settings tab is divided into 3 sections, Global settings for products, Global Settings for packages, and Shopping cart settings.
The application of these settings affects all products of the store at once, unless local settings are set for the product (more on this below).
Global settings for products
Use fractional remainder - Enabling this function will allow you to edit the field: Unit of quantity.
ExampleFor example, in a store selling cable, there are products sold only in meters, in this case, in the add-on settings, you can enable the use of fractional remainder and set the unit of measurement of quantity, meter. As a result, all products (unless another setting is selected locally for the product/the use of fractional remainder is disabled) will display the unit of measurement of the quantity specified in the global settings of the add-on.
Global settings for packages
The product is for sale:
- Piece by piece - goods are sold in pieces, all goods (unless another setting is selected locally for the product/package sale is enabled) will be sold in a piece or similar form;
- Packages - goods are sold in packages, you can specify:
- The quantity of goods in a package is the step of changing the quantity of goods that will be applied to goods sold in packages;
Options for displaying the selection of the quantity of the product:
- Show the number of packages - Display only the counter with the number of packages in the product card and catalog;
- Show the quantity of goods and packages - Display in the product card and catalog a counter with the number of packages and the number of goods in the package.
- The product is sold in packages;
- Quantity of goods in a package: 12;
- Display options for selecting the quantity of goods: Show the quantity of goods and packages.
For example, in a wholesale grocery store there is a product: a box of milk. This product must be sold in packages and demonstrate that there are 12 bags of milk in 1 package. To do this, select in the add-on settings:
Shopping Cart Settings
Quantity display mode on the basket icon - Allows you to select the display option on the basket icon:
- Number of items - how many types of goods are in the basket;
- Number of units - how many units of the product are in the basket;
- Do not display.
In the add-on settings, the Display tab contains settings responsible for displaying units of measurement and methods of sale on the showcase.
- Display units of measurement in sellers' offers
When this function is enabled on the showcase, the seller's offers will display the unit of measurement of the product specified in the global settings of the add-on or the local settings of the product.
- Display all sales methods on the categories page
This and all subsequent settings are responsible for displaying all sales methods on the pages and blocks of your choice.
For example, you don't want to overload the customer's information on the deferred products page and the product block. In this case, the desired items are unchecked and only the standard counter for adding an item to the cart will be displayed on the showcase on these pages and blocks, instead of the extended one with the display of packages and step values in the package.
View with the enabled setting To display all sales methods in the product block:
View with the disabled setting To display all sales methods in the product block:
View with the enabled setting To display all sales methods on the deferred items page:
View with the disabled setting To display all sales methods on the deferred items page:
In the add-on settings, the Information tab displays the instructions for adding hooks described at the beginning of this instruction.
Add-ons Settings (Local Settings)
Go to the section Products → Products → Open the product to set up the fractional stock→ Go to the Add-ons tab → Find the block MS: Fractional Stock.
Product Settings
Use a fractional remainder
- Global Settings:
- The unit of measurement of quantity from the global settings of the add-on will be used for the product;
- For the product, you can specify:
- Step of the quantity selection list;
- Minimum quantity of goods to order;
- The maximum quantity for the purchase of one product.
- Yes:
- A fractional remainder will be used forcibly for the product;
- For the product, you can specify:
- The unit of measurement of quantity;
- Step of the quantity selection list;
- Minimum quantity of goods to order;
- The maximum quantity for the purchase of one product.
- No:
- The fractional balance will be forcibly turned off for the product;
- For the product, you can specify:
- The unit of measurement of quantity.
- Global Settings:
- Global settings for packages will be used for the product;
- Fields are not editable for the product:
- The quantity of the product in the package;
- Options for displaying the selection of the quantity of the product;
- Yes:
- For a product, you can set the quantity of the product in the package;
- For the product, you can select options for displaying the selection of the quantity of the product;
- No:
- The product is sold in pieces, global settings do not affect the product, local fields are not editable.
In a confectionery store, it is necessary to sell almond petals, the minimum order is from 500 gr. the increment is 100 gr. and the maximum quantity of goods for the order is 2000 gr. In this case, the Unit of Measurement of the quantity is set in the add-on settings and the Use of fractional remainder is enabled:
The following fields are filled in in the product settings:
As a result, the card will look like this:
For example, in a furniture store there is a product self-tapping screws sold in grams, in increments of 50 grams. the minimum order is from 200 grams and the maximum is up to 5000 rubles.
In this case, the use of fractional remainder is disabled in the add-on settings:
The following fields are filled in in the product settings:
As a result, the card will look like this:
For example, in a beverage store, you can set the units of measurement bottle, jar, package, etc. for each product:
Packaging Settings
The product is sold in packages
For example, a wholesale beverage store offers customers only packages of 6 bottles.
In this case, the add-on settings will look like this:
Locally for the products you need to select:
Use fractional remainder: Global Settings
The product is sold in packages: Global settings
As a result, the card will look like this:
Mass editing
Through updating products in CS-Cart:
- Open the Products → Products;
- Select the necessary products;
- Click Edit Selected;
- Select fields to edit;
- Click Edit Selected;
- Enter new values for the selected fields; Meaning global - Global Settings Y - Yes N - No
- Click Save.
Through the export and import of goods:
- Open the Administration → Export Data → Products;
- Move the following fields from the list of available fields to the exported fields: MS:Allow Fractional Amount MS:Product Amount Step MS:Product minimum order quantity MS:Product maximum order quantity MS:Product Amount Postfix MS:Product Sale Type MS:Show Sale Types These fields will be displayed in a table file for editing fractional remainder settings
- Click Export;
- Make the necessary changes in the table file and save;
- Open the Administration → Data Import → Products section;
- Press the + button;
- Select a table file;
- Go to the next step Matching fields;
- Match the fields as shown below:
- Click Import.
v2.5.13 11/14/2023
[-] Removed unnecessary, commented-out code
[!] Field MS: "Minimum quantity of goods for order" does not work. Corrected
[!] The "Quantity unit" field in the settings is not translated. Corrected
[!] Correct display in the product card
[*] Current line numbers for adding add-on hooks
[+] Added information about adding add-on hooks
[!] Added types of displaying the quantity of goods on the cart icon
[!] Displaying fractional values in the cart
[!] Displaying the product quantity counter in the product card
[+] Add-onstandardization
v2.5.12 from 10/23/2023
[!] Correct counting of packages on the cart page
[!] Availability of the service on the order page in the administrative panel
[!] The "Quantity unit" field in the product settings has been changed to the "float" type
[!] Fields related to quantity selection only store positive values
[!] In the field MS: "Minimum quantity of goods for order" only entering digital values is available
[*] Standardization of language variables
v2.5.11 from 10/16/2023
[*] Changed short tags to regular
[*] Add-on settings have been reworked
v2.5.10 from 07/18/2023
[!] Correct display in the product card
[!] Loading icons
[!] Field "Product quantity step" saves only positive values
[!] Correct display of unit names on the pages of promotional products, new items, bestsellers and search results
[!] Displaying units of measurement on the deferred page
v2.5.9 from 06/25/2023
[+] Add-on standardization
v2.5.8 from 06/12/2023
[+] Add-on standardization
v2.5.7 from 06/08/2023
[*] The style in the "Bestsellers" block has been corrected if it opens in the product card
v2.5.6 from 06/05/2023
[+] Added a setting for displaying fractional balances in the import and export of goods
[+] Added settings and adjustments for displaying all sales methods on different pages
[+] Added a setting for displaying units of measurement in the block of offers from sellers in the product card
[!] Fixed a bug that breaks the category view page
v2.5.5 from 05/20/2023
[+] Added a setting for displaying fractional balances in the product card on the product editing page in the admin panel
v2.5.4 from 05/16/2023
[*] Minor changes to the qty.override.tpl template
v2.5.3 from 05/16/2023
[!] Fixed an error when adding a product to the cart when the "General products of sellers" add-on is running
v2.5.2 from 05/15/2023
[*] Licensing
v2.5.1 from 05/10/2023
[!] Fixed import of the product_amount_postfix field
Here you can share your opinion and evaluate our work.
Your feedback helps us become better and offer you even better service.