Add a number in the opencart category
Creation, development, manufacturing sites | WEB-STYDIA.COM

5/51 rating

I often at creating an online store customers are asking how to add a quantity to the category opencart, that could be immediately from the list of goods from the category add the right amount to the basket.

Online stores are different, and it is not always necessary for the client to enter the card itself, so the number in the category opencart is very convenient for the buyer and he can immediately buy several products from the category with the right amount.

Of course, this will be relevant provided that the product does not have options that need to be selected. If the product has options, the customer will in any case be forced to enter the product card and from there already make a purchase, well, or you can display the options in the category, too.

Today I want to make a note not about the options, but about the possibility to add the right amount to the basket immediately from the category. There is nothing complicated here, all you need to do is make small changes to the controller of the opencart category and also to the template itself and of course to embellish the whole thing with styles.

And so our task is to add a field for entering the quantity of goods in front of the button in the category opencart, well, and we will also make the buttons plus a minus for this field, so that the client would be more comfortable. How all this will look can look at the picture below:

This method will work on any version of opencart except for some moments. And so, we proceed to perform the task itself and edit first the category controller file catalog/controller/product/category.php

We find in it:

Below under this line, we need to add:

This is all, the controller file can be closed, and go directly to the template file of the active theme catalog/view/theme/default/template/product/category.tpl

We need to change the button of purchase and add the quantity form in front of it, we find the output code for the button itself:

And change it to:

After before the above row of the button, we need to add a quantity input field with plus and minus buttons, that is, add:

That's all, now in the category of goods will be the ability to choose the quantity of goods. Now you can embellish it with a little bit of style, for example, by adding a style to your stylesheet file:

By the same method, you can add a quantity field to either an opencart module or to a search page, a vendor, etc.

General try, if that does not work or you have a better solution comment.

You may also like

No Comment

You can post first response comment.

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter a message.