kit and show variants in stock
kit and show variants in stock
Regarding kits.
I want to display items in stock at each variant.
Now, in the radiobuttonlist / dropdown list, it displays only "2 GB Dual Channel DDR2 SDRAM at 667MHz- 2DIMMs - (kr 0.00)" .
I want to display: "2 GB Dual Channel DDR2 SDRAM at 667MHz- 2DIMMs - (kr 0.00) - 12 items in stock"
Is this possible? Where ?
Do I need to buy the source code?
I want to display items in stock at each variant.
Now, in the radiobuttonlist / dropdown list, it displays only "2 GB Dual Channel DDR2 SDRAM at 667MHz- 2DIMMs - (kr 0.00)" .
I want to display: "2 GB Dual Channel DDR2 SDRAM at 667MHz- 2DIMMs - (kr 0.00) - 12 items in stock"
Is this possible? Where ?
Do I need to buy the source code?
Re: kit and show variants in stock
No need to buy source for this change. Try following fix
Go to following method
in App_Code/ProductHelper.cs class and locate following code lines
and replace them with below code block
Go to following method
Code: Select all
public static List<int> BuildKitOptions(Product product, PlaceHolder phOptions)
Code: Select all
if (o != null)
{
Type oType = o.GetType();
if (oType.Equals(typeof(RadioButtonList)))
{
((RadioButtonList)o).AutoPostBack = true;
}
else if (oType.Equals(typeof(DropDownList)))
{
((DropDownList)o).AutoPostBack = true;
}
else if (oType.Equals(typeof(CheckBoxList)))
{
((CheckBoxList)o).AutoPostBack = true;
}
phOptions.Controls.Add(o);
// SEE WHETHER A VALID VALUE FOR THIS FIELD IS PRESENT IN FORM POST
List<int> theseOptions = component.GetControlValue(o);
selectedChoices.AddRange(theseOptions);
}
Code: Select all
if (o != null)
{
Type oType = o.GetType();
if (oType.Equals(typeof(RadioButtonList)))
{
((RadioButtonList)o).AutoPostBack = true;
RadioButtonList rbl = ((RadioButtonList)o);
foreach (KitProduct kitProduct in component.KitProducts)
{
ListItem listItem = rbl.Items.FindByValue(kitProduct.KitProductId.ToString());
if (listItem != null)
listItem.Text += string.Format("- {0} item{1} in stock", kitProduct.Product.InStock,(kitProduct.Product.InStock > 1)?"s":string.Empty);
}
}
else if (oType.Equals(typeof(DropDownList)))
{
((DropDownList)o).AutoPostBack = true;
DropDownList ddl = ((DropDownList)o);
foreach (KitProduct kitProduct in component.KitProducts)
{
ListItem listItem = ddl.Items.FindByValue(kitProduct.KitProductId.ToString());
if (listItem != null)
listItem.Text += string.Format("- {0} item{1} in stock", kitProduct.Product.InStock, (kitProduct.Product.InStock > 1) ? "s" : string.Empty);
}
}
else if (oType.Equals(typeof(CheckBoxList)))
{
((CheckBoxList)o).AutoPostBack = true;
CheckBoxList chkl = ((CheckBoxList)o);
foreach (KitProduct kitProduct in component.KitProducts)
{
ListItem listItem = chkl.Items.FindByValue(kitProduct.KitProductId.ToString());
if (listItem != null)
listItem.Text += string.Format("- {0} item{1} in stock", kitProduct.Product.InStock, (kitProduct.Product.InStock > 1) ? "s" : string.Empty);
}
}
phOptions.Controls.Add(o);
// SEE WHETHER A VALID VALUE FOR THIS FIELD IS PRESENT IN FORM POST
List<int> theseOptions = component.GetControlValue(o);
selectedChoices.AddRange(theseOptions);
}
Re: kit and show variants in stock
Yes, that works if inventory tracking is set to Track Products, but it displays "0 items in stock" if the inventory tracking is set to "Track Variants". (E.g. against the t-shirts)
And I have double checked that stock is set >0 on the variants.
Please, help me. I am almost there now...
And I have double checked that stock is set >0 on the variants.
Please, help me. I am almost there now...
Re: kit and show variants in stock
Thank's for the links regarding multilanguage.
But can you still help me with showing stocks for variants. (I just changed my previous post when I discovered that it shows "0 items in stock" when an option in a kit is mapped to a variant in another product. (e.g. mapping to Male, Large in the shirt product).
But can you still help me with showing stocks for variants. (I just changed my previous post when I discovered that it shows "0 items in stock" when an option in a kit is mapped to a variant in another product. (e.g. mapping to Male, Large in the shirt product).
Re: kit and show variants in stock
You can update the if statement as below to take care of product variants as well
Code: Select all
if (listItem != null)
{
if(kitProduct.ProductVariant != null)
listItem.Text += string.Format("- {0} item{1} in stock", kitProduct.ProductVariant.InStock, (kitProduct.ProductVariant.InStock > 1) ? "s" : string.Empty);
else
listItem.Text += string.Format("- {0} item{1} in stock", kitProduct.Product.InStock, (kitProduct.Product.InStock > 1) ? "s" : string.Empty);
}
Re: kit and show variants in stock
Great ! Thank you.
I have a proposal for improvement for the next version:
E.g. take the t-shirt in demo (presented as an ordinary product, not kit), this comes in sizes (small,large...) and gender (male,female).
Now then, instead of selecting from two drop-down-list (gender and size), let the user select from a single drop-down-list/radio-buttons. Like this:
* Male, Small, 2 items in stock
* Male, Large, 4 items in stock
...
* Female, Small, Out of stock. Approx. 3 weeks of delivery time.
* Female, Medium, 1 item in stock.
..
This will show the currrent stock to the user immediately - he doesn't need to select from two different combos in order to make the "out-of-stock-message" appear.
If backorders are not allowed, the variant combination should not appear at all.
If backorders are allowed, an approximately delivery time should be showed to the user (e.g. 3 weeks of delivery time). This should be given at each product.
The only way to solve this today, is to use kits and putting the delivery time into one of the existing field (e.g. at end of the SKU separated by a semi-colon).
You should consider this, I have seen a lot of norwegian shopping systems that has this functionality.
I have a proposal for improvement for the next version:
E.g. take the t-shirt in demo (presented as an ordinary product, not kit), this comes in sizes (small,large...) and gender (male,female).
Now then, instead of selecting from two drop-down-list (gender and size), let the user select from a single drop-down-list/radio-buttons. Like this:
* Male, Small, 2 items in stock
* Male, Large, 4 items in stock
...
* Female, Small, Out of stock. Approx. 3 weeks of delivery time.
* Female, Medium, 1 item in stock.
..
This will show the currrent stock to the user immediately - he doesn't need to select from two different combos in order to make the "out-of-stock-message" appear.
If backorders are not allowed, the variant combination should not appear at all.
If backorders are allowed, an approximately delivery time should be showed to the user (e.g. 3 weeks of delivery time). This should be given at each product.
The only way to solve this today, is to use kits and putting the delivery time into one of the existing field (e.g. at end of the SKU separated by a semi-colon).
You should consider this, I have seen a lot of norwegian shopping systems that has this functionality.
Re: kit and show variants in stock
If you think this is something helpful you can create a poll in feature request forum.lars-erik wrote:Great ! Thank you.
I have a proposal for improvement for the next version:
E.g. take the t-shirt in demo (presented as an ordinary product, not kit), this comes in sizes (small,large...) and gender (male,female).
Now then, instead of selecting from two drop-down-list (gender and size), let the user select from a single drop-down-list/radio-buttons. Like this:
* Male, Small, 2 items in stock
* Male, Large, 4 items in stock
...
* Female, Small, Out of stock. Approx. 3 weeks of delivery time.
* Female, Medium, 1 item in stock.
..
This will show the currrent stock to the user immediately - he doesn't need to select from two different combos in order to make the "out-of-stock-message" appear.
If backorders are not allowed, the variant combination should not appear at all.
If backorders are allowed, an approximately delivery time should be showed to the user (e.g. 3 weeks of delivery time). This should be given at each product.
The only way to solve this today, is to use kits and putting the delivery time into one of the existing field (e.g. at end of the SKU separated by a semi-colon).
You should consider this, I have seen a lot of norwegian shopping systems that has this functionality.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: kit and show variants in stock
You could do the dual options now by making the option a combination of the size and color instead of separate fields.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: kit and show variants in stock
Can the same thing be achieved with non-kit products with a 1-dimension variant ?
I sell shoes, and want to display the available sizes in stock in the text in the drop-down-list. I DON'T want the customer to be notified with a "out-of-stock" message after the shoe size is selected.
E.g.
Shoe,
the text in the drop-down-list:
Choose size:
<42, 12 items in stock>
<43, no items in stock>
Is this possible?
I sell shoes, and want to display the available sizes in stock in the text in the drop-down-list. I DON'T want the customer to be notified with a "out-of-stock" message after the shoe size is selected.
E.g.
Shoe,
the text in the drop-down-list:
Choose size:
<42, 12 items in stock>
<43, no items in stock>
Is this possible?
Re: kit and show variants in stock
Edit your ProductHelper.cs class BuildProductOptions method and locate following code block in code section where dropdown list being added dynamically
and then change it as below
Code: Select all
foreach (OptionChoice optionOption in availableOptions)
{
aspOptions.Items.Add(new ListItem(optionOption.Name, optionOption.OptionChoiceId.ToString()));
}
Code: Select all
foreach (OptionChoice optionOption in availableOptions)
{
List<int> chList = new List<int>();
chList.Add(optionOption.OptionChoiceId);
ProductVariant productVariant = ProductVariantDataSource.LoadForOptionList(product.ProductId, chList.ToArray());
if (productVariant != null)
{
string msg = string.Format("- {0} item{1} in stock", productVariant.InStock, (productVariant.InStock > 1) ? "s" : string.Empty);
aspOptions.Items.Add(new ListItem(optionOption.Name + msg , optionOption.OptionChoiceId.ToString()));
}
else
aspOptions.Items.Add(new ListItem(optionOption.Name, optionOption.OptionChoiceId.ToString()));
}