MAW-894: review stars
This commit is contained in:
@@ -240,7 +240,7 @@ const app = Vue.createApp({
|
||||
} else if (type=="discover") {
|
||||
cctype = "Discover";
|
||||
}
|
||||
document.querySelector('.cc_type').innerHTML = '<input type="hidden" name="creditcard_type" id="creditcard_type" value="'+cctype+'"><img aria-hidden="true" src="/wp-content/themes/lifeline/images/' + type +'.png" style="width: 50px;">';
|
||||
document.querySelector('.cc_type').innerHTML = '<input type="hidden" name="creditcard_type" id="creditcard_type" value="'+cctype+'"><img aria-hidden="true" src="/wp-content/themes/medicalalert/images/' + type +'.png" style="width: 50px;">';
|
||||
}
|
||||
},
|
||||
date: {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
<?php
|
||||
get_header();
|
||||
|
||||
// start main content gathering
|
||||
while (have_posts()) {
|
||||
the_post();
|
||||
|
||||
// get the photo gallery out of output buffering because woo commerce is gross
|
||||
ob_start();
|
||||
do_action('woocommerce_before_single_product_summary');
|
||||
$wooGallery = ob_get_contents();
|
||||
@@ -30,16 +27,12 @@ while (have_posts()) {
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['variation_id'])) {
|
||||
$variation_id = intval($_POST['variation_id']);
|
||||
|
||||
// Check if the variation exists before adding it to the cart
|
||||
$variation = wc_get_product($variation_id);
|
||||
|
||||
if ($variation && $variation->is_type('variation')) {
|
||||
// Add the selected variation to the cart
|
||||
$cart_item_key = WC()->cart->add_to_cart($product->get_id(), 1, $variation_id);
|
||||
|
||||
if ($cart_item_key) {
|
||||
// Redirect to the cart or checkout page
|
||||
echo '<script>window.location.href = "' . wc_get_cart_url() . '";</script>';
|
||||
exit;
|
||||
}
|
||||
@@ -53,16 +46,13 @@ $homeSafeStandardVsAutoAlertProducts = [];
|
||||
|
||||
$currentProductIsHomeSafe = false;
|
||||
$productsWithWearingStyle = [];
|
||||
$productsWithConnectionType = []; // non autoalert
|
||||
$HomeSafeProducts = []; // same as above, but autoalert only
|
||||
$productsWithConnectionType = [];
|
||||
$HomeSafeProducts = [];
|
||||
foreach ($allProducts as $lifelineProduct) {
|
||||
// hydrate all autoAlert products
|
||||
if (strpos($lifelineProduct["title"], "Home") !== false) {
|
||||
// die(var_dump($lifelineProduct));
|
||||
$autoAlertProducts[] = $lifelineProduct;
|
||||
}
|
||||
|
||||
// hydrate all products that have a "style" attribute and match the current product's "connection-type"
|
||||
if (is_array($lifelineProduct["_product_attributes"]) &&
|
||||
array_key_exists("style", $lifelineProduct["_product_attributes"]) &&
|
||||
is_array($currentProduct["_product_attributes"]) &&
|
||||
@@ -72,7 +62,6 @@ foreach ($allProducts as $lifelineProduct) {
|
||||
$productsWithWearingStyle[] = $lifelineProduct;
|
||||
}
|
||||
|
||||
// hydrate all products that have a "connection-type" attribute and match the current product's "style"
|
||||
if (is_array($lifelineProduct["_product_attributes"]) &&
|
||||
array_key_exists("connection-type", $lifelineProduct["_product_attributes"]) &&
|
||||
is_array($currentProduct["_product_attributes"]) &&
|
||||
@@ -82,28 +71,22 @@ foreach ($allProducts as $lifelineProduct) {
|
||||
$productsWithConnectionType[] = $lifelineProduct;
|
||||
}
|
||||
|
||||
// next, determine if the current product is HomeSafe
|
||||
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"]) &&
|
||||
array_key_exists("connection-type", $lifelineProduct["_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"]
|
||||
) {
|
||||
// next, only show standard products that are of style "Wristband"
|
||||
if (is_array($lifelineProduct["_product_attributes"]["style"])) {
|
||||
if ($lifelineProduct["_product_attributes"]["style"]["value"] === "Wristband") {
|
||||
$homeSafeStandardVsAutoAlertProducts[] = $lifelineProduct;
|
||||
}
|
||||
} else {
|
||||
$homeSafeStandardVsAutoAlertProducts[] = $lifelineProduct; // this one should be the current autoalert product
|
||||
$homeSafeStandardVsAutoAlertProducts[] = $lifelineProduct;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,18 +125,11 @@ echo site()->render("single_product", [
|
||||
"homeSafeProducts" => array_reverse($homeSafeProducts),
|
||||
"showOTGOptions" => strtolower($currentProduct["title"]) === "mobile system" || strtolower($currentProduct["title"]) === "mini mobile system",
|
||||
"OTGProducts" => array_reverse($ontheGoProducts),
|
||||
|
||||
|
||||
// style link options
|
||||
"hasWearingStyle" => is_array($currentProduct["_product_attributes"]) && array_key_exists("style", $currentProduct["_product_attributes"]),
|
||||
"productsWithWearingStyle" => $productsWithWearingStyle,
|
||||
|
||||
// connection type options
|
||||
//"hasConnectionType" => is_array($currentProduct["_product_attributes"]) && array_key_exists("connection-type", $currentProduct["_product_attributes"]),
|
||||
"productsWithConnectionType" => array_reverse($productsWithConnectionType),
|
||||
"productsWithWearingStyle" => $productsWithWearingStyle,
|
||||
"autoAlertProducts" => array_reverse($autoAlertProducts),
|
||||
|
||||
"currentProductIsHomeSafe" => $currentProductIsHomeSafe,
|
||||
"homeSafeStandardVsAutoAlertProducts" => array_reverse($homeSafeStandardVsAutoAlertProducts),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user