X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Menu linking to PDF's in template (https://forum.x-cart.com/showthread.php?t=45611)

AMMoyer 02-16-2009 11:20 AM

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/>


Victor D 02-17-2009 04:55 AM

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/>


AMMoyer 02-17-2009 08:27 AM

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

Victor D 02-18-2009 01:19 AM

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')">

AMMoyer 02-18-2009 07:14 AM

Re: Menu linking to PDF's in template
 
Excellent. Thanks again Victor.


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.