Code Assistance

Questions and answers about ShopSite Custom Templates

Code Assistance

Postby Kapitol » Sat Jan 25, 2014 9:06 am

I am working on modifying a More Info Page template. I have moved a few things around, and I have run into some errors. I would like to troubleshoot my code by analyzing each part's Process. Is there a resource for this outside of copying templates from within the store?

I would like to see each processes default code:
Display Ordering Options Process

Display Order Quantity Process

The Price Process

Subproduct Process
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Code Assistance

Postby Kapitol » Sat Jan 25, 2014 9:16 am

I forgot to mention that I have already checked in "Custom Template Global Tags" The issue is that a code sample of each is given in its most basic form. I need to see more complex samples of each. It would also help to have a really well documented sample page in its entirety to reference.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Code Assistance

Postby Jim » Sat Jan 25, 2014 6:31 pm

I'm not exactly sure what you are trying to get at but here are a couple of suggestions of things I do to find how things are working.

I often add some text before and after a template tag so that I can see what the individual tag out puts. Something like this.
Code: Select all
JIMJIMJIM1 [-- product.price --] JIMJIMJIM1


This same method could be used for an include statement to see what is actually being done in the file that is included.
Code: Select all
JIMJIMJIM2 [-- INCLUDE XYZ  PROCESS --] JIMJIMJIM2


If you need to find out what file a section of the html is being generated by you can enable the Utilities > Publish >Insert an html comment before each include file checkbox and in the html output the name of the file being included will be displayed in a comment.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Code Assistance

Postby ShopSite Lauren » Mon Jan 27, 2014 9:38 am

You might be referring to some of the INCLUDE tags. I believe for the first two tags you mentioned, the ordering options and order quantity, they don't have includes (the words INCLUDE and PROCESS in their tags), but instead they are plain tags (this does depend on the template, but most templates don't have includes for these). You can include the tags in your template, and they will output their code...this is the basic format for those tags:

[-- IF PRODUCT.DisplayOrderingOptions --] - this is just a tag to check if the checkbox (Products > Edit Product Layout) is checked. You don't have to use this tag in your custom template. The result of this tag (if you remove the IF) will just be "checked" or "unchecked"

[-- PRODUCT.OptionText --] - this will add the text you/the merchant puts in the pull down menu description field. If this field has nothing in it, nothing will be output by this tag. The pull down menu description field is under Products > Edit Product Layout. Merchants will often include something like "Select Size and Color" in that field if they use that field.

[-- ORDER_OPTION_MENU Column --] (this could also be [-- ORDER_OPTION_MENU Line --]) - this outputs a table, each cell in the table will contain one of the pull down menus a customer has created for a product (Products > Edit Product Layout). If there are not pull down menus specified, nothing will be output by this tag. The format for these pull down menus in this tag might be something like: <table><tr><td><select><option>Small</option><option>Medium</option><option>Large</option></select></td></tr></table>

[-- IF PRODUCT.DisplayOrderQuantity --] - this is just a tag to check if the checkbox (Products > Edit Product Layout) is checked. You don't have to use this tag in your custom template. The result of this tag (if you remove the IF) will just be "checked" or "unchecked"

For the ACTUAL quantity field, you would create the code for that in your template by adding the following code: Quantity <input type="text" size="2" name="[-- PRODUCT.RecordNumber --]:qnty" value="1">.


The next tag you mentioned MIGHT be an include file, [-- INCLUDE Product-Price PROCESS --]. If that is the case, that is an include file that is being used. You can make a copy of that include file by going to Merchandising > Custom Templates > Includes > Copy ShopSite Include, and make a copy of the include file named "Product-Price". When I make copies of the - include files, I will then copy all the code from that include, and just paste it IN PLACE OF the [-- INCLUDE Product-Price PROCESS --] tag in the product template. That way it is easier to edit the HTML code, without having to go to a different file.

The last tag you mention, the subproduct process, I am not sure what tag that is. There are a few - tags that define the subproduct name, define the subproduct price, and define the subproduct add to cart button. All of those include files are relatively non-important, and you can often use the same formatting you use for your main product, for your subproduct. For example, you could replace [-- INCLUDE Subproduct-Name PROCESS --] with just [-- PRODUCT.Name --]. You could replace [-- INCLUDE Subproduct-Price PROCESS --] with [-- IF PRODUCT.SaleAmount --][-- PRODUCT.SaleAmount --][-- ELSE --][-- PRODUCT.Price --][-- END_IF --]. You could replace [-- INCLUDE Subproduct-AddToCartButton PROCESS --] with <a href="[-- PRODUCT.AddToCartURL --]">Add To Cart</a>.

OR, you could be referring to the looping of subproducts themselves, in which case they aren't include files, but a series of LOOP tags within the define product or define more information page section of the product template. Those loop tags (to add the subproduct code IF there are subproducts assigned) is:
[-- IF PRODUCT.Subproduct --][-- LOOP SUBPRODUCTS --][-- SUBPRODUCTS --][-- END_LOOP SUBPRODUCTS --][-- END_IF --]

I hope that helps.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT


Return to Custom Template Questions

Who is online

Users browsing this forum: Google [Bot] and 32 guests