Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Only 2 extra fields in <a href>

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-20-2009, 08:00 AM
 
BrighterBlooms1 BrighterBlooms1 is offline
 

Advanced Member
  
Join Date: Feb 2008
Location: Charlotte, NC
Posts: 29
 

Default Only 2 extra fields in <a href>

Need some help, i am trying to have one extra field be the anchor text with the other extra field fill in the URL, below is the code... tell me where i am going wrong.

Code:
{if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} <tr> <td colspan="2" align="center" class="PlantBoxFooter">{section name=field loop=$extra_fields} {if $extra_fields[field].field_value and ($extra_fields[field].service_name eq "SERVICE_NAME15")}<a target="_blank" href="{$extra_fields[field].field_value}">{/if}{if $extra_fields[field].field_value and ($extra_fields[field].service_name eq "SERVICE_NAME13")} {$extra_fields[field].field_value} Planting Directions</a>{/if}{/section} </td> </tr> {/if}
__________________
X-cart version 4.6.5
Reply With Quote
  #2  
Old 11-20-2009, 09:21 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Only 2 extra fields in <a href>

did you input any info into the extra field??

$extra_fields[field].field_value <--- thisis asking if the extra field has data
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 11-20-2009, 09:40 AM
 
BrighterBlooms1 BrighterBlooms1 is offline
 

Advanced Member
  
Join Date: Feb 2008
Location: Charlotte, NC
Posts: 29
 

Default Re: Only 2 extra fields in <a href>

yes, there is info in the field... when i look at the source code of the output i get this...

Code:
<td colspan="2" class="PlantBoxFooter" align="center"> Knockout Rose Planting Directions<a target="_blank" href="/planting-directions/knockout-roses-care/"></a></td>


so it is picking up the values, just not putting them in the correct order. The anchor text is displayed outside the <a>
__________________
X-cart version 4.6.5
Reply With Quote
  #4  
Old 11-20-2009, 10:44 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Only 2 extra fields in <a href>

maybe try this - move the {/if} inside teh </a> - just a guess

Planting Directions{/if}</a>
__________________
xcart 5.1.2
Reply With Quote
  #5  
Old 11-20-2009, 11:32 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Only 2 extra fields in <a href>

Your code is wrong
Code:
{if $extra_fields[field].field_value and ($extra_fields[field].service_name eq "SERVICE_NAME15")} <a target="_blank" href="{$extra_fields[field].field_value}"> {/if} {if $extra_fields[field].field_value and ($extra_fields[field].service_name eq "SERVICE_NAME13")} {$extra_fields[field].field_value} Planting Directions</a> {/if}
You will not get what you need like this because "field" and "service name" are the same for both ifs in each loop.
What do you have in first field and what in the second? Can you give example?
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 12-02-2009, 09:45 AM
 
BrighterBlooms1 BrighterBlooms1 is offline
 

Advanced Member
  
Join Date: Feb 2008
Location: Charlotte, NC
Posts: 29
 

Default Re: Only 2 extra fields in <a href>

the first field "SERVICE_NAME15" is a URL, the second "SERVICE_NAME13" will be the anchor text for the link. such as

<a href="xxxxxxxx.com/xxx.html">TEST</a>
__________________
X-cart version 4.6.5
Reply With Quote
  #7  
Old 12-02-2009, 10:45 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Only 2 extra fields in <a href>

Try this
Code:
{if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {section name=field loop=$extra_fields} {if $extra_fields[field].field_value and $extra_fields[field].service_name eq "SERVICE_NAME15"} {assign name="url" value=$extra_fields[field].field_value} {/if} {if $extra_fields[field].field_value and $extra_fields[field].service_name eq "SERVICE_NAME13"} {assign name="anchor" value=$extra_fields[field].field_value} {/if} {/section} {if $url and $anchor} <tr> <td colspan="2" align="center" class="PlantBoxFooter"> <a href="{$url}">{$anchor}</a> </td> </tr> {/if} {/if}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #8  
Old 12-02-2009, 12:21 PM
 
BrighterBlooms1 BrighterBlooms1 is offline
 

Advanced Member
  
Join Date: Feb 2008
Location: Charlotte, NC
Posts: 29
 

Default Re: Only 2 extra fields in <a href>

i see what you are trying to do, yet the code is not displaying anything?
__________________
X-cart version 4.6.5
Reply With Quote
  #9  
Old 12-02-2009, 02:32 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Only 2 extra fields in <a href>

Where are you trying to execute this? Maybe $extra_fields is not available there. I can't really test this as I don't have 4.1.8. You can use the xcart debuger to see which variables are available on that page and what are they called
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #10  
Old 12-03-2009, 12:35 PM
 
BrighterBlooms1 BrighterBlooms1 is offline
 

Advanced Member
  
Join Date: Feb 2008
Location: Charlotte, NC
Posts: 29
 

Default Re: Only 2 extra fields in <a href>

this is on product.tpl. which, as i understand, has extra fields available by default.
__________________
X-cart version 4.6.5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:03 PM.

   

 
X-Cart forums © 2001-2020