promotion 1.0

This commit is contained in:
Kevin Adametz 2021-12-25 02:51:22 +01:00
parent 1cc8e025a1
commit 570d428b1c
60 changed files with 1596 additions and 272 deletions

View file

@ -35,11 +35,19 @@ class PromotionCart
}
}
public static function clearCart($data, $add=false)
public static function clearCart($data)
{
Yard::instance('shopping')->destroy();
}
public static function switchShipping($data)
{
//pick_up//dhl_shipping
Yard::instance('shopping')->setShippingOption($data['shipping_option']);
Yard::instance('shopping')->reCalculateShippingPrice();
}
public static function updateProduct($data, $add=false)
{
if($product = Product::find($data['product_id'])){
@ -77,13 +85,13 @@ class PromotionCart
//wenn kleiner wurde ein produkt entfernt aufgrund der Anzahl
//wenn gleich löschen, da neue Versandkosten
if($row->options->free_product) {
if($row->options->free_product_id) {
Yard::instance('shopping')->remove($row->rowId);
}
}
if(isset($data['free_poduct_id'])) {
if ($product = Product::find($data['free_poduct_id'])) {
if(isset($data['free_product_id'])) {
if ($product = Product::find($data['product_id'])) {
$image = "";
if ($product->images->count()) {
$image = $product->images->first()->slug;
@ -92,8 +100,8 @@ class PromotionCart
[
'image' => $image,
'slug' => $product->slug,
'weight' => 0,
'free_product' => 1,
'weight' => $product->weight,
'free_product_id' => intval($data['free_product_id']),
'product_id' => $product->id
]);
Yard::setTax($cartItem->rowId, 0);