From 74adeb0542e3d94055098caad425910949251d89 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Tue, 14 Apr 2026 12:05:01 +0200 Subject: [PATCH 01/10] feat: add prompt_rule DB table schema (#32) --- etc/db_schema.xml | 32 ++++++++++++++++++++++++++++++++ etc/db_schema_whitelist.json | 21 +++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/etc/db_schema.xml b/etc/db_schema.xml index c454280..97c994b 100644 --- a/etc/db_schema.xml +++ b/etc/db_schema.xml @@ -35,4 +35,36 @@ + + + + + + + + + + + + + + + + + + + + +
diff --git a/etc/db_schema_whitelist.json b/etc/db_schema_whitelist.json index 7d840e1..e068dc8 100644 --- a/etc/db_schema_whitelist.json +++ b/etc/db_schema_whitelist.json @@ -24,5 +24,26 @@ "IDX_CATALOGAI_ENRICHMENT_STATUS": true, "IDX_CATALOGAI_ENRICHMENT_CREATED_AT": true } + }, + "mageos_catalogai_prompt_rule": { + "column": { + "rule_id": true, + "name": true, + "attribute_code": true, + "store_ids": true, + "conditions_serialized": true, + "prompt": true, + "priority": true, + "is_active": true, + "created_at": true, + "updated_at": true + }, + "constraint": { + "PRIMARY": true + }, + "index": { + "MAGEOS_CATALOGAI_PROMPT_RULE_ATTR_CODE": true, + "MAGEOS_CATALOGAI_PROMPT_RULE_IS_ACTIVE": true + } } } From 6d7f6adffc79ba808df4eedf56a7cd73828c9851 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Tue, 14 Apr 2026 12:05:11 +0200 Subject: [PATCH 02/10] feat: add PromptRule model with conditions support (#32) --- Api/Data/PromptRuleInterface.php | 25 ++++++ Model/PromptRule.php | 84 +++++++++++++++++++ Model/ResourceModel/PromptRule.php | 14 ++++ Model/ResourceModel/PromptRule/Collection.php | 18 ++++ 4 files changed, 141 insertions(+) create mode 100644 Api/Data/PromptRuleInterface.php create mode 100644 Model/PromptRule.php create mode 100644 Model/ResourceModel/PromptRule.php create mode 100644 Model/ResourceModel/PromptRule/Collection.php diff --git a/Api/Data/PromptRuleInterface.php b/Api/Data/PromptRuleInterface.php new file mode 100644 index 0000000..f9e4188 --- /dev/null +++ b/Api/Data/PromptRuleInterface.php @@ -0,0 +1,25 @@ +_init(PromptRuleResource::class); + } + + public function getConditionsInstance(): \Magento\Rule\Model\Condition\Combine + { + return $this->_conditionFactory->create(Combine::class); + } + + public function getActionsInstance(): \Magento\Rule\Model\Action\Collection + { + return $this->_actionFactory->create(\Magento\Rule\Model\Action\Collection::class); + } + + public function getRuleId(): ?int + { + return $this->getData(self::RULE_ID) ? (int)$this->getData(self::RULE_ID) : null; + } + + public function getName(): string + { + return (string)$this->getData(self::NAME); + } + + public function getAttributeCode(): string + { + return (string)$this->getData(self::ATTRIBUTE_CODE); + } + + public function getStoreIds(): string + { + return (string)$this->getData(self::STORE_IDS); + } + + public function getConditionsSerialized(): ?string + { + return $this->getData(self::CONDITIONS_SERIALIZED); + } + + public function getPrompt(): string + { + return (string)$this->getData(self::PROMPT); + } + + public function getPriority(): int + { + return (int)$this->getData(self::PRIORITY); + } + + public function getIsActive(): bool + { + return (bool)$this->getData(self::IS_ACTIVE); + } + + public function matchesProduct(\Magento\Catalog\Model\Product $product): bool + { + return $this->getConditions()->validate($product); + } + + public function matchesStore(int $storeId): bool + { + $storeIds = $this->getStoreIds(); + if ($storeIds === '' || $storeIds === '0') { + return true; + } + $ids = array_map('intval', explode(',', $storeIds)); + return in_array(0, $ids, true) || in_array($storeId, $ids, true); + } +} diff --git a/Model/ResourceModel/PromptRule.php b/Model/ResourceModel/PromptRule.php new file mode 100644 index 0000000..0378f84 --- /dev/null +++ b/Model/ResourceModel/PromptRule.php @@ -0,0 +1,14 @@ +_init('mageos_catalogai_prompt_rule', 'rule_id'); + } +} diff --git a/Model/ResourceModel/PromptRule/Collection.php b/Model/ResourceModel/PromptRule/Collection.php new file mode 100644 index 0000000..00cb064 --- /dev/null +++ b/Model/ResourceModel/PromptRule/Collection.php @@ -0,0 +1,18 @@ +_init(PromptRule::class, PromptRuleResource::class); + } +} From d1feb8d728e2ad9bd196bc02e9e4369203827815 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Tue, 14 Apr 2026 12:06:15 +0200 Subject: [PATCH 03/10] feat: add PromptResolver service with priority-based rule matching (#32) --- Model/Product/PromptResolver.php | 37 ++++++++++ .../Unit/Model/Product/PromptResolverTest.php | 74 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 Model/Product/PromptResolver.php create mode 100644 Test/Unit/Model/Product/PromptResolverTest.php diff --git a/Model/Product/PromptResolver.php b/Model/Product/PromptResolver.php new file mode 100644 index 0000000..03732df --- /dev/null +++ b/Model/Product/PromptResolver.php @@ -0,0 +1,37 @@ +getStoreId(); + + $collection = $this->ruleCollectionFactory->create(); + $collection->addFieldToFilter('attribute_code', $attributeCode); + $collection->addFieldToFilter('is_active', 1); + $collection->setOrder('priority', 'DESC'); + + /** @var PromptRule $rule */ + foreach ($collection as $rule) { + if ($rule->matchesStore($storeId) && $rule->matchesProduct($product)) { + return $rule->getPrompt(); + } + } + + return $this->config->getProductPrompt($attributeCode); + } +} diff --git a/Test/Unit/Model/Product/PromptResolverTest.php b/Test/Unit/Model/Product/PromptResolverTest.php new file mode 100644 index 0000000..9cadb86 --- /dev/null +++ b/Test/Unit/Model/Product/PromptResolverTest.php @@ -0,0 +1,74 @@ +createMock(Product::class); + $product->method('getStoreId')->willReturn(1); + + $lowRule = $this->createMock(PromptRule::class); + $lowRule->method('getIsActive')->willReturn(true); + $lowRule->method('getPriority')->willReturn(10); + $lowRule->method('getPrompt')->willReturn('low priority prompt'); + $lowRule->method('matchesStore')->willReturn(true); + $lowRule->method('matchesProduct')->willReturn(true); + + $highRule = $this->createMock(PromptRule::class); + $highRule->method('getIsActive')->willReturn(true); + $highRule->method('getPriority')->willReturn(50); + $highRule->method('getPrompt')->willReturn('high priority prompt'); + $highRule->method('matchesStore')->willReturn(true); + $highRule->method('matchesProduct')->willReturn(true); + + $collection = $this->createMock(Collection::class); + $collection->method('addFieldToFilter')->willReturnSelf(); + $collection->method('setOrder')->willReturnSelf(); + $collection->method('getIterator')->willReturn(new \ArrayIterator([$highRule, $lowRule])); + + $collectionFactory = $this->createMock(CollectionFactory::class); + $collectionFactory->method('create')->willReturn($collection); + + $config = $this->createMock(Config::class); + + $resolver = new PromptResolver($collectionFactory, $config); + $result = $resolver->resolve('description', $product); + + $this->assertEquals('high priority prompt', $result); + } + + public function test_falls_back_to_config_when_no_rule_matches(): void + { + $product = $this->createMock(Product::class); + $product->method('getStoreId')->willReturn(1); + + $collection = $this->createMock(Collection::class); + $collection->method('addFieldToFilter')->willReturnSelf(); + $collection->method('setOrder')->willReturnSelf(); + $collection->method('getIterator')->willReturn(new \ArrayIterator([])); + + $collectionFactory = $this->createMock(CollectionFactory::class); + $collectionFactory->method('create')->willReturn($collection); + + $config = $this->createMock(Config::class); + $config->method('getProductPrompt') + ->with('description') + ->willReturn('default config prompt'); + + $resolver = new PromptResolver($collectionFactory, $config); + $result = $resolver->resolve('description', $product); + + $this->assertEquals('default config prompt', $result); + } +} From 7e084041498124aaf3fc3a09ad7aca720d89307c Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Tue, 14 Apr 2026 12:06:25 +0200 Subject: [PATCH 04/10] feat: Enricher uses PromptResolver for rule-based prompt selection (#32) --- Model/Product/Enricher.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Model/Product/Enricher.php b/Model/Product/Enricher.php index f6d65f1..1a2054c 100644 --- a/Model/Product/Enricher.php +++ b/Model/Product/Enricher.php @@ -17,12 +17,14 @@ class Enricher * @param Config $config * @param HashGenerator $hashGenerator * @param EnrichmentRecorder $enrichmentRecorder + * @param PromptResolver $promptResolver */ public function __construct( private readonly AiClientInterface $aiClient, private readonly Config $config, private readonly HashGenerator $hashGenerator, - private readonly EnrichmentRecorder $enrichmentRecorder + private readonly EnrichmentRecorder $enrichmentRecorder, + private readonly PromptResolver $promptResolver ) { } @@ -47,7 +49,7 @@ public function enrichAttribute(Product $product, string $attributeCode): void return; } - $prompt = $this->config->getProductPrompt($attributeCode, (int) $product->getStoreId()); + $prompt = $this->promptResolver->resolve($attributeCode, $product); if (!$prompt) { return; } From 84c9c74c1a1f795115a40d598b3ed84fb0f48096 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Tue, 14 Apr 2026 12:09:14 +0200 Subject: [PATCH 05/10] feat: add prompt rules admin grid with listing and menu (#32) --- Controller/Adminhtml/PromptRule/Index.php | 29 +++++ .../PromptRule/Grid/Collection.php | 72 ++++++++++++ .../Listing/Column/PromptRuleActions.php | 53 +++++++++ etc/adminhtml/di.xml | 7 ++ etc/adminhtml/menu.xml | 7 ++ .../layout/catalogai_promptrule_index.xml | 9 ++ .../mageos_catalogai_prompt_rule_listing.xml | 107 ++++++++++++++++++ 7 files changed, 284 insertions(+) create mode 100644 Controller/Adminhtml/PromptRule/Index.php create mode 100644 Model/ResourceModel/PromptRule/Grid/Collection.php create mode 100644 Ui/Component/Listing/Column/PromptRuleActions.php create mode 100644 view/adminhtml/layout/catalogai_promptrule_index.xml create mode 100644 view/adminhtml/ui_component/mageos_catalogai_prompt_rule_listing.xml diff --git a/Controller/Adminhtml/PromptRule/Index.php b/Controller/Adminhtml/PromptRule/Index.php new file mode 100644 index 0000000..4847190 --- /dev/null +++ b/Controller/Adminhtml/PromptRule/Index.php @@ -0,0 +1,29 @@ +resultPageFactory->create(); + $resultPage->setActiveMenu('MageOS_CatalogDataAI::prompt_rules'); + $resultPage->getConfig()->getTitle()->prepend(__('AI Prompt Rules')); + return $resultPage; + } +} diff --git a/Model/ResourceModel/PromptRule/Grid/Collection.php b/Model/ResourceModel/PromptRule/Grid/Collection.php new file mode 100644 index 0000000..1d447a5 --- /dev/null +++ b/Model/ResourceModel/PromptRule/Grid/Collection.php @@ -0,0 +1,72 @@ +_mainTable = $mainTable; + $this->_setIdFieldName('rule_id'); + $this->setModel(\Magento\Framework\View\Element\UiComponent\DataProvider\Document::class); + } + + public function getAggregations(): AggregationInterface + { + return $this->aggregations; + } + + public function setAggregations($aggregations): self + { + $this->aggregations = $aggregations; + return $this; + } + + public function getSearchCriteria(): ?SearchCriteriaInterface + { + return null; + } + + public function setSearchCriteria(SearchCriteriaInterface $searchCriteria): self + { + return $this; + } + + public function getTotalCount(): int + { + return $this->getSize(); + } + + public function setTotalCount($totalCount): self + { + return $this; + } + + public function setItems(?array $items = null): self + { + return $this; + } +} diff --git a/Ui/Component/Listing/Column/PromptRuleActions.php b/Ui/Component/Listing/Column/PromptRuleActions.php new file mode 100644 index 0000000..d82749d --- /dev/null +++ b/Ui/Component/Listing/Column/PromptRuleActions.php @@ -0,0 +1,53 @@ +getData('name')] = [ + 'edit' => [ + 'href' => $this->urlBuilder->getUrl( + 'catalogai/promptrule/edit', + ['rule_id' => $item['rule_id']] + ), + 'label' => __('Edit'), + ], + 'delete' => [ + 'href' => $this->urlBuilder->getUrl( + 'catalogai/promptrule/delete', + ['rule_id' => $item['rule_id']] + ), + 'label' => __('Delete'), + 'confirm' => [ + 'title' => __('Delete Rule'), + 'message' => __('Are you sure you want to delete this rule?'), + ], + ], + ]; + } + } + } + return $dataSource; + } +} diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml index ff8db02..b66654d 100644 --- a/etc/adminhtml/di.xml +++ b/etc/adminhtml/di.xml @@ -11,4 +11,11 @@ + + + + MageOS\CatalogDataAI\Model\ResourceModel\PromptRule\Grid\Collection + + + diff --git a/etc/adminhtml/menu.xml b/etc/adminhtml/menu.xml index 64a9ff4..a810a27 100644 --- a/etc/adminhtml/menu.xml +++ b/etc/adminhtml/menu.xml @@ -8,5 +8,12 @@ parent="Magento_Catalog::catalog" action="catalogai/enrichment/index" resource="MageOS_CatalogDataAI::enrichment_review"/> + diff --git a/view/adminhtml/layout/catalogai_promptrule_index.xml b/view/adminhtml/layout/catalogai_promptrule_index.xml new file mode 100644 index 0000000..e956cfd --- /dev/null +++ b/view/adminhtml/layout/catalogai_promptrule_index.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/view/adminhtml/ui_component/mageos_catalogai_prompt_rule_listing.xml b/view/adminhtml/ui_component/mageos_catalogai_prompt_rule_listing.xml new file mode 100644 index 0000000..9c69d9b --- /dev/null +++ b/view/adminhtml/ui_component/mageos_catalogai_prompt_rule_listing.xml @@ -0,0 +1,107 @@ + ++ + + mageos_catalogai_prompt_rule_listing.mageos_catalogai_prompt_rule_listing_data_source + + + + + + + mageos_catalogai_prompt_rule_columns + + mageos_catalogai_prompt_rule_listing.mageos_catalogai_prompt_rule_listing_data_source + + + + + + + + + rule_id + rule_id + + + + + + true + + + + + + + + + + Delete selected rules? + Delete + + + delete + + + + + + + + + rule_id + + + + + textRange + + asc + + + + + text + + + + + + text + + + + + + textRange + + + + + + select + + select + + + + + + dateRange + date + + + + + + rule_id + + + + From 3726680f58ed3427d59e3cc6079ed3590b993ccc Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Tue, 14 Apr 2026 12:09:51 +0200 Subject: [PATCH 06/10] feat: add prompt rule edit form with CRUD controllers (#32) --- .../PromptRule/Edit/DeleteButton.php | 36 +++++ .../Adminhtml/PromptRule/Edit/SaveButton.php | 22 +++ Controller/Adminhtml/PromptRule/Delete.php | 51 +++++++ Controller/Adminhtml/PromptRule/Edit.php | 47 ++++++ Controller/Adminhtml/PromptRule/NewAction.php | 18 +++ Controller/Adminhtml/PromptRule/Save.php | 67 +++++++++ Model/Config/Source/EnrichableAttributes.php | 38 +++++ Model/PromptRule/DataProvider.php | 53 +++++++ .../layout/catalogai_promptrule_edit.xml | 9 ++ .../layout/catalogai_promptrule_new.xml | 9 ++ .../mageos_catalogai_prompt_rule_form.xml | 142 ++++++++++++++++++ 11 files changed, 492 insertions(+) create mode 100644 Block/Adminhtml/PromptRule/Edit/DeleteButton.php create mode 100644 Block/Adminhtml/PromptRule/Edit/SaveButton.php create mode 100644 Controller/Adminhtml/PromptRule/Delete.php create mode 100644 Controller/Adminhtml/PromptRule/Edit.php create mode 100644 Controller/Adminhtml/PromptRule/NewAction.php create mode 100644 Controller/Adminhtml/PromptRule/Save.php create mode 100644 Model/Config/Source/EnrichableAttributes.php create mode 100644 Model/PromptRule/DataProvider.php create mode 100644 view/adminhtml/layout/catalogai_promptrule_edit.xml create mode 100644 view/adminhtml/layout/catalogai_promptrule_new.xml create mode 100644 view/adminhtml/ui_component/mageos_catalogai_prompt_rule_form.xml diff --git a/Block/Adminhtml/PromptRule/Edit/DeleteButton.php b/Block/Adminhtml/PromptRule/Edit/DeleteButton.php new file mode 100644 index 0000000..6f93f90 --- /dev/null +++ b/Block/Adminhtml/PromptRule/Edit/DeleteButton.php @@ -0,0 +1,36 @@ +request->getParam('rule_id'); + if (!$ruleId) { + return []; + } + + return [ + 'label' => __('Delete Rule'), + 'class' => 'delete', + 'on_click' => sprintf( + "deleteConfirm('%s', '%s', {data: {}})", + __('Are you sure you want to delete this rule?'), + $this->urlBuilder->getUrl('*/*/delete', ['rule_id' => $ruleId]) + ), + 'sort_order' => 20, + ]; + } +} diff --git a/Block/Adminhtml/PromptRule/Edit/SaveButton.php b/Block/Adminhtml/PromptRule/Edit/SaveButton.php new file mode 100644 index 0000000..12f990b --- /dev/null +++ b/Block/Adminhtml/PromptRule/Edit/SaveButton.php @@ -0,0 +1,22 @@ + __('Save Rule'), + 'class' => 'save primary', + 'data_attribute' => [ + 'mage-init' => ['button' => ['event' => 'save']], + 'form-role' => 'save', + ], + 'sort_order' => 90, + ]; + } +} diff --git a/Controller/Adminhtml/PromptRule/Delete.php b/Controller/Adminhtml/PromptRule/Delete.php new file mode 100644 index 0000000..6648cf9 --- /dev/null +++ b/Controller/Adminhtml/PromptRule/Delete.php @@ -0,0 +1,51 @@ +getRequest()->getParam('rule_id'); + $redirect = $this->resultRedirectFactory->create()->setPath('*/*/'); + + if (!$ruleId) { + $this->messageManager->addErrorMessage(__('Rule ID is required.')); + return $redirect; + } + + $rule = $this->ruleFactory->create(); + $this->ruleResource->load($rule, $ruleId); + + if (!$rule->getRuleId()) { + $this->messageManager->addErrorMessage(__('This rule no longer exists.')); + return $redirect; + } + + try { + $this->ruleResource->delete($rule); + $this->messageManager->addSuccessMessage(__('The rule has been deleted.')); + } catch (\Exception $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + } + + return $redirect; + } +} diff --git a/Controller/Adminhtml/PromptRule/Edit.php b/Controller/Adminhtml/PromptRule/Edit.php new file mode 100644 index 0000000..2c03b51 --- /dev/null +++ b/Controller/Adminhtml/PromptRule/Edit.php @@ -0,0 +1,47 @@ +getRequest()->getParam('rule_id'); + $rule = $this->ruleFactory->create(); + + if ($ruleId) { + $this->ruleResource->load($rule, $ruleId); + if (!$rule->getRuleId()) { + $this->messageManager->addErrorMessage(__('This rule no longer exists.')); + return $this->resultRedirectFactory->create()->setPath('*/*/'); + } + } + + $resultPage = $this->resultPageFactory->create(); + $resultPage->setActiveMenu('MageOS_CatalogDataAI::prompt_rules'); + $resultPage->getConfig()->getTitle()->prepend( + $ruleId ? __('Edit Rule: %1', $rule->getName()) : __('New Prompt Rule') + ); + + return $resultPage; + } +} diff --git a/Controller/Adminhtml/PromptRule/NewAction.php b/Controller/Adminhtml/PromptRule/NewAction.php new file mode 100644 index 0000000..26c7e84 --- /dev/null +++ b/Controller/Adminhtml/PromptRule/NewAction.php @@ -0,0 +1,18 @@ +resultFactory->create(ResultFactory::TYPE_FORWARD)->forward('edit'); + } +} diff --git a/Controller/Adminhtml/PromptRule/Save.php b/Controller/Adminhtml/PromptRule/Save.php new file mode 100644 index 0000000..722ffb6 --- /dev/null +++ b/Controller/Adminhtml/PromptRule/Save.php @@ -0,0 +1,67 @@ +getRequest()->getPostValue(); + $redirect = $this->resultRedirectFactory->create(); + + if (!$data) { + return $redirect->setPath('*/*/'); + } + + $ruleId = (int)($data['rule_id'] ?? 0); + $rule = $this->ruleFactory->create(); + + if ($ruleId) { + $this->ruleResource->load($rule, $ruleId); + if (!$rule->getRuleId()) { + $this->messageManager->addErrorMessage(__('This rule no longer exists.')); + return $redirect->setPath('*/*/'); + } + } + + if (isset($data['store_ids']) && is_array($data['store_ids'])) { + $data['store_ids'] = implode(',', $data['store_ids']); + } + + if (isset($data['rule']['conditions'])) { + $rule->loadPost(['conditions' => $data['rule']['conditions']]); + } + + $rule->addData($data); + + try { + $this->ruleResource->save($rule); + $this->messageManager->addSuccessMessage(__('The rule has been saved.')); + + if ($this->getRequest()->getParam('back')) { + return $redirect->setPath('*/*/edit', ['rule_id' => $rule->getRuleId()]); + } + return $redirect->setPath('*/*/'); + } catch (\Exception $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + return $redirect->setPath('*/*/edit', ['rule_id' => $ruleId]); + } + } +} diff --git a/Model/Config/Source/EnrichableAttributes.php b/Model/Config/Source/EnrichableAttributes.php new file mode 100644 index 0000000..511252e --- /dev/null +++ b/Model/Config/Source/EnrichableAttributes.php @@ -0,0 +1,38 @@ +searchCriteriaBuilder + ->addFilter('frontend_input', ['text', 'textarea'], 'in') + ->create(); + + $attributes = $this->attributeRepository->getList($searchCriteria); + + $options = [['value' => '', 'label' => __('-- Please Select --')]]; + foreach ($attributes->getItems() as $attribute) { + $options[] = [ + 'value' => $attribute->getAttributeCode(), + 'label' => ($attribute->getDefaultFrontendLabel() ?? $attribute->getAttributeCode()), + ]; + } + + usort($options, fn($a, $b) => strcmp((string)$a['label'], (string)$b['label'])); + + return $options; + } +} diff --git a/Model/PromptRule/DataProvider.php b/Model/PromptRule/DataProvider.php new file mode 100644 index 0000000..ac238dd --- /dev/null +++ b/Model/PromptRule/DataProvider.php @@ -0,0 +1,53 @@ +collection = $collectionFactory->create(); + parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); + } + + public function getData(): array + { + if (!empty($this->loadedData)) { + return $this->loadedData; + } + + $ruleId = (int)$this->request->getParam('rule_id'); + if ($ruleId) { + $rule = $this->ruleFactory->create(); + $this->ruleResource->load($rule, $ruleId); + + if ($rule->getRuleId()) { + $data = $rule->getData(); + if (isset($data['store_ids']) && is_string($data['store_ids'])) { + $data['store_ids'] = explode(',', $data['store_ids']); + } + $this->loadedData[$ruleId] = $data; + } + } + + return $this->loadedData; + } +} diff --git a/view/adminhtml/layout/catalogai_promptrule_edit.xml b/view/adminhtml/layout/catalogai_promptrule_edit.xml new file mode 100644 index 0000000..0e1deaa --- /dev/null +++ b/view/adminhtml/layout/catalogai_promptrule_edit.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/view/adminhtml/layout/catalogai_promptrule_new.xml b/view/adminhtml/layout/catalogai_promptrule_new.xml new file mode 100644 index 0000000..0e1deaa --- /dev/null +++ b/view/adminhtml/layout/catalogai_promptrule_new.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/view/adminhtml/ui_component/mageos_catalogai_prompt_rule_form.xml b/view/adminhtml/ui_component/mageos_catalogai_prompt_rule_form.xml new file mode 100644 index 0000000..68eda35 --- /dev/null +++ b/view/adminhtml/ui_component/mageos_catalogai_prompt_rule_form.xml @@ -0,0 +1,142 @@ + +
+ + + mageos_catalogai_prompt_rule_form.mageos_catalogai_prompt_rule_form_data_source + + Prompt Rule + templates/form/collapsible + + + + +