Change quantity position

  • Posts: 1027
  • Thank you received: 11
  • Hikashop Business
6 years 3 months ago #285726

-- HikaShop version -- : 3.2.2
-- Joomla version -- : 3.8.3
-- PHP version -- : 7.0

Hello,

how can i change the position of hikashop_product_stock_count?
I can't figure out how to do it from the view "show_dafault"

<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
			<?php
			$this->row = & $this->element;
			$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
			$this->setLayout('quantity');
			echo $this->loadTemplate();
			?>
		</div>

Thank you

Attachments:

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

  • Posts: 81511
  • Thank you received: 13066
  • MODERATOR
6 years 3 months ago #285734

Hi,

It depends.
The count is displayed by the same view file than the one displaying the add to cart button ( product / quantity.php ).
So if you move that code from the show_default.php it will move both together.
To move one of them independently from the other, you would have to extract the stock display from the add to cart button display ( delete its code in quantity.php and move it in show_default.php ).

The following user(s) said Thank You: verzevoul

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

  • Posts: 1027
  • Thank you received: 11
  • Hikashop Business
6 years 3 months ago #285774

Hi!

To move one of them independently from the other, you would have to extract the stock display from the add to cart button display ( delete its code in quantity.php and move it in show_default.php ).


which part of the code do i have to move?

Thank you

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

  • Posts: 81511
  • Thank you received: 13066
  • MODERATOR
6 years 3 months ago #285778

Hi,

You need to copy/paste this:

$stock = $this->row->product_quantity;
if($stock == -1 && !empty($this->element->main) && isset($this->element->main->product_quantity))
	$stock = $this->element->main->product_quantity;
$in_stock = $stock != 0;
and cut/paste this:
$stock_class = ($stock != 0) ? "" : " hikashop_product_no_stock";
?>
<span class="hikashop_product_stock_count<?php echo $stock_class; ?>">
<?php
	if(!empty($this->row->product_stock_message))
		echo JText::_($this->row->product_stock_message);
	elseif($stock > 0)
		echo (($stock == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $stock) : JText::sprintf('X_ITEMS_IN_STOCK', $stock));
	elseif(!$in_stock)
		echo JText::_('NO_STOCK');
?>
</span>
<?php

The following user(s) said Thank You: verzevoul

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

Time to create page: 0.060 seconds
Powered by Kunena Forum