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

put content of Extra Field into the <head> ?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-17-2011, 04:31 PM
 
carpeperdiem carpeperdiem is offline
 

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

Default put content of Extra Field into the <head> ?

I'm building a site in 4.4.4 and I have to use an audio player on each product page that is HTML5 compliant (with flash fallback).

Considering 42% of my customers use an iPad or iPhone to read my marketing emails (stat thanks to mailchimp!) - only having a flash/swf dependent audio player will be stupid.

SO many great audio players, but not very many are HTML5 compliant, and can embed an audio player for iPad or iPhone (without popping up the quicktime player, which I do not want!)

I found jPlayer jplayer.org/ - and that seems to do the trick, but it wants the /path/to/audio/content to be placed in a script in the <head>

Is this even possible with x-cart? I thought extra fields had to go into the <body>, yes?

Has anyone every put an extra field into the <head> section? How? Examples?

Thanks,

J

PS -- if anyone has a better solution for an audio player??? -- I need an audio player that is: iPad/iPhone compliant (to embed) and has a flash fallback for non-HTML5 browsers. .ogg or .m4a or .mp3 for audio, and each product will have Extra Fields with the path to the audio files. Surely this is a wheel that doesn't have to be invented? Thanks.

PPS -- looks like jPlayer CAN have the player <script> in the page <body> -- so that means Extra Fields will work here... it';s gonna be a late night!
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #2  
Old 11-17-2011, 06:53 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: put content of Extra Field into the <head> ?

Everything assigned to smarty from the php scripts is available immediatelly in the template(s) being called after the execution of that php script so yes you can access the extra fields info in the head section of home.tpl just like you will access it in the body section.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
carpeperdiem (11-17-2011)
  #3  
Old 11-17-2011, 07:05 PM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: put content of Extra Field into the <head> ?

Quote:
Originally Posted by cflsystems
Everything assigned to smarty from the php scripts is available immediatelly in the template(s) being called after the execution of that php script so yes you can access the extra fields info in the head section of home.tpl just like you will access it in the body section.

Really? Cool. For some reason I thought the Extra Fields module content was not available to home.tpl, and only to product.tpl (now product_details.tpl)

I'll try this now.

Thx

J
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #4  
Old 11-17-2011, 07:30 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: put content of Extra Field into the <head> ?

Well that's a different story. Extar fields may not be available on some pages for example they are not on static pages but they are available on product details page and I think now even on products list pages by default, you'll be ok
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 11-20-2011, 02:07 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: put content of Extra Field into the <head> ?

Quote:
Originally Posted by carpeperdiem
Really? Cool. For some reason I thought the Extra Fields module content was not available to home.tpl, and only to product.tpl (now product_details.tpl)
It has more to do with the page being product.php rather than the template file. If the php file is getting Extra Fields then they will be available for any template file displayed on that page, including the ones that build the head.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following user thanks cherie for this useful post:
carpeperdiem (11-20-2011)
  #6  
Old 11-20-2011, 02:09 PM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: put content of Extra Field into the <head> ?

Thanks for the explanation. Makes total sense.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #7  
Old 12-18-2011, 12:19 PM
 
weckie weckie is offline
 

eXpert
  
Join Date: Feb 2005
Location: Netherlands
Posts: 220
 

Default Re: put content of Extra Field into the <head> ?

I read this thread, and i am stunned, since i tried everything to get extra fiels in other pages than product pages. I need it in Product_list but it wont show up the way it shows up in product pages.

Maybe i am doing something wrong?
__________________
Herman Steijn

Using: X-cart 4.5.4
AT: http://www.weckonline.com LIVE
Reply With Quote
  #8  
Old 12-18-2011, 12:36 PM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: put content of Extra Field into the <head> ?

You will need to get the variables brought in by products.php

Try this (untested, but it should work):

in products.php

BEFORE
Code:
if (!empty($active_modules["Subscriptions"])) { include $xcart_dir."/modules/Subscriptions/subscription.php"; }
INSERT
Code:
if(!empty($active_modules["Extra_Fields"])) { $extra_fields_provider=$product_info["provider"]; include $xcart_dir."/modules/Extra_Fields/extra_fields.php"; }
That should enable the extra field variables to be available to the product list (products.php).

ONLY work on backups.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #9  
Old 12-18-2011, 12:57 PM
 
weckie weckie is offline
 

eXpert
  
Join Date: Feb 2005
Location: Netherlands
Posts: 220
 

Default Re: put content of Extra Field into the <head> ?

Hi Carpediem....


I put ur code into it, didnt work Actually i took also the exact code from PRODUCT.PHP and put it in Products.php and product_list.php... None of them worked.
__________________
Herman Steijn

Using: X-cart 4.5.4
AT: http://www.weckonline.com LIVE
Reply With Quote
  #10  
Old 12-18-2011, 01:01 PM
 
weckie weckie is offline
 

eXpert
  
Join Date: Feb 2005
Location: Netherlands
Posts: 220
 

Default Re: put content of Extra Field into the <head> ?

Maybe little explanation WHY?

I need it cuz i am using extra fields just to have a possibility to automise a product price per unit.

example: i sell a box with 24 jars, set a prices for that, than want to display the UNIT price also.
In the product page it works perfect with this code:

Code:
{foreach from=$extra_fields item=v} {if $v.active eq "Y" and $v.field_value} {if $v.field eq "AANTAL PER VE"} {math equation="x / y" x=$product.taxed_price y=$v.field_value assign="perstuk"} {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.list_price} {/if}{/if} {/foreach} {if $v.field_value} <h3> {$lng.lbl_market_price}:{* {currency value=$product.list_price} *}{currency value=$perstuk} </h3> {/if}


In the extra field i put the amount of units in the box, then a little math: price divided bij amount of units. outcome = $perstuk.
__________________
Herman Steijn

Using: X-cart 4.5.4
AT: http://www.weckonline.com LIVE
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 07:24 AM.

   

 
X-Cart forums © 2001-2020