Mandatory Field

General ShopSite user discussion

Mandatory Field

Postby takumaspin » Tue Mar 16, 2010 8:47 pm

Hello,

I have used the 'Ordering Instructions' box via the Shopping Cart Screen administration page and it is showing in my checkout. I would like to make this field mandatory. How can I make this extra field a mandatory field?

Thanks,
Kei
takumaspin
 
Posts: 29
Joined: Wed Sep 30, 2009 10:05 pm
Location: Bay Area

Postby takumaspin » Wed Mar 17, 2010 11:14 am

Hello, just wanted to see if anyone could help me get this to work.

Thanks!
takumaspin
 
Posts: 29
Joined: Wed Sep 30, 2009 10:05 pm
Location: Bay Area

Postby Jim » Wed Mar 17, 2010 2:36 pm

It would take special javascript to validate the input field and not allow the shopper to continue if it is empty. You would put the javascript in the field on Commerce Setup > Order System >checkout > Javascript added at start of built-in CheckIt function:

Also you could use the Custom Checkout fields on that same screen to add required fields to the checkout screen. See help at
http://shopsite.com/help/10.1/en-US/sc/ ... ields.html

Note that both these options would only work in a Pro level store.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby takumaspin » Sat Mar 20, 2010 11:16 am

Thanks Jim!

Can you tell me where I can edit the style of the error messages that appear on the screen? I believe it is the [-- ShopSiteMessages --] tag.

Thanks again!
takumaspin
 
Posts: 29
Joined: Wed Sep 30, 2009 10:05 pm
Location: Bay Area

Postby Jim » Sat Mar 20, 2010 12:03 pm

The style of the message will depend on the template that is being used.

View the source of the page when the message box is displayed. Find the message in the html code and look at the styles that are used. Then go to Merchandising > Custom Templates > Shopping cart and use the Copy ShopSite template to find the Template used for the theme you are using. Make a copy of that template and then edit the template and see which style files are included in the template (or perhaps the styles are defined right in the template.) If there are include files for the styles make note of which ones are used. Then go to Merchandising > Custom Templates > Includes and find the include files that are in the Shopping cart template and copy those include files. Look at each include file to see if it contains the style that is used on the [-- ShopSiteMessages --] in your shopping cart. Once you have found that section modify the style to meet your needs. After you have made the modifications and saved the file use the Copy button to copy your file and give it the same name as the ShopSite file you copied it from. This will allow your file to override the ShopSite provided include file.

Note you might be able to find what files are being use by going to http://www.shopsite.com/templates/cookb ... ates.shtml and find the template you are using and clicking on the link to see more details about the theme. Usually there is a list of all the files used by the theme so you can pick the .css files and in the backoffice just look at those include files.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby takumaspin » Mon Mar 22, 2010 1:49 am

Hi Jim,

Thanks for the reply. I was able to change it by editing the CSS that it was using. I did find one problem though. I have added the two custom fields and made them a required field. The first time around when the customer does not enter anything, the error that comes out with the warning.gif appears.

If I go back to the cart and go back to the checkout page, press submit again without entering anything, the two custom fields are not required fields any more and I get the popup warning that does not include the two custom fields.

Would you happen to know why this might happen?

Thanks
takumaspin
 
Posts: 29
Joined: Wed Sep 30, 2009 10:05 pm
Location: Bay Area

Postby Jim » Mon Mar 22, 2010 8:46 am

I'm not sure I understand what you are saying? Did you add the custom fields in the Commerce Setup > Order System > Checkout > Custom Checkout Fields ? Did you check the box to display the fields and check the Req box to make them required?

Or did you create them in the custom shopping cart template?

ShopSite saves the fields it knows about in a cookie so that when the page is reloaded the fields can be repopulated. Since it doesn't know about your custom fields it can't automatically save that data. You should be able to add some javascript to save the contents of the fields you added to a cookie and then reload them on a page refresh.

Note if you put default text in a text field you should also add that text to the Invalid Value field so that it will not be accepted as valid data for the required field.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 6 guests