View Single Post
  #1  
Old 03-05-2009, 04:43 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default extra fields, assigning a variable, using more than one extra field

I am trying to do something that is just beyond my level of expertise. All help is appreciated.

MY ULTIMATE GOAL is to put a bunch of videos on specific product pages. To do this, I have encoded the videos into f4v format using Flash encoder CS4, and will use shadowbox and the JW player. It works great.

Now, to get the videos onto the product.tpl -- I had a few ideas...

A few pieces of info: I am using extra fields to propagate an INGREDIENTS tab (that is the only visible extra field -- I also have hidden extra fields too) -- I use a simple xyz.png for each products' ingredients, saved as an image.

SO -- my questions/problems:

1. HOW can i constrain the extra fields to just a specific extra field in product.tpl?

I thought I could use: {if $extra_fields[field].field eq "videocontent"} --- but that didn't work.

IN my file, /skin1/modules/Extra_Fields/product.tpl

It looks like this:

Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].field eq "Ingredients"} {if $extra_fields[field].field_value ne ""} <img src="/product-images/ingredients/{$extra_fields[field].field_value}" />{/if} {else} {if $extra_fields[field].active eq "Y" && $extra_fields[field].field_value} {$extra_fields[field].field_value} {/if} {/if} {/section}

This allows me to drop this template into the TABS for my ingredients, and the ingredients display, per product.

I tried adding more code to /skin1/modules/Extra_Fields/product.tpl, but that just crashed the tabs. (yes, the tabs have an include for /skin1/modules/Extra_Fields/product.tpl )

HOW CAN I HAVE MORE THAN ONE EXTRA FIELD, and then if for the field name at different locations in product.tpl as well as other templates ?

Additionally, to simplify the content in the extra field, and simplify the amount of code, can someone remind me of the technique to assign the results of an if string to a $variable, so that it can be used multiple times? This way, if my extra field, "videocontent" for product msp is simply "msp" -- then I can use the $msp string a few times, cutting down on code.

Clear as mud?

Thanks in advance for the assistance. Yes, I searched the forum, and even found answers from myself that I thought would be the solution, but it's not working... I must be losing brain cells. Thanks.

Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote