From 6ca34898d78498db821486a125ecfeb3800cefed Mon Sep 17 00:00:00 2001 From: PhoenixDev - VP Date: Tue, 4 Sep 2018 15:56:06 +0300 Subject: [PATCH] Fix default_value for attributes, rename endpoint #7 --- .../VueStorefrontBridge/controllers/AttributesController.php | 4 ++-- node-app/config.example.json | 2 +- node-app/src/meta/elastic.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/magento1-module/app/code/local/Divante/VueStorefrontBridge/controllers/AttributesController.php b/magento1-module/app/code/local/Divante/VueStorefrontBridge/controllers/AttributesController.php index f19fd14..cf293b6 100644 --- a/magento1-module/app/code/local/Divante/VueStorefrontBridge/controllers/AttributesController.php +++ b/magento1-module/app/code/local/Divante/VueStorefrontBridge/controllers/AttributesController.php @@ -53,7 +53,7 @@ public function indexAction() $productAttrDTO['id'] = intval($productAttr->getAttributeId()); $productAttrDTO['options'] = $options; - $productAttrDTO['default_value'] = (string)$productAttrDTO['default_value']; + $productAttrDTO['default_value'] = (int)$productAttrDTO['default_value']; $productAttrDTO = $this->_filterDTO($productAttrDTO); $attrList[] = $productAttrDTO; } @@ -64,7 +64,7 @@ public function indexAction() /** * Prepare attribute data for mappings */ - public function attributeInfoAction() + public function productMappingAction() { if ($this->_authorize($this->getRequest())) { $result = array(); diff --git a/node-app/config.example.json b/node-app/config.example.json index ece3b6f..1afb69a 100644 --- a/node-app/config.example.json +++ b/node-app/config.example.json @@ -16,6 +16,6 @@ "category_endpoint": "http://dockerized-magento.local/vsbridge/categories/index", "taxrule_endpoint": "http://dockerized-magento.local/vsbridge/taxrules/index", "attribute_endpoint": "http://dockerized-magento.local/vsbridge/attributes/index", - "attribute_data_endpoint": "http://dockerized-magento.local/vsbridge/attributes/attributeInfo" + "product_mapping_endpoint": "http://dockerized-magento.local/vsbridge/attributes/productMapping" } } \ No newline at end of file diff --git a/node-app/src/meta/elastic.js b/node-app/src/meta/elastic.js index 99e4759..bbfc7db 100644 --- a/node-app/src/meta/elastic.js +++ b/node-app/src/meta/elastic.js @@ -179,6 +179,7 @@ async function putMappings(db, indexName, next, token) { properties: { id: { type: "long" }, attribute_id: { type: "long" }, + default_value: {type: "integer"}, options: { properties: { value: { type: "text", "index" : "not_analyzed" } @@ -209,7 +210,7 @@ function getAttributeData(token) { let promise = new Promise((resolve, reject) => { console.log('*** Getting attribute data') api.authWith(token); - api.get(config.vsbridge['attribute_data_endpoint']).type('json').end((resp) => { + api.get(config.vsbridge['product_mapping_endpoint']).type('json').end((resp) => { if (resp.body && resp.body.code !== 200) { // unauthroized request console.log(resp.body.result); process.exit(-1)