public function view($promotionID = null) { $this->requireAsset('css', 'vividStoreDashboard'); $this->requireAsset('javascript', 'vividStoreFunctions'); if ($promotionID) { $promotion = StorePromotion::getByID($promotionID); } else { $promotion = new StorePromotion(); } $this->set('rewardTypes', StorePromotionRewardType::getPromotionRewardTypes()); $this->set('ruleTypes', StorePromotionRuleType::getPromotionRuleTypes()); $this->set('promotion', $promotion); $this->getAssets(); }
public static function installPromotionRuleType($handle, $name, $pkg) { $promotionRuleType = StorePromotionRuleType::getByHandle($handle); if (!is_object($promotionRuleType)) { StorePromotionRuleType::add($handle, $name, $pkg); } }