ProductTracking::DO_NOT_TRACK when selected
he's allowed to be added to the infinite basket, How do we define limits?
you have 10000000000000000000000 products in your basket
LIMIT 9999
How Can I do it?
I have to set a limit.
ProductTracking::DO_NOT_TRACK when selected
LIMIT 9999
For example, you can use hooks in the fn_add_product_to_cart function (app/functions/fn.cart.php) to correct product amount
function fn_check_amount_in_stock($product_id, $amount, $product_options, $cart_id, $is_edp, $original_amount, &$cart, $update_id = 0) { fn_set_hook('check_amount_in_stock', $product_id, $amount, $product_options, $cart_id, $is_edp, $original_amount, $cart); // If the product is EDP don't track the inventory if ($is_edp == 'Y') { return 1; } $product = db_get_row("SELECT ?:products.tracking, ?:products.amount, ?:products.min_qty, ?:products.max_qty, ?:products.qty_step, ?:products.list_qty_count, ?:products.out_of_stock_actions, ?:product_descriptions.product FROM ?:products LEFT JOIN ?:product_descriptions ON ?:product_descriptions.product_id = ?:products.product_id AND lang_code = ?s WHERE ?:products.product_id = ?i", CART_LANGUAGE, $product_id); if (isset($product['tracking']) && Registry::get('settings.General.inventory_tracking') == 'Y' && $product['tracking'] != ProductTracking::DO_NOT_TRACK ) { // Track amount for ordinary product if ($product['tracking'] == ProductTracking::TRACK_WITHOUT_OPTIONS) { $current_amount = $product['amount']; // Track amount for product with options } elseif ($product['tracking'] == ProductTracking::TRACK_WITH_OPTIONS) { $selectable_cart_id = fn_generate_cart_id($product_id, array('product_options' => $product_options), true); $current_amount = (int)db_get_field( "SELECT amount FROM ?:product_options_inventory WHERE combination_hash = ?s", $selectable_cart_id ); } if (!empty($cart['products']) && is_array($cart['products'])) { $product_not_in_cart = true; foreach ($cart['products'] as $k => $v) { // Check if the product with the same selectable options already exists ( for tracking = O) if ($k != $cart_id) { if (isset ($product['tracking']) && ( $product['tracking'] == ProductTracking::TRACK_WITHOUT_OPTIONS && $v['product_id'] == $product_id ) || ( $product['tracking'] == ProductTracking::TRACK_WITH_OPTIONS && @$v['selectable_cart_id'] == $selectable_cart_id ) ) { $current_amount -= $v['amount']; } } else { $product_not_in_cart = false; } } if ($product['tracking'] == ProductTracking::TRACK_WITHOUT_OPTIONS && !empty($update_id) && $product_not_in_cart && !empty($cart['products'][$update_id]) ) { $current_amount += $cart['products'][$update_id]['amount']; } if ($product['tracking'] == ProductTracking::TRACK_WITH_OPTIONS) { // Store cart_id for selectable options in cart variable, so if the same product is added to // the cart with the same selectable options, but different text options, // the total amount will be tracked anyway as it is the one product if (!empty($selectable_cart_id) && isset($cart['products'][$cart_id])) { $cart['products'][$cart_id]['selectable_cart_id'] = $selectable_cart_id; } } } }