예제 #1
0
 function createCartHash(&$cart)
 {
     if (!empty(OPCcache::$totalWeight)) {
         return OPCcache::$totalWeight;
     }
     OPCcache::$totalWeight = 0;
     $order_weight = 0;
     $hash = '';
     foreach ($cart->products as $product) {
         $h = serialize($product);
         $md5 = $h;
         $hash[$md5] = 1;
         $order_weight += $product->product_weight * $product->quantity;
     }
     OPCcache::$cartHash = md5(serialize($hash));
     OPCcache::$totalWeight = $order_weight;
 }