PROCESS Extra Product Field

General ShopSite user discussion

PROCESS Extra Product Field

Postby bkerns » Tue Mar 18, 2014 5:18 pm

Is there a way to get a product's extra field to process?

I was thinking something like this:
~~~~~~~~Product Field 2 Content~~~~~~~
<INPUT TYPE="checkbox" NAME="[-- PRODUCT.RecordNumber --]:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>
~~~~~~~~Product Field 2~~~~~~~

Then in the template call it like this:
~~~~~~~~Custom Product Template~~~~~~~~
[-- PRODUCT.Field2 PROCESS --]
~~~~~~~~Custom Product Template~~~~~~~~

For my project, Product Field 2 Content is different for each product but I can't get at the PRODUCT.RecordNumber until I publish, then I have to look at the number the software set for itemnum and hard code it. Otherwise I have to create an include for each product to get at the process function. Would be great if those extra fields could be processed when published.

-Brian
bkerns
 
Posts: 16
Joined: Wed Nov 20, 2013 2:07 pm

Re: PROCESS Extra Product Field

Postby Jim » Tue Mar 18, 2014 5:31 pm

Have you tried [-- product.productfieldX --] where X is the product field you are wanting to get?

Most of the template tags and brief description can be found on the cheatsheet at http://www.shopsite.com/help/11.0/en-US/templates/custom.template.cheatsheet.html
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: PROCESS Extra Product Field

Postby Jim » Tue Mar 18, 2014 5:37 pm

I just looked at your question again and maybe you are trying to do something that won't work. If you are planning on putting
Code: Select all
<INPUT TYPE="checkbox" NAME="[-- PRODUCT.RecordNumber --]:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>
in the product field and then using that in the template it won't work. Template tags are only evaluated if they are in the template itself and can't be included from a text field in the page or product.

The finopt values are what comes from the Order Options so that also probably would not work as you have it defined.

Can you explain a little more about what you are trying to do?
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: PROCESS Extra Product Field

Postby bkerns » Tue Mar 18, 2014 6:19 pm

Here is my dev site: http://www.intint.com/shop/Tucson-Kennel-Club.html

The classes option lists are marked up and inserted as product fields. It's not a problem with the drop down option lists because the PRODUCT.RecordNumber is defined in the template in the select tag:

~~~~~TEMPLATE~~~~~
<SELECT NAME="[-- PRODUCT.RecordNumber --]:finopt:3">
[-- PRODUCT.Field3 --]
</SELECT>
~~~~~TEMPLATE~~~~~

~~~~~Product Field 3 content~~~~~
<OPTION VALUE="9 - Puppy 9 and under 12 months - $18.00">9 - Puppy 9 and under 12 months - $18.00</OPTION>
<OPTION VALUE="C - 12 mos. & under 15 mos.">C - 12 mos. & under 15 mos.</OPTION>
<OPTION VALUE="G - 15 mos. & under 18 mos.">G - 15 mos. & under 18 mos.</OPTION>
<OPTION VALUE="H - Amateur Owner-Handled">H - Amateur Owner-Handled</OPTION>
~~~~~Product Field 3 content~~~~~

But with check boxes (unlike the option tag), PRODUCT.RecordNumber has to be defined in the tag like this:

<INPUT TYPE="checkbox" NAME="4:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>

What I want to do is this:
<INPUT TYPE="checkbox" NAME="[-- PRODUCT.RecordNumber --]:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>

...so that I can generate a text file with all of the product's fields and content marked up from an Access database. All I have to do is import the product's text file to populate the cart. I have several hundred products, and it will be an ongoing process. I can't figure out how to get at the PRODUCT.RecordNumber without having to publish the product, then look at the source code of the output for the value that is returned for PRODUCT.RecordNumber, then hard code it into the checkboxes and paste it into the product field.

I hope that is clearer, it's been a difficult project. I do appreciate your help an interest.

-Brian
bkerns
 
Posts: 16
Joined: Wed Nov 20, 2013 2:07 pm

Re: PROCESS Extra Product Field

Postby Jim » Tue Mar 18, 2014 8:43 pm

You don't have to use the record number of the product if you have an sku assigned to the product. Here is a sample of an Order Anywhere link using the sku, which in this case I made SKUVALUE so you can see where you need to replace it.
Code: Select all
<form action="http://blister.shopsite.com/cgi-bin/jim/11sp3/sc/order.cgi" method="post">
<select name="SKUVALUE:finopt:0" size="1">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option value="option3">option3</option>
</select>
<input type="hidden" name="SKUVALUE:finoptnum" value="1">
<br><input type=hidden name="storeid" value="*100bd218ab0744409e25">
<input type=hidden name="dbname" value="products">
<input type=hidden name="function" value="add">
<input type=hidden name="sku" value="SKUVALUE">
<input type=submit value="Add To Cart">
<input type=submit name="checkout" value="View Cart">
</form>
so for your template tag in this line
Code: Select all
<INPUT TYPE="checkbox" NAME="[-- PRODUCT.RecordNumber --]:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>
you would switch it to
Code: Select all
<INPUT TYPE="checkbox" NAME="[-- PRODUCT.sku --]:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>
or you could just include the sku in the appropriate place in the Product text field
Code: Select all
<INPUT TYPE="checkbox" NAME="SKUVALUE:finopt:0" VALUE="Friday, April 25, 2014">Friday, April 25, 2014<BR>



Note that ShopSite 12 (and maybe 11) does not by default allow order options to be added to the cart that are not defined in the product as order options. This is because someone could grab your html page, edit the option prices or names and submit the order. If you weren't careful in processing the order you might not catch that they had changed the price and they could get the product at a reduced price or add options that should cost extra but not pay for them. You can override that feature by going to Commerce Setup > Order System > Shopping cart and and checking the box [ ]Ordering Options can be defined outside of ShopSite . In your case you would also want to check the box [ ]Ordering Options can not be changed since the order options will not display properly in the cart since they are not being defined as actual order options.

Note that there is a template tag [-- PRODUCT.OptionFiniteText --] which simply lists the various order options but doesn't output all of the formatting for the order options. This allows you to feed the order options to a separate CALL program that can format the output however you would like. It may be simpler to create the CALL program than to do the ordering options how you are suggesting.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: PROCESS Extra Product Field

Postby bkerns » Wed Mar 19, 2014 6:57 am

Thanks for the help. I didn't know you could use [-- PRODUCT.sku --] for the finopt. That may be an option. I wonder if you can mix RecordNumber and sku - i.e. use sku for just one of the fields and RecordNumber for the rest? I'll have to test it out. Having them enter a sku may be the answer, at least they wont have to publish and then look at the source to get the RecordNumber and go back into the product and edit the dates in the product field. I'm not using sku now.

I may look into a jquery solution as well. I don't think you can change the name of a tag in the DOM but I know you can create them on the fly. Maybe php could handle formatting of those checkboxes.

To keep people from hacking the form, I plan to keep posts to order.cgi confined to the domain with .htaccess. There is on order validation on the client side when the downloaded shopsite orders are pushed into Access.

See this topic: http://support.shopsite.com/forums/viewtopic.php?f=1&t=10132

-Brian
bkerns
 
Posts: 16
Joined: Wed Nov 20, 2013 2:07 pm


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 130 guests