News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Multiple Quantity Question

Started by team, April 26, 2012, 16:27:40 PM

Previous topic - Next topic

team

Hi Staff, hello people, first time writting here, of course I searched solution before post here, but no result found.
Thanks in advance to help me.
My question is multiple quantity orderable.
My product can be purchased and shipped only on multiple of 10.
I did set Minimum Purchase Quantity to 10 in Product Status tab.
Now the add cart button shows 10, and that's OK.
If customers click on +/- button the quantity goes up/down of 1 unit instead of 10, that's not acceptable.
I absolutely cannot sell 11, 12, 13 pcs, but just 10 or 20 or 30 and so on.
Where am I wrong?
How to solve it?
Thanks
Piero / Italy


John2400

Hi team
two options....
http://extensions.virtuemart.net/extensions-virtuemart-2/quantity-related-calculation-detail

or simply state - that all quantities are sold in lots - eg
we sell arrows in dozens so we simply have - one dozen first at one price and all the drop down tabs are sold in 2 dozen, three dozen and so on.

Customers seem to have little issue with that.

Lockerbie

#3
My client sells wine and he wants to show the price per single bottle, but sell most products per box of 6 bottles (no discount). Only some wines are sold per bottle.

The option webiedesign mentioned seems good, but unfortunate, not alle wines are sold in quantities of 6.
The quantity-related-plugin looks like an option (bought it already), but my client doesn't want to work with discount for boxes of 6 bottles of wine.

How can I adjust things so that some wines are sold in quantities of 6 bottles and others are sold per single bottle?

(J! 2.5.4 - VM 2.0.6)

John2400

You can add the image of the product as normal and have

* the price as normal - next to the product  and have an attribute as a drop down that says price per one - price per 1/2 dozen, price prer dozen etc.

If you sets your weight correctly then the shipping cost of one will be expensive , compared to the cost of 1/2 dozen and so on.

* all options you have mentioned here should be ok in the setting of attributes- but always explain clearly on your site that items are sold in volumes are cheaper to ship than single items.   " have a best offer"" best to buy in Bulk.

Lockerbie

Hello John2400,

Thanks for your answer. To do it that way is a possibility, I guess. Just a lot of work to attach a lot of attributes to all products. With (the most of) 125 products, this would mean something like 500-750 attributes or more! And with manually calculated prices, in stead of automatic.
You should think there should be an easier way to achieve this... Is there?

John2400

#6
Just for the moment _ A quick answer is that you could get one product just the way you like - then just clone the product - . Then all you have to do is add an image and change the price.

I understand what you mean - let me think on a option for a while - I have heard of stores with 2000 plus items.  There is an extension that you can change prices in bulk. I have used this it is called 'VM bulk editor' - have a look at the free options and maybe see what you can do with that.
http://www.virtuemart-bulk-editor.anthonyglover.com/

Lockerbie

Wouldn't it be possible to create a calculation rule with someting like 'multiply by 6' in it?
The only option I'll see in there are +, -, +% and -%. If possible to add a multiplier, how can I do this?

John2400

mmm?

Have an idea - not something I use but - if you use stock variants, (plug ins)--, VM custome , stock variants)- see image number 1 , & number.



Then add this to a product and you can add prices here. in groups. -

have a look at this option



[attachment cleanup by admin]

Lockerbie

I found the VM custom-stock variants -plugin, activated it and played with it.
But I can't get someting like in your other image; I don't see anything like 'parent variant or the other fields. What am I missing here?

Lockerbie

Nevermind: I've got the same fields now. I missed the 'child products'.
I'll try this out and let you know!

Lockerbie

Oké, I think this could work!
Off course there are a few things to take care of:
- you'll have to fill in the right price per quantity (in this case: before tax),
- you'll have to manually calculate the 'additonal charge'. (*5, that is! Or *11, and so on.)

Besides that, the product price is displayed per 1 bottle. If you change the number to 12, the price changes accordingly. So far, so good. But if after that you change the quantity to 6, the price doesn't change anymore. Minor problem, but still. See: this example.

Below the quantity-dropdown it says 'price: free'. I'll have to look where to change or remove this.
And the 'normal' quantitynumbers (and +/-) have to be removed also.

I'll have to go know, I will look into this later on. Thank you very much for now!

Lockerbie

I'm afraid it's not as perfect as we thought. It's workable, but also complicated. You'll have to manual calculate the (before tax-) prices for the additional charges, so you get *5, *11, *17, *23 and so on. So for every 10 choices (=10 boxes, =60 bottles of wine), you'll have to add 10 childproducts with all manually calculated prices.
For me it's not a very big problem (although much work), but I forsee problems when my client wants to add new products himself...

I still wonder if it isn't possible to make a new calculation rule with a possibility to multiply, so all prices are calculated automaticly. This would be great, both for me and my clients!  8)

(A few days ago I bought the 'quantity-related-price-calculation'-plugin, but this seems to work only when given discount with a given quantity, wich is something my client doens't want to use. So if someone would know how to achieve what we want with this plugin, this would be another great option!
The developer suggested to set up the products as bundles, but since there are some products that aren't sold in a bundle, and the shopowner wants the prices to be shown for single bottles, this is not an ideal option, I guess.)

Lockerbie

#13
Another thing not wishable: all child products are in the dropdown, off course. But besides that, when searching on product name, you'll find all child products as single products displayed.

You should think there should be an easier solution for selling some products per 6, and others per single product...

Just an idea... isn't it possible to combine the special-quantity-option and the normal cart layout? I mean: the special-quantity-option is written for VM1, but isn't it possible to use something like this in a page-override, so you can choose per product what 'quantity-cart' you want to use?

Off course I've emailed the developer, but I've gotten no answer yet.
So since I'm no scripter, could someone point me in the right direction on how to adjust things... ?

Lockerbie

So here I am again. But now I know for certain that it's possible to have a template with a cart that adds/subtracts single products, and a template with a cart that adds/subtracts 6 products each time!
I can't seem to get it working right together at the same time though, but perhaps someone could help me with this?
This is what I did so far:

in components/com_virtuemar/assets/js/vmprices.js, about line 86 I added:
plus6  = cart.find('.quantity-plus6'),
    minus6 = cart.find('.quantity-minus6'),

and changed:
plus.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN) {
quantity.val(Qtt + 1);
Virtuemart.setproducttype(cart,virtuemart_product_id);
}

});
minus.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN && Qtt>1) {
quantity.val(Qtt - 1);
} else quantity.val(1);
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
select.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
radio.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
quantity.keyup(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});

to:
plus6.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN) {
quantity.val(Qtt + 6);
Virtuemart.setproducttype(cart,virtuemart_product_id);
}

});
minus6.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN && Qtt>6) {
quantity.val(Qtt - 6);
} else quantity.val(6);
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
select.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
radio.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
quantity.keyup(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});

and saved it as vmprices6.js

in components/com_virtuemart/views/productdetails/tmpl/default_addtocart.php, I changed:
    <span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus" />
<input type="button" class="quantity-controls quantity-minus" />
    </span>

to:
    <span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus6" />
<input type="button" class="quantity-controls quantity-minus6" />
    </span>

and saved this file as default_addtocart6.php

in components/com_virtuemart/views/productdetails/tmpl/default.php, I changed:
<?php
// Add To Cart Button
//  if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
if (!VmConfig::get('use_as_catalog'0) and !empty($this->product->prices)) {
    echo $this->loadTemplate('addtocart');
}  // Add To Cart Button END
?>

to:
<?php
// Add To Cart Button
//  if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
if (!VmConfig::get('use_as_catalog'0) and !empty($this->product->prices)) {
    echo $this->loadTemplate('addtocart6');
}  // Add To Cart Button END
?>

and saved this as default-per-6-flessen.php

Next, in VM-backend, I opened one article, set the article template to default-per-6-flessen and the minimum order to 6, and it worked!
But when I combine the code for the normal cart with this above, it isn't working anymore.

The file components/com_virtuemart/assets/js/vmprices6.js so far:
if(typeof Virtuemart==="undefined")

var Virtuemart = {
setproducttype : function(form,id){
var $ = jQuery ;
form.view = null ;
var datas = form.serialize(),
prices = $("#productPrice"+id);
datas = datas.replace("&view=cart", "");
prices.fadeTo("fast", 0.75);
$.getJSON(window.vmSiteurl+'index.php?option=com_virtuemart&nosef=1&view=productdetails&task=recalculate&format=json'+window.vmLang,encodeURIComponent(datas),
function(datas, textStatus) {
prices.fadeTo("fast", 1);
// refresh price
for(key in datas) {
var value = datas[key];
if (value!=0) prices.find("span.Price"+key).show().html(value);
else prices.find(".Price"+key).html(0).hide();
}
});
return false; // prevent reload
},
productUpdate : function(mod) {
var $ = jQuery ;
$.ajaxSetup({ cache: false })
$.getJSON(window.vmSiteurl+"index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json"+window.vmLang,
function(datas, textStatus) {
if (datas.totalProduct >0) {
mod.find(".vm_cart_products").html("");
$.each(datas.products, function(key, val) {
$("#hiddencontainer .container").clone().appendTo(".vmCartModule .vm_cart_products");
$.each(val, function(key, val) {
if ($("#hiddencontainer .container ."+key)) mod.find(".vm_cart_products ."+key+":last").html(val) ;
});
});
mod.find(".total").html(datas.billTotal);
mod.find(".show_cart").html(datas.cart_show);
}
mod.find(".total_products").html(datas.totalProductTxt);
}
);
},
sendtocart : function (form){
var $ = jQuery ;
if (Virtuemart.addtocart_popup ==1) {
$.ajaxSetup({ cache: false })
var datas = form.serialize();
$.getJSON(vmSiteurl+'index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json'+vmLang,encodeURIComponent(datas),
function(datas, textStatus) {
if(datas.stat ==1){
//var value = form.find('.quantity-input').val() ;
var txt = form.find(".pname").val()+' '+vmCartText;
$.facebox.settings.closeImage = closeImage;
$.facebox.settings.loadingImage = loadingImage;
$.facebox.settings.faceboxHtml = faceboxHtml;
$.facebox({ text: datas.msg +"<H4>"+txt+"</H4>" }, 'my-groovy-style');
} else if(datas.stat ==2){
var value = form.find('.quantity-input').val() ;
var txt = form.find(".pname").val();
$.facebox.settings.closeImage = closeImage;
$.facebox.settings.loadingImage = loadingImage;
$.facebox.settings.faceboxHtml = faceboxHtml;
$.facebox({ text: datas.msg +"<H4>"+txt+"</H4>" }, 'my-groovy-style');
} else {
$.facebox.settings.closeImage = closeImage;
$.facebox.settings.loadingImage = loadingImage;
$.facebox.settings.faceboxHtml = faceboxHtml;
$.facebox({ text: "<H4>"+vmCartError+"</H4>"+datas.msg }, 'my-groovy-style');
}
if ($(".vmCartModule")[0]) {
Virtuemart.productUpdate($(".vmCartModule"));
}
});
$.ajaxSetup({ cache: true });
} else {
form.append('<input type="hidden" name="task" value="add" />');
form.submit();
}
},
product : function(carts) {
carts.each(function(){
var cart = jQuery(this),
addtocart = cart.find('input.addtocart-button'),
plus   = cart.find('.quantity-plus'),
minus  = cart.find('.quantity-minus'),
plus6  = cart.find('.quantity-plus6'),
    minus6 = cart.find('.quantity-minus6'),
select = cart.find('select'),
radio = cart.find('input:radio'),
virtuemart_product_id = cart.find('input[name="virtuemart_product_id[]"]').val(),
quantity = cart.find('.quantity-input');

addtocart.click(function(e) {
Virtuemart.sendtocart(cart);
return false;
});
plus.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN) {
quantity.val(Qtt + 1);
Virtuemart.setproducttype(cart,virtuemart_product_id);
}

});
minus.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN && Qtt>1) {
quantity.val(Qtt - 1);
} else quantity.val(1);
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
select.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
radio.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
quantity.keyup(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});

plus6.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN) {
quantity.val(Qtt + 6);
Virtuemart.setproducttype(cart,virtuemart_product_id);
}

});
minus6.click(function() {
var Qtt = parseInt(quantity.val());
if (Qtt != NaN && Qtt>6) {
quantity.val(Qtt - 6);
} else quantity.val(6);
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
select.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
radio.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
quantity.keyup(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
});

}
};
jQuery.noConflict();
jQuery(document).ready(function($) {

Virtuemart.product($(".product"));

$("form.js-recalculate").each(function(){
if ($(this).find(".product-fields").length) {
var id= $(this).find('input[name="virtuemart_product_id[]"]').val();
Virtuemart.setproducttype($(this),id);

}
});
});



Since I'm no scripter, can someone please tell me where I went wrong?