Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Product page dynamic custom inputs
 
TWTeam
Jr. Member
 
Total Posts:  2
Joined:  2013-06-18
 

I am trying to add dynamically generated inputs to the product page that are carried into the cart, quote item, and order item. I am using a product attribute that contains XML to store the configuration for each product. Based on that configuration, I need to generate html on the product page for the dynamic inputs, change the price being displayed on the product page to reflect their selections, and show special output in the cart, order email, and backend.

So far, I have done the following:
1. Created a product attribute that stores the configuration XML.
2. Extended the product view block to allow me to access the configuration from the view template.
3. Copied and modified the products view.phtml to allow me to show the inputs.

What I’m confused about at the moment is:
1. How to have the values the customer enters stored with/in the cart, quote, and order.
2. How to show what the customer entered/selected in the cart and order pages (and the admin area).
3. Change the subtotal based on the customers selections so that the order total is correct on the cart page and throughout checkout, etc.

The reason I not using custom options or attributes is because the inputs are so complicated. One input may drive what others are required, etc.

For example:
Example XML that is stored in the product attribute:

<myconfig>
    <
decoration_method_list>
        <
decoration_method>
            <
service_code>EMB</service_code>
            <
label>Embroidered</label>
            <
setup_charge>25.00</setup_charge>
            <
must_specify_colors>0</must_specify_colors>
        </
decoration_method>
        <
decoration_method>
            <
service_code>SP</service_code>
            <
label>Screenprinted</label>
            <
setup_charge>25.00</setup_charge>
            <
must_specify_colors>1</must_specify_colors>
        </
decoration_method>
    </
decoration_method_list>
    <
decoration_location_list>
        <
location>
            <
location_code>LC</location_code>
            <
label>Left Chest</label>
            <
available_decoration_methods>
                <
service_code>SP</service_code>
                <
service_code>EMB</service_code>
            </
available_decoration_methods>
        </
location>
        <
location>
            <
location_code>FB</location_code>
            <
label>Full Back</label>
            <
available_decoration_methods>
                <
service_code>SP</service_code>
            </
available_decoration_methods>
        </
location>
     <
decoration_location_list>
</
myconfig>

This xml would require the product page to have two location options that can be selected by the user. If either are selected, they must select the decoration method for the location as well.  Certain decoration methods require the user to add a list of colors.

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedev
Sr. Member
 
Avatar
Total Posts:  117
Joined:  2009-06-01
 

I would strongly recommend to rather extend built in functionality (custom options if you don’t need control the stock or configurable products if you need stock management). It would definitely be easier to configure how the custom options are presented to the user than implementing entire process from scratch. You can also have a look at these extensions:

http://www.magentocommerce.com/magento-connect/dependent-custom-options.html
http://www.magentocommerce.com/magento-connect/catalog/product/view/id/17757/

Hope that helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
TWTeam
Jr. Member
 
Total Posts:  2
Joined:  2013-06-18
 

Thanks for the advice!

The input needs to be pretty complex. For example, a dynamic list of colors are required for some decoration methods, but not others. It will depend on which method the user selects for a specific location.  Maybe a good way to accomplish this would be to create a custom option type where
(1) a custom option of this type is dynamically attached to the product when its viewed based on if it has the config XML attribute defined,
(2) each place the option displays (product view, cart, order, etc) is custom so the more complicated input/display can be provided, and
(3) the price adjustment and SKU are dynamically set based on what the user chooses.

We are under a pretty strict deadline so we may need to cut some corners to get this done on-time. Does this custom option type sound better and is there a good starting point for creating it?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top