示例#1
0
 public function relations()
 {
     $map = new CMap(parent::relations());
     $nrelation = array('thumbs' => array(self::HAS_MANY, 'Image', 'model_id', 'condition' => 'thumbs.model_name = \'Product\''));
     $map->mergeWith($nrelation);
     return $map;
 }
示例#2
0
 public function getData()
 {
     $data = parent::getData();
     if (is_string($data)) {
         $data = json_decode($data, true);
     }
     return $data;
 }
示例#3
0
 public function preSave($evt = null)
 {
     Doctrine::getConnectionByTableName($this->getTable()->getTableName())->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, false);
     // we do not want to refresh our records
     $this->updateSlug();
     Doctrine::getConnectionByTableName($this->getTable()->getTableName())->setAttribute(Doctrine_Core::ATTR_HYDRATE_OVERWRITE, true);
     return parent::preSave($evt);
 }
示例#4
0
文件: Product.php 项目: kotow/work
 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         $genericDocument->delete();
         parent::delete();
         $con->commit();
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
示例#5
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     ProductPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new ProductPeer();
     }
     return self::$peer;
 }
示例#6
0
 /**
  * Initializes internal state of Product object.
  * @see        parent::__construct()
  */
 public function __construct()
 {
     // Make sure that parent constructor is always invoked, since that
     // is where any default values for this object are set.
     parent::__construct();
 }
示例#7
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'Name':
             return $this->Title;
         case 'IsMaster':
             return $this->IsMaster();
         case 'IsChild':
             return $this->IsChild();
         case 'IsIndependent':
             return $this->IsIndependent();
         case 'Slug':
             return $this->GetSlug();
         case 'Code':
             if ($this->IsChild()) {
                 if ($prod = $this->GetMaster()) {
                     return $prod->code;
                 }
             }
             return $this->code;
         case 'FkProductMaster':
             return $this->GetMaster();
         case 'InventoryDisplay':
             return $this->InventoryDisplay();
         case 'Family':
             if (isset($this->family)) {
                 return $this->family->family;
             } else {
                 return '';
             }
         case 'Class':
             if (isset($this->class)) {
                 return $this->class->class_name;
             } else {
                 return '';
             }
         case 'Url':
         case 'Link':
             return $this->getUrl();
         case 'SEOName':
             return $this->GetSEOName();
         case 'AbsoluteUrl':
             return $this->GetAbsoluteUrl();
         case 'AddToCartImage':
             return $this->GetImageLink(ImagesType::addtocartmodal);
         case 'ListingImage':
             return $this->GetImageLink(ImagesType::listing);
         case 'ListingImageAbsolute':
             return $this->GetImageLink(ImagesType::listing, true);
         case 'MiniImage':
             return $this->GetImageLink(ImagesType::mini);
         case 'MiniImageAbsolute':
             return $this->GetImageLink(ImagesType::mini, true);
         case 'MiniImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::mini));
         case 'PreviewImage':
             return $this->GetImageLink(ImagesType::preview);
         case 'PreviewImageAbsolute':
             return $this->GetImageLink(ImagesType::preview, true);
         case 'PreviewImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::preview));
         case 'SliderImage':
             return $this->GetImageLink(ImagesType::slider);
         case 'SliderImageAbsolute':
             return $this->GetImageLink(ImagesType::slider, true);
         case 'SliderImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::slider));
         case 'CategoryImage':
             return $this->GetImageLink(ImagesType::category);
         case 'CategoryImageAbsolute':
             return $this->GetImageLink(ImagesType::category, true);
         case 'CategoryImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::category));
         case 'PDetailImage':
             return $this->GetImageLink(ImagesType::pdetail);
         case 'PDetailImageAbsolute':
             return $this->GetImageLink(ImagesType::pdetail, true);
         case 'PDetailImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::pdetail));
         case 'SmallImage':
             return $this->GetImageLink(ImagesType::small);
         case 'SmallImageAbsolute':
             return $this->GetImageLink(ImagesType::small, true);
         case 'SmallImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::small));
         case 'Image':
             return $this->GetImageLink(ImagesType::normal);
         case 'ImageAbsolute':
             return $this->GetImageLink(ImagesType::normal, true);
         case 'ImageTag':
             return CHtml::image(Images::GetLink($this->image_id, ImagesType::normal));
         case 'OriginalCode':
             return $this->code;
         case 'SizeLabel':
             return _xls_get_conf('PRODUCT_SIZE_LABEL', _sp('Size'));
         case 'ColorLabel':
             return _xls_get_conf('PRODUCT_COLOR_LABEL', _sp('Color'));
         case 'PageTitle':
             return _xls_truncate($this->GetPageMeta('SEO_PRODUCT_TITLE'), 70);
         case 'PageDescription':
             return _xls_truncate($this->GetPageMeta('SEO_PRODUCT_DESCRIPTION'), 255);
         default:
             return parent::__get($strName);
     }
 }
示例#8
0
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
示例#9
0
 function Product($object = null)
 {
     parent::__construct($object);
 }
示例#10
0
 public static function listFromRegion($region_id, $buffer, $table = 'products', $where = '')
 {
     return parent::listFromRegion($region_id, $buffer, $table, $where);
 }