11 private static $instance = array();
20 private function __construct($fUserId, $siteId)
22 $this->fUserId = $fUserId;
23 $this->siteId = $siteId;
26 private function __clone()
30 protected static function getHash($fUserId, $siteId)
32 return "{$fUserId}_{$siteId}";
37 return $this->fUserId;
57 $hash = static::getHash($fUserId, $siteId);
59 if (!isset(static::$instance[$hash]))
61 static::$instance[$hash] =
new static($fUserId, $siteId);
64 return static::$instance[$hash];
67 public function getBasket()
69 if (!isset($this->basket))
71 $registry = Sale\Registry::getInstance(
Sale\Registry::REGISTRY_TYPE_ORDER);
74 $basketClassName = $registry->getBasketClassName();
76 $this->basket = $basketClassName::loadItemsForFUser($this->getFUserId(), $this->getSiteId());
82 public function getOrderableBasket()
84 if (!isset($this->orderableBasket))
87 $basketClone = $this->getBasket()->createClone();
88 $this->orderableBasket = $basketClone->getOrderableItems();
91 return $this->orderableBasket;