Hello,
we are redesigning our checkout, and we encounter a problem when updating the current quantity of a product in the checkout section.
We would like to use a link for it. We have used this to delete products from the cart.
Delete Link
index.php?dispatch=checkout.delete&cart_id=303560847&redirect_mode=cart
Now we would like to use it for updates from the quantity, but unfortunately it does not work properly.
index.php?dispatch=checkout.update&cart_id=683261860&product_id=697&amount=1&redirect_mode=cart
Here is the target php file where I make my request:
// file: app/controllers/frontend/checkout.php// Update products quantity in the cart // if ($mode == 'update') { if (!empty($_REQUEST['cart_products'])) { foreach ($_REQUEST['cart_products'] as $_key => $_data) { if (empty($_data['amount']) && !isset($cart['products'][$_key]['extra']['parent'])) { fn_delete_cart_product($cart, $_key); } } fn_add_product_to_cart($_REQUEST['cart_products'], $cart, $auth, true); fn_save_cart_content($cart, $auth['user_id']); } unset($cart['product_groups']); fn_set_notification('N', __('notice'), __('text_products_updated_successfully')); // Recalculate cart when updating the products if (!empty($cart['chosen_shipping'])) { $cart['calculate_shipping'] = true; } $cart['recalculate'] = true; $_suffix = ".$_REQUEST[redirect_mode]"; }
Does anyone have a tip for me on how I can solve this or what I am missing?