Advanced Search

Search Results (Searched for: jquery)

21 Feb 2024 13:32

Hide add to cart from guest users

Category: Install & Update

Hi,

What do you mean by "it doesn't work" ?
This code change will definitely work and not crash the website as far as I can see.
Also, from what I can understand reading this code:
- this code can only work if jquery is available on the page. If that's not the case, you'll get a javascript error in the console of your browser. Your code doesn't load jquery, so if the template doesn't load it, and nothing of HikaShop / Joomla doesn't load it either because they don't need it, it won't work properly.
- You've added your code for the "Show default in div" mode of display of the "quantity input method". If you've configured this setting to something else in the HikaShop configuration or differently in the "quantity input" setting of your product, your code won't be used either.
- Also, since it's a view override, you need to make sure you're making the view override for the template you're actually using on the frontend and not another one.

If you want us to work on this for you, please go through our contact form and provide as much information as possible on how to reproduce the issue etc :
www.hikashop.com/support/contact-us.html
21 Feb 2024 10:02

Hide add to cart from guest users

Category: Install & Update

Hi!

I added it like this:
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	5.0.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2024 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(!isset($this->config))
	$this->config = hikashop_config();
$css_button = $this->config->get('css_button', 'hikabtn');

$quantity_counter = $this->getQuantityCounter();
$id = 'hikashop_product_quantity_field_'.$quantity_counter;
if($this->params->get('show_quantity_legacy', false)) {
	$i = (int)$this->params->get('i', 0);
	if($i > 0) $id = 'hikashop_product_quantity_field_'.$i;
}
$this->last_quantity_field_id = $id;
$name = 'quantity';
if(!empty($this->row->quantityFieldName)){
	$name = $this->row->quantityFieldName;
}

if(isset($this->row) && isset($this->row->product_min_per_order)) {
	$min_quantity = ($this->row->product_min_per_order || empty($this->element->main)) ? $this->row->product_min_per_order : @$this->element->main->product_min_per_order;
	$max_quantity = ($this->row->product_max_per_order || empty($this->element->main)) ? $this->row->product_max_per_order : @$this->element->main->product_max_per_order;
	if($this->row->product_quantity > 0) {
		if($max_quantity > 0)
			$max_quantity = min($max_quantity, $this->row->product_quantity);
		else
			$max_quantity = $this->row->product_quantity;
	}
	$min_quantity = max((int)$min_quantity, 1);
	$max_quantity = max((int)$max_quantity, 0);
} else {
	$min_quantity = max((int)$this->params->get('min_quantity', 0), 1);
	$max_quantity = max((int)$this->params->get('max_quantity', 0), 0);
}
$html = $this->params->get('html');

if(!isset($this->global_on_listing)){
	$this->global_on_listing = $this->config->get('show_quantity_field') == 2;
}
if(!empty($this->global_on_listing))
	$min_quantity = 0;

$current_quantity = hikaInput::get()->getInt('quantity', $min_quantity);
?>
	<div class="hikashop_quantity_form">
<?php
if(!isset($this->quantityLayout)) {
	$quantityLayout = $this->config->get('product_quantity_display', 'show_default_div');
	if(isset($this->row))
		$quantityLayout = $this->getProductQuantityLayout($this->row);
} else
	$quantityLayout = $this->quantityLayout;

$extra_classes = '';
if($this->config->get('synchronized_add_to_cart', 0) && isset($this->row) && empty($this->global_on_listing)) {
	$cartClass = hikashop_get('class.cart');
	$cartProductData = $cartClass->getCartProductData($this->row->product_id);
	$this->row->synched_cart_quantity = (int)@$cartProductData->cart_product_quantity;
	if($quantityLayout == 'show_default')
		$quantityLayout = 'show_default_div';
	if($this->row->synched_cart_quantity)
		$current_quantity = $this->row->synched_cart_quantity;
	if($min_quantity == 1)
		$min_quantity = 0;
	$cartClass->syncInit();
	if(in_array($quantityLayout, array('show_select','show_select_price')))
		$extra_classes = 'no-chzn';
?>
	<input id="<?php echo $id; ?>_synch" class="synchronized_add_to_cart" data-id="<?php echo $id; ?>" data-product-id="<?php echo $this->row->product_id; ?>"  data-cart-product-id="<?php echo @$cartProductData->cart_product_id; ?>" type="hidden" name="synched_cart_quantity" value="<?php echo $this->row->synched_cart_quantity; ?>"/>
<?php
}
if(HIKASHOP_J40) {
	if(in_array($quantityLayout, array('show_select','show_select_price')))
		$extra_classes.=' '.HK_FORM_SELECT_CLASS;
	else
		$extra_classes.=' '.HK_FORM_CONTROL_CLASS;
}


hikashop_loadJslib('notify');
hikashop_loadJslib('translations');

switch($quantityLayout) {
	case 'show_none':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_regrouped':
?>
		<div id="<?php echo $id; ?>_area" class="input-append hikashop_product_quantity_div hikashop_product_quantity_input_div_regrouped">
			<input id="<?php echo $id; ?>" type="text" onfocus="this.select()" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field <?php echo $extra_classes; ?>" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
			<div class="add-on hikashop_product_quantity_div hikashop_product_quantity_change_div_regrouped">
				<div class="hikashop_product_quantity_change_div_plus_regrouped">
					<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this, '<?php echo $id; ?>');">+</a>
				</div>
				<div class="hikashop_product_quantity_change_div_minus_regrouped">
					<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this, '<?php echo $id; ?>');">&ndash;</a>
				</div>
			</div>
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_regrouped"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_select':
		$increment = ($min_quantity ? $min_quantity : 1);
		if(empty($max_quantity)) {
			$max_quantity = (int)$increment * $this->config->get('quantity_select_max_default_value', 15);
		} else {
			$increment = min($increment, $max_quantity, $max_quantity-$min_quantity);
		}
		if($min_quantity == $max_quantity)
			$r = array($min_quantity);
		else
			$r = range($min_quantity, $max_quantity, $increment);
?>
		<div id="<?php echo $id; ?>_area" class="hikashop_product_quantity_div hikashop_product_quantity_input_div_select"><?php
			if(!in_array($max_quantity, $r))
				$r[] = $max_quantity;
			$values = array_combine($r, $r);
			ksort($values);
			echo JHTML::_('select.genericlist', $values, '', ' class="'.$extra_classes.'" onchange="document.getElementById(\''.$id.'\').value = this.value; document.getElementById(\''.$id.'\').onchange();"', 'value', 'text', $current_quantity, $id.'_select');
			?>
			<input id="<?php echo $id; ?>" type="hidden" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_select"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_select_price':
		$increment = ($min_quantity ? $min_quantity : 1);
		if(!$max_quantity){
			$max_quantity = (int)$increment * $this->config->get('quantity_select_max_default_value', 15);
		}
?>
		<div id="<?php echo $id; ?>_area" class="hikashop_product_quantity_div hikashop_product_quantity_input_div_select"><?php
				$values = array();
				if(!isset($this->row->all_prices) && isset($this->row->prices))
					$this->row->all_prices =& $this->row->prices;
				if(!empty($this->row->all_prices)){
					foreach($this->row->all_prices as $price) {
						$price_min_qty = max((int)$price->price_min_quantity, $min_quantity);
						$values[$price_min_qty] = $price_min_qty;
					}
					$min_quantity = min($values);
					$max_quantity = max($values);
					if($current_quantity < $min_quantity)
						$current_quantity = $min_quantity;
				}
				if(empty($values)) {
					$increment = min($increment, $max_quantity);
					$r = range($min_quantity, $max_quantity, $increment);
					if(!in_array($max_quantity, $r))
						$r[] = $max_quantity;
					$values = array_combine($r, $r);
				}
				ksort($values);
				echo JHTML::_('select.genericlist', $values, '', ' class="'.$extra_classes.'" onchange="document.getElementById(\''.$id.'\').value = this.value; document.getElementById(\''.$id.'\').onchange();"', 'value', 'text', $current_quantity);
			?>
			<input id="<?php echo $id; ?>" type="hidden" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_select"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_simple':
?>
		<span id="<?php echo $id; ?>_area"><input id="<?php echo $id; ?>" type="hidden" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" /></span>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simple"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_leftright':
?>
<div class="control-group">
	<div class="controls">
		<div id="<?php echo $id; ?>_area" class="input-prepend input-append hikashop_product_quantity_div hikashop_product_quantity_change_div_leftright">
			<span class="add-on">
				<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">&ndash;</a>
			</span>
			<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field <?php echo $extra_classes; ?>" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
			<span class="add-on">
				<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">+</a>
			</span>
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_leftright"><?php
			echo $html;
		?></div>
	</div>
</div>
<?php
		break;

	case 'show_simplified':
?>
		<div id="<?php echo $id; ?>_area" class="hikashop_product_quantity_div hikashop_product_quantity_input_div_simplified">
			<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field <?php echo $extra_classes; ?>" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simplified"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_html5':
		$html5_data = ((int)$max_quantity > 0) ? 'max="'.(int)$max_quantity.'"' : '';
?>
		<div id="<?php echo $id; ?>_area" class="hikashop_product_quantity_div hikashop_product_quantity_input_div_simplified">
			<input id="<?php echo $id; ?>" type="number" min="<?php echo $min_quantity; ?>" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field <?php echo $extra_classes; ?>" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simplified"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_default':
?>
		<table>
			<tr>
				<td rowspan="2">
					<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field <?php echo $extra_classes; ?>" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
				</td>
				<td>
					<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">+</a>
				</td>
				<td rowspan="2"><?php
					echo $html;
				?></td>
			</tr>
			<tr>
				<td>
					<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">&ndash;</a>
				</td>
			</tr>
		</table>
<?php
		break;

	default:
		if(!empty($this->quantityLayout) && substr($this->quantityLayout, 0, 14) == 'show_quantity_') {
			$quantityDisplayType = hikashop_get('type.quantitydisplay');
			if($quantityDisplayType->check($this->quantityLayout)) {
				$doc = JFactory::getDocument();
				$viewType = $doc->getType();
				$controller = new hikashopBridgeController(array('name'=>'product'));
				$view = $controller->getView('', $viewType, '');
				$view->setLayout($this->quantityLayout);
				echo $view->loadTemplate();
				break;
			}
		}
	case 'show_default_div':
?>
		<div id="<?php echo $id; ?>_area" class="hikashop_product_quantity_input_div_default_main">
			<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_default">
				<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field <?php echo $extra_classes; ?>" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
			</div>
			<div class="hikashop_product_quantity_div hikashop_product_quantity_change_div_default">
				<div class="hikashop_product_quantity_change_div_plus_default">
					<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">+</a>
				</div>
				<div class="hikashop_product_quantity_change_div_minus_default">
					<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change <?php echo $css_button; ?>" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">&ndash;</a>
				</div>
			</div>
		</div>
		<div id="<?php echo $id; ?>_buttons" class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_default"><?php
			echo $html;
		?></div>
<?php

$user = JFactory::getUser();

if ($user->guest) {
	echo JText::_("LOGIN_FOR_PRICES");
} else {
	?>
<script>
jQuery('.hikashop_product_quantity_div').css('display','inline-block');
  jQuery('.hikashop_product_quantity_div > input').attr('size',60);
</script>
<?php
}
?>	

<style>
  .hikashop_product_quantity_div{display:none}

  .hikashop_product_quantity_div > input{box-sizing: content-box;}</style>
		
		
<?php
		break;
}

?>
	</div>

But still doesn't work.

Is the code correct there?

Thank you
20 Feb 2024 19:42

Hide add to cart from guest users

Category: Install & Update

Hi,

The code that was added there is this:
$user = JFactory::getUser();

if ($user->guest) {
	echo JText::_("LOGIN_FOR_PRICES");
} else {
	?>
<script>
jQuery('.hikashop_product_quantity_div').css('display','inline-block');
  jQuery('.hikashop_product_quantity_div > input').attr('size',60);
</script>
<?php
}
?>	

<style>
  .hikashop_product_quantity_div{display:none}

  .hikashop_product_quantity_div > input{box-sizing: content-box;}</style>
		
		
<?php
20 Feb 2024 14:59

Hide add to cart from guest users

Category: Install & Update

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 4.4.2
-- PHP version -- : 8.1

Hi!

After migrating to Joomla 4, i lost some override customisations including the Hide add to cart from guest users in view show_quantity.php
This is the Joomla 3 website that is the correct way.

In the Url of the page with the problem i provided is the Joomla 4 website that i need your help to fix it.
So, the add to cart button in product listings and in product pages should only be displayed for registered users and instead of the add to cart button i need to display the message "Please login for our prices".

This is the Joomla 3 show_quantity.php code:
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.2.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2020 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$quantity_counter = $this->getQuantityCounter();
$id = 'hikashop_product_quantity_field_'.$quantity_counter;
if($this->params->get('show_quantity_legacy', false)) {
	$i = (int)$this->params->get('i', 0);
	if($i > 0) $id = 'hikashop_product_quantity_field_'.$i;
}
$name = 'quantity';
if(!empty($this->row->quantityFieldName)){
	$name = $this->row->quantityFieldName;
}
if(!isset($this->config))
	$this->config = hikashop_config();

if(isset($this->row) && isset($this->row->product_min_per_order)) {
	$min_quantity = ($this->row->product_min_per_order || empty($this->element->main)) ? $this->row->product_min_per_order : @$this->element->main->product_min_per_order;
	$max_quantity = ($this->row->product_max_per_order || empty($this->element->main)) ? $this->row->product_max_per_order : @$this->element->main->product_max_per_order;
	if($this->row->product_quantity > 0) {
		if($max_quantity > 0)
			$max_quantity = min($max_quantity, $this->row->product_quantity);
		else
			$max_quantity = $this->row->product_quantity;
	}
	$min_quantity = max((int)$min_quantity, 1);
	$max_quantity = max((int)$max_quantity, 0);
} else {
	$min_quantity = max((int)$this->params->get('min_quantity', 0), 1);
	$max_quantity = max((int)$this->params->get('max_quantity', 0), 0);
}
$html = $this->params->get('html');

if(!isset($this->global_on_listing)){
	$this->global_on_listing = $this->config->get('show_quantity_field') == 2;
}
if(!empty($this->global_on_listing))
	$min_quantity = 0;

$current_quantity = hikaInput::get()->getInt('quantity', $min_quantity);

if(!isset($this->quantityLayout)) {
	$quantityLayout = $this->config->get('product_quantity_display', 'show_default_div');
	if(isset($this->row))
		$quantityLayout = $this->getProductQuantityLayout($this->row);
} else
	$quantityLayout = $this->quantityLayout;


hikashop_loadJslib('notify');
hikashop_loadJslib('translations');

switch($quantityLayout) {
	case 'show_none':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_regrouped':
?>
		<div class="input-append hikashop_product_quantity_div hikashop_product_quantity_input_div_regrouped">
			<input id="<?php echo $id; ?>" type="text" onfocus="this.select()" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
			<div class="add-on hikashop_product_quantity_div hikashop_product_quantity_change_div_regrouped">
				<div class="hikashop_product_quantity_change_div_plus_regrouped">
					<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this, '<?php echo $id; ?>');">+</a>
				</div>
				<div class="hikashop_product_quantity_change_div_plus_regrouped">
					<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this, '<?php echo $id; ?>');">&ndash;</a>
				</div>
			</div>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_regrouped"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_select':
		$increment = ($min_quantity ? $min_quantity : 1);
		if(empty($max_quantity)){
			$max_quantity = (int)$increment * $this->config->get('quantity_select_max_default_value', 15);
		}
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_select"><?php
			$r = range($min_quantity, $max_quantity, $increment);
			if(!in_array($max_quantity, $r))
				$r[] = $max_quantity;
			$values = array_combine($r, $r);
			ksort($values);
			echo JHTML::_('select.genericlist', $values, '', 'onchange="document.getElementById(\''.$id.'\').value = this.value;"', 'value', 'text', $current_quantity, $id.'_select');
			?>
			<input id="<?php echo $id; ?>" type="hidden" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_select"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_select_price':
		$increment = ($min_quantity ? $min_quantity : 1);
		if(!$max_quantity){
			$max_quantity = (int)$increment * $this->config->get('quantity_select_max_default_value', 15);
		}
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_select"><?php
				$values = array();
				if(!isset($this->row->all_prices) && isset($this->row->prices))
					$this->row->all_prices =& $this->row->prices;
				if(!empty($this->row->all_prices)){
					foreach($this->row->all_prices as $price) {
						$price_min_qty = max((int)$price->price_min_quantity, $min_quantity);
						$values[$price_min_qty] = $price_min_qty;
					}
					$min_quantity = min($values);
					$max_quantity = max($values);
					if($current_quantity < $min_quantity)
						$current_quantity = $min_quantity;
				}
				if(empty($values)) {
					$r = range($min_quantity, $max_quantity, $increment);
					if(!in_array($max_quantity, $r))
						$r[] = $max_quantity;
					$values = array_combine($r, $r);
				}
				ksort($values);
				echo JHTML::_('select.genericlist', $values, '', 'onchange="document.getElementById(\''.$id.'\').value = this.value;"', 'value', 'text', $current_quantity);
			?>
			<input id="<?php echo $id; ?>" type="hidden" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_select"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_simple':
?>
		<input id="<?php echo $id; ?>" type="hidden" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simple"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_leftright':
?>
		<div class="input-prepend input-append hikashop_product_quantity_div hikashop_product_quantity_change_div_leftright">
			<span class="add-on">
				<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">&ndash;</a>
			</span>
			<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
			<span class="add-on">
				<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">+</a>
			</span>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_leftright"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_simplified':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_simplified">
			<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simplified"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_html5':
		$html5_data = ((int)$max_quantity > 0) ? 'max="'.(int)$max_quantity.'"' : '';
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_simplified">
			<input id="<?php echo $id; ?>" type="number" min="<?php echo $min_quantity; ?>" value="<?php echo $current_quantity; ?>" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_simplified"><?php
			echo $html;
		?></div>
<?php
		break;

	case 'show_default':
?>
		<table>
			<tr>
				<td rowspan="2">
					<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
				</td>
				<td>
					<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">+</a>
				</td>
				<td rowspan="2"><?php
					echo $html;
				?></td>
			</tr>
			<tr>
				<td>
					<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">&ndash;</a>
				</td>
			</tr>
		</table>
<?php
		break;

	default:
		if(!empty($this->quantityLayout) && substr($this->quantityLayout, 0, 14) == 'show_quantity_') {
			$quantityDisplayType = hikashop_get('type.quantitydisplay');
			if($quantityDisplayType->check($this->quantityLayout)) {
				$doc = JFactory::getDocument();
				$viewType = $doc->getType();
				$controller = new hikashopBridgeController(array('name'=>'product'));
				$view = $controller->getView('', $viewType, '');
				$view->setLayout($this->quantityLayout);
				echo $view->loadTemplate();
				break;
			}
		}
	case 'show_default_div':
?>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_input_div_default">
			<input id="<?php echo $id; ?>" type="text" value="<?php echo $current_quantity; ?>" onfocus="this.select()" class="hikashop_product_quantity_field" name="<?php echo $name; ?>" data-hk-qty-min="<?php echo $min_quantity; ?>" data-hk-qty-max="<?php echo $max_quantity; ?>" onchange="window.hikashop.checkQuantity(this);" />
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_change_div_default">
			<div class="hikashop_product_quantity_change_div_plus_default">
				<a class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">+</a>
			</div>
			<div class="hikashop_product_quantity_change_div_minus_default">
				<a class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" data-hk-qty-mod="-1" onclick="return window.hikashop.updateQuantity(this,'<?php echo $id; ?>');">&ndash;</a>
			</div>
		</div>
		<div class="hikashop_product_quantity_div hikashop_product_quantity_add_to_cart_div hikashop_product_quantity_add_to_cart_div_default"><?php
			echo $html;
		?>
		</div>
<?php
$user = JFactory::getUser();

if ($user->guest) {
	echo JText::_("LOGIN_FOR_PRICES");
} else {
	?>
<script>
jQuery('.hikashop_product_quantity_div').css('display','inline-block');
  jQuery('.hikashop_product_quantity_div > input').attr('size',60);
</script>
<?php
}
?>	

<style>
  .hikashop_product_quantity_div{display:none}

  .hikashop_product_quantity_div > input{box-sizing: content-box;}</style>
		
		
<?php
		break;
}

Could you help me with this?

Thank you
19 Jan 2024 14:56

Guest checkout on different location, different IP, user data display

Category: Checkout

jQuery(document).ready(function() {
  
  

    jQuery("#register_email").val("xx@xxx.com");
    jQuery(".hkform-group.control-group.hikashop_registration_email_line").hide();

    // Attach a change event handler to the radio buttons
    jQuery("input[name='data[register][registration_method]']").change(function() {
        // Check if the radio button with value 2 is checked
        if (jQuery(this).val() === "2") {
            // If yes, fill in the email
            jQuery("#register_email").val("xx@xxx.com");
            jQuery(".hkform-group.control-group.hikashop_registration_email_line").hide();
        } else {
            // If not, you can optionally clear the email field
            jQuery("#register_email").val("");
			jQuery(".hkform-group.control-group.hikashop_registration_email_line").show();
        }
    });


 

});  

we added these code into checkout / sub_block_login_registration.php

dont think it is related

when every one using guest checkout, they all share the same email, would like to know how the system if it should load the account and address or not
19 Jan 2024 11:45

Guest checkout on different location, different IP, user data display

Category: Checkout

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.12
-- PHP version -- : 7.3
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : no error message

Hi, we had do some tricks on guest checkout to skip the EMAIL filling steps and only fill in name + contact number

we prefill the email using jquery and hide the field during checkout

however, we face a problem randomly user A is seeing user C name and phone while go to checkout

any pieces of code we need to check to optimize this?
30 Dec 2023 09:52

Erreur js au vote

Category: Support en Français (French Support)

Bonjour,

Essayez de changer :
				if(hkjQuery().chosen)
					hkjQuery('#' + section.id + ' select').chosen();
en:
				if(hkjQuery().chosen && hkjQuery('#' + section.id + ' select')) {
					hkjQuery('#' + section.id + ' select').chosen();
				}
dans le fichier media/com_hikashop/js/vote.js (2 endroits)
et cela devrait éviter l'erreur JS après avoir vidé le cache du navigateur.
13 Dec 2023 19:57

PayPal Checkout - Uncaught SyntaxError: unexpected token: identifier

Category: Payment Methods

Hi,

The javascript error is indeed the culprit.
Now, there is no "identifier" in the PayPal Checkout plugin. And if I look online for that error message, it points at something linked to Jquery: stackoverflow.com/questions/64900999/unc...ted-token-identifier
Also, you didn't provide the file and line number of the error message. On the right side of the screen where you have the error message, you should see both.
They will point at the area of the page where the javascript error happens.
It's likely to come from a third party extension.
I also tried to check directly on your website, but I couldn't find any product I could add to the cart in order to access the checkout. So I would need precise instructions to reproduce the issue so that I could directly look at the problem.
30 Nov 2023 15:57

After changing the shipping method, it does not refresh the cart page.

Category: Checkout

Hi,

Ok, I understand the issue now.

First, you have a javascript error when the page is loaded:
i.imgur.com/Q4edCnK.png
And I think it is linked to the fact that you have the javascript library jquery loaded twice on your pages, and in the middle of both, the notify library is loaded into jquery, but then it is missing after the 2 jquery file ovewrite jquery and thus it generates an error.
To avoid this, I would recommend installing and configuring the jquery easy plugin:
extensions.joomla.org/extension/jquery-easy/
That way, you can make sure that only one jquery is loaded on the pages.

The second problem is the javascript error which appears when you try to change the shipping method:
i.imgur.com/XMq0m9H.png
This is the first time I see this.
I can see in the HTML of your shipping method selectors the call to this zmien javascript function which isn't defined anywhere:
i.imgur.com/Jkqzb0l.png
This looks like some customization done on your end in the checkout / show_block_shipping view file.
23 Nov 2023 16:02

Alerts for reaching maximum orders

Category: Install & Update

Hi,

I'm not sure what you mean ?
You don't need to have existing CSS code to add custom CSS to an HTML element.
As long as the HTML element has a class or an id unique to it, you can use that class / id to add your custom CSS for it, in any CSS file on the page.
The text of course comes from a translation key of HikaShop's translation file. So if you need to change the wording of the text, you can use a normal translation override: www.hikashop.com/download/languages.html#modify
The timing is fixed by the javascript in HikaShop, and we didn't made any plan to allow for easy modification of this.
The popup is displayed by the code:
hkjQuery(el).notify({title:trans[0],text:trans[1].replace('%s', max), image:'<i class="fa fa-3x fa-exclamation-circle"></i>'},{style:"metro",className:"warning",arrowShow:true,position:"top left"});
in media/com_hikashop/js/hikashop.js
I think that adding a parameter to the json with the name autoHideDelay and the value in milliseconds should allow you to change the default from 5 seconds to something else.
17 Oct 2023 18:32

Optimize for speed and security

Category: Product & Category Display

-- HikaShop version -- : 5
-- Joomla version -- : 4

Some optimization tips for Hikashop:
  • Update jQuery UI 1.12.1 to 1.13.2 - security
  • Minimize css notify-metro.css, tooltip.css, vex.css
  • Minimize js hikashop.js, swiper-bundle.js, tooltip.js, vote.js,
  • Add font-display:swap to fontawesome css
17 Oct 2023 15:02

Advanced date picker does not work anymore

Category: Install & Update

-- HikaShop version -- : 5.0.0
-- Joomla version -- : 4.3.4
-- PHP version -- : 8.2.10

Hi,

In our Hikashop installation I have created a product custom field 'Advanced date picker'. This has worked well so far. Today, however, the customer reported back that the field no longer works in the product. Also, manually changing an existing value resets on save.

I suspect that the problem has to do with the update to version 5.0.0, but I can't say for sure. I see the following JS errors in the Firefox error console:

- 'Uncaught TypeError: options is null'
(index.php)
- 'failed parsing JSON in string below: {maxDate:0,dateFormat:'dd.mm.yy',defaultDate:'10.02.2021',firstDay:0}'
(hikashop.js)
- jQuery.Deferred exception: options is null window.hikashopDatepicker@https://DOMAIN-REPLACED/administrator/index.php?option=com_hikashop&ctrl=product:265:5
@https://DOMAIN-REPLACED/administrator/index.php?option=com_hikashop&ctrl=product:1612:42
e@https://DOMAIN-REPLACED/media/vendor/jquery/js/jquery.min.js?3.6.3:2:30310
Deferred/then/l/</t<@https://DOMAIN-REPLACED/media/vendor/jquery/js/jquery.min.js?3.6.3:2:30612
undefined
(jquery.min.js:2:31865)

Regards
Stefan
27 Sep 2023 09:44

Characteristic price is wrong when go back

Category: Product & Category Display

Hi!

There are two more line with the code
<?php if(($characteristics_dynamic_display && $count > 1) || $characteristics_dynamic_display > 1) { ?>

Should i do something there also?

This is what i have now:
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.6.2
 * @author	hikashop.com
 * @copyright	(C) 2010-2022 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->element->characteristics))
	return;

?>
<div id="hikashop_product_characteristics" class="hikashop_product_characteristics">
<?php
if($this->params->get('characteristic_display') != 'list') {

	$app = JFactory::getApplication();
	$config = hikashop_config();
	$characteristics_dynamic_display = $config->get('characteristics_dynamic_display', 1);

	$this->characteristics=&$this->element->main->characteristics;
	foreach($this->characteristics as $k => $characteristic) {
		if(empty($this->characteristics[$k]->characteristic_display_method)) {
			$this->characteristics[$k]->characteristic_display_method = $this->params->get('characteristic_display');
		}
	}

	$chromePath = JPATH_THEMES . DS . $app->getTemplate() . DS . 'html' . DS . 'hikashop_characteristics.php';
	if(file_exists($chromePath)) {
		require_once ($chromePath);
		if(function_exists('hikashop_characteristics_html')) {
			echo hikashop_characteristics_html($this->element, $params, $this);
			echo '</div>';
			return;
		}
	}

	$html = '';
	$js = '';
	$ids = array_keys($this->characteristics);
	$list = '[\''.implode('\',\'',$ids).'\']';

	switch($this->params->get('characteristic_display')){
		case 'table':
			if(count($this->characteristics) == 2) {
				$html = '';
				$firstCharacteristic = reset($this->characteristics);
				$secondCharacteristic = end($this->characteristics);

				$html.= '<table class="hikashop_product_characteristic_chooser"><tr><td></td>';
				if(!empty($secondCharacteristic->values)){
					foreach($secondCharacteristic->values as $value){
						$html.='<td>'.hikashop_translate($value->characteristic_value).'</td>';
					}
				}
				$html.='</tr>';
				$this->options=' onclick="return hikashopUpdateVariantData(this.value);"';
				$size=0;
				if(!empty($firstCharacteristic->values)){
					foreach($firstCharacteristic->values as $value){
						$html .= '<tr><td style="text-align:right">'.hikashop_translate($value->characteristic_value).'</td>';
						if(strlen($value->characteristic_value)>$size)
							$size=strlen($value->characteristic_value);
						if(!empty($secondCharacteristic->values)) {
							foreach($secondCharacteristic->values as $value2) {
								$class = '';
								$classspan = '';
								$extra = '';
								foreach($this->element->variants as $k => $variant) {
									$char1 = false;
									$char2 = false;
									foreach($variant->characteristics as $variantCharacteristic) {
										if($variantCharacteristic->characteristic_id == $value->characteristic_id) {
											$char1 = true;
										} elseif($variantCharacteristic->characteristic_id == $value2->characteristic_id) {
											$char2 = true;
										}
										if($char1 && $char2) {
											if(!$variant->product_published || $variant->product_quantity == 0) {
												$class = ' hikashop_product_variant_out_of_stock';
												$classspan=' hikashop_product_variant_out_of_stock_span';
											}else {
												$extra = ' data-stock="'.(int)$variant->product_quantity.'"';
											}
											break 2;
										}
									}
								}

								$name = '_'.$value->characteristic_id.'_'.$value2->characteristic_id;
								$radio = "\n\t<span class=\"hikashop_product_characteristic_span".$classspan."\"><input type=\"radio\" class=\"hikashop_product_characteristic".$class."\" name=\"hikashop_product_characteristic\"".$extra." id=\"hikashop_product_characteristic".$name."\" value=\"".$name."\" ".$this->options;
								if($this->characteristics[$value->characteristic_parent_id]->default->characteristic_id == $value->characteristic_id && !empty($this->characteristics[$value2->characteristic_parent_id]->default->characteristic_id) && $this->characteristics[$value2->characteristic_parent_id]->default->characteristic_id == $value2->characteristic_id) {
									$radio .= ' checked';
								}
								$radio .= " /></span>";
								$html .= '<td>'.$radio.'</td>';
							}
						}
						$html .= '</tr>';
					}
				}
				$html .= '</table>';
				if($this->params->get('characteristic_display_text')) {
					$space = '';
					for($i = 0; $i <= $size; $i++) {
						$space .= '&nbsp;&nbsp;';
					}
					$html = '<table class="hikashop_product_characteristic_chooser"><tr><td></td><td class="hikashop_charactersitic_name">'.$space.@$secondCharacteristic->characteristic_value.'</td></tr><tr><td class="hikashop_charactersitic_name">'.$firstCharacteristic->characteristic_value.'</td><td>'.$html.'</td></table>';
				}
				break;
			}

		default:
		case 'radio':
		case 'dropdown':
			$main_html = '<table class="hikashop_product_characteristics_table">';
			$config = hikashop_config();
			$count = count($this->characteristics);
			$i = 0;
			foreach($this->characteristics as $characteristic) {
				$i++;
				$main_html.='<tr class="hikashop_characteristic_line_'.$characteristic->characteristic_id.'" data-characrow="'.$i.'">';
				$values = array();
				$switch_done = false;
				if(!empty($characteristic->values)) {
					foreach($characteristic->values as $k => $value){
						if(!$config->get('show_out_of_stock',1)){
							$hasQuantity = false;
							foreach($this->element->variants as $variant){
								foreach($variant->characteristics as $variantCharacteristic){
									if($variantCharacteristic->characteristic_id==$value->characteristic_id){
										if($variant->product_quantity != 0){
											$hasQuantity = true;
										}elseif( $this->element->product_id==$variant->product_id && !$switch_done){
											if($characteristic->characteristic_display_method == 'dropdown'){
												$id = 'hikashop_product_characteristic_'.$characteristic->characteristic_id;
												$js = "hikashopUpdateVariant(document.getElementById('".$id."'));";
											}else{
												$id = 'hikashop_product_characteristic['.$characteristic->characteristic_id.']';
												$js = "var el = document.querySelector('[name=\"".$id."\"]'); if(el) el.checked = true; hikashopUpdateVariant(el);";
											}

											$js = "
											window.hikashop.ready( function() {".$js."});";
											$switch_done = true;
										}
									}
								}
							}
							if(!$hasQuantity)
								continue;
						}
						$values[$k] = $value->characteristic_value;
					}
				}

				if(empty($values) || !is_array($values)){
					echo JText::_('NO_VALUES_FOUND');
					echo '</div>';
					return;
				}

				if(is_array($this->characteristics)){
					$characteristic_id = @$characteristic->characteristic_id;
					@$characteristic->characteristic_id = 'hikashop_product_characteristic['.$characteristic_id.']';
					$id = 'hikashop_product_characteristic_'.$characteristic_id;
				}else{
					$id = $characteristic_id = $map;
				}
				$selected = (int)@$characteristic->default->characteristic_id;

				$this->values = array();
				if(($characteristics_dynamic_display && $count > 1) || $characteristics_dynamic_display > 1) {
					if($characteristic->characteristic_display_method!='radio')
						$this->values[] = JHTML::_('select.option', '', JText::_('PLEASE_SELECT') );
					$selected = '';
				}
				foreach($values as $key => $val){
					if(strlen($val)!=0 && empty($val)){
						$val = $val.'&nbsp;';
					}

					if(strpos($val, '<img ') !== false)
						$val = str_replace('<img ', '<img onclick="return hikashopVariantSelected(\'hikashop_product_characteristic_'.$characteristic_id.$key.'\');" ', $val);
					$clean = hikashop_translate(strip_tags($val));
					$optionValue = ($characteristic->characteristic_display_method != 'radio' && !empty($clean) ? $clean : hikashop_translate($val));

					$obj = new stdClass;
					$obj->value  = $key;
					$obj->text = $optionValue;
					$obj->id = 'hikashop_product_characteristic_'.$characteristic_id.'_'.$key;
					$this->values[] = $obj;
				}

				$type = 'onclick';
				if($characteristic->characteristic_display_method!='radio'){
					$characteristic->characteristic_display_method='generic';
					$type = 'onchange';
				}
				$options = ' '.$type.'="return hikashopVariantSelected(this);"';
				$options .=' data-characteristic="'.$i.'"';
				if($count == $i)
					$options .=' data-last="1"';

				$html = JHTML::_('select.'.$characteristic->characteristic_display_method.'list', $this->values, @$characteristic->characteristic_id, 'class="custom-select" size="1"' . $options, 'value', 'text', $selected, $id );
				if($this->params->get('characteristic_display_text') && isset($characteristic->characteristic_value)) {

					$html = hikashop_translate($characteristic->characteristic_value).'</td><td>'.$html;
				}
				$main_html .= '<td>'.$html.'</td></tr>';
			}
			$main_html .= '</table>';
			$html = $main_html;

			if($characteristics_dynamic_display) {
				$matches = $this->getAllValuesMatches($this->characteristics, $this->element->variants, $this->element->main);
				$js.="\r\n".'window.hikashop.availableValues = [';
				if($matches) {
					foreach($matches as $value_id => $children) {
						$js.="\r\n\t"."[".implode(',',$children)."],";
					}

				}
				$js.="\r\n".'];';
			}

			break;
	}

	echo $html;
?>
	<script>
<?php echo $js; ?>

window.hikashop.ready( function() {
	// register the default values on the charactersitics
	var elements = document.querySelectorAll('[data-characteristic="1"]');
	if(elements && elements.length == 1) {
		for (index = 0; index < elements.length; ++index) {
			elements[index].dataset.default = elements[index].selectedIndex;
		}
	}
	elements = document.querySelector('[data-characrow="1"] input');
	if(elements && elements.length == 1) {
		for (index = 0; index < elements.length; ++index) {
			if(elements[index].checked)
				elements[index].dataset.defaultchecked = true;
			else
				elements[index].dataset.defaultchecked = false;
		}
	}
	// reset the dropdowns and checkboxes when the page changes
	window.addEventListener('beforeunload', (event) => {
		var elements = document.querySelectorAll('[data-characteristic="1"]');
		if(elements && elements.length == 1) {
			for (index = 0; index < elements.length; ++index) {
				if(elements[index].tagName.toLowerCase() == 'select') {
					elements[index].selectedIndex = elements[index].dataset.default;
				}
			}
		}
		elements = document.querySelector('[data-characrow="1"] input');
		if(elements && elements.length == 1) {
			for (index = 0; index < elements.length; ++index) {
				elements[index].checked = elements[index].dataset.defaultchecked;
			}
		}
	});
<?php if(($characteristics_dynamic_display && $count > 1) || $characteristics_dynamic_display > 1) { ?>
	initVariants();
<?php } ?>
});
function initVariants() {
	var allRows = document.querySelectorAll('tr[data-characrow]'), first = true,
	qtyArea = document.getElementById('hikashop_product_quantity_main'), altArea = document.getElementById('hikashop_product_quantity_alt');
	for (index = 0; index < allRows.length; ++index) {
		if(first) {
			first = false;
		} else {
			allRows[index].style.display = 'none';
		}
	}
	if(qtyArea) {
		qtyArea.style.display = 'none';
	}
	if(altArea) {
		altArea.style.display = '';
	}

<?php if(@$this->displayVariants['prices']) { ?>
	var priceDivs = document.querySelectorAll('#hikashop_product_price_main > .hikashop_product_price_full');
	priceDivs.forEach(function (sub) { sub.style.display = 'none'; });
<?php } ?>

<?php if( $characteristics_dynamic_display <= 1) { ?>
	var firstEl = document.querySelector('[data-characteristic="1"]');
	var firstRow = document.querySelector('[data-characrow="1"]');
	var autoSelect = false;
	if(firstEl.tagName.toLowerCase() == 'select') {
		if(firstEl.options.length == 2) {
			autoSelect = true;
			firstEl.selectedIndex = firstEl.options.length - 1;
			if(window.jQuery && typeof(jQuery().chosen) == "function") {
				jQuery( "#hikashop_product_characteristics select" ).chosen('destroy').chosen({disable_search_threshold:10, search_contains: true});
			}
		}
	} else {
		var inputs = firstRow.querySelectorAll('input');
		if(inputs.length == 1) {
			autoSelect = true;
			inputs[inputs.length-1].checked = true;
		}
	}

	if(autoSelect) {
		if(firstEl.tagName.toLowerCase() == 'select') {
			hikashopVariantSelected(firstEl);
		} else {
			hikashopVariantSelected(inputs[inputs.length-1]);
		}
	}
<?php } ?>
}

function getValidVariants(pos) {
	var allInputs = document.querySelectorAll('[data-characteristic]'), selectedElements = [], validVariants = [];

	for (index = 0; index < allInputs.length; ++index) {
		var input = allInputs[index];
		if(input.tagName.toLowerCase() == 'select') {
			if(input.selectedIndex && input.value)
				selectedElements[selectedElements.length] = parseInt(input.options[input.selectedIndex].value);
		} else {
			if(input.checked)
				selectedElements[selectedElements.length] = parseInt(input.value);
		}
		if(selectedElements.length == pos)
			break;
	}

	if(!selectedElements.length)
		return window.hikashop.availableValues;

	for (index = 0; index < window.hikashop.availableValues.length; ++index) {
		var valid = true;
		for (index2 = 0; index2 < selectedElements.length; ++index2) {
			if(selectedElements[index2] != window.hikashop.availableValues[index][index2]) {
				valid = false;
				break;
			}
		}
		if(valid){
			validVariants[validVariants.length] = window.hikashop.availableValues[index];
		}
	}
	return validVariants;
}

function hikashopVariantSelected(obj) {
<?php if(($characteristics_dynamic_display && $count > 1) || $characteristics_dynamic_display > 1) { ?>
	if(typeof(obj) == "string")
		obj = document.getElementById(obj);
	if(!obj)
		return true;
	var pos = obj.getAttribute('data-characteristic'), last = obj.getAttribute('data-last'), otherRow = null,
	qtyArea = document.getElementById('hikashop_product_quantity_main'), altArea = document.getElementById('hikashop_product_quantity_alt');
	if(!last) {
		validVariants = getValidVariants(pos);

		if(validVariants.length < 1 && obj.value != '') {
			console.log('characteristic value with id ' + obj.value + ' missing in window.hikashop.availableValues');
		} else {
			var next = parseInt(pos) + 1;
			var nextEl = document.querySelector('[data-characteristic="'+next+'"]');
			var nextRow = document.querySelector('[data-characrow="'+next+'"]');
			if(nextEl.tagName.toLowerCase() == 'select') {
				nextEl.selectedIndex = 0;
			} else {
				var inputs = nextRow.querySelectorAll('input');
				for (index = 0; index < inputs.length; ++index) {
					inputs[index].checked = false;
				}
			}
			if(obj.value == '') {
				nextRow.style.display = 'none';
			} else {
				nextRow.style.display = '';
			}
			next++;
			while(otherRow = document.querySelector('[data-characrow="'+next+'"]')) {
				next++;
				otherRow.style.display = 'none';
			}
			var autoSelect = false;
			if(nextEl.tagName.toLowerCase() == 'select') {
				var count = 0;
				var lastIndexFound = 0;
				for (index = 0; index < nextEl.options.length; ++index) {
					var found = false;
					for (i = 0; i < validVariants.length; ++i) {
						var currentVariant = validVariants[i];
						if(parseInt(nextEl.options[index].value) == currentVariant[pos]) {
							found = true;
							lastIndexFound = index;
							nextEl.options[index].hidden = false;
							nextEl.options[index].disabled = false;
						}
					}
					if(!found && index != 0) {
						nextEl.options[index].hidden = true;
						nextEl.options[index].disabled = true;
					} else {
						count++;
					}
				}

				if(count==2) {
					autoSelect = true;
					nextEl.selectedIndex = lastIndexFound;
				}
				if(window.jQuery && typeof(jQuery().chosen) == "function") {
					jQuery( "#hikashop_product_characteristics select" ).chosen('destroy').chosen({disable_search_threshold:10, search_contains: true});
				}
			} else {
				var inputs = nextRow.querySelectorAll('input');
				var count = 0;
				var lastIndexFound = 0;
				for (index = 0; index < inputs.length; ++index) {
					var found = false;
					for (i = 0; i < validVariants.length; ++i) {
						var currentVariant = validVariants[i];
						if(parseInt(inputs[index].value) == currentVariant[pos]) {
							found = true;
							lastIndexFound = index;
							inputs[index].parentNode.style.setProperty('display', '', 'important');
						}
					}

					if(!found) {
						inputs[index].parentNode.style.setProperty('display', 'none', 'important');
					} else {
						count++;
					}
				}
				if(count==2) {
					autoSelect = true;
					inputs[lastIndexFound].checked = true;
				}
			}

			if(qtyArea) {
				qtyArea.style.display = 'none';
			}
			if(altArea) {
				altArea.style.display = '';
			}
			if(autoSelect) {
				if(nextEl.tagName.toLowerCase() == 'select') {
					hikashopVariantSelected(nextEl);
				} else {
					hikashopVariantSelected(inputs[lastIndexFound]);
				}
			}
			return;
		}
	}
	if(obj.value != '') {
		if(qtyArea) {
			qtyArea.style.display = '';
		}
		if(altArea) {
			altArea.style.display = 'none';
		}
	} else {
		if(qtyArea) {
			qtyArea.style.display = 'none';
		}
		if(altArea) {
			altArea.style.display = '';
		}
	}
<?php } ?>
	hikashopUpdateVariant(obj);
}
function hikashopUpdateVariant(obj) {
	var options = <?php echo $list; ?>;
	var len = options.length, selection = '', found = false, el = null;
	if(typeof(obj) == "string")
		obj = document.getElementById(obj);
	if(!obj)
		return true;
	try { obj.blur(); } catch(e){}
	for (var i = 0; i < len; i++) {
		el = document.getElementById('hikashop_product_characteristic_'+options[i]);
		if(el) {
			selection += '_' + el.value;
			continue;
		}
		var form = document['hikashop_product_form'];
		if(!form) {
			continue;
		}
		var checkFields = form.elements['hikashop_product_characteristic['+options[i]+']'];
		if(checkFields && !checkFields.length && checkFields.value) {
			selection += '_' + checkFields.value;
			continue;
		}
		var len2 = (checkFields ? checkFields.length : 0);
		for (var j = 0; j < len2; j++) {
			if(checkFields && checkFields[j] && checkFields[j].checked) {
				selection += '_' + checkFields[j].value;
				found = true;
			}
		}
		if(!found) {
			return true;
		}
	}

	hikashopUpdateVariantData(selection);
	if(window.Oby && window.Oby.fireAjax) window.Oby.fireAjax("hkAfterUpdateVariant", {obj:obj,selection:selection});
	return true;
}

function hikashopUpdateVariantData(selection) {
	if(!selection)
		return true;
	var names = ['id','name','code','image','price','quantity','description','weight','url','width','length','height','contact','custom_info','files'];
	var len = names.length;
	for(var i = 0; i < len; i++){
		var el = document.getElementById('hikashop_product_'+names[i]+'_main');
		var el2 = document.getElementById('hikashop_product_'+names[i]+selection);
		if(el && el2)
			el.innerHTML = el2.innerHTML.replace(/_VARIANT_NAME/g, selection).replace(/data-content/g, 'content').replace(/data-itemprop/g, 'itemprop');
	}
	if(window.hikaProductOptions) hikaProductOptions.refreshPrice();
	else if(typeof this.window['hikashopRefreshOptionPrice'] == 'function') hikashopRefreshOptionPrice();
	if(window.Oby && window.Oby.fireAjax) window.Oby.fireAjax("hkContentChanged", {selection:selection});
	return true;
}
	</script>
</div>
<?php
	return;
}

if(!empty($this->element->main->characteristics)) {
	$columns=0;
	if((int)$this->config->get('show_quantity_field') >= 2) {
?>
	<form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_variants" enctype="multipart/form-data">
<?php
	}
?>
	<table class="hikashop_variants_table hikashop_products_table adminlist table table-striped table-hover" cellpadding="1">
		<thead class="hikashop_variants_table_thead">
			<tr class="hikashop_variants_table_thead_tr">
<?php if($this->config->get('thumbnail') && @$this->displayVariants['images']) { $columns++; ?>
				<th class="hikashop_product_image title hikashop_variants_table_th"><?php
					echo JText::_( 'HIKA_IMAGE' );
				?></th>
<?php }
	if(@$this->displayVariants['variant_name']) { $columns++; ?>
				<th class="hikashop_product_name title hikashop_variants_table_th"><?php
					echo JText::_( 'PRODUCT' );
				?></th>
<?php }
	if($this->config->get('show_code')) { $columns++; ?>
				<th class="hikashop_product_code title hikashop_variants_table_th"><?php
					echo JText::_( 'PRODUCT_CODE' );
				?></th>
<?php }
	foreach($this->element->main->characteristics as $characteristic) { $columns++; ?>
				<th class="hikashop_product_characteristic hikashop_product_characteristic_<?php echo $characteristic->characteristic_id; ?> title hikashop_variants_table_th"><?php
					echo hikashop_translate($characteristic->characteristic_value);
				?></th>
<?php }

	if(@$this->displayVariants['product_description']) { $columns++; ?>
				<th class="hikashop_product_description title hikashop_variants_table_th"><?php
					echo JText::_( 'HIKA_DESCRIPTION' );
				?></th>
<?php }
	if($this->params->get('show_price','-1') == '-1') {
		$this->params->set('show_price', $this->config->get('show_price'));
	}
	if($this->params->get('show_price') && @$this->displayVariants['prices']) { $columns++; ?>
				<th class="hikashop_product_price title hikashop_variants_table_th"><?php
					echo JText::_('PRICE');
				?></th>
<?php }
	if(!$this->params->get('catalogue')){ $columns++; ?>
				<th class="hikashop_product_add_to_cart title hikashop_variants_table_th">
				</th>
<?php } ?>
			</tr>
		</thead>
		<tbody class="hikashop_variants_table_tbody">
<?php
	$productClass = hikashop_get('class.product');
	$productClass->generateVariantData($this->element);

	foreach($this->element->variants as $variant) {
		if(isset($variant->map))
			continue;
		if(!$this->config->get('show_out_of_stock', 1) && $variant->product_quantity == 0)
			continue;
		if(!$variant->product_published)
			continue;

		$this->row =& $variant;
?>
			<tr id="hikashop_variant_row_<?php echo $variant->product_id; ?>" class="hikashop_variant_row hikashop_variants_table_tbody_tr">
<?php 	if($this->config->get('thumbnail') && @$this->displayVariants['images']){ ?>
				<td class="hikashop_product_image_row hikashop_variants_table_td" data-label="<?php echo JText::_( 'HIKA_IMAGE' ); ?>">
<?php
			if (!empty ($variant->images)) {
				$image = reset($variant->images);
				$width = $this->config->get('thumbnail_x');
				$height = $this->config->get('thumbnail_y');
				$this->image->checkSize($width,$height,$image);
				foreach($variant->images as $image) {
?>
					<div class="hikashop_variants_table_image_thumb"><?php
					if($this->image->override) {
						echo $this->image->display(@$image->file_path, true, @$image->file_name, 'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"','', $width, $height);
					} else {
						if(empty($this->popup))
							$this->popup = hikashop_get('helper.popup');
						$image_options = array('default' => true,'forcesize'=>$this->config->get('image_force_size',true),'scale'=>$this->config->get('image_scale_mode','inside'));
						$img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options);
						if(@$img->success) {
							$attributes = 'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"';
							if($img->external && $img->req_width && $img->req_height)
								$attributes .= ' width="'.$img->req_width.'" height="'.$img->req_height.'"';
							$html = '<img '.$attributes.' title="'.$this->escape((string)@$image->file_description).'" alt="'.$this->escape((string)@$image->file_name).'" src="'.$img->url.'"/>';
							if($this->config->get('add_webp_images', 1) && function_exists('imagewebp') && !empty($img->webpurl)) {
								$html = '
								<picture>
									<source srcset="'.$img->webpurl.'" type="image/webp">
									<source srcset="'.$img->url.'" type="image/'.$img->ext.'">
									'.$html.'
								</picture>
								';
							}

							echo $this->popup->image($html, $img->origin_url, null, 'title="'.$this->escape((string)@$image->file_description).'"');
						}
					}
					?></div>
<?php			}
			}
?>
				</td>
<?php	}
		if(@$this->displayVariants['variant_name']){ ?>
				<td class="hikashop_product_name_row hikashop_variants_table_td" data-label="<?php echo JText::_( 'PRODUCT' ); ?>">
					<?php echo $variant->variant_name; ?>
				</td>
<?php	}
		if ($this->config->get('show_code')) {
?>
				<td class="hikashop_product_code_row hikashop_variants_table_td" data-label="<?php echo JText::_( 'PRODUCT_CODE' ); ?>"><?php
					echo $variant->product_code;
				?></td>
<?php	}

		foreach($this->element->main->characteristics as $characteristic) {
?>
				<td class="hikashop_product_characteristic_row hikashop_product_characteristic_<?php echo $characteristic->characteristic_id; ?>_row hikashop_variants_table_td" data-label="<?php echo $characteristic->characteristic_value; ?>">
<?php
			if(!empty($characteristic->values)) {
				foreach($characteristic->values as $k => $value) {
					foreach($variant->characteristics as $variantCharacteristic) {
						if($variantCharacteristic->characteristic_id == $value->characteristic_id) {
							echo hikashop_translate($variantCharacteristic->characteristic_value);
							break 2;
						}
					}
				}
			}
?>
				</td>
<?php 	}

		if(@$this->displayVariants['product_description']) {
?>
				<td class="hikashop_product_description_row hikashop_variants_table_td" data-label="<?php echo JText::_( 'HIKA_DESCRIPTION' ); ?>"><?php
					echo JHTML::_('content.prepare', preg_replace('#<hr *id="system-readmore" */>#i', '', $variant->product_description));
				?></td>
<?php 	}

		if($this->params->get('show_price') && @$this->displayVariants['prices']){
?>
				<td class="hikashop_product_price_row hikashop_variants_table_td" data-label="<?php echo JText::_( 'PRICE' ); ?>">
<?php
			if ( ($this->row->product_msrp) == ($this->element->main->product_msrp) )
				$this->params->set('from_module',1);

			$this->setLayout('listing_price');
			echo $this->loadTemplate();
			$this->params->set('from_module',0);
?>
				</td>
<?php	}
		if(!$this->params->get('catalogue')) {
?>
				<td class="hikashop_product_add_to_cart_row hikashop_variants_table_td">
<?php
			if ($this->config->get('show_quantity_field') < 2) {
				$this->params->set('main_div_name','variants');
				$this->params->set('extra_div_name','hikashop_product_form');
				$this->params->set('product_waitlist', $this->config->get('product_waitlist', 0));
	 			$this->setLayout('add_to_cart_ajax');
				echo $this->loadTemplate();
				$this->params->set('extra_div_name','');
			} else {
				$start_date = (@$this->row->product_sale_start || empty($this->element->main)) ? @$this->row->product_sale_start : $this->element->main->product_sale_start;
				$end_date = (@$this->row->product_sale_end || empty($this->element->main)) ? @$this->row->product_sale_end : $this->element->main->product_sale_end;
				$now = time();
				if($end_date > 0 && $end_date < $now) {
				?>
					<span class="hikashop_product_sale_end"><?php
					echo JText::_('ITEM_NOT_SOLD_ANYMORE');
					?></span>
				<?php
				}

				else if($start_date > 0 && $start_date > $now) {
				?>
					<span class="hikashop_product_sale_start"><?php
					echo JText::sprintf('ITEM_SOLD_ON_DATE', hikashop_getDate($start_date, $this->params->get('date_format', '%d %B %Y')));
					?></span>
				<?php
				}
				else {
?>
					<span class="hikashop_product_stock_count">
<?php
					if($this->row->product_quantity > 0)
						echo (($this->row->product_quantity == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $this->row->product_quantity) : JText::sprintf('X_ITEMS_IN_STOCK', $this->row->product_quantity));
					elseif($this->row->product_quantity == 0)
						echo JText::_('NO_STOCK');
?>
					</span>
<?php
					if($this->row->product_quantity == -1 || $this->row->product_quantity > 0) {
						$quantityLayout = $this->quantityLayout;
						if(!empty($this->row->product_quantity_layout) && $this->row->product_quantity_layout != 'inherit')
							$quantityLayout = $this->row->product_quantity_layout;
						if(empty($quantityLayout) || !in_array($quantityLayout, array( 'show_select', 'show_select_price'))) {
?>
					<input id="hikashop_listing_quantity_<?php echo $this->row->product_id;?>" type="text" style="width:40px;" name="data[<?php echo $this->row->product_id;?>]" class="hikashop_listing_quantity_field" value="0" />
<?php 				} else {
							$min_quantity = ($this->row->product_min_per_order || empty($this->element->main)) ? $this->row->product_min_per_order : $this->element->main->product_min_per_order;
							$max_quantity = ($this->row->product_max_per_order || empty($this->element->main)) ? $this->row->product_max_per_order : $this->element->main->product_max_per_order;
							$min_quantity = max((int)$min_quantity, 1);
							$max_quantity = max((int)$max_quantity, 0);
							if($max_quantity == 0)
								$max_quantity = $min_quantity * $this->config->get('quantity_select_max_default_value', 15);
							$values = array();
							if($quantityLayout == 'show_select' || empty($this->row->prices)) {
								$values = range($min_quantity, $max_quantity, $min_quantity);
							} else {
								foreach($this->row->prices as $price) {
									$price_min_qty = max((int)$price->price_min_quantity, $min_quantity);
									$values[$price_min_qty] = $price_min_qty;
								}
							}
?>
					<select id="hikashop_listing_quantity_select_<?php echo $this->row->product_id;?>" class="tochosen" onchange="var qty_field = document.getElementById('hikashop_listing_quantity_<?php echo $this->row->product_id;?>'); qty_field.value = this.value;">
<?php
							echo '<option value="0" selected="selected">0</option>';
							foreach($values as $j) {
								echo '<option value="'.$j.'">'.$j.'</option>';
							}
?>
					</select>
					<input id="hikashop_listing_quantity_<?php echo $this->row->product_id;?>" type="hidden" name="data[<?php echo $this->row->product_id;?>]" value="0" />
<?php
						}
					}
				}
			}
?>
				</td>
<?php
		}
?>
			</tr>
<?php
	}
?>
		</tbody>
	</table>
<?php
	if($this->config->get('show_quantity_field') >= 2) {
		$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form_variants\')){ return hikashopModifyQuantity(\'\',field,1,\'hikashop_product_form_variants\'); } return false;';
		$this->row = new stdClass();
		$this->row->prices = array($this->row);
		$this->row->product_quantity = -1;
		$this->row->product_min_per_order = 0;
		$this->row->product_max_per_order = -1;
		$this->row->product_sale_start = 0;
		$this->row->product_sale_end = 0;
		$this->row->formName = 'hikashop_product_form_variants';
		$this->row->prices = array('filler');
		$this->params->set('show_quantity_field', 2);
		$this->setLayout('quantity');
		echo $this->loadTemplate();

		if(!empty($this->ajax) && $this->config->get('redirect_url_after_add_cart','stay_if_cart') == 'ask_user') {
?>
		<input type="hidden" name="popup" value="1"/>
<?php
 		}
?>
		<input type="hidden" name="hikashop_cart_type_0" id="hikashop_cart_type_0" value="cart"/>
		<input type="hidden" name="add" value="1"/>
		<input type="hidden" name="ctrl" value="product"/>
		<input type="hidden" name="task" value="updatecart"/>
		<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
	</form>
<?php
	}
}
?></div>

Thank you
26 Sep 2023 16:47

Characteristic price is wrong when go back

Category: Product & Category Display

Hi

You have a javascript error on your page which comes from the code:
<script> jQuery(function($) {       
            $('#tm-dialog-mobile .uk-nav-default, #tm-dialog-mobile .uk-nav-sub').addClass('uk-nav-parent-icon').attr('uk-nav', '');
            $('#tm-dialog-mobile .uk-nav-default .uk-parent > a, #tm-dialog-mobile .uk-nav-sub .uk-parent > a').append('<span uk-nav-parent-icon></span>');
            $('.uk-parent:has(.uk-active)').addClass('uk-active');
    });


<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/13956b617854c6a4f34c1e258/f7cfc75ded658143d0579e29d.js");

</script>
As you can see, you have a script tag inside a script tag, and that's not valid.

Because of that, the code I provided is not run by your browser and so it doesn't change anything.
25 Sep 2023 23:19

PHP8 stops confirmed status from Worldpay plugin

Category: Payment Methods

Hi Nicolas,
Yes it's been a long time since I last looked at this, but since I went live at the weekend with Joomla4 update, I had to change the PHP to 8.2 :-/
I actually went back to Namesco and saw a message from them, not sure if this helps:


"Hi Ian

I've looked more at this, and added the config change,. This errors immediately on home page under php7.4:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgSystemBigshotgoogleanalytics has a deprecated constructor in /var/www/web/plugins/system/bigshotgoogleanalytics/bigshotgoogleanalytics.php on line 18 Notice: Only variables should be assigned by reference in /var/www/web/plugins/system/bigshotgoogleanalytics/bigshotgoogleanalytics.php on line 29\


Setting PHP to 8.2 does indeed HTTP500, but there's an immediate redirect and then a load of errors:

Deprecated: Joomla\Input\Input implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/web/libraries/vendor/joomla/input/src/Input.php on line 41 Deprecated: Return type of Joomla\Input\Input::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/web/libraries/vendor/joomla/input/src/Input.php on line 170 Deprecated: Joomla\CMS\Input\Input implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/web/libraries/src/Input/Input.php on line 31 Deprecated: Joomla\CMS\Input\Cookie implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/web/libraries/src/Input/Cookie.php on line 21 Deprecated: Creation of dynamic property Joomla\CMS\User\User::$aid is deprecated in /var/www/web/libraries/src/User/User.php on line 953 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property Joomla\CMS\User\User::$aid is deprecated in /var/www/web/libraries/src/User/User.php on line 255 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property PlgSystemAdvancedModules::$_id is deprecated in /var/www/web/libraries/regularlabs/src/SystemPlugin.php on line 65 Deprecated: Creation of dynamic property PlgSystemSourcerer::$_id is deprecated in /var/www/web/libraries/regularlabs/src/SystemPlugin.php on line 65 Deprecated: Creation of dynamic property plgSystemHikashopuser::$currency is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 25 Deprecated: Creation of dynamic property plgSystemHikashopuser::$entries is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 26 Deprecated: Creation of dynamic property plgSystemHikashopuser::$session is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 29 Deprecated: Creation of dynamic property plgSystemHikashopuser::$cart is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 31 Deprecated: Creation of dynamic property plgSystemHikashopuser::$wishlist is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 32 Deprecated: Creation of dynamic property plgSystemHikashopuser::$checkout_fields is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 33 Deprecated: Creation of dynamic property plgSystemHikashopuser::$checkout_fields_ok is deprecated in /var/www/web/plugins/system/hikashopuser/hikashopuser.php on line 34 Deprecated: Creation of dynamic property plgSystemDJjQueryMonster::$_enabled is deprecated in /var/www/web/plugins/system/djjquerymonster/djjquerymonster.php on line 51 Deprecated: Creation of dynamic property PlgSystemModals::$_id is deprecated in /var/www/web/libraries/regularlabs/src/SystemPlugin.php on line 65 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/web/libraries/src/Uri/Uri.php on line 141 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property ContactRouterRulesLegacy::$router is deprecated in /var/www/web/components/com_contact/helpers/legacyrouter.php on line 30 Deprecated: Creation of dynamic property ContentRouterRulesLegacy::$router is deprecated in /var/www/web/components/com_content/helpers/legacyrouter.php on line 30 Deprecated: Creation of dynamic property NewsfeedsRouterRulesLegacy::$router is deprecated in /var/www/web/components/com_newsfeeds/helpers/legacyrouter.php on line 30 Deprecated: Creation of dynamic property UsersRouterRulesLegacy::$router is deprecated in /var/www/web/components/com_users/helpers/legacyrouter.php on line 30 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Function utf8_encode() is deprecated in /var/www/web/libraries/src/Filter/InputFilter.php on line 1181 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /var/www/web/libraries/src/Cache/CacheStorage.php on line 107 Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/web/plugins/system/djjquerymonster/djjquerymonster.php on line 303 Notice: Only variables should be assigned by reference in /var/www/web/plugins/system/bigshotgoogleanalytics/bigshotgoogleanalytics.php on line 29 Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /var/www/web/libraries/src/Date/Date.php on line 112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Many thanks
Ian
16 Jul 2023 12:38

Customise the layout of the checkout page

Category: Checkout

I've worked out how to do it now, it was surprisingly simple using the following code:

(function() {
jQuery("#hikabtn_checkout_next")
.detach()
.appendTo("#hikashop_checkout_cart_1_4");
})();
28 Jun 2023 16:42

Checkout Page Issue

Category: Checkout

Hi,

No, jquery has not been removed. Joomla still comes with it and there are parts which can require it being loaded.
However, it's true that Joomla 4 tries to not load it as much as possible.
28 Jun 2023 13:35

Checkout Page Issue

Category: Checkout

Hi Nicolas

I have just noticed that.

I have also switched the template to Cassiopeia and created a child template. All works as expected.

I thought jQuery was being removed in J4, although it seems some template providers may still use it.

I will raise this with the developer.

Thanks

David
28 Jun 2023 12:52

Checkout Page Issue

Category: Checkout

Hi,

My bad, I had indeed missed that.
The issue comes from a javascript error in the jquery of the template :
i.imgur.com/hvX9pBB.png
This prevents HikaShop from being able to initialize the selector there.
I think it might be a jquery conflict (several jquery files are loaded at the same time on the page). Try using the extension jquery easy to prevent the conflict:
extensions.joomla.org/extension/jquery-easy/

You can add the errors here after the issue with the selector is solved in order to not be confused again when we come back here.
Displaying 1 - 19 out of 19 results.
Time to create page: 0.320 seconds
Powered by Kunena Forum