示例#1
0
 /**
  * Select category
  *
  * @param FixtureInterface $fixture
  * @return void|null
  */
 protected function fillCategory(FixtureInterface $fixture)
 {
     // TODO should be removed after suggest widget implementation as typified element
     $categoryName = null;
     if (!empty($this->category)) {
         $categoryName = $this->category->getName();
     }
     if (empty($categoryName) && !$fixture instanceof InjectableFixture) {
         $categoryName = $fixture->getCategoryName();
     }
     if (empty($categoryName)) {
         return;
     }
     $category = $this->_rootElement->find(str_replace('%categoryName%', $categoryName, $this->categoryName), Locator::SELECTOR_XPATH);
     if (!$category->isVisible()) {
         $this->fillCategoryField($categoryName, 'category_ids-suggest', '//*[@id="attribute-category_ids-container"]');
     }
 }
示例#2
0
 /**
  * Fill the product form
  *
  * @param FixtureInterface $product
  * @param Element|null $element [optional]
  * @param FixtureInterface|null $category [optional]
  * @return FormTabs
  */
 public function fill(FixtureInterface $product, Element $element = null, FixtureInterface $category = null)
 {
     $tabs = $this->getFieldsByTabs($product);
     if ($category) {
         $tabs['product-details']['category_ids']['value'] = $category instanceof InjectableFixture ? $category->getName() : $category->getCategoryName();
     }
     $this->showAdvancedSettings();
     return parent::fillTabs($tabs, $element);
 }