Quantity Box

  • Posts: 36
  • Thank you received: 0
14 years 1 day ago #2091

Hello,

first time posting and I have a question about quantity boxes.

Is it possible to show a quantity box for some items and not for others.

thanks
David

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
14 years 19 hours ago #2093

Hi,

If you set the quantity of a product to 0, the add to cart button and the quantity box will be removed.

If you just wan to display the quantity box and keep the add to cart button for all the product, you can change the configuration option "Display the quantity field on the product page" under the tab display.

But if you want to do it only for some products, you will have to change the code of the view. You can go to Display->Views and edit the file show of the view product. There, you can use the code
$this->params->set('show_quantity_field',0);
to hide it, and the code
$this->params->set('show_quantity_field',1);
to show it.

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

  • Posts: 36
  • Thank you received: 0
14 years 5 hours ago #2152

Thanks nicolas

do I just add this code

$this->params->set('show_quantity_field',0);
to hide it, and the code
$this->params->set('show_quantity_field',1);
to show it.

anywhere to the file?

thanks
David

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
14 years 5 hours ago #2153

You need to add your code before the quantity layout loading code:

$this->setLayout('quantity');
			echo $this->loadTemplate();

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

  • Posts: 36
  • Thank you received: 0
14 years 5 hours ago #2154

is this correct?

}
?><span id="hikashop_product_quantity_main" class="hikashop_product_quantity_main"><?php
$this->row =& $this->element;
$this->params->set('show_quantity_field',1);
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
</span>

to show the quantity box

and

}
?><span id="hikashop_product_quantity_main" class="hikashop_product_quantity_main"><?php
$this->row =& $this->element;
$this->params->set('show_quantity_field',0);
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
</span>

to hid it.

thanks
David

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
14 years 5 hours ago #2156

Yes.

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

  • Posts: 36
  • Thank you received: 0
14 years 5 hours ago #2158

thanks

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

Time to create page: 0.067 seconds
Powered by Kunena Forum