2.9.2
Table of contents
- Installation
- Installing hooks
- Setting
- Add-ons Settings (Global Settings)
- Basic Settings:
- Global settings for products
- Global settings for packages
- Shopping Cart Settings
- Add-ons Settings (Local Settings)
- Product Settings
- Packaging Settings
- Mass editing
- Through updating products in CS-Cart:
- Through the export and import of goods:
Fractional Stock
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.