custom fields for basketItem & orderItem
custom fields for basketItem & orderItem
Hi, we are creating a product that includes a user generated design. We need to add a custom field to basketItem and orderItem ( we are using kits) From what i've been reading in the forums we have 2 options
1) add an additional field "designId" to the basketItem & orderItem.
Question 1: I'm currently using demo install. When i get the full installation will i get access to basketItemDataSource & orderItemDataSource to recompile this new property? Obviously I'm aware still makes further installations troublesome.
2) Created a custom table/class.
Is this post:
viewtopic.php?f=44&t=6712
There is talk of creating a wrapper around AC classes.
I was wondering if someone could explain how you could create a wrapper that could add the property DesignId to BasketItem. The trouble in my mind is that you need to save the basket with new property in the BasketItem
ie: The code now
Basket basket = Token.Instance.User.Basket;
basket.Items.Add(basketItem);
basket.Save();
thanks,
1) add an additional field "designId" to the basketItem & orderItem.
Question 1: I'm currently using demo install. When i get the full installation will i get access to basketItemDataSource & orderItemDataSource to recompile this new property? Obviously I'm aware still makes further installations troublesome.
2) Created a custom table/class.
Is this post:
viewtopic.php?f=44&t=6712
There is talk of creating a wrapper around AC classes.
I was wondering if someone could explain how you could create a wrapper that could add the property DesignId to BasketItem. The trouble in my mind is that you need to save the basket with new property in the BasketItem
ie: The code now
Basket basket = Token.Instance.User.Basket;
basket.Items.Add(basketItem);
basket.Save();
thanks,
Re: custom fields for basketItem & orderItem
These classes are inside the CommerceBuilder API. You have to purchase the API as well if you want to have the source code. You can read more about the API at1) add an additional field "designId" to the basketItem & orderItem.
Question 1: I'm currently using demo install. When i get the full installation will i get access to basketItemDataSource & orderItemDataSource to recompile this new property? Obviously I'm aware still makes further installations troublesome.
http://wiki.ablecommerce.com/index.php/ ... uilder_API
This discussion sum up that you can't create the wrapper around AbleCommerce class. In fact that is about creating the wrapper around the database table. Read the following link for help2) Created a custom table/class.
Is this post:
viewtopic.php?f=44&t=6712
There is talk of creating a wrapper around AC classes.
I was wondering if someone could explain how you could create a wrapper that could add the property DesignId to BasketItem. The trouble in my mind is that you need to save the basket with new property in the BasketItem
ie: The code now
Basket basket = Token.Instance.User.Basket;
basket.Items.Add(basketItem);
basket.Save();
http://wiki.ablecommerce.com/index.php/ ... cess_Layer
Re: custom fields for basketItem & orderItem
thanks, i've tried another approach. Not glamourous but should work.
I can added a field to basketItem called ProductId and insert a record
"update ac_BasketItems set DesignId = 5 where BasketItemId = 199"
The next step is to add the designId to ac_OrderItem.
The problem is:
CheckoutResponse checkoutResponse = Token.Instance.User.Basket.Checkout(checkoutRequest);
This method adds everything from the basket to the order and then removes it from the basket Thus lose the basket after the order is create. Therefore i can't insert the designId. Any thoughts? Maybe i could save a collection prior to the basket being deleted.
Basket basket = Token.Instance.User.Basket;
List<int> designId = new List<int>();
foreach(BasketItem bi in basket.Items)
{
designId.Add(bi.BasketItemId);
}
CheckoutResponse checkoutResponse = Token.Instance.User.Basket.Checkout(checkoutRequest);
I can added a field to basketItem called ProductId and insert a record
"update ac_BasketItems set DesignId = 5 where BasketItemId = 199"
The next step is to add the designId to ac_OrderItem.
The problem is:
CheckoutResponse checkoutResponse = Token.Instance.User.Basket.Checkout(checkoutRequest);
This method adds everything from the basket to the order and then removes it from the basket Thus lose the basket after the order is create. Therefore i can't insert the designId. Any thoughts? Maybe i could save a collection prior to the basket being deleted.
Basket basket = Token.Instance.User.Basket;
List<int> designId = new List<int>();
foreach(BasketItem bi in basket.Items)
{
designId.Add(bi.BasketItemId);
}
CheckoutResponse checkoutResponse = Token.Instance.User.Basket.Checkout(checkoutRequest);
Re: custom fields for basketItem & orderItem
Mazhar, Thanks for link. Though don't understand it in the context of adding a custom field to BasketItem and OrderItem.
would you mind giving a further explanation. How can i put a wrapper around a table.
much appreciated.
would you mind giving a further explanation. How can i put a wrapper around a table.
much appreciated.
Re: custom fields for basketItem & orderItem
What I understand is that each product of yours will have an additional piece of information associated with it that you call the 'Design'. The established (and proposed) way of handling such additional information is to add them as custom fields to the products. Once you are using custom fields you do not need to worry about how your additional piece of information will be carried over in the basket and the order. When you add a product with a custom field to the basket the corresponding order item created for the product already includes the custom field information. Similarly when the basket gets converted into an order the custom field information is transfered to the order.Hi, we are creating a product that includes a user generated design. We need to add a custom field to basketItem and orderItem ( we are using kits) From what i've been reading in the forums we have 2 options
To my understanding the problem you are trying to solve should be tackled with product custom fields.
Addition of additional fields to ac_Tables and then managing them would require a great deal of effort. You will most probably need to purchase the source of AC7 class files. Given the problem at hand I am so far not able to understand why you would like to go for this approach.1) add an additional field "designId" to the basketItem & orderItem.
Question 1: I'm currently using demo install. When i get the full installation will i get access to basketItemDataSource & orderItemDataSource to recompile this new property? Obviously I'm aware still makes further installations troublesome.
The post you are referring is actually not using the word 'wrapper' in correct sense. Actually you do not 'wrap' existing Ablecommerce db access classes. If you want to make database changes to existing tables you will have difficulty managing them without the AC7 source. If you want to add new tables you do not need the source. Here is the best reference for this purpose http://wiki.ablecommerce.com/index.php/ ... cess_Layer2) Created a custom table/class.
Is this post:
viewtopic.php?f=44&t=6712
There is talk of creating a wrapper around AC classes.
Once Basket.Checkout is called, it will convert all basket items to order items and remove them. So you have no chance of moving the value of your new field to order items table after calling the Basket.Checkout ... You can't do it before calling Basket.Checkout because by that time no order exists ... What you can probably do is keep the data in some temporary object, call Basket.Checkout(), if the checkout is successful and order is created, set the values from temporary object to the order items in the new order.thanks, i've tried another approach. Not glamourous but should work.
I can added a field to basketItem called ProductId and insert a record
"update ac_BasketItems set DesignId = 5 where BasketItemId = 199"
The next step is to add the designId to ac_OrderItem.
The problem is:
But before going through this hassle please do check the use of custom fields. I think they should be sufficient to handle your requirements.
Re: custom fields for basketItem & orderItem
thanks, let me be more specific.
we are using a Kit which consist of 1 -> unlimited products
ie
- T-shirt
- design 1 (Guid)
- design 2 (Guid)
- design 3 (Guid)
each of the designs needs a unique id.
When you mention adding custom fields to product, are you referring to varients. I don't see anything in the admin that adds custom fields.
we are using a Kit which consist of 1 -> unlimited products
ie
- T-shirt
- design 1 (Guid)
- design 2 (Guid)
- design 3 (Guid)
each of the designs needs a unique id.
When you mention adding custom fields to product, are you referring to varients. I don't see anything in the admin that adds custom fields.
Re: custom fields for basketItem & orderItem
In fact you can add custom fields to product using product templates. See the Catalog-> Product Templates. You can add two types of custom fields either Merchant or Customer. For merchant fields the merchant will provide a value and for customer fields the customer can provide a value.
After creating a Product Template you need to apply that template to the product. For this edit a product and from left side menu select Product Template and then select and apply your product template to the product.
After creating a Product Template you need to apply that template to the product. For this edit a product and from left side menu select Product Template and then select and apply your product template to the product.
Re: custom fields for basketItem & orderItem
wow, thats its. Really appreciate your response. Very useful feature..
ok, now for bonus point. Is there a way to set up a category that will always use a product templete?
ie everything put in category Tshirt will use the product template called "ShirtTemplate"
thanks again.
ok, now for bonus point. Is there a way to set up a category that will always use a product templete?
ie everything put in category Tshirt will use the product template called "ShirtTemplate"
thanks again.
Re: custom fields for basketItem & orderItem
You have to apply Product Template foreach product one by one there is no support for Category level.wow, thats its. Really appreciate your response. Very useful feature..
ok, now for bonus point. Is there a way to set up a category that will always use a product templete?
ie everything put in category Tshirt will use the product template called "ShirtTemplate"
thanks again.
Re: custom fields for basketItem & orderItem
Could be a nice enhancement if this facility is provided.You have to apply Product Template foreach product one by one there is no support for Category level.