예제 #1
0
파일: Gift.php 프로젝트: ascertain/NGshop
 /**
  * restore product
  */
 public function __wakeup()
 {
     if ($this->product != '') {
         $this->product = OnlineShop_Framework_AbstractProduct::getByPath($this->product);
     }
 }
예제 #2
0
 /**
  * @param OnlineShop_Framework_AbstractProduct $product
  *
  * @return Website_OnlineShop_Demo_OnlineShop_RecentlyViewedProducts
  */
 public function addProduct(OnlineShop_Framework_AbstractProduct $product)
 {
     // load
     $list = $this->getList();
     // exists?
     if (($pos = array_search($product->getId(), $list)) > 0) {
         unset($list[$pos]);
     }
     // add
     if (!in_array($product->getId(), $list)) {
         array_unshift($list, $product->getId());
     }
     // limit?
     if (count($list) > $this->getMaxCount()) {
         array_pop($list);
     }
     // save
     $this->saveList($list);
     return $this;
 }