diff --git a/Model/Source/Category.php b/Model/Source/Category.php
new file mode 100644
index 0000000..c363755
--- /dev/null
+++ b/Model/Source/Category.php
@@ -0,0 +1,101 @@
+collectionFactory = $collectionFactory;
+ $this->request = $request;
+ }
+
+ /**
+ * Options getter
+ *
+ * @return array
+ */
+ public function toOptionArray(): array
+ {
+ $optionArray = [];
+ $arr = $this->toArray();
+ foreach ($arr as $value => $label) {
+ $optionArray[] = [
+ 'value' => $value,
+ 'label' => $label
+ ];
+ }
+
+ return $optionArray;
+ }
+
+ /**
+ * Get options in "key-value" format
+ *
+ * @return array
+ */
+ public function toArray(): array
+ {
+ return $this->getChildren(self::SYSTEM_CATEGORY_ID, self::ROOT_LEVEL);
+ }
+
+ /**
+ * Get Children option
+ *
+ * @param mixed $parentCategoryId
+ * @param mixed $level
+ * @return array
+ */
+ private function getChildren(int $parentCategoryId, int $level)
+ {
+ $storeId = (int) $this->request->getParam(Store::ENTITY, Store::DEFAULT_STORE_ID);
+ $options[self::NONE] = __('None');
+ $collection = $this->collectionFactory->create();
+ $collection->setStoreId($storeId);
+ $collection->addAttributeToSelect('name');
+ $collection->addAttributeToFilter('level', $level);
+ $collection->addAttributeToFilter('parent_id', $parentCategoryId);
+ $collection->setOrder('position', SortOrder::SORT_ASC);
+
+ foreach ($collection as $category) {
+ $options[$category->getId()] =
+ str_repeat(". ", max(0, ($category->getLevel() - 1) * 3)) . $category->getName();
+ if ($category->hasChildren()) {
+ $options = array_replace(
+ $options,
+ $this->getChildren((int) $category->getId(), $category->getLevel() + 1)
+ );
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 958c16d..06e7f99 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -12,21 +12,21 @@
-
+
acp
RunAsRoot_AgenticCommerceProtocol::config
-
+
-
+
Magento\Config\Model\Config\Source\Yesno
Enable/disable the ACP module
-
+
Magento\Config\Model\Config\Backend\Encrypted
@@ -35,7 +35,7 @@
1
-
+
Magento\Config\Model\Config\Source\Yesno
@@ -54,25 +54,25 @@
-
+
-
+
Magento\Config\Model\Config\Source\Yesno
Enable product feed generation for ChatGPT discovery
-
+
- Magento\Catalog\Model\Category\Attribute\Source\Categories
+ RunAsRoot\AgenticCommerceProtocol\Model\Source\Category
Select categories to include in product feed (leave empty for all)
1
-
+
Maximum number of products to include in feed (default: 1000)
@@ -82,16 +82,16 @@
-
+
-
+
Magento\Config\Model\Config\Source\Yesno
Send order event notifications to OpenAI
-
+
OpenAI webhook endpoint for order events
@@ -100,7 +100,7 @@
1
-
+
Magento\Config\Model\Config\Backend\Encrypted