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.10.2 от 28.12.2024
[!] Отсутствует хук "create_order_details" в файле init.php. Исправлено
v2.10.1 от 12.11.2024
[!] Исправлено добавление товара в корзину, при первом добавлении товар округлялся до целых чисел
v2.10.0 от 29.10.2024
[+] Новый расчет количества. Происходит расчет кол-во уп. переводится в ед. и сравнивается с кол-во ед. в наличии, если их достаточно, то добавляет в корзину
[*] Подправлены стили
[+] Добавлена запись данных по дробному остатку товара в таблицу order_details после оформления/обновления заказа
[+] Добавлена передача в шаблоны писем по заказу переменные из настроек модуля и переменные по дробному остатку по каждому товару в таблице товаров
[!] Не корректный тег на странице "Товара". Исправлено
[*] Изменены стили для счёткика количества на странице "Товара" и "Корзина" для youpi темы
[!] Ошибка расчёта количества при вводе значения вручную. Исправлено
[!] Дубликат атрибута id на странице "Корзина". Исправлено
[!] При установке количества товара на странице "Корзина" не работает округление. Исправлено
[*] Добавлена переменная для вывода кол-ва товаров csc_fractional_stock
[+] В hooks.php исправлен метод fn_csc_fractional_stock_create_order_details (добалена логика проверки и запись значения в специальную переменную - единичный товар или упаковки товара)
[+] По пути \app\addons\csc_fractional_stock\Tygh\Template\Snippet в класс CscFractionalStockVariables добавлена переменная csc_fractional_stock_show_amount
[+] В класс CscProductVariable в метод attributes добавлена csc_fractional_stock_show_amount
[+] Добавлено отображение символа валюты для переменной csc_fractional_stock_price_by_piece
[!] Неккоректно считалось стоимость товара в упаковке при добавлении в корзину. Исправлено
[!] Исправлена ошибка появляющаяся из за типов данных в параметрах хука
[*] Исправлено отображение цены csc_fractional_stock_price_by_piece - добавлено форматирование цены по аналогии с price в документах заказа
[*] Исправлено отображение наличия товара на витрине в unitheme2
[!] Исправлена ошибка, возникающая при создании комплектов товара
[!] Исправлена ошибка, при добавлении товара с предзаказом
v2.9.1 от 28.03.2024
[*] Стандартизация языковых переменных
[*] Подправлены стили у unitheme2
[+] Добавлены шаблоны и стили для youpitheme
[+] Добавлены настройки для массового редактирования товаров
[*] Подправлены стили unitheme2 и файл лицензии
[+] Добавлена возможность отображать товары в единицах измерений на всех этапах оформления заказа даже если товар продается упаковками
v2.9.0 от 20.02.2024
[*] Проведена оптимизация запросов в базу данных
v2.8.1 от 16.02.2024
[*] Добавил проверку локального значения для товара при отображении цен для единиц товара и для упаковки
v2.8.0 от 16.02.2024
[+] Добавлены настройки в модуле и у товара для управления использования цены (единицы/упаковки)
v2.7.1 от 30.01.2024
[!] Удален дублирующий код, нарушавший добавление в корзину дробного остатка при работе со складами
v2.7.0 от 19.01.2024
[+] Добавлена возможность работы с модулем "Склады"
[*] Исправлено отображение изображения товара на странице детального просмотра заказа на витрине
[*] Подправлены стили
[*] Если товар продается упаковками, то при оформлении заказа количество будет вычитаться в единицах товара, а не в упаковках
[*] Изменен механизм вычитания количества на складах при продаже товара упаковками и включенном режиме отображения "Показывать количество товара и упаковок" товар будет списываться количеством выбранных штук
[*] Изменен механизм вычитания количества на складах при продаже товара упаковками и включенном режиме отображения "Показывать количество упаковок" товар будет списываться: количество упаковок, умноженное на количество штук в упаковке
[*] При продаже товара упаковками и включенном режиме отображения "Показывать количество упаковок" в поле ввода количества упаковок можно ввести только целые исла
v2.6.0 от 10.01.2024
[*] Изменена структура во вкладке Настройки->Информация
[+] Добавлена передача дробных остатков через обмен commerceml
[-] Удалены исключения для единиц измерений
[+] Добавлена передача дробных остатков товаров в заказе через обмен commerceml
[+] Запросы в базу данных из файла addon.xml перенесены в файл func.php для корректной проверки перед выполнением запросов
[*] Изменены стили
[+] Добавлены языковые переменные
[+] Добавлены настройки для управления "Способ изменения количества товаров"
[*] Переименованы настройки "Шаг списка выбора количества" в "Шаг изменения количества товара"
[*] Исправлено увеличение количества упаковок
v2.5.14 23.11.2023
[!] Экспорт/импорт поля "Единица измерения количества"
v2.5.13 14.11.2023
[-] Удаление закомментированного кода
[!] Корректировка поля MS: "Минимальное количество товара для заказа"
[!] Перевод поля "Единица измерения количества"
[!] Корректное отображение в карточке товара
[*] Актуальные номера строк для добавления хуков модуля
[+] Добавлена информация о добавлении хуков модуля
[!] Добавлены виды отображения количества товара на иконке корзины
[!] Отображение дробного значения в корзине
[!] Отображение счетчика количества товаров в карточке товаров
[+] Стандартизация модуля
v2.5.12 от 23.10.2023
[!] Правильный подсчет упаковок на странице корзины
[!] Доступность сервиса на странице заказа в административной панели
[!] Поле "Единица измерения количества" в настройках продукта изменено на тип "float"
[!] Поля, связанные с выбором количества, сохраняют только положительное значения
[!] В поле MS: "Минимальное количество товара для заказа" доступен только ввод цифровых значений
[*] Стандартизация языковых переменных
v2.5.11 от 16.10.2023
[*] Изменены короткие теги на обычные
[*] Переработаны настройки модуля
v2.5.10 от 18.07.2023
[!] Корректное отображение в карточке товара
[!] Загрузка иконки
[!] Поле "Шаг количества товара", сохраняет только положительное значения
[!] Корректное отображение названия единиц на страницах товары по акции, новинки, хиты продаж и результат поиска
[!] Отображение единиц измерения на странице отложенные
v2.5.9 от 25.06.2023
[+] Стандартизация модуля
v2.5.8 от 12.06.2023
[+] Стандартизация модуля
v2.5.7 от 08.06.2023
[*] Подправлен стиль в блоке "Хиты продаж" если он открывается в карточке товара
v2.5.6 от 05.06.2023
[+] Добавлена настройка отображения дробного остатка в импорт и экспорт товаров
[+] Добавлены настройки и регулировка отображения всех способов продаж на разных страницах
[+] Добавлена настройка для отображения единицы измерения в блоке предложений от продавцов в карточке товара
[!] Исправлена ошибка, которая ломает страницу просмотра категории
v2.5.5 от 20.05.2023
[+] Добавлена настройка отображения дробного остатка в карточке товара на странице редактирования товара в админке
v2.5.4 от 16.05.2023
[*] Мелкие правки в шаблоне qty.override.tpl
v2.5.3 от 16.05.2023
[!] Исправлена ошибка при добавлении товара в корзину при работающем модуле "Общие товары продавцов"
v2.5.2 от 15.05.2023
[*] Лицензирование
v2.5.1 от 10.05.2023
[!] Исправлен импорт поля product_amount_postfix
Локально задавать тип упаковки
Добавление локальной настройки ввода типа упаковки (метры, паллеты, коробки, ящики)
Обучить модуль Склады дробным остаткам
Обучить модуль Склады дробным остаткам
Разделение модуля Дробный остаток на 2 модуля
Разделение существующего модуля на 2 автономных
Адаптация и настройки отображения счетчика количества товаров
Адаптация и настройки отображения счетчика количества товаров
Арифметика продажи упаковками
Использование существующей цены как за уп так и за м2
Использование существующей цены как за уп так и за м2
Количество товара для отображения в карточке
Доработка модуля
Новая логика расчета товара в наличии при продаже уп.
Новая логика расчета товара в наличии при продаже уп.
Удобные настройки
Настройки для модуля интуитивно не понятные, надо это исправить, сделать их логичными и удобными
шт. или упаковки отображение при оформлении заказа
Настройка отображение типа товара (упаковками, штуками и т.д.) на всех этапах оформления заказа.
Ваш запрос отправлен!
Ваш запрос на доработку модуля отправлен в техническую поддержку. Мы изучим ваши пожелания и дадим обратную свзязь.
Вам придет уведомление на указанный Email.