Example #1
0
 public function setCartForDelivery()
 {
     $weight = 0.0;
     $price = 0.0;
     $priceWithoutVat = 0.0;
     $shippingCost = 0.0;
     foreach ($this->Cart as $product) {
         if (!isset($product['attributes']) || $product['attributes'] == NULL) {
             $weight += $product['weight'] * $product['qty'];
             $price += $product['newprice'] * $product['qty'];
         } else {
             if (isset($product['standard'])) {
                 $weight += $product['weight'] * $product['qty'];
                 $price += $product['newprice'] * $product['qty'];
                 foreach ($product['attributes'] as $attrtab) {
                     $weight += $attrtab['weight'] * $attrtab['qty'];
                     $price += $attrtab['newprice'] * $attrtab['qty'];
                 }
             } else {
                 foreach ($product['attributes'] as $attrtab) {
                     $weight += $attrtab['weight'] * $attrtab['qty'];
                     $price += $attrtab['newprice'] * $attrtab['qty'];
                 }
             }
         }
     }
     $Data = array('weight' => $weight, 'price' => $price);
     Session::setActiveCartForDelivery($Data);
 }