MAW-894: product radio buttons

This commit is contained in:
Tony Volpe
2024-07-24 13:19:06 -04:00
parent f6ecc4a605
commit 000f648705

View File

@@ -57,7 +57,7 @@ $productsWithConnectionType = []; // non autoalert
$HomeSafeProducts = []; // same as above, but autoalert only
foreach ($allProducts as $lifelineProduct) {
// hydrate all autoAlert products
if (strpos($lifelineProduct["title"], "HomeSafe") !== false) {
if (strpos($lifelineProduct["title"], "Home") !== false) {
// die(var_dump($lifelineProduct));
$autoAlertProducts[] = $lifelineProduct;
}
@@ -82,14 +82,13 @@ foreach ($allProducts as $lifelineProduct) {
$productsWithConnectionType[] = $lifelineProduct;
}
// next, determine if the current product is HomeSafe
if (strpos($currentProduct["title"], "HomeSafe") !== false) {
if (strpos($currentProduct["title"], "Home") !== false) {
$currentProductIsHomeSafe = true;
//var_dump($currentProductIsHomeSafe);
}
//var_dump($currentProduct["title"]);
//var_dump($lifelineProduct);
// next, determine which two products we should be switching between with
// the radio button like choices shown in the template
if (is_array($lifelineProduct["_product_attributes"]) &&
@@ -111,14 +110,11 @@ foreach ($allProducts as $lifelineProduct) {
$OntheGoProducts = [];
foreach ($allProducts as $llProduct) {
if (strpos($llProduct["title"], "On the Go") !== false) {
if (strpos($llProduct["title"], "Mini Mobile System") !== false || strpos($llProduct["title"], "Mobile System") !== false) {
$ontheGoProducts[] = $llProduct;
}
}
$test = strtolower($currentProduct["title"]) === "On the Go";
$flexOutput = "";
if (is_array(get_field('flex_content'))) {
foreach (get_field('flex_content') as $flex) {
@@ -142,9 +138,9 @@ 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, 8)) === "homesafe",
"showHomesafeOptions" => strtolower(substr($currentProduct["title"], 0, 4)) === "home",
"homeSafeProducts" => array_reverse($homeSafeProducts),
"showOTGOptions" => strtolower($currentProduct["title"]) === "on the go" || strtolower($currentProduct["title"]) === "on the go mini",
"showOTGOptions" => strtolower($currentProduct["title"]) === "mobile system" || strtolower($currentProduct["title"]) === "mini mobile system",
"OTGProducts" => array_reverse($ontheGoProducts),