Page 1 of 1
Forcing item to be sold in multiples
Posted: Mon Aug 25, 2014 1:14 pm
by Brewhaus
We have a group of products that we only sell in multiples of 12 due to customization. I cannot find in AC Gold R6 that this is possible, and on the forum I only found a method for AC7 (via manipulating files and scriptlets, which AC Gold does not appear to use). Has anyone managed this with Gold R6, or can offer insight on how to go about this?
Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 8:05 am
by mazhar
You can try two things here. First from admin edit product page set the minimum purchase quantity for product to 12. This will make sure when some one will add product from category listings it will have a quantity of 12. Secondly on product details page where you can change product quantity it will be initialized with value 12 and won't let you put any thing less then it. In order to make sure value is always multiple of 12 you can use ASP.NET custom validator with some javascript to make the happen.
Edit
Website/ConLib/BuyProductDialog.ascx file and locate following location
Code: Select all
<asp:PlaceHolder ID="QuantityLimitsPanel" runat="server" EnableViewState="false"></asp:PlaceHolder>
and then update it like
Code: Select all
<script type="text/javascript">
function validateMultiples(source, arguments) {
if (arguments.Value % 12 == 0) {
arguments.IsValid = true;
} else {
arguments.IsValid = false;
}
}
</script>
<asp:CustomValidator ID="MultipleQuantityValid" runat="server" ControlToValidate="Quantity" ClientValidationFunction="validateMultiples" ValidationGroup="AddToBasket" Text="*" ErrorMessage="Quantity must be multiple of 12."></asp:CustomValidator>
<asp:PlaceHolder ID="QuantityLimitsPanel" runat="server" EnableViewState="false"></asp:PlaceHolder>
Hopefully that will help.
Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 8:13 am
by ChipWV
How about creating a kit of 12? Customer orders 2 kits they get 24, ect.
Hope this helps.
Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 8:14 am
by Brewhaus
Thank you, Mazhar. Will we need to create a new Product.ascx and .cs page, and a new BuyProductDialog.ascx and .cs file so that only certain products are forced to purchase in multiples of 12?
Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 8:18 am
by Brewhaus
That is a good idea, Chip. I will look at both options and decide.
Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 8:24 am
by mazhar
Brewhaus wrote:Thank you, Mazhar. Will we need to create a new Product.ascx and .cs page, and a new BuyProductDialog.ascx and .cs file so that only certain products are forced to purchase in multiples of 12?
Actually you can make one more small code update to make this happen. Edit
Website/ConLib/BuyProductDialog.ascx.cs file and locate following code
Code: Select all
if (Quantity.MinValue > 0) Quantity.Text = Quantity.MinValue.ToString();
and update it like
Code: Select all
if (Quantity.MinValue > 0) Quantity.Text = Quantity.MinValue.ToString();
MultipleQuantityValid.Visible = _Product.MinQuantity > 0 && _Product.MinQuantity == 12;
This will make this custom validator only work when a product has minimum quantity set to 12.
Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 8:41 am
by Brewhaus
Thank you, Mazhar. I will test this out later today when I get the time.

Re: Forcing item to be sold in multiples
Posted: Thu Aug 28, 2014 10:58 am
by Brewhaus
Your solution worked perfectly, Mazhar. Thank you again!