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

Menu linking to PDF's in template

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

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Menu linking to PDF's in template

I am trying to write a .tpl that is a dropdown menu that links to all my instruction PDF's. This is in a static page and the dropdown is filled from a query I added to pages.php. You select your product from the dropdown and the PDF should opens. I don't have any preference on how the form gets submitted, if its "onchange" or a submit button or something else. (I've tried both) I'd prefer the pdf to open in a new window, but don't feel real strong about that either. Any help is greatly appreciated. Thanks.

Code:
<br /> PDF Stiffy Instructions <form method="post" name="stiffyinstr"> <select name="stiffy" style="width: 50%;" onchange="document.stiffyinstr.submit ();"> <option value="">Select Stiffy PN</option> {section name=st loop=$stiffys} <option value="{$current_location}/instructions/{$stiffys[st].IE_part_number}.pdf">-{$stiffys[st].IE_part_number}- {$stiffys[st].year}-{$stiffys[st].year_to} {$stiffys[st].makename} {$stiffys[st].modelname}{if $stiffys[st].submodel_name} {$stiffys[st].submodel_name}{/if}{if $stiffys[st].engine_size}, {$stiffys[st].engine_size}L{/if}</option> {/section} </select> <!--<input type="submit" value="View PDF"/><a href onclick="{$current_location}/instructions/{$stiffy}.pdf"></a>--> </form> <br/>
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
Reply With Quote
  #2  
Old 02-17-2009, 04:55 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Menu linking to PDF's in template

Code:
<form method="post" name="stiffyinstr">
There is no action specified. It should be
Code:
<form method="post" name="stiffyinstr" action="customScript.php">
Where customScript is the name of the script that will handle user selection

If you just want to open new window with pdf, don't mess with forms try this instead of form submitting:
Code:
<br /> PDF Stiffy Instructions <select name="stiffy" style="width: 50%;" onchange="window.open(this.value,'PDF Stiffy Instructions','width=300,height=500,toolbar=1')"> <option value="">Select Stiffy PN</option> {section name=st loop=$stiffys} <option value="{$current_location}/instructions/{$stiffys[st].IE_part_number}.pdf">-{$stiffys[st].IE_part_number}- {$stiffys[st].year}-{$stiffys[st].year_to} {$stiffys[st].makename} {$stiffys[st].modelname}{if $stiffys[st].submodel_name} {$stiffys[st].submodel_name}{/if}{if $stiffys[st].engine_size}, {$stiffys[st].engine_size}L{/if}</option> {/section} </select> <br/>
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #3  
Old 02-17-2009, 08:27 AM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Menu linking to PDF's in template

Thanks Victor. Simple is always better for me. It works great in Firefox, but not at all in IE7. I turned PopUps on and doesn't seem to do anything when I make a selection from the list.

Adam
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
Reply With Quote
  #4  
Old 02-18-2009, 01:19 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Menu linking to PDF's in template

Sorry, I've missed that select has no value for IE and there are some other limitations such as popup window title should not contain spaces. So try to replace the line with the select
Code:
<select name="stiffy" style="width: 50%;" onchange="window.open(this.options[this.selectedIndex].value,'PDF','width=300,height=500,toolbar=1')">
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #5  
Old 02-18-2009, 07:14 AM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Menu linking to PDF's in template

Excellent. Thanks again Victor.
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
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 03:46 AM.

   

 
X-Cart forums © 2001-2020