-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest.js
43 lines (32 loc) · 1.29 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { Sequelize } = require('sequelize');
var initModels = require("./Models/init-models");
const sequelize = new Sequelize(
'magento',
'root',
'',
{
host: '127.0.0.1',
dialect: 'mysql',
logging: console.log,
// stop the auto-pluralization performed by Sequelize using the freezeTableName: true option
freezeTableName: true
});
var magentoModels = initModels(sequelize);
async function getProduct(){
var Product = await magentoModels.CatalogProductEntity.findOne({ where: {'sku': '24-MB01'}});
console.log(Product);
var EAV_VAR = await Product.getCatalogProductEntityVarchars();
console.log(EAV_VAR);
var Product = await magentoModels.CatalogProductEntity.findOne({ where: {'sku': '24-MB01'},
include: [
{ model: magentoModels.CatalogProductEntityVarchar, as: 'CatalogProductEntityVarchars' },
{ model: magentoModels.CatalogProductEntityInt, as: 'CatalogProductEntityInts' },
{ model: magentoModels.CatalogProductEntityText, as: 'CatalogProductEntityTexts' },
{ model: magentoModels.CatalogProductEntityDecimal, as: 'CatalogProductEntityDecimals'},
{ model: magentoModels.CatalogProductEntityDatetime, as: 'CatalogProductEntityDatetimes'},
]
});
console.log(Product);
return Product;
}
getProduct();