/** * Prepare data for create. * * @param CustomerSegment $customerSegment * @return array */ protected function prepareData(CustomerSegment $customerSegment) { $data = $this->replaceMappingData($customerSegment->getData()); if ($customerSegment->hasData('conditions_serialized')) { $data['rule']['conditions'] = $this->prepareCondition($data['conditions_serialized']); unset($data['conditions_serialized']); } if (isset($data['website_ids'])) { foreach ($data['website_ids'] as $key => $value) { $data['website_ids'][$key] = isset($this->mappingData['website_ids'][$value]) ? $this->mappingData['website_ids'][$value] : $value; } } return $data; }
/** * Fill website. * * @param CustomerSegment $customerSegment * @return void */ protected function fillWebsite(CustomerSegment $customerSegment) { $websiteField = $this->_rootElement->find($this->website, Locator::SELECTOR_CSS, 'multiselect'); if ($websiteField->isVisible() && !$customerSegment->hasData('website_ids')) { $websiteField->setValue('Main Website'); } }