Files
medicalalert-web-reloaded/wp/wp-content/plugins/iper-medical/templates/template-product.php
2024-03-01 15:39:06 +00:00

204 lines
5.0 KiB
PHP

<?php
session_start();
$_SESSION['Opportunity_ID_Order_Page']='';
unset($_SESSION['Opportunity_ID_Order_Page']);
setcookie('sel_upsell', '', time() + (3600), "/");
function upsell_price_calc($term, $price){
$upsell_price='';
if($term == 'Annually'){
$upsell_price = $price/12;
}
if($term == 'Monthly'){
$upsell_price = $price;
}
if($term == 'Quarterly'){
$upsell_price = $price/3;
}
if($term == 'Semi-Annually'){
$upsell_price = ($price)/6;
}
return $upsell_price;
}
$args = array(
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'rateplan'
);
$posts_array = get_posts( $args );
if(!$posts_array || empty($post->ID)) {
$home_url = "location:" . home_url();
header('location:'.$home_url);
}
global $wpdb,$post;
$product_wp_id=$post->ID;
/*$cookie_name = "sel_product";
$cookie_value = get_the_title($post->ID);
setcookie($cookie_name, $cookie_value, time() + (3600), "/");*/
iper_hook_css(); //richiama la funzione per settare gli stili. vedi functions.php
get_header('product');
$feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
$home_id = get_option('id_medical_home');
?>
<div class="content-area anchor_container" data-anchor="">
<div class="" role="listbox">
<div class="item active">
<?php $content=$post->post_content; $content=apply_filters('the_content',$content); ?>
<?php echo $content;?>
<a id="connection-type" class="anchor_me"></a>
</div>
</div>
</div>
<div class="modal fade" id="modalProduct" tabindex="-1" role="dialog" aria-labelledby="modalProductLabel">
</div>
<script type="text/javascript">
(function(window, $, _, undefined) {
$(document).ready(function() {
$(".et_pb_button_0").on("click", function(){
var radioValue = $("input[name='prodterm']:checked").val();
// var id = $(this).attr("id");
//alert(radioValue + " Rate Plan Selected");
//alert(cards + " Rate Plan Selected");
//alert(radioValue + " Selected"); // Core Product (At Home Cellular Selected | At Home Landline, etc)
//document.selectedRatePlan = radioValue;
//woo.displayFallDetection(product_id);
event.preventDefault();
});
var x = window.location.pathname;
var y = x.replace('product', '');
var page = y.replace(/\//g, '');
var productID;
if (page == 'home-system-cellular'){
productID = 25534;
productName = "Home Cellular System";
}else if (page == 'home-system-landline'){
//alert(page);
productID = 25502;
productName = "Home Landline System";
}else{
//alert(page);
productID = 25513;
productName = "Mobile System";
}
woo.getCoreProducts(function(products) {
for(var key in products) {
if(products[key].sku !== 'shipping'){
}else{
localStorage.setItem('ShippingInfo', JSON.stringify(products[key].id));
}
}
}, $);
var cards = '';
woo.getRatePlan(function(products) {
for(var key in products) {
if ((products[key].attributes[0].option)===('core')){
cards += woo.createRateCard(products[key]);
}
}
$('#RatePlan').html(cards);
}, productID, productName);
});
})(window, jQuery, undefined);
</script>
<form id='dataPassing' method='POST' action='/medical-shipping'>
<input type='hidden' value='' name='Package'/>
</form>
<script>
(function($) {
var colHeight = 0;
jQuery(".card-column .card-container .card").each(function( index ) {
if(jQuery( this ).height() > colHeight){
colHeight=$( this ).height();
}
}).each(function( index ) {
if(colHeight!=0){
jQuery( this ).height(colHeight);
}
});
function scroll(){
console.log($("#anchor_me").offset().top);
window.scrollTo(0, $("#anchor_me").offset().top-150);
}
jQuery(document).ready(function() {
jQuery(window).load(function() {
if(jQuery('.anchor_container').attr('data-anchor')=='1') {
setTimeout(function () {
scroll();
}, 100);
}
});});
})(jQuery);
</script>
<?php
include($ABS_path . "/footer.php");
get_footer();
?>