element->product_requires_wes, "yeswes") == 0) ? true : false; $productIsContractRequired = (strcasecmp($this->element->product_requires_contract, "yescontract") == 0) ? true : false; $productIsCriminalRecordRequired = (strcasecmp($this->element->product_requires_criminal_record_doc, "yescriminalrecord") == 0) ? true : false; $productIsAdultRequired = (strcasecmp($this->element->product_requires_adult, "yesadult") == 0) ? true : false; $productIsRestrictedForOnlineSale = (strcasecmp($this->element->product_restrict_online_sale, "yesrestrictedonlinesale") == 0) ? true : false; // Load user data and read them to the required variables $hikaShopUser = hikaShop_loadUser(true); $isUserLoggedIn = (is_null($hikaShopUser)) ? false : true; $userAge = 0; $isUserAdult = false; $isUsersPermitValid = false; $isUsersBirthdateRegistered = false; $isUsersValidityExpireDateRegistered = false; if ($isUserLoggedIn) { // Calculate age of customer $usersBirthdate = $hikaShopUser->user_date_of_birth; if(!is_null($usersBirthdate)) { if(strlen($usersBirthdate) > 0) { $isUsersBirthdateRegistered = true; $birthday_timestamp = strtotime($hikaShopUser->user_date_of_birth); $userAge = date('md', $birthday_timestamp) > date('md') ? date('Y') - date('Y', $birthday_timestamp) - 1 : date('Y') - date('Y', $birthday_timestamp); if($userAge < 0) { $userAge = 0; // in case when a future date has been entered for birthdate. } if($userAge >= 18) { $isUserAdult = true; } } } // Calculate if the user is valid. $usersValidityExpireDate = $hikaShopUser->user_validity_expire_date; if(!is_null($usersValidityExpireDate)) { if(strlen($usersValidityExpireDate) > 0) { $isUsersValidityExpireDateRegistered = true; $validity_timestamp = strtotime($hikaShopUser->user_validity_expire_date); $now_timestamp = strtotime("now"); if($validity_timestamp > $now_timestamp) { $isUsersPermitValid = true; } else { if($validity_timestamp == $now_timestamp) { $isUsersPermitValid = true; } } } } } $displayCart = true; if($productIsWesRequired || $productIsContractRequired || $productIsRestrictedForOnlineSale) { $displayCart = false; } else if ($productIsCriminalRecordRequired && $isUsersPermitValid == false) { $displayCart = false; } else if($productIsAdultRequired && $isUserAdult == false) { $displayCart = false; } $displayNoStockMessage = true; if($productIsWesRequired || $productIsContractRequired || $productIsRestrictedForOnlineSale) { $displayNoStockMessage = false; } if($productIsWesRequired || $productIsContractRequired || $productIsCriminalRecordRequired || $productIsAdultRequired || $productIsRestrictedForOnlineSale) {?>


row->has_options)){ echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.$this->itemid),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.$this->itemid)).'\';return false;',''); }else{ $url = ''; if(empty($this->ajax)){ $this->ajax = 'return hikashopModifyQuantity(\''.$this->row->product_id.'\',field,1,0);'; } if($this->row->product_sale_start || empty($this->element->main)){ $start_date = $this->row->product_sale_start; }else{ $start_date = $this->element->main->product_sale_start; } if($this->row->product_sale_end || empty($this->element->main)){ $end_date = $this->row->product_sale_end; }else{ $end_date = $this->element->main->product_sale_end; } if($end_date && $end_date time()){ ?> params->get('date_format','%d %B %Y'))); ?> params->get('catalogue') && $displayCart && ($this->config->get('display_add_to_cart_for_free_products') || !empty($this->row->prices))){ if($this->row->product_min_per_order<=0){ $this->row->product_min_per_order=1; } if($this->row->product_quantity==-1){ ?>
cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$this->row->product_max_per_order,$this->row->product_min_per_order); }elseif($this->row->product_quantity>0){ ?>
'.JText::sprintf('X_ITEMS_IN_STOCK',$this->row->product_quantity).'
'; $config =& hikashop_config(); if($config->get('button_style','normal')=='css'){ echo '
'; } if($this->row->product_max_per_order<=0 || $this->row->product_max_per_order>$this->row->product_quantity) $this->row->product_max_per_order = $this->row->product_quantity; echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$this->row->product_max_per_order,$this->row->product_min_per_order); }else{ ?>
config->get('product_waitlist',0); if(hikashop_level(1) && ($waitlist==2 || ($waitlist==1 && !empty($this->element->product_waitlist)))){ ?>
cart->displayButton(JText::_('ADD_ME_WAITLIST'),'add_waitlist',$params,hikashop_completeLink('product&task=waitlist&cid='.$this->row->product_id),'window.location=\''.str_replace("'","\'",hikashop_completeLink('product&task=waitlist&cid='.$this->row->product_id)).'\';return false;'); } }?>