Skip to main content

Quantity Box

More
15 years 10 months ago #2091 by coober
Quantity Box was created by coober
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.

More
15 years 10 months ago #2093 by nicolas
Replied by nicolas on topic Re: Quantity Box
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.

More
15 years 10 months ago #2152 by coober
Replied by coober on topic Re: Quantity Box
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.

More
15 years 10 months ago #2153 by nicolas
Replied by nicolas on topic Re: Quantity Box
You need to add your code before the quantity layout loading code:
Code:
$this->setLayout('quantity'); echo $this->loadTemplate();

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

More
15 years 10 months ago #2154 by coober
Replied by coober on topic Re: Quantity Box
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.

More
15 years 10 months ago #2156 by nicolas
Replied by nicolas on topic Re: Quantity Box
Yes.

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

More
15 years 10 months ago #2158 by coober
Replied by coober on topic Re: Quantity Box
thanks

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

Time to create page: 0.185 seconds
Powered by Kunena Forum