diff --git a/mirzaev/arming_bot/system/controllers/cart.php b/mirzaev/arming_bot/system/controllers/cart.php
index a166020..ad2ad21 100755
--- a/mirzaev/arming_bot/system/controllers/cart.php
+++ b/mirzaev/arming_bot/system/controllers/cart.php
@@ -6,8 +6,10 @@ namespace mirzaev\arming_bot\controllers;
// Files of the project
use mirzaev\arming_bot\controllers\core,
+ mirzaev\arming_bot\models\cart as model,
mirzaev\arming_bot\models\product,
- mirzaev\arming_bot\models\cart as model;
+ mirzaev\arming_bot\models\menu,
+ mirzaev\arming_bot\models\enumerations\language;
// Framework for ArangoDB
use mirzaev\arangodb\document;
@@ -28,9 +30,74 @@ final class cart extends core
protected array $errors = [
'session' => [],
'account' => [],
- 'cart' => []
+ 'cart' => [],
+ 'menu' => [],
];
+ /**
+ * Cart
+ *
+ * @param array $parameters Parameters of the request (POST + GET)
+ */
+ public function index(array $parameters = []): ?string
+ {
+ if (isset($menu)) {
+ //
+
+ } else {
+ // Not received ... menu
+
+ // Search for filters and write to the buffer of global variables of view templater
+ $this->view->menu = menu::_read(
+ return: 'MERGE(d, { name: d.name.@language })',
+ sort: 'd.position ASC, d.created DESC, d._key DESC',
+ amount: 4,
+ parameters: ['language' => $this->language->name],
+ errors: $this->errors['menu']
+ );
+ }
+
+ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
+ // GET request
+
+ // Exit (success)
+ return $this->view->render('cart/page.html', [
+ 'h2' => $this->language === language::ru ? 'Корзина' : 'Cart' // @see https://git.mirzaev.sexy/mirzaev/huesos/issues/1
+ ]);
+ } else if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ // POST request
+
+ // Initializing a response headers
+ header('Content-Type: application/json');
+ header('Content-Encoding: none');
+ header('X-Accel-Buffering: no');
+
+ // Initializing of the output buffer
+ ob_start();
+
+ // Generating the reponse
+ echo json_encode(
+ [
+ 'main' => '',
+ 'errors' => $this->errors
+ ]
+ );
+
+ // Initializing a response headers
+ header('Content-Length: ' . ob_get_length());
+
+ // Sending and deinitializing of the output buffer
+ ob_end_flush();
+ flush();
+
+ // Exit (success)
+ return null;
+ }
+
+ // Exit (fail)
+ return null;
+ }
+
/**
* Product
*
diff --git a/mirzaev/arming_bot/system/controllers/catalog.php b/mirzaev/arming_bot/system/controllers/catalog.php
index 8f6f5e7..194cbef 100755
--- a/mirzaev/arming_bot/system/controllers/catalog.php
+++ b/mirzaev/arming_bot/system/controllers/catalog.php
@@ -46,19 +46,19 @@ final class catalog extends core
if (!empty($parameters['product']) && preg_match('/[\d]+/', $parameters['product'], $matches)) $product = (int) $matches[0];
if (isset($product)) {
- // received and validated identifier of the product
+ // Received and validated identifier of the product
// Search for the product data and write to the buffer of global variables of view templater
$this->view->product = product::read(
filter: "d.identifier == @identifier && d.deleted != true && d.hidden != true",
sort: 'd.created DESC',
amount: 1,
- return: '{name: d.name.@language, description: d.description.@language, cost: d.cost, weight: d.weight, dimensions: d.dimensions, brand: d.brand.@language, compatibility: d.compatibility.@language, cost: d.cost.@currency, images: d.images[*].storage}',
+ return: '{identifier: d.identifier, name: d.name.@language, description: d.description.@language, cost: d.cost, weight: d.weight, dimensions: d.dimensions, brand: d.brand.@language, compatibility: d.compatibility.@language, cost: d.cost.@currency, images: d.images[*].storage}',
language: $this->language,
currency: $this->currency,
parameters: ['identifier' => $product],
errors: $this->errors['catalog']
- )[0]?->getAll() ?? null;
+ )?->getAll();
}
// Intializing buffer of query parameters
@@ -296,19 +296,23 @@ final class catalog extends core
) ?? null;
}
- // Search among products in the $category
- if (isset($this->view->products) && count($this->view->products) > 0) {
- // Amount of rendered products is more than 0
+ if (isset($brand) || (isset($this->view->products) && count($this->view->products) > 0)) {
+ // Received and validated at least one of filters or amount of rendered products is more than 0
// Search for filters and write to the buffer of global variables of view templater
$this->view->filters = [
'brands' => product::collect(
return: 'd.brand.@language',
- products: array_map(fn(_document $document): string => $document->getId(), $this->view->products),
+ products: array_map(fn(_document $document): string => $document->getId(), $this->view->products ?? []),
language: $this->language,
errors: $this->errors['catalog']
)
];
+ }
+
+ // Search among products in the $category
+ if (isset($text) || isset($this->view->products) && count($this->view->products) > 0) {
+ // Amount of rendered products is more than 0
// Search for products and write to the buffer of global variables of view templater
$this->view->products = product::read(
@@ -347,11 +351,16 @@ final class catalog extends core
// Initialized the product data
// Writing javascript code that has been executed after core and damper has been loaded
- $this->view->javascript = [<< core.catalog.product_system('$product'), 500);
- }
- javascript] + ($this->view->javascript ?? []);
+ $this->view->javascript = [
+ sprintf(
+ << core.catalog.product_system('%s'), 500);
+ }
+ javascript,
+ $this->view->product['identifier']
+ )
+ ] + ($this->view->javascript ?? []);
}
// Exit (success)
diff --git a/mirzaev/arming_bot/system/models/product.php b/mirzaev/arming_bot/system/models/product.php
index abae9ed..0ed3aa9 100755
--- a/mirzaev/arming_bot/system/models/product.php
+++ b/mirzaev/arming_bot/system/models/product.php
@@ -130,8 +130,8 @@ final class product extends core implements document_interface, collection_inter
* @param array &$errors Registry of errors
*
* @return array|static Found products or instance of the product from ArangoDB (can be empty)
- *
- * @todo убрать language и currency
+ *
+ * @todo убрать language и currency
*/
public static function read(
?string $search = null,
@@ -205,7 +205,7 @@ final class product extends core implements document_interface, collection_inter
);
if ($amount === 1 && $result instanceof _document) {
- // Found product @todo need to rebuild this
+ // Found the product @todo need to rebuild this
// Initializing the object
$product = new static;
@@ -219,10 +219,12 @@ final class product extends core implements document_interface, collection_inter
// Exit (success)
return $product;
} else throw new exception('Class ' . static::class . ' does not implement a document from ArangoDB');
- }
+ } else if (!empty($result)) {
+ // Found products
- // Exit (success)
- return is_array($result) ? $result : [$result];
+ // Exit (success)
+ return is_array($result) ? $result : [$result];
+ }
} else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
} catch (exception $e) {
// Writing to the registry of errors
diff --git a/mirzaev/arming_bot/system/public/js/cart.js b/mirzaev/arming_bot/system/public/js/cart.js
index 2701fa1..8166060 100755
--- a/mirzaev/arming_bot/system/public/js/cart.js
+++ b/mirzaev/arming_bot/system/public/js/cart.js
@@ -44,12 +44,12 @@ import("/js/core.js").then(() =>
*
* @return {bool} True if an error occurs to continue the event execution
*/
- static toggle(button, force = false) {
+ static toggle(button, product, force = false) {
// Blocking the button
button.setAttribute("disabled", "true");
// Execute under damper
- this.toggle_damper(button, force);
+ this.toggle_damper(button, product, force);
// Exit (success)
return false;
@@ -82,16 +82,13 @@ import("/js/core.js").then(() =>
*
* @todo add unblocking button by timer + everywhere
*/
- static async toggle_system(button) {
- if (button instanceof HTMLElement) {
+ static async toggle_system(button, product) {
+ if (
+ product instanceof HTMLElement &&
+ button instanceof HTMLElement
+ ) {
// Validated
- // Initializing of the wrap of buttons
- const wrap = button.parentElement;
-
- // Initializing of the product
- const product = wrap.parentElement;
-
// Initializing of identifier of the product
const identifier = product.getAttribute(
"data-product-identifier",
@@ -118,9 +115,9 @@ import("/js/core.js").then(() =>
button.removeAttribute("disabled");
// Writing offset of hue-rotate to indicate that the product is in the cart
- wrap.style.setProperty(
+ product.style.setProperty(
"--hue-rotate-offset",
- json.amount + '0deg',
+ json.amount + "0deg",
);
// Writing attribute with amount of the product in the cart
@@ -130,15 +127,24 @@ import("/js/core.js").then(() =>
);
// Initializing the amount element
- const amount = wrap.querySelector(
- 'span[data-product-button-text="amount"]',
+ const amounts = product.querySelectorAll(
+ 'span[data-product-parameter="amount"]',
);
- if (amount instanceof HTMLElement) {
- // Initialized the amount element
+ for (const amount of amounts) {
+ // Iterating over an amount elements
- // Writing amount of the product in the cart
- amount.innerText = json.amount;
+ if (amount instanceof HTMLInputElement) {
+ // The element
+
+ // Writing amount of the product in the cart
+ amount.value = json.amount;
+ } else {
+ // Not the element
+
+ // Writing amount of the product in the cart
+ amount.innerText = json.amount;
+ }
}
}
});
@@ -157,7 +163,7 @@ import("/js/core.js").then(() =>
*
* @return {bool} True if an error occurs to continue the event execution
*/
- static write(button, amount = 1, force = false) {
+ static write(button, product, amount = 1, force = false) {
// Blocking the button
button.setAttribute("disabled", "true");
@@ -197,8 +203,9 @@ import("/js/core.js").then(() =>
*
* @todo add unblocking button by timer + everywhere
*/
- static async write_system(button, amount = 1) {
+ static async write_system(button, product, amount = 1) {
if (
+ product instanceof HTMLElement &&
button instanceof HTMLElement &&
typeof amount === "number" &&
amount > -1 &&
@@ -206,12 +213,6 @@ import("/js/core.js").then(() =>
) {
// Validated
- // Initializing of the wrap of buttons
- const wrap = button.parentElement;
-
- // Initializing of the product
- const product = wrap.parentElement;
-
// Initializing of identifier of the product
const identifier = product.getAttribute(
"data-product-identifier",
@@ -238,9 +239,9 @@ import("/js/core.js").then(() =>
button.removeAttribute("disabled");
// Writing offset of hue-rotate to indicate that the product is in the cart
- wrap.style.setProperty(
+ product.style.setProperty(
"--hue-rotate-offset",
- json.amount + '0deg',
+ json.amount + "0deg",
);
// Writing attribute with amount of the product in the cart
@@ -250,15 +251,24 @@ import("/js/core.js").then(() =>
);
// Initializing the amount element
- const amount = wrap.querySelector(
- 'span[data-product-button-text="amount"]',
+ const amounts = product.querySelectorAll(
+ 'span[data-product-parameter="amount"]',
);
- if (amount instanceof HTMLElement) {
- // Initialized the amount element
+ for (const amount of amounts) {
+ // Iterating over an amount elements
- // Writing amount of the product in the cart
- amount.innerText = json.amount;
+ if (amount instanceof HTMLInputElement) {
+ // The element
+
+ // Writing amount of the product in the cart
+ amount.value = json.amount;
+ } else {
+ // Not the element
+
+ // Writing amount of the product in the cart
+ amount.innerText = json.amount;
+ }
}
}
});
@@ -277,7 +287,7 @@ import("/js/core.js").then(() =>
*
* @return {bool} True if an error occurs to continue the event execution
*/
- static delete(button, amount = 1, force = false) {
+ static delete(button, product, amount = 1, force = false) {
// Blocking the button
button.setAttribute("disabled", "true");
@@ -317,8 +327,9 @@ import("/js/core.js").then(() =>
*
* @todo add unblocking button by timer + everywhere
*/
- static async delete_system(button, amount = 1) {
+ static async delete_system(button, product, amount = 1) {
if (
+ product instanceof HTMLElement &&
button instanceof HTMLElement &&
typeof amount === "number" &&
amount > 0 &&
@@ -326,12 +337,6 @@ import("/js/core.js").then(() =>
) {
// Validated
- // Initializing of the wrap of buttons
- const wrap = button.parentElement;
-
- // Initializing of the product
- const product = wrap.parentElement;
-
// Initializing of identifier of the product
const identifier = product.getAttribute(
"data-product-identifier",
@@ -358,9 +363,9 @@ import("/js/core.js").then(() =>
button.removeAttribute("disabled");
// Writing offset of hue-rotate to indicate that the product is in the cart
- wrap.style.setProperty(
+ product.style.setProperty(
"--hue-rotate-offset",
- json.amount + '0deg',
+ json.amount + "0deg",
);
// Writing attribute with amount of the product in the cart
@@ -370,15 +375,24 @@ import("/js/core.js").then(() =>
);
// Initializing the amount element
- const amount = wrap.querySelector(
- 'span[data-product-button-text="amount"]',
+ const amounts = product.querySelectorAll(
+ 'span[data-product-parameter="amount"]',
);
- if (amount instanceof HTMLElement) {
- // Initialized the amount element
+ for (const amount of amounts) {
+ // Iterating over an amount elements
- // Writing amount of the product in the cart
- amount.innerText = json.amount;
+ if (amount instanceof HTMLInputElement) {
+ // The element
+
+ // Writing amount of the product in the cart
+ amount.value = json.amount;
+ } else {
+ // Not the element
+
+ // Writing amount of the product in the cart
+ amount.innerText = json.amount;
+ }
}
}
});
@@ -397,7 +411,7 @@ import("/js/core.js").then(() =>
*
* @return {bool} True if an error occurs to continue the event execution
*/
- static set(button, amount = 1, force = false) {
+ static set(button, product, amount = 1, force = false) {
// Blocking the button
button.setAttribute("disabled", "true");
@@ -437,8 +451,9 @@ import("/js/core.js").then(() =>
*
* @todo add unblocking button by timer + everywhere
*/
- static async set_system(button, amount = 1) {
+ static async set_system(button, product, amount = 1) {
if (
+ product instanceof HTMLElement &&
button instanceof HTMLElement &&
typeof amount === "number" &&
amount > -1 &&
@@ -446,12 +461,6 @@ import("/js/core.js").then(() =>
) {
// Validated
- // Initializing of the wrap of buttons
- const wrap = button.parentElement;
-
- // Initializing of the product
- const product = wrap.parentElement;
-
// Initializing of identifier of the product
const identifier = product.getAttribute(
"data-product-identifier",
@@ -478,9 +487,9 @@ import("/js/core.js").then(() =>
button.removeAttribute("disabled");
// Writing offset of hue-rotate to indicate that the product is in the cart
- wrap.style.setProperty(
+ product.style.setProperty(
"--hue-rotate-offset",
- json.amount + '0deg',
+ json.amount + "0deg",
);
// Writing attribute with amount of the product in the cart
@@ -490,15 +499,24 @@ import("/js/core.js").then(() =>
);
// Initializing the amount element
- const amount = wrap.querySelector(
- 'span[data-product-button-text="amount"]',
+ const amounts = product.querySelectorAll(
+ 'span[data-product-parameter="amount"]',
);
- if (amount instanceof HTMLElement) {
- // Initialized the amount element
+ for (const amount of amounts) {
+ // Iterating over an amount elements
- // Writing amount of the product in the cart
- amount.innerText = json.amount;
+ if (amount instanceof HTMLInputElement) {
+ // The element
+
+ // Writing amount of the product in the cart
+ amount.value = json.amount;
+ } else {
+ // Not the element
+
+ // Writing amount of the product in the cart
+ amount.innerText = json.amount;
+ }
}
}
});
diff --git a/mirzaev/arming_bot/system/public/js/catalog.js b/mirzaev/arming_bot/system/public/js/catalog.js
index 42d4899..bc7d58a 100755
--- a/mirzaev/arming_bot/system/public/js/catalog.js
+++ b/mirzaev/arming_bot/system/public/js/catalog.js
@@ -50,8 +50,9 @@ import("/js/core.js").then(() =>
this.element_search.getElementsByTagName("input")[0];
// Categories
- static element_categories =
- document.getElementById("categories");
+ static element_categories = document.getElementById(
+ "categories",
+ );
// Filters
static element_filters = document.getElementById("filters");
@@ -75,7 +76,7 @@ import("/js/core.js").then(() =>
[
"category",
new URLSearchParams(document.location.search).get(
- "category"
+ "category",
),
],
[
@@ -128,6 +129,12 @@ import("/js/core.js").then(() =>
if (event.keyCode === 13) {
// Executed by "enter" button
+ // Blocking the search element
+ this.element_search_input.setAttribute(
+ "disabled",
+ true,
+ );
+
// Execute
this.search_system();
} else if (this.element_search_input.value.length < 3) {
@@ -169,7 +176,7 @@ import("/js/core.js").then(() =>
static search_damper = core.damper(
(...variables) => this.search_system(...variables),
1400,
- 1
+ 1,
);
/**
@@ -182,14 +189,11 @@ import("/js/core.js").then(() =>
* @todo add animations of errors
*/
static async search_system() {
- // Blocking the search element
- this.element_search_input.setAttribute("disabled", true);
-
// @todo add timeout to unblock
// Initialize the buffer of URN parameters
const parameters = new URLSearchParams(
- window.location.search
+ window.location.search,
);
// Iterate parameters
@@ -250,7 +254,7 @@ import("/js/core.js").then(() =>
// Writing the title
element before the first element in the element
core.main.insertBefore(
this.element_title,
- first
+ first,
);
}
}
@@ -289,14 +293,16 @@ import("/js/core.js").then(() =>
this.element_search.outerHTML = json.search;
// Reinitializing the parameter with the search element
- this.element_search =
- document.getElementById("search");
+ this.element_search = document.getElementById(
+ "search",
+ );
} else {
// Not found the search element
// Initialize the search element
- this.element_search =
- document.createElement("search");
+ this.element_search = document.createElement(
+ "search",
+ );
if (core.main instanceof HTMLElement) {
// Found the element
@@ -307,7 +313,7 @@ import("/js/core.js").then(() =>
// Writing the search element after the title
element in the element
core.main.insertBefore(
this.element_search,
- this.element_title.nextSibling
+ this.element_title.nextSibling,
);
} else {
// Not initialized the title
element in the element
@@ -321,7 +327,7 @@ import("/js/core.js").then(() =>
// Writing the search element before the first element in the element
core.main.insertBefore(
this.element_search,
- first
+ first,
);
}
}
@@ -330,13 +336,14 @@ import("/js/core.js").then(() =>
this.element_search.outerHTML = json.search;
// Reinitializing the parameter with the search element
- this.element_search =
- document.getElementById("search");
+ this.element_search = document.getElementById(
+ "search",
+ );
// Reinitializing the parameter with the search element
this.element_search_input =
this.element_search.getElementsByTagName(
- "input"
+ "input",
)[0];
}
}
@@ -371,14 +378,16 @@ import("/js/core.js").then(() =>
this.element_categories.outerHTML = json.categories;
// Reinitializing the parameter with the categories element
- this.element_categories =
- document.getElementById("categories");
+ this.element_categories = document.getElementById(
+ "categories",
+ );
} else {
// Not found the categories element
// Initialize the categories element
- this.element_categories =
- document.createElement("section");
+ this.element_categories = document.createElement(
+ "section",
+ );
if (core.main instanceof HTMLElement) {
// Found the element
@@ -389,7 +398,7 @@ import("/js/core.js").then(() =>
// Writing the categories element after the search element in the element
core.main.insertBefore(
this.element_categories,
- this.element_search.nextSibling
+ this.element_search.nextSibling,
);
} else if (
this.element_title instanceof HTMLElement
@@ -399,7 +408,7 @@ import("/js/core.js").then(() =>
// Writing the categories element after the title
element in the element
core.main.insertBefore(
this.element_categories,
- this.element_title.nextSibling
+ this.element_title.nextSibling,
);
} else {
// Not initialized the title
element in the element
@@ -413,7 +422,7 @@ import("/js/core.js").then(() =>
// Writing the categories before the first element in the element
core.main.insertBefore(
this.element_categories,
- first
+ first,
);
}
}
@@ -423,8 +432,9 @@ import("/js/core.js").then(() =>
json.categories;
// Reinitializing the parameter with the categories element
- this.element_categories =
- document.getElementById("categories");
+ this.element_categories = document.getElementById(
+ "categories",
+ );
}
}
} else {
@@ -454,14 +464,16 @@ import("/js/core.js").then(() =>
this.element_filters.outerHTML = json.filters;
// Reinitializing the parameter with the filters element
- this.element_filters =
- document.getElementById("filters");
+ this.element_filters = document.getElementById(
+ "filters",
+ );
} else {
// Not found the filters element
// Initialize the filters element
- this.element_filters =
- document.createElement("section");
+ this.element_filters = document.createElement(
+ "section",
+ );
if (core.main instanceof HTMLElement) {
// Found the element
@@ -474,7 +486,7 @@ import("/js/core.js").then(() =>
// Writing the filters element after the categories element in the element
core.main.insertBefore(
this.element_filters,
- this.element_categories.nextSibling
+ this.element_categories.nextSibling,
);
} else if (
this.element_search instanceof HTMLElement
@@ -484,7 +496,7 @@ import("/js/core.js").then(() =>
// Writing the filters element after the search element in the element
core.main.insertBefore(
this.element_filters,
- this.element_search.nextSibling
+ this.element_search.nextSibling,
);
} else if (
this.element_title instanceof HTMLElement
@@ -494,7 +506,7 @@ import("/js/core.js").then(() =>
// Writing the filters element after the title
element in the element
core.main.insertBefore(
this.element_filters,
- this.element_title.nextSibling
+ this.element_title.nextSibling,
);
} else {
// Not initialized the title
element in the element
@@ -508,7 +520,7 @@ import("/js/core.js").then(() =>
// Writing the filters before the first element in the element
core.main.insertBefore(
this.element_filters,
- first
+ first,
);
}
}
@@ -517,8 +529,9 @@ import("/js/core.js").then(() =>
this.element_filters.outerHTML = json.filters;
// Reinitializing the parameter with the filters element
- this.element_filters =
- document.getElementById("filters");
+ this.element_filters = document.getElementById(
+ "filters",
+ );
}
}
} else {
@@ -548,14 +561,16 @@ import("/js/core.js").then(() =>
this.element_sorting.outerHTML = json.sorting;
// Reinitializing the parameter with the sorting element
- this.element_sorting =
- document.getElementById("sorting");
+ this.element_sorting = document.getElementById(
+ "sorting",
+ );
} else {
// Not found the sorting element
// Initialize the sorting element
- this.element_sorting =
- document.createElement("section");
+ this.element_sorting = document.createElement(
+ "section",
+ );
if (core.main instanceof HTMLElement) {
// Found the element
@@ -566,7 +581,7 @@ import("/js/core.js").then(() =>
// Writing the sorting element after the filters element in the element
core.main.insertBefore(
this.element_sorting,
- this.element_filters.nextSibling
+ this.element_filters.nextSibling,
);
} else if (
this.element_categories instanceof HTMLElement
@@ -576,7 +591,7 @@ import("/js/core.js").then(() =>
// Writing the sorting element after the categories element in the element
core.main.insertBefore(
this.element_sorting,
- this.element_categories.nextSibling
+ this.element_categories.nextSibling,
);
} else if (
this.element_search instanceof HTMLElement
@@ -586,7 +601,7 @@ import("/js/core.js").then(() =>
// Writing the sorting element after the search element in the element
core.main.insertBefore(
this.element_sorting,
- this.element_search.nextSibling
+ this.element_search.nextSibling,
);
} else if (
this.element_title instanceof HTMLElement
@@ -596,7 +611,7 @@ import("/js/core.js").then(() =>
// Writing the sorting element after the title
element in the element
core.main.insertBefore(
this.element_sorting,
- this.element_title.nextSibling
+ this.element_title.nextSibling,
);
} else {
// Not initialized the title
element in the element
@@ -610,7 +625,7 @@ import("/js/core.js").then(() =>
// Writing the sorting before the first element in the element
core.main.insertBefore(
this.element_sorting,
- first
+ first,
);
}
}
@@ -619,8 +634,9 @@ import("/js/core.js").then(() =>
this.element_sorting.outerHTML = json.sorting;
// Reinitializing the parameter with the sorting element
- this.element_sorting =
- document.getElementById("sorting");
+ this.element_sorting = document.getElementById(
+ "sorting",
+ );
}
}
} else {
@@ -650,14 +666,16 @@ import("/js/core.js").then(() =>
this.element_products.outerHTML = json.products;
// Reinitializing the parameter with the products element
- this.element_products =
- document.getElementById("products");
+ this.element_products = document.getElementById(
+ "products",
+ );
} else {
// Not found the products element element
// Initialize the products element
- this.element_products =
- document.createElement("section");
+ this.element_products = document.createElement(
+ "section",
+ );
if (core.main instanceof HTMLElement) {
// Found the element
@@ -668,7 +686,7 @@ import("/js/core.js").then(() =>
// Writing the products element after the sorting element in the element
core.main.insertBefore(
this.element_products,
- this.element_sorting.nextSibling
+ this.element_sorting.nextSibling,
);
} else if (
this.element_filters instanceof HTMLElement
@@ -678,7 +696,7 @@ import("/js/core.js").then(() =>
// Writing the products element after the filters element in the element
core.main.insertBefore(
this.element_products,
- this.element_filters.nextSibling
+ this.element_filters.nextSibling,
);
} else if (
this.element_categories instanceof HTMLElement
@@ -688,7 +706,7 @@ import("/js/core.js").then(() =>
// Writing the products element after the categories element in the element
core.main.insertBefore(
this.element_products,
- this.element_categories.nextSibling
+ this.element_categories.nextSibling,
);
} else if (
this.element_search instanceof HTMLElement
@@ -698,7 +716,7 @@ import("/js/core.js").then(() =>
// Writing the products element after the search element in the element
core.main.insertBefore(
this.element_products,
- this.element_search.nextSibling
+ this.element_search.nextSibling,
);
} else if (
this.element_title instanceof HTMLElement
@@ -708,7 +726,7 @@ import("/js/core.js").then(() =>
// Writing the products element after the title
element in the element
core.main.insertBefore(
this.element_products,
- this.element_title.nextSibling
+ this.element_title.nextSibling,
);
} else {
// Not initialized the title