Example #1
0
 /**
  *  Generates a hash based on the cartItem array
  *
  * @param bool $force
  *
  * @return string itemHash
  */
 public function generateHash($force = false)
 {
     if ($force === true) {
         $this->itemHash = null;
     }
     if ($this->lineItem === false) {
         $this->itemHash = null;
         $cartItemArray = (array) $this;
         if (empty($cartItemArray['options']) === false) {
             ksort($cartItemArray['options']);
         }
         $this->itemHash = $itemHash = \LaraCart::generateHash($cartItemArray);
     } elseif (empty($this->itemHash) === true) {
         $this->itemHash = \LaraCart::generateRandomHash();
     }
     return $this->itemHash;
 }