Help with Extra Fields

General ShopSite user discussion

Help with Extra Fields

Postby Jacque » Wed Nov 05, 2008 8:40 am

I would like to get some advice on how to get my extra field to display in my shopping cart. I want an input box (not a textarea) for the customer to enter an Event Date. I managed to figure out how to get it displayed on my More Information page, though I don't really know if I have the right syntax. I also have some other products that will need multiple input boxes (Once I get this first one figured out. In my Product page (Edit Product Info), in Extra Field number one, I placed the following:

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

<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type="text"
id="[-- PRODUCT.RecordNumber --]:finopt:0" value="" size="15"><br>


In my Products template, I placed the following code where I want the input to display:

[-- STORE.ProductField1 --]
[-- PRODUCT.Field1 --]

Here's a link to a page that I have the text box on:
http://www.forrestrealm.com/store/product1687.html

My problem is I don't know how to get this field to display in my cart, and I know that I lack understanding how it works. I'm using a modified version of the Cross Sell template. Could someone tell me exactly what to do? I've searched the forums and the Internet and haven't really found alot of info on this subject. I''ve manged to over-come most of my obstacles on this journey, but this one is beginning to frustrate me!

Thanks in advance for help!
Jacque
 
Posts: 9
Joined: Wed Nov 05, 2008 8:11 am

Postby Jim » Wed Nov 05, 2008 1:26 pm

Extra product field cannot be displayed in the shopping cart. You will need to use the textarea field that is available to add any kind of input field that will display in the shopping cart.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Help with Extra Fields

Postby Jacque » Thu Nov 06, 2008 8:59 am

Okay - just to be clear:

I can setup all my extra fields. Then, when the customer clicks the Add to Cart link, I can run a bit of Javascript that takes the values of my extra fields and adds them all to the freeopt field. Does that sound about right? Will I have any issues running a Javascript onClick event on the Add to Cart link?

Thanks again, for the help!
Jacque
 
Posts: 9
Joined: Wed Nov 05, 2008 8:11 am

Solution for extra fields in shopping cart

Postby Jacque » Mon Nov 17, 2008 6:30 am

If anyone is interested, here's the solution I came up with for getting the extra fields in my shopping cart. I use a modified version of the CrossSell template.

In the PRODUCT template I created an onClick function that takes my extra fields and adds them to the customer text entry box.

I put the below code between the <head></head> tags so that the event date and the invitation wording get added to the customer text entry when the customer clicks Add to Cart:

<script language="JavaScript">
function addItems() {
eD = "Event Date: " + document.getElementById("eDate").value;
iWord = "Wording:" + "\n" + document.getElementById("invWording").value;
document.getElementById("custOpts").value=eD + "\n\n" + iWord;
}
</script>

I gave the <form> tag an ID equal to "prForm" and specified what to do when the form is submitted with the addItem function. There are multiple form tags in the template. I modified the one in the More Information section. It goes right before the <div class="mi-productBlock"> (in my particular template). It looks like this:

<form name="prForm" onSubmit="return addItems();" action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method="post">

Again, in the More Information section, in "Cust Fields", I added the actual text inputs:

#######################
# # CUST FIELDS #
#######################
[-- IF PRODUCT.OptionsBox --]
<input id="custOpts" type="hidden" name="[-- PRODUCT.Recordnumber --]:freeopt">
Event Date: <input type="text" name="eventDate" id="eDate"><br><br />
<br>Wording:<br><textarea name="inviteWording" cols="40" rows="2" id="invWording"></textarea><BR /><BR />
[-- END_IF --]

Be sure that your customer text entry box is checked in the product page to be able to see it in your cart.

Here's a url to see an example:
http://www.forrestrealm.com/store/product588.html

Hope that helps someone!
Jacque
 
Posts: 9
Joined: Wed Nov 05, 2008 8:11 am

Postby healthdesigns » Wed Sep 02, 2009 12:22 pm

I like your code. I am trying to do something similar but maybe simpler. Basically, if the qoh = 0, i want to print a product message on the product page and carry it over to the shopping cart.
In my custom product page, I have

[-- IF PRODUCT.QuantityOnHand 0 --]
[-- IF PRODUCT.OptionsBox --]
[-- PRODUCT.Field10 --]
[-- END_IF --]
[-- END_IF --]

this works good for showing the message on the product page but it is not getting to the shopping cart. I do have the check in the customer text entry box in the product in shopsite. any help with getting this message to the shopping cart?
Marge
healthdesigns
 
Posts: 5
Joined: Fri Sep 29, 2006 11:59 am
Location: elkhart, in

Use freeopt

Postby Jacque » Wed Sep 02, 2009 5:22 pm

I'm no Shopsite expert, but it's my understanding that you cannot make any PRODUCT.Field display in the shopping cart without doing a work-around. You have to pass the information to the shopping cart using the customer text entry box (freeopt). Also, since you are using PRODUCT.OptionsBox, make sure that you have "display ordering options" turned on (checked) in "Edit Product Layout" for each product that uses the template. Do you have a different message for each product or would it be the same since it's related to qoh? If your message is something like "Out of Stock" when qoh=0, then maybe you could embed it into your template:

[-- IF PRODUCT.QuantityOnHand 0 --]
[-- IF PRODUCT.OptionsBox --]
<input id="outofstock" type="hidden" name="[-- PRODUCT.Recordnumber --]:freeopt" value="Out of Stock">
[-- END_IF --]
[-- END_IF --]

I don't track inventory, so I don't really have a way to test this theory, but maybe it will give you something to go on!
Jacque
 
Posts: 9
Joined: Wed Nov 05, 2008 8:11 am


Return to User Forum

Who is online

Users browsing this forum: No registered users and 129 guests