Jump to content

Product quantity increase or decrease on click on product page


Recommended Posts

hello guys i found an excellect trick tested works 100% no problem.

 

just follow this.

now customer can increase or decrease product quantity on click.

 

please find zip the attachement and image.

product.tpl line 335 replace with this

<div id="quantity_wanted_p" class="product-qty"><input id="quantity_wanted" class="input-text qty" type="text" maxlength="12" size="2" value="1" name="qty"></input><input class="qty-increase" type="button" onclick="var qty_el = document.getElementById('quantity_wanted'); var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;"></input><input class="qty-decrease" type="button" onclick="var qty_el = document.getElementById('quantity_wanted'); var qty = qty_el.value; if( !isNaN( qty ) && qty > 0 ) qty_el.value--;return false;"></input></div>

 

 

 

add this css on product.css

 

#quantity_wanted_p input {

 

width:50px; text-align:center;

 

border:1px solid #cdcdcd;

 

}

 

#quantity_wanted_p {float:left; border:1px solid rgb(221, 221, 221);

border-radius: 3px 3px 3px 3px;box-shadow: 0px 0px 3px 0px rgb(204, 204, 204);}

#input.qty {

width: 2.5em !important;

padding: 4px 2px;}

 

.qty-increase {

float: right;

width: 46px;

height: 16px;

border: medium none;

padding: 0px;

margin: 0px;

background: url("../img/btn-qty.png") no-repeat;

cursor: pointer;}

.qty-decrease, .add-to-cart input.qty-increase {

float: right;

width: 46px;

height: 16px;

border: medium none;

padding: 0px;

margin: 0px;

background: url("../img/btn-qty.png") no-repeat 0px 100%;

cursor: pointer;}

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

So I've made two product.tpl files, one is for quantity input field products, and one for button quantity products.

To select wich products belongs to wich .tpl file edited: ProductController.php, and changed line 276 to:

 

 

if ($this->category->id == 93)

$this->setTemplate(_PS_THEME_DIR_.'product2.tpl');

else

$this->setTemplate(_PS_THEME_DIR_.'product.tpl');

This works perfect, there is just one problem... If a product is in a subcategorie or you click the product while you where on his second categorie, it doesent work. Any ideas?

 

Thank you in advance.

Link to comment
Share on other sites

  • 7 months later...

Jiten rash, thanks for sharing this GREAT modification!

 

It's perfect besides one thing: is it possible to let the price update with every click? So that product-discounts will be applied to the displayed product price? If you could add this feature then this modification would be even more great. At this moment the price only updates when I change with attributes, not with quantities. Because you made the increase/decrease clickable, there should be a way to "include" the update of the price. I'm getting a headace to finding the solution for this.

 

I hope to hear from you. Thanks again! (weird that I'm the first one who say "Thanks", since there are 55 downloads)

Edited by Jan Jansen (see edit history)
Link to comment
Share on other sites

Jiten rash, thanks for sharing this GREAT modification!

 

It's perfect besides one thing: is it possible to let the price update with every click? So that product-discounts will be applied to the displayed product price? If you could add this feature then this modification would be even more great. At this moment the price only updates when I change with attributes, not with quantities. Because you made the increase/decrease clickable, there should be a way to "include" the update of the price. I'm getting a headace to finding the solution for this.

 

I hope to hear from you. Thanks again! (weird that I'm the first one who say "Thanks", since there are 55 downloads)

it is, but only with this modification: http://www.prestashop.com/forums/topic/239317-change-quantity-with-buttons/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...