Quantity can't be set from store

tannis00's picture
tannis00
Tue, 06/27/2017 - 16:12
#1
Quantity can't be set from store

See www.LMoor.com. There is no quantity value in the store. It doesn't appear until you go to the cart. If I enable quantity display from Drupal Commerce, it just shows as 1, with no way to change it. How do I enable a quantity selector similar to what is available in the cart?

phuonght's picture
phuonght
Wed, 06/28/2017 - 05:12

Hi,

Not sure about your problem. Can you please send us some screenshots?

tannis00's picture
tannis00
Sun, 07/02/2017 - 16:49

When viewing a shop product, there is an add to cart button, but that's it. If you wanted to order more than one of the product, you would need to hit add to cart several times, or adjust the quantity in the cart. 

That said, I've found my own solution:

1) Go to the content type for the product display. By default for this theme, that's Shop_Product. Go to Manage Display, and then click the gear icon beside the Product Options field. Tick the box that says, "Display a textfield quantity widget on the add to cart form". Save your changes. This adds a text only quantity box.

2) Change MD_Avendor.js (in sites/all/themes/md_avendor/js/), adding the green lines below to the Shop Input section. This adds the arrow buttons to increase and decrease the quantity.

        // Shop Input
$('.input-quantity').before('<span class="qdown qselect icon-angle-left"></span>');
$('.input-quantity').after('<span class="qup qselect icon-angle-right"></span>');
$( '#views-form-commerce-cart-form-default .views-field-edit-quantity input[type="text"]').addClass("input-quantity");
$( '#views-form-commerce-cart-form-default .views-field-edit-quantity input[type="text"]').before('<span class="qdown qselect icon-angle-left"></span>');
$( '#views-form-commerce-cart-form-default .views-field-edit-quantity input[type="text"]').after('<span class="qup qselect icon-angle-right"></span>');

// New code $( '.form-item-quantity input[type="text"]').addClass("input-quantity");
$( '.form-item-quantity input[type="text"]').before('<span class="qdown qselect icon-angle-left"></span>');
$( '.form-item-quantity input[type="text"]').after('<span class="qup qselect icon-angle-right"></span>');

// End new code

$('.qup').on('click',function(){
$(this).siblings('.input-quantity').val(parseInt($(this).siblings('.input-quantity').val())+1);
});
$('.qdown').on('click',function(){
if(parseInt($(this).siblings('.input-quantity').val()) > 0) {
$(this).siblings('.input-quantity').val(parseInt($(this).siblings('.input-quantity').val())-1);

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.