Page de commande avec quantité non modifiable + bouton suppression

  • Posts: 13
  • Thank you received: 0
6 years 5 months ago #294131

Bonjour,

Dans la page de synthèse des commandes pouvez vous me dire s'il est possible de conserver l'information de quantité mais la rendre non modifiable et garder le bouton suppression ?

Merci

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 5 months ago #294158

Bonjour,

Il y a l'option "read only" dans la vue "cart" du "checkout workflow" dans la configuration HikaShop, pour rendre la quantité non modifiable, mais cela enlève le champs de quantité ET le bouton de suppression.
Pour n'avoir que l'un des deux, il va falloir modifier le code de la vue "show_block_cart" via le menu Affichage>Vues:

if(empty($this->options['status'])) {
			if($product->product_parent_id != 0 && isset($product->main_product_quantity_layout))
				$product->product_quantity_layout = $product->main_product_quantity_layout;

			if($product->product_quantity_layout == 'show_select' || (empty($product->product_quantity_layout) && $this->config->get('product_quantity_display', '') == 'show_select')) {
				$min_quantity = ($product->product_min_per_order || empty($product->parent_product)) ? $product->product_min_per_order : $product->parent_product->product_min_per_order;
				$max_quantity = ($product->product_max_per_order || empty($product->parent_product)) ? $product->product_max_per_order : $product->parent_product->product_max_per_order;
				$min_quantity = max((int)$min_quantity, 1);
				$max_quantity = max((int)$max_quantity, 0);
				if($max_quantity == 0)
					$max_quantity = (int)$min_quantity * 15;

				$values = array(
					0 => JHTML::_('select.option', 0, 0)
				);
				for($j = $min_quantity; $j <= $max_quantity; $j += $min_quantity) {
					$values[$j] = JHTML::_('select.option', $j, $j);
				}
				$onchange = 'onchange="window.hikashop.checkQuantity(this); var qty_field = document.getElementById(\'hikashop_checkout_quantity_'.$product->cart_product_id.'\'); if (qty_field && qty_field.value != \''.$product->cart_product_quantity.'\'){'.$input.'return window.checkout.submitCart('.$this->step.','.$this->module_position.'); } return false;"';
				$ret = JHTML::_('select.genericlist', $values, 'checkout[cart][item]['.$product->cart_product_id.']', 'id="hikashop_checkout_quantity_'.$product->cart_product_id.'" data-hk-qty-old="'. $product->cart_product_quantity.'" '.$onchange, 'value', 'text', $product->cart_product_quantity);
				echo str_replace('id="checkoutcartitem'.$product->cart_product_id.'"', '', $ret);
			} else {
?>
				<input id="hikashop_checkout_quantity_<?php echo $product->cart_product_id;?>" type="text" name="checkout[cart][item][<?php echo $product->cart_product_id;?>]" class="hikashop_product_quantity_field" data-hk-qty-old="<?php echo $product->cart_product_quantity; ?>" value="<?php echo $product->cart_product_quantity; ?>" onchange="window.hikashop.checkQuantity(this);"/>
				<div class="hikashop_cart_product_quantity_refresh">
					<a class="hikashop_no_print" href="#" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $product->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $product->cart_product_quantity; ?>'){<?php echo $input; ?> return window.checkout.submitCart(<?php echo $this->step; ?>,<?php echo $this->module_position; ?>); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">
						<img src="<?php echo HIKASHOP_IMAGES . 'refresh.png';?>" border="0" alt="<?php echo JText::_('HIKA_REFRESH'); ?>" />
					</a>
				</div>
<?php
			}

			if(!empty($this->options['show_delete'])) {
				$url = hikashop_currentURL();
?>
				<div class="hikashop_cart_product_quantity_delete">
					<a class="hikashop_no_print" href="<?php echo hikashop_completeLink('product&task=updatecart&product_id='.$product->product_id.'&quantity=0&return_url='.urlencode(base64_encode(urldecode($url)))); ?>" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $product->cart_product_id;?>'); if(qty_field){qty_field.value=0; return window.checkout.submitCart(<?php echo $this->step; ?>,<?php echo $this->module_position; ?>); } return false;" title="<?php echo JText::_('HIKA_DELETE'); ?>">
						<img src="<?php echo HIKASHOP_IMAGES . 'delete2.png';?>" border="0" alt="<?php echo JText::_('HIKA_DELETE'); ?>" />
					</a>
				</div>
<?php
			}
		}else{
			echo $product->cart_product_quantity;
		}

Please Log in or Create an account to join the conversation.

Time to create page: 0.044 seconds
Powered by Kunena Forum