|
|
|
|
@@ -42,52 +42,41 @@ $allProducts = site()->getPosts(
|
|
|
|
|
['post_type' => 'product', 'nopaging' => true],
|
|
|
|
|
["id", "title", "permalink", "meta._product_attributes"]
|
|
|
|
|
);
|
|
|
|
|
$homeSafeStandardVsAutoAlertProducts = [];
|
|
|
|
|
|
|
|
|
|
$currentProductIsHomeSafe = false;
|
|
|
|
|
$productsWithWearingStyle = [];
|
|
|
|
|
$currentProductIsHome = false;
|
|
|
|
|
|
|
|
|
|
$productsWithConnectionType = [];
|
|
|
|
|
$HomeSafeProducts = [];
|
|
|
|
|
foreach ($allProducts as $lifelineProduct) {
|
|
|
|
|
if (strpos($lifelineProduct["title"], "Home") !== false) {
|
|
|
|
|
$autoAlertProducts[] = $lifelineProduct;
|
|
|
|
|
|
|
|
|
|
foreach ($allProducts as $maProduct) {
|
|
|
|
|
if (strpos($maProduct["title"], "Home") !== false) {
|
|
|
|
|
$homesystemProducts[] = $maProduct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_array($lifelineProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("style", $lifelineProduct["_product_attributes"]) &&
|
|
|
|
|
if (is_array($maProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("style", $maProduct["_product_attributes"]) &&
|
|
|
|
|
is_array($currentProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("connection-type", $currentProduct["_product_attributes"]) &&
|
|
|
|
|
$currentProduct["_product_attributes"]["connection-type"]["value"] == $lifelineProduct["_product_attributes"]["connection-type"]["value"]
|
|
|
|
|
$currentProduct["_product_attributes"]["connection-type"]["value"] == $maProduct["_product_attributes"]["connection-type"]["value"]
|
|
|
|
|
) {
|
|
|
|
|
$productsWithWearingStyle[] = $lifelineProduct;
|
|
|
|
|
$productsWithWearingStyle[] = $maProduct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_array($lifelineProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("connection-type", $lifelineProduct["_product_attributes"]) &&
|
|
|
|
|
if (is_array($maProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("connection-type", $maProduct["_product_attributes"]) &&
|
|
|
|
|
is_array($currentProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("style", $currentProduct["_product_attributes"]) &&
|
|
|
|
|
$currentProduct["_product_attributes"]["style"]["value"] == $lifelineProduct["_product_attributes"]["style"]["value"]
|
|
|
|
|
) {
|
|
|
|
|
$productsWithConnectionType[] = $lifelineProduct;
|
|
|
|
|
}
|
|
|
|
|
$currentProduct["_product_attributes"]["style"]["value"] == $maProduct["_product_attributes"]["style"]["value"]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (strpos($currentProduct["title"], "Home") !== false) {
|
|
|
|
|
$currentProductIsHomeSafe = true;
|
|
|
|
|
$currentProductIsHome = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_array($lifelineProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("connection-type", $lifelineProduct["_product_attributes"]) &&
|
|
|
|
|
if (is_array($maProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("connection-type", $maProduct["_product_attributes"]) &&
|
|
|
|
|
is_array($currentProduct["_product_attributes"]) &&
|
|
|
|
|
array_key_exists("connection-type", $currentProduct["_product_attributes"]) &&
|
|
|
|
|
$currentProduct["_product_attributes"]["connection-type"]["value"] == $lifelineProduct["_product_attributes"]["connection-type"]["value"]
|
|
|
|
|
) {
|
|
|
|
|
if (is_array($lifelineProduct["_product_attributes"]["style"])) {
|
|
|
|
|
if ($lifelineProduct["_product_attributes"]["style"]["value"] === "Wristband") {
|
|
|
|
|
$homeSafeStandardVsAutoAlertProducts[] = $lifelineProduct;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$homeSafeStandardVsAutoAlertProducts[] = $lifelineProduct;
|
|
|
|
|
}
|
|
|
|
|
$currentProduct["_product_attributes"]["connection-type"]["value"] == $maProduct["_product_attributes"]["connection-type"]["value"]) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -121,17 +110,11 @@ echo site()->render("single_product", [
|
|
|
|
|
"product" => $currentProduct,
|
|
|
|
|
"add-to-cart-url" => do_shortcode("[add_to_cart_url id='".$currentProduct->ID."']"),
|
|
|
|
|
"flex-content" => $flexOutput,
|
|
|
|
|
"showHomesafeOptions" => strtolower(substr($currentProduct["title"], 0, 4)) === "home",
|
|
|
|
|
"homeSafeProducts" => array_reverse($homeSafeProducts),
|
|
|
|
|
"showHomeOptions" => strtolower(substr($currentProduct["title"], 0, 4)) === "home",
|
|
|
|
|
"showOTGOptions" => strtolower($currentProduct["title"]) === "mobile system" || strtolower($currentProduct["title"]) === "mini mobile system",
|
|
|
|
|
"OTGProducts" => array_reverse($ontheGoProducts),
|
|
|
|
|
"hasWearingStyle" => is_array($currentProduct["_product_attributes"]) && array_key_exists("style", $currentProduct["_product_attributes"]),
|
|
|
|
|
"productsWithWearingStyle" => $productsWithWearingStyle,
|
|
|
|
|
"productsWithConnectionType" => array_reverse($productsWithConnectionType),
|
|
|
|
|
"productsWithWearingStyle" => $productsWithWearingStyle,
|
|
|
|
|
"autoAlertProducts" => array_reverse($autoAlertProducts),
|
|
|
|
|
"currentProductIsHomeSafe" => $currentProductIsHomeSafe,
|
|
|
|
|
"homeSafeStandardVsAutoAlertProducts" => array_reverse($homeSafeStandardVsAutoAlertProducts),
|
|
|
|
|
"homesystemProducts" => array_reverse($homesystemProducts),
|
|
|
|
|
"currentProductIsHome" => $currentProductIsHome,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
get_footer('shop');
|
|
|
|
|
|