Пример #1
0
 public function insertPromoTemplate(App_Promo_Dm $dm)
 {
     if (true != ($r = $dm->beforeAdd())) {
         return $r;
     }
     return $this->_loadPromoDao()->add($dm->getData());
 }
Пример #2
0
 public function add_template()
 {
     $element1 = 'M';
     //merchandise. which will be participate the promotions.
     $element2 = 'C';
     //const. it's a condition, meet price, trigger promotions.
     $element3 = 'A';
     //amount. deduct price.
     $elementList = array($element1, $element2, $element3);
     $templateid = $this->_getPromoDs()->generateTemplateId();
     $templateid = $templateid['templateid'];
     $name = "MeetDeduct";
     $isDuplicate = $this->_getPromoDs()->checkDuplicateInfo('name', $name);
     if ($isDuplicate) {
         return;
     }
     foreach ($elementList as $key => $value) {
         $dm = new App_Promo_Dm();
         $dm->setTemplateId($templateid)->setName($name)->setElement($value)->setCreateDate(Pw::getTime())->setLastUpdateTime(Pw::getTime());
         $this->_getPromoDs()->insertPromoTemplate($dm);
     }
 }