I have a product that will need to be sold only in multiples of 6 (6, 12, 18, 24, etc.)
Currently, the Quantity field on the product page is an open text field that will allow the user to enter any number in and purchase however many of the product they would like. Is there an option that allows me to change the Quantity box to a dropdown and only allow the product to be purchased in certain quantities? Or is my only option to call the product something like "Glass (6-Pack)" and leave it with an open text Quantity field and manage it that way?
Quantity Field, fixed amounts instead of open text field
Re: Quantity Field, fixed amounts instead of open text field
There isn't a built-in option for this.
To do this you would have to modify the ConLib\BuyProductDialog control. And unless all of your products have these quantity 6-pack constraints, you would need two versions of the product page and a way to switch between them. One version for standard products and another for the 6-pack products. If you have more packaging options then the variables multiply. And, if your search results or category pages let users select a quantity before adding to their cart, you would also need to update those controls for both product types.
The simplest approach is your "Glass (6-pack)" idea. I see a lot of sites that take that approach so I don't think it would confuse your customers.
To do this you would have to modify the ConLib\BuyProductDialog control. And unless all of your products have these quantity 6-pack constraints, you would need two versions of the product page and a way to switch between them. One version for standard products and another for the 6-pack products. If you have more packaging options then the variables multiply. And, if your search results or category pages let users select a quantity before adding to their cart, you would also need to update those controls for both product types.
The simplest approach is your "Glass (6-pack)" idea. I see a lot of sites that take that approach so I don't think it would confuse your customers.
Re: Quantity Field, fixed amounts instead of open text field
We did this for pet food sold in cases of 12. Our inventory is recorded in number of cans, but for our online orders, we only sell it by the case. I made a custom BuyProductDialog.ascx.cs where I just divided the available quantity by 12 and added the word " Cases" to the in stock message. Dividing the inv.InStock by 12 prevents customers from ordering more than we have and rounds down in the instance of a partial case being in stock. The only down side to this is that they can still raise the quantity on the basket page, since that quantity check won't do the division.
Here's the only code that I changed in BuyProductDialog.ascx.cs:
I did have to make new, renamed copies of Product.aspx, the Show Product content scriptlet, and the ConLib control BuyProductDialog.ascx. The .aspx page is identical to Product.aspx, the content scriptlet has "Case of 12" after the product name, and in the new BuyProductDialog.ascx, the CodeFile value points to the new BuyProductDialog.ascx.cs. With this setup I just have to change the product's display page for products that come in cases.
Here is an example of this in action: http://www.barknpurr.com/Instinct-Chick ... 7C366.aspx. I also added "Case of 12" to the product summary so that information is available on the category page.
Here's the only code that I changed in BuyProductDialog.ascx.cs:
Code: Select all
if ((inv.InventoryMode == InventoryMode.None) || (inv.AllowBackorder)) return;
//Added
//Divide stock by 12 to get number of cases.
inv.InStock /= 12;
if (inv.InStock > 0)
{
string inStockformat = Token.Instance.Store.Settings.InventoryInStockMessage;
string inStockMessage = string.Format(inStockformat, inv.InStock + " Cases"); //added " Cases"
InventoryDetailsPanel.Controls.Clear();
Here is an example of this in action: http://www.barknpurr.com/Instinct-Chick ... 7C366.aspx. I also added "Case of 12" to the product summary so that information is available on the category page.