MAW-894: product radio buttons
This commit is contained in:
@@ -57,7 +57,7 @@ $productsWithConnectionType = []; // non autoalert
|
|||||||
$HomeSafeProducts = []; // same as above, but autoalert only
|
$HomeSafeProducts = []; // same as above, but autoalert only
|
||||||
foreach ($allProducts as $lifelineProduct) {
|
foreach ($allProducts as $lifelineProduct) {
|
||||||
// hydrate all autoAlert products
|
// hydrate all autoAlert products
|
||||||
if (strpos($lifelineProduct["title"], "HomeSafe") !== false) {
|
if (strpos($lifelineProduct["title"], "Home") !== false) {
|
||||||
// die(var_dump($lifelineProduct));
|
// die(var_dump($lifelineProduct));
|
||||||
$autoAlertProducts[] = $lifelineProduct;
|
$autoAlertProducts[] = $lifelineProduct;
|
||||||
}
|
}
|
||||||
@@ -82,14 +82,13 @@ foreach ($allProducts as $lifelineProduct) {
|
|||||||
$productsWithConnectionType[] = $lifelineProduct;
|
$productsWithConnectionType[] = $lifelineProduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// next, determine if the current product is HomeSafe
|
// next, determine if the current product is HomeSafe
|
||||||
if (strpos($currentProduct["title"], "HomeSafe") !== false) {
|
if (strpos($currentProduct["title"], "Home") !== false) {
|
||||||
$currentProductIsHomeSafe = true;
|
$currentProductIsHomeSafe = true;
|
||||||
//var_dump($currentProductIsHomeSafe);
|
//var_dump($currentProductIsHomeSafe);
|
||||||
}
|
}
|
||||||
|
//var_dump($currentProduct["title"]);
|
||||||
|
//var_dump($lifelineProduct);
|
||||||
// next, determine which two products we should be switching between with
|
// next, determine which two products we should be switching between with
|
||||||
// the radio button like choices shown in the template
|
// the radio button like choices shown in the template
|
||||||
if (is_array($lifelineProduct["_product_attributes"]) &&
|
if (is_array($lifelineProduct["_product_attributes"]) &&
|
||||||
@@ -111,14 +110,11 @@ foreach ($allProducts as $lifelineProduct) {
|
|||||||
|
|
||||||
$OntheGoProducts = [];
|
$OntheGoProducts = [];
|
||||||
foreach ($allProducts as $llProduct) {
|
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;
|
$ontheGoProducts[] = $llProduct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$test = strtolower($currentProduct["title"]) === "On the Go";
|
|
||||||
|
|
||||||
$flexOutput = "";
|
$flexOutput = "";
|
||||||
if (is_array(get_field('flex_content'))) {
|
if (is_array(get_field('flex_content'))) {
|
||||||
foreach (get_field('flex_content') as $flex) {
|
foreach (get_field('flex_content') as $flex) {
|
||||||
@@ -142,9 +138,9 @@ echo site()->render("single_product", [
|
|||||||
"product" => $currentProduct,
|
"product" => $currentProduct,
|
||||||
"add-to-cart-url" => do_shortcode("[add_to_cart_url id='".$currentProduct->ID."']"),
|
"add-to-cart-url" => do_shortcode("[add_to_cart_url id='".$currentProduct->ID."']"),
|
||||||
"flex-content" => $flexOutput,
|
"flex-content" => $flexOutput,
|
||||||
"showHomesafeOptions" => strtolower(substr($currentProduct["title"], 0, 8)) === "homesafe",
|
"showHomesafeOptions" => strtolower(substr($currentProduct["title"], 0, 4)) === "home",
|
||||||
"homeSafeProducts" => array_reverse($homeSafeProducts),
|
"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),
|
"OTGProducts" => array_reverse($ontheGoProducts),
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user