Kirin 2 rokov pred
rodič
commit
1744de5d24
1 zmenil súbory, kde vykonal 11 pridanie a 9 odobranie
  1. 11 9
      app/models/store/StoreCart.php

+ 11 - 9
app/models/store/StoreCart.php

@@ -269,15 +269,17 @@ class StoreCart extends BaseModel
 
                             $discounts = json_decode($product['time_area_discount'], true);
                             $discount = 0;
-                            foreach ($discounts as $kk => $v) {
-                                $times = explode('-', $kk);
-                                if (!(count($times) == 2)) {
-                                    break;
-                                }
-                                $start = strtotime(date('Y-m-d') . ' ' . $times[0]);
-                                $end = strtotime(date('Y-m-d') . ' ' . $times[1]);
-                                if (time() > $start && time() <= $end) {
-                                    $discount = $v;
+                            if (count($discounts) > 0) {
+                                foreach ($discounts as $kk => $v) {
+                                    $times = explode('-', $kk);
+                                    if (!(count($times) == 2)) {
+                                        break;
+                                    }
+                                    $start = strtotime(date('Y-m-d') . ' ' . $times[0]);
+                                    $end = strtotime(date('Y-m-d') . ' ' . $times[1]);
+                                    if (time() > $start && time() <= $end) {
+                                        $discount = $v;
+                                    }
                                 }
                             }
                             if ($discount > 0) {