Page 1 of 1

Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 7:48 am
by heinscott
Hello,

Just wondering if someone could tell me how the code has changed for creation of kits in 7.02? I had some code I made to allow for kits inside of kits, so we could create different sizes of pool packages that all included a certain "kit" of items. It seems now, with the upgrade, that something changed, and my method for creating these kits no longer works. Can anyone explain to me how (through code) I could create a kit product if I have a list of the product Id's that will make up the package?? I was using :

BasketItem basketItem = BasketItemDataSource.CreateForProduct(4876, 1, "", _SelectedKitProducts);

as a test for creating a pool package with certain options I had selected. When I add this basket item, it will show up in the basket, but no components show up in the basket. (I have verified that _SelectedKitProducts contains the proper ids of components I'd like to add)

Any ideas for me?

Thanks,

Scott

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 8:04 am
by mazhar
7.0.2 have same implementations of kitting feature as 7.0.0 do, no change.

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 9:33 am
by heinscott
I think that maybe some things were actually fixed with pricing that we weren't aware of. I just thought that there was a major change because of hidden (included) kit items defaulting to NOT show in the cart. Once we changed back to true, we were able to figure out our problem with pricing fairly quickly.
Thanks for the response, Mazhar!

Scott

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 9:37 am
by Logan Rhodehamel
Can I ask to clarify? The products you want to associate with the master product are in _SelectedKitProducts, but this is a list you have generated through some custom code and not necessarily what you would see from the admin side if you viewed the kit. Is that correct?

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 10:07 am
by heinscott
No, they are actually all items that from Admin, would be include in the kit. I didn't included in the message, however, that for each one of the _SelectedKitProducts ints I run...

Code: Select all

            foreach (int i in _SelectedKitProducts)
            {
                KitProduct kp = KitProductDataSource.Load(i);
                if (kp.Product.KitStatus.Equals(KitStatus.Master))
                {
                    foreach (ProductKitComponent kpc in kp.Product.ProductKitComponents)
                    {
                        foreach (KitProduct mykp in kpc.KitComponent.KitProducts)
                        {
                            BasketItemKitProduct bikp = BasketItemKitProductDataSource.Load(basketItem.BasketItemId, mykp.KitProductId);
                            basketItem.BasketItemKitProducts.Add(bikp); //Add component to original basket item
                        }
                    }
                }
            }
Everything did indeed work correctly for me, though I couldn't see it because the kit items were set to 'included hidden'. I also had to change where the pricing for the kit was coming from. The way I had it setup caused the pricing to be added twice to the kit. Made it easier to just make the first level kit items contain the price, with everything inside set to zero.

Thanks for the help.

Scott

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 10:11 am
by Logan Rhodehamel
Scott... just remember that kit generation IS going to change for 7.0.3. It's a fairly major change. You will probably have to make adjustments to your custom code to accomodate it, so keep that in mind.

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 10:20 am
by heinscott
Absolutely, thanks Logan. This is a fairly small part of our kitting in Able. Only for a few special products that we couldn't figure out any other way to display. As long as my normal kitted items (ie, a master product set to a Zero cost, that allows for a different combination of internal products) still works in a similar fashion after 7.03 upgrade, I think we should be okay ultimately. If I have to revise custom code for just a few things, it's not too big a deal.
Can you tell me how kitted products will work in the next version?
Thanks a lot,

Scott

Re: Change in kit generation in v. 7.02??

Posted: Mon Apr 13, 2009 10:26 am
by Logan Rhodehamel
Two major changes I see impacting you are

- The list of kit products is validated to ensure it's accurate and complete. So if the list of kit products does not jive with something that it considers possible based on the admin configuration, the kit is considered invalid.

- Kit products are added to the basketitems table along with the master product.

I am not sure how your custom code works, but I do not think these will be blockers. Depending on how the kit product is set up in the admin, perhaps it will not change anything at all.