Customer Text Entry Fields

Questions and answers about ShopSite Custom Templates

Customer Text Entry Fields

Postby tmlogo » Thu Aug 01, 2013 2:36 pm

I am looking to do Customer Text Entry Fields on a template, and I have followed the instructions as laid out on Example 2.. http://www.shopsite.com/templates/cookbook/product16-textentryfielddivided.shtml

When I test the product, this error message comes up in the shopping cart:
"has product options which do not match what is in the database."

I have other options in the Pull-down Menus and they work fine when I don't add the code referenced above.

Thank you in advance.
tmlogo
 
Posts: 103
Joined: Tue Jun 17, 2008 3:00 pm

Re: Customer Text Entry Fields

Postby ShopSite Nicole » Thu Aug 01, 2013 4:02 pm

I believe that the second option replaces the ordering option pull down menus. So if you have ordering option pull down menus you can't use the 2nd example, you have to use the 1st example, which uses the customer text entry field.
ShopSite Nicole
 
Posts: 184
Joined: Thu Jan 14, 2010 10:30 am
Location: Utah

Re: Customer Text Entry Fields

Postby Jim » Thu Aug 01, 2013 4:04 pm

Try going to Commerce Setup > Order System > Shopping Cart and check the box by "Ordering Options can be defined outside of ShopSite" (Read the warning that is associated with the box.)
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Customer Text Entry Fields

Postby tmlogo » Thu Aug 01, 2013 4:12 pm

Jim.... I have read the warning. Would this possibility for malicious users affect only one person's order, or the entire system? I have also just tried it, and in the shopping cart the other pulldown items I have are listed appear with a comma following and then the "line 1 goes here" etc. I need to know how to put the line items underneath my pulldown items and how to make the third line appear.

i.e

Purple, Line 1, line 1 goes here
Gift box, Line 2, line 2 goes here
(Third Line my Option shows, but the "Line 3, line 3 goes here does not appear)
tmlogo
 
Posts: 103
Joined: Tue Jun 17, 2008 3:00 pm

Re: Customer Text Entry Fields

Postby Jim » Thu Aug 01, 2013 8:19 pm

The warning just means that it would be possible for someone to change the values on their own order so that it may not be exactly what you are expecting. They would have to save a copy of the page you have your code on and make the changes to the html and then submit the form. This isn't something that is likely to occur but it could so you would need to watch your orders in case something unexpected is input.

Please post the entire section of code that you are using. I didn't write the code in the examples so I don't know exactly how it is suppose to work but someone might be able to tell from your code if something is wrong or if that is just the way it is suppose to work.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Customer Text Entry Fields

Postby tmlogo » Fri Aug 02, 2013 7:49 am

Thanks Jim.

This is the coding I have. It has worked perfectly until I added the coding for the customer text entry fields.

<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method=post>

[-- PRODUCT.DisplayOrderingOptions --]
[-- PRODUCT.OptionText --]
[-- ORDER_OPTION_MENU COLUMN --]
[--PRODUCT.Field3 --]
<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type="hidden"
id="[-- PRODUCT.RecordNumber --]:finopt:0" value="Line 1 ">
Line 1 <input name="[-- PRODUCT.RecordNumber --]:finopt:0" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:0" value="line 1 goes here" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type="hidden"
id="[-- PRODUCT.RecordNumber --]:finopt:1" value="Line 2 ">
Line 2 <input name="[-- PRODUCT.RecordNumber --]:finopt:1" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:1" value="line 2 goes here" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="hidden"
id="[-- PRODUCT.RecordNumber --]:finopt:2" value="Line 3 ">
Line 3 <input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:2" value="line 3 goes here" size="15"><br>


<input type=text size=2 name="[-- PRODUCT.RecordNumber --]:qnty" value="1" >
<input type=hidden name=storeid value=[-- STORE_ID --]>
<input type=hidden name=dbname value=products>
<input type=hidden name=function value=add>
<input type=hidden name=itemnum value=[-- PRODUCT.RecordNumber --]>
<input type="hidden" name="[-- PRODUCT.RecordNumber --]:finoptnum" value="3">
<input class="add" input type=image src="/media/add.gif" width="80" height="24" border="0" align="absbottom" name="Add to Cart0" alt="Add to Cart"></form>
tmlogo
 
Posts: 103
Joined: Tue Jun 17, 2008 3:00 pm

Re: Customer Text Entry Fields

Postby Jim » Fri Aug 02, 2013 10:43 am

Ok, several things are wrong.
1. [-- PRODUCT.DisplayOrderingOptions --] just displays "checked" on the page, it doesn't do anything in the template itself.
2. The code from the cookbook is used to replace the order options pulldowns for the product, so trying to use both that code and the tag [-- ORDER_OPTION_MENU COLUMN --] results in a combining of the pull down options and the text fields which is why you get
Code: Select all
Purple, Line 1, line 1 goes here
Gift box, Line 2, line 2 goes here
(Third Line my Option shows, but the "Line 3, line 3 goes here does not appear)

The Purple and Gift box are options selected from the pulldowns. The text Line #, Line # goes here is coming from the text fields but since they have the same finopt:# as the options from the pulldowns (which you should be able to see if you view the page source) they are combined in the shopping cart.

I haven't tried but it might be able to make some changes and get both to work.
1. Change the 3 finopt# values for the code copied from the cookbook from 0, 1, 2 to 2,3,4
2. Change the 3 in this line
Code: Select all
<input type="hidden" name="[-- PRODUCT.RecordNumber --]:finoptnum" value="3">
to a 5. This will tell the code there are 5 finopt values, 2 from the pulldown menus and 3 from the cookbook code.

Give that a try and see if it works then.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Customer Text Entry Fields

Postby tmlogo » Fri Aug 02, 2013 12:44 pm

Hi Jim... Unfortunately it didn't work. The items from the cookbook now don't transfer to the cart. It looks to me like ShopSite is automatically putting in a value for the finoptnum from the order options, and then the finoptnum I enter for the cookbook items is possibly ignored. It is in the source code for the product twice.
tmlogo
 
Posts: 103
Joined: Tue Jun 17, 2008 3:00 pm

Re: Customer Text Entry Fields

Postby tmlogo » Fri Aug 02, 2013 1:04 pm

Hi Jim.... I just tried to put:

<input type="hidden" name="[-- PRODUCT.RecordNumber --]:finoptnum" value="5">

above the Ordering Options tag hoping that it would supercede and take preference over the ShopSite code and it worked! ;-)

Thank you for all of your help
tmlogo
 
Posts: 103
Joined: Tue Jun 17, 2008 3:00 pm

Re: Customer Text Entry Fields

Postby Jim » Fri Aug 02, 2013 1:14 pm

The following works for me with a product that has 2 option pulldown. I can make selections for the options and enter text in the 3 input fields and it is all displayed as separate lines in the shopping cart

Code: Select all
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method=post>
<input type="hidden" name="[-- PRODUCT.RecordNumber --]:finoptnum" value="5">
[-- PRODUCT.DisplayOrderingOptions --]
[-- PRODUCT.OptionText --]
[-- ORDER_OPTION_MENU COLUMN --]
[--PRODUCT.Field3 --]
<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="hidden"
id="[-- PRODUCT.RecordNumber --]:finopt:2" value="Line 1 ">
Line 1 <input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:2" value="line 1 goes here" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type="hidden"
id="[-- PRODUCT.RecordNumber --]:finopt:3" value="Line 2 ">
Line 2 <input name="[-- PRODUCT.RecordNumber --]:finopt:3" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:3" value="line 2 goes here" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:4" type="hidden"
id="[-- PRODUCT.RecordNumber --]:finopt:4" value="Line 3 ">
Line 3 <input name="[-- PRODUCT.RecordNumber --]:finopt:4" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:4" value="line 3 goes here" size="15"><br>


<input type=text size=2 name="[-- PRODUCT.RecordNumber --]:qnty" value="1" >
<input type=hidden name=storeid value=[-- STORE_ID --]>
<input type=hidden name=dbname value=products>
<input type=hidden name=function value=add>
<input type=hidden name=itemnum value=[-- PRODUCT.RecordNumber --]>

<input class="add" input type=image src="/media/add.gif" width="80" height="24" border="0" align="absbottom" name="Add to Cart0" alt="Add to Cart"></form>
Here is the output from the cart
Code: Select all
blue
two
Line 1 ,line 1 goes here1
Line 2 ,line 2 goes here2
Line 3 ,line 3 goes here3


What I did was renumber all of the finopt# values to start at the number of options (since the counting starts at 0 not 1) and increase for each text field. I also moved the line <input type="hidden" name="[-- PRODUCT.RecordNumber --]:finoptnum" value="5"> to the very top of the form so that the value would be set early and override any change made later.

Hope that helps.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Customer Text Entry Fields

Postby tmlogo » Fri Aug 02, 2013 1:18 pm

Thank you Jim.... I guess you missed my reply where I had gotten to work... basically I think the trick was to move that one line up!

Thanks again.
tmlogo
 
Posts: 103
Joined: Tue Jun 17, 2008 3:00 pm


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 21 guests