Use "More Information Image"

Questions and answers about ShopSite Custom Templates

Use "More Information Image"

Postby LaBouq » Mon Mar 17, 2014 5:18 pm

Hi.
I'm working on a new custom template and would like to display different images (of same product) for different product pages. Ideally i would like to use "More Information Image 1" for the secondary template.
Example:
-Webpage: widget.html
Displays>> Product Image: widget_blue.jpg

-Webpage2: widgetframes.html
Displays>> More Information Image 1: widget_blue_frame.jpg

-Same Item/Product, Same SKU/Price/ETC. Just display "More Information Image 1" on a one page and the normal "Product Image" on the other.
----
The direction i believe is correct is to create 2 templates, append the More Information Image 1 field to the 2nd template's product loop? Is this possible?

thx in advance :)
LaBouq
 
Posts: 4
Joined: Mon Mar 17, 2014 4:48 pm

Re: Use "More Information Image"

Postby ShopSite Lauren » Tue Mar 18, 2014 8:38 am

Yes, you can do exactly what you mention below. Create 2 product templates that may look like the following (I am only including the graphic for these templates)
MoreInfoImage1-Product
[-- DEFINE PRODUCT --]
[-- IF Product.MoreInfoImage1 --][-- Product.MoreInfoImage1 --][--ELSE_IF PRODUCT.Graphic --][-- PRODUCT.Graphic --][-- END_IF --]
[-- END_DEFINE PRODUCT --]


MoreInfoImage2-Product
[-- DEFINE PRODUCT --]
[-- IF Product.MoreInfoImage2 --][-- Product.MoreInfoImage2 --][--ELSE_IF PRODUCT.Graphic --][-- PRODUCT.Graphic --][-- END_IF --]
[-- END_DEFINE PRODUCT --]


Then what I would do, so that you don't have to create multiple page templates is to add a var tag, and use an extra page field to specify this template to use. For example, if you want your default template to be "MoreInfoImage1-Product", then your VAR tags in your page template would look like this:
[-- IF PAGE.Field1 --][-- VAR.ProductTemplate PAGE.Field1 --][-- ELSE --][-- VAR.ProductTemplate "MoreInfoImage1-Product" --][-- END_IF --]

Your LOOP tags would look like:
[-- LOOP PRODUCTS --][-- PRODUCT VAR.ProductTemplate --][-- END_LOOP PRODUCTS --]

For pages you wanted to use the alternate layout, you would simply type "MoreInfoImage2-Product" in the extra page field 1.
- 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

Re: Use "More Information Image"

Postby LaBouq » Wed Mar 19, 2014 1:54 pm

Thanks for pointing me in the right direction Lauren.
I do still have a followup questions--i'm new to shopsite :)

I really would like to keep it as simple as possible. For the main default page template, i want to use the regular [-- PRODUCT --] images. For the secondary template i want to use the MoreInfoImage2.

(Using original example)
To Webpage2: widgetframes.html I added Page Field3: MoreInfoImage2
For default pages, Page Field3 is left blank.

I added to the product page:
[-- IF Product.MoreInfoImage2 --][-- Product.MoreInfoImage2 --][--ELSE_IF PRODUCT.Graphic --][-- PRODUCT.Graphic --][-- END_IF --]

If i were to use the default [-- PRODUCT --] is the below line correct? Also, where does this line go--in header or body (above the loop?)--of the page template:
[-- IF PAGE.Field3 --][-- VAR.ProductTemplate PAGE.Field3 --][-- ELSE --][-- PRODUCT --][-- END_IF --]
[-- LOOP PRODUCTS --]
[-- PRODUCT VAR.ProductTemplate --]
[-- END_LOOP PRODUCTS --]

-The idea is: If Page Field3=MoreInfoImage2 it will use the MoreInfoImage2 Image on the page. If Page Field3 is blank it will default to the standard [-- PRODUCT --] settings for the page.

Also i would like to use this in conjunction with grouping the products into categories (not sure if they will conflict):
http://www.shopsite.com/templates/cookbook/page-products-in-categories.shtml

THANKS VERY MUCH FOR THE HELP!
LaBouq
 
Posts: 4
Joined: Mon Mar 17, 2014 4:48 pm

Re: Use "More Information Image"

Postby ShopSite Lauren » Wed Mar 19, 2014 2:17 pm

The code in your page template would be something like:

[-- IF PAGE.Field3 --][-- VAR.ProductTemplate PAGE.Field3 --][-- ELSE --][-- VAR.ProductTemplate "MoreInfoImage1" --][-- END_IF --]
[-- LOOP PRODUCTS --]
[-- PRODUCT VAR.ProductTemplate --]
[-- END_LOOP PRODUCTS --]

You want to put the name of your regular product template in the bolded and red area above.
- 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

Re: Use "More Information Image"

Postby LaBouq » Thu Mar 20, 2014 4:38 pm

When publishing i would get template errors:
VAR.ProductTemplate [1]: Template Error: Could not find template file: /www/labouquetiere/cgi-bin/sb/templates/products/VAR.ProductTemplate

It doesnt seem like VAR.ProductTemplate is allowed within [-- PRODUCT --]

With some help i was able to do the IF statement within the loop and got it to work.

THANKS :)
LaBouq
 
Posts: 4
Joined: Mon Mar 17, 2014 4:48 pm


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 32 guests

cron