Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Create a Custom Product Option with Open Text? View modes: 
User avatar
Member
Member
TexasT - 2/14/2010 10:08:46 PM
   
Create a Custom Product Option with Open Text?
I know there are only dropdown and radio button product options that can be setup. But my goal is to create a product, in which the user can add custom options (or notes) to a product as they add it to the shopping cart. Currently, the only way to achieve this is by going through the cart process and adding notes to the order. I'd like there to be notes tied to a product (or possibly multiple products).

Is there an easy way to achieve this?

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 2/15/2010 1:55:23 PM
   
RE:Create a Custom Product Option with Open Text?
Hi,

I understand your needs, but I am afraid it is not supported now. It will require heavy customization of the e-commerce.

At first, you can add for example only one field of type boolean. This field can be then editable on the Custom fields for the product option. This will indicate if the text area should be displayed or not.

Then, in the Shopping cart selector (\CMSModules\Ecommerce\Controls\ProductOptions\ShoppingCartItemSelector.ascx.cs) you will need to add the logic, which will check the value from the custom boolean field and display or hide the text area.

There is AddProductToShoppingCart() method in this file. In this method you can see that the URL is being build with the querystring parameters. So, you will need to add new parameter which will hold the data from the text area, so they can be passed to the shopping cart itself. Then, you will also need to modify the shopping cart steps to display the value of this product option.

Then you can store this data in ShoppingCart.CustomData property.

We are already planning to add this feature in one of the next versions.

I hope it will help.

Best regards,
Miroslav Remias.

User avatar
Member
Member
TexasT - 2/15/2010 8:58:30 PM
   
RE:Create a Custom Product Option with Open Text?
Thanks for the quick reply. What I did to solve my issue is to place a text area in the ShoppingCartItemSelector.ascx file and add the value to a session variable when adding the item to the shopping cart. I used the SKU Item ID as the session variable name, as it should be unique.

Then on the shopping cart preview page, I am looping through the shopping cart items from order object and using the SKU Item ID to build and search the session variables for any values. I am building a string of formatted text from any values and showing it in the Order Notes text area.

The user can now add notes on the product pages and make last minute modifications before submitting their order. This allows the shopping cart to function normally.

If I find a problem with this approach, I will probably use the ShoppingCart.CustomData property.