1
Answers
Vote up!
0
Vote down!

How to customize the Form generated by product reference

This is my first Commerce project and everything seems to be working OK. However, this is a registration system, not product sales and my client want s few changes in the form that Commerce generates automatically from the product reference. The text above the select list says "Select a Product". They want to change that to "Select a Registration Type". Also, they want to change the order the products show up in the Select list. Other people seem to have said the order can't be changed. Is tyhis correct? That just doesn't seem right.

I have Devel installed but I cannot get the info from there. I tried installed Devel Themer to see if I could find where the form was being generated but it doesn't appear to work with Commerce. Can anyone tell me where this code is so I know what to override? The form id is "commerce-cart-add-to-cart-form-16-12-1-19-17-11"

Is there any other way to do it?

Thanks for any assistance.

Asked by: LizD
on November 18, 2012

1 Answer

Vote up!
1
Vote down!

You could change the text here:

<?php
$form
['attributes']['product_select']['#title'] = t('Select a product');
?>

The order of the products can be changed by entering the products in the order you'd like to show them. The way you change the order is entirely based on how your product reference field is managed. For example, if you're using Kickstart 2, then you can simply drag and drop your product variations in the order you'd like. If you're just using a standard Commerce install, you could potentially re-enter the product variations in the way you want.

Josh Miller
Answer by: Josh Miller
Posted: Mar 11, 2013