Lewati ke konten utama

searchPage

Pencarian cepat untuk objek halaman dengan output terbatas.

Deskripsi

Metode ini melakukan pencarian cepat untuk objek halaman berdasarkan kueri teks (nama). Ini mengembalikan sebuah Promise yang menyelesaikan menjadi array objek IPagesEntity atau array kosong [].

Pages.searchPage(

name*, url, langCode

);

Skema parameter

Skema

name(diperlukan): string
Teks untuk mencari objek halaman (pencarian dilakukan pada field judul dari objek localizeInfos dengan mempertimbangkan bahasa)
contoh: "Tentang Kami"

url: string
URL Halaman
contoh: "katalog"

langCode: string
Kode bahasa. Default: "en_US"
contoh: "en_US"

Contoh

Contoh minimal

const response = await Pages.searchPage('cup');

Contoh dengan atribut

const response = await Pages.searchPage('cup', 'en_US');

Contoh respons

[
{
"id": 10,
"parentId": null,
"pageUrl": "catalog",
"depth": 0,
"localizeInfos": {
"title": "Catalog",
"menuTitle": "Catalog",
"htmlContent": "",
"plainContent": ""
},
"isVisible": true,
"blocks": [
"product_block",
"test",
"freq_ordered",
"..."
],
"type": "catalog_page",
"templateIdentifier": "template",
"attributeSetIdentifier": "page",
"attributeValues": {
"text": {
"type": "string",
"value": "catalog text",
"position": 0,
"additionalFields": {}
},
"number": {
"type": "integer",
"value": 0,
"position": 1,
"additionalFields": {}
},
"real": {
"type": "real",
"value": "",
"position": 2,
"additionalFields": {}
},
"float": {
"type": "float",
"value": 0,
"position": 3,
"additionalFields": {}
}
},
"moduleFormConfigs": [],
"isSync": true,
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
}
]

Skema respons

Skema: IPagesEntity[]

id: number
Identifikasi objek.
contoh: 8

parentId: number | null
Id dari halaman induk, jika berisi null, maka itu adalah halaman tingkat atas.
contoh: 10

pageUrl: string
URL halaman yang unik.
contoh: "blog"

depth: number
Kedalaman nesting halaman relatif terhadap parentId.
contoh: 10

localizeInfos: ILocalizeInfo
Nama halaman, dengan mempertimbangkan lokalisasi.
contoh:

{
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
}

isVisible: boolean
Tanda visibilitas halaman.
contoh: true

type: PageType
Tipe halaman.
contoh: "common_page"

templateIdentifier: string | null
Id pengguna dari template yang terhubung.
contoh: "template"

attributeSetIdentifier: string | null
Set id atribut.
contoh: "page"

attributeValues: IAttributeValues
Peta nilai atribut yang dikunci oleh penanda; objek kosong jika tidak ada.
contoh:

{
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": []
}
}

isSync: boolean
Indikasi pengindeksan halaman.
contoh: true

template: object
Objek template.
contoh:

{}

position: number
Nomor item (untuk pengurutan).
contoh: 2

config: Record<string, number>
Pengaturan output untuk halaman katalog.
contoh:

{
"rowsPerPage": 1,
"productsPerRow": 1
}

products: number
Jumlah produk yang terhubung ke halaman.
contoh: 0

childrenCount: number
Jumlah anak.
contoh: 1

blocks: IBlockEntity[] | string[]
blok.
contoh:

{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}

blocks.attributeValues: IAttributeValues
Peta nilai atribut yang dikunci oleh penanda; objek kosong jika tidak ada.
contoh:

{
"block-text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
}

blocks.id: number
Identifikasi unik dari blok.
contoh: 1234

blocks.localizeInfos: ILocalizeInfo
Informasi lokalisasi untuk blok.
contoh:

{
"key": "value"
}

blocks.version: number
Versi entitas blok.
contoh: 1

blocks.identifier: string
Identifikasi string unik untuk blok.
contoh: "block1"

blocks.type: BlockType
Tipe blok.
contoh: "produk"

blocks.position: number
Posisi blok untuk pengurutan.
contoh: 1

blocks.templateIdentifier: string | null
Identifikasi untuk template yang digunakan oleh blok, atau null jika tidak berlaku.
contoh: "template1"

blocks.isVisible: boolean
Menunjukkan apakah blok terlihat.
contoh: true

blocks.countElementsPerRow: number
Jumlah elemen yang ditampilkan per baris dalam blok, jika berlaku.
contoh: 3

blocks.quantity: number
Jumlah item dalam blok, jika berlaku.
contoh: 5

blocks.similarProducts: IProductsResponse
Respons yang berisi produk serupa yang terkait dengan blok.
contoh:

{
"total": 10,
"items": []
}

blocks.products: IProductsEntity[]
Array entitas produk yang terkait dengan blok.
contoh:

[
{
"id": 1,
"name": "Product 1"
},
{
"id": 2,
"name": "Product 2"
}
]

moduleFormConfigs: Array<IFormConfig>
Konfigurasi formulir modul yang terhubung ke halaman.

rating: IRating
Data penilaian.

total: string
Jumlah total produk yang terhubung ke halaman.
contoh: "10"

categoryPath: string | null
String jalur kategori; null untuk halaman bersarang yang tidak memiliki jalur kategori sendiri.
contoh: "katalog"