Abo Einmalprodukte und Bestätigung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2bdc9ada3c
commit
2269ce031f
57 changed files with 3647 additions and 371 deletions
|
|
@ -28,6 +28,12 @@ class CardController extends Controller
|
|||
{
|
||||
$product = Product::find($id);
|
||||
if ($product && ProductOrderContext::isProductAllowedInCustomerWebshop($product)) {
|
||||
$additionalWeight = (int) $product->weight * (int) $quantity;
|
||||
if ($additionalWeight > 0 && Yard::instance($this->instance)->exceedsMaxWeight($additionalWeight)) {
|
||||
\Session::flash('alert-error', __('msg.cart_max_weight_reached'));
|
||||
|
||||
return back();
|
||||
}
|
||||
$image = '';
|
||||
if ($product->images->count()) {
|
||||
$image = $product->images->first()->slug;
|
||||
|
|
@ -61,11 +67,17 @@ class CardController extends Controller
|
|||
$product = Product::find($id);
|
||||
|
||||
if ($product && ProductOrderContext::isProductAllowedInCustomerWebshop($product)) {
|
||||
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
|
||||
$additionalWeight = (int) $product->weight * (int) $quantity;
|
||||
if ($additionalWeight > 0 && Yard::instance($this->instance)->exceedsMaxWeight($additionalWeight)) {
|
||||
\Session::flash('alert-error', __('msg.cart_max_weight_reached'));
|
||||
|
||||
return back();
|
||||
}
|
||||
$image = '';
|
||||
if ($product->images->count()) {
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
|
||||
$cartItem = Yard::instance($this->instance)
|
||||
->add(
|
||||
$product->id,
|
||||
|
|
@ -122,6 +134,14 @@ class CardController extends Controller
|
|||
if ($product && $product->is_membership_only) {
|
||||
$qty = 1;
|
||||
}
|
||||
if ($product) {
|
||||
$additionalWeight = (int) $product->weight * ((int) $qty - (int) $cartItem->qty);
|
||||
if ($additionalWeight > 0 && Yard::instance($this->instance)->exceedsMaxWeight($additionalWeight)) {
|
||||
\Session::flash('alert-error', __('msg.cart_max_weight_reached'));
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Yard::instance($this->instance)->update($rowId, $qty);
|
||||
Yard::instance($this->instance)->reCalculateShippingPrice();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue