/** * @return $this * @throws \Exception */ protected function _afterLoad() { $this->mapAssociatedEntities('website', 'website_ids'); $this->mapAssociatedEntities('customer_group', 'customer_group_ids'); $this->setFlag('add_websites_to_result', false); return parent::_afterLoad(); }
/** * Add primary coupon to collection * * @return $this */ public function _initSelect() { parent::_initSelect(); $this->getSelect()->joinLeft(['rule_coupons' => $this->getTable('salesrule_coupon')], 'main_table.rule_id = rule_coupons.rule_id AND rule_coupons.is_primary = 1', ['code']); return $this; }