Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Creating a Jump Menu using the zen_draw_form function

    I found this old thread: http://www.zen-cart.com/showthread.p...-outside-links

    and this post:
    Here is the code for the Drop down Jump Box using JS.

    With a GO Button
    <form name="Jump" action="">
    <select name="Menu">
    <option value="">Your Choices</option>
    <option value="http://offsite1.com/">link 1</option>
    <option value="http://offsite2.com/">link 2</option>
    </select>

    <input type="button" onClick="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" value="GO">
    </form>


    Immediate Action
    <form name="Jump" action="">
    <select name="Menu" onchange="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" value="GO">
    <option value="">Your Choices</option>
    <option value="http://offsite1.com/">link 1</option>
    <option value="http://offsite2.com/">link 2</option>
    </select>
    </form>
    I'm trying to create a jump menu using the "Immediate Action" option.. but I can't quite wrap my head around how to use the zen_draw_form function in place of the "form" tag in the example. Can anyone offer some assistance???
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  2. #2
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by DivaVocals View Post
    I found this old thread: http://www.zen-cart.com/showthread.p...-outside-links

    and this post:

    I'm trying to create a jump menu using the "Immediate Action" option.. but I can't quite wrap my head around how to use the zen_draw_form function in place of the "form" tag in the example. Can anyone offer some assistance???
    Did a little more research and messed around a bit.. I think I found what works.. Wanted to share in case others were interested..

    With a GO Button
    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select name="Menu">
    <option value="">Your Choices</option>
    <option value="http://offsite1.com/">link 1</option>
    <option value="http://offsite2.com/">link 2</option>
    </select>
    
    <input type="button" onClick="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" value="GO">
    </form>
    Immediate Action
    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select name="Menu" onchange="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" value="GO">
    <option value="">Your Choices</option>
    <option value="http://offsite1.com/">link 1</option>
    <option value="http://offsite2.com/">link 2</option>
    </select>
    </form>
    Last edited by DivaVocals; 7 Oct 2013 at 04:46 AM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  3. #3
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by DivaVocals View Post
    Did a little more research and messed around a bit.. I think I found what works.. Wanted to share in case others were interested..

    With a GO Button
    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select name="Menu">
    <option value="">Your Choices</option>
    <option value="http://offsite1.com/">link 1</option>
    <option value="http://offsite2.com/">link 2</option>
    </select>
    
    <input type="button" onClick="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" value="GO">
    </form>
    Seems to work!

    Quote Originally Posted by DivaVocals View Post
    Immediate Action
    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select name="Menu" onchange="location=document.Jump.Menu.options[document.Jump.Menu.selectedIndex].value;" value="GO">
    <option value="">Your Choices</option>
    <option value="http://offsite1.com/">link 1</option>
    <option value="http://offsite2.com/">link 2</option>
    </select>
    </form>
    I get a javascript error and nothing happens for this one.

  4. #4
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by rbarbour View Post
    Seems to work!



    I get a javascript error and nothing happens for this one.
    I don't get an error for either one.. they both work for me.. I'm using the "Immediate Action" code for the menu I'm trying to build and it's working just fine with my test links..

    Now I just need to figure out how to get the EZ-Pages header links to display inside a jump menu..
    Last edited by DivaVocals; 7 Oct 2013 at 05:44 AM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  5. #5
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by DivaVocals View Post
    I don't get an error for either one.. they both work for me.. I'm using the "Immediate Action" code for the menu I'm trying to build and it's working just fine with my test links..
    I thought it was a conflict with other JS I had installed but nope - still doesn't work. So this is what I have for I just simplified my code to give you an idea how to do the ez-pages.

    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select onchange="if (this.value) window.location.href=this.value">
    <option>Where to go?</option>
    <option value="http://google.com/">google.com</option>
    <option value="http://yahoo.com/">yahoo.com</option>
    </select>
    </form>
    Quote Originally Posted by DivaVocals View Post
    Now I just need to figure out how to get the EZ-Pages header links to display inside a jump menu..
    [/QUOTE]

    Now with my code this will work for the EZ-Pages header links, you will have to change accordingly for your code.

    in /includes/templates/YOUR_TEMPLATE/templates/tpl_ezpages_bar_header.php

    find:
    Code:
    <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
      <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?>
    <?php } // end FOR loop ?>
    replace with:
    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select onchange="if (this.value) window.location.href=this.value">
    <option>EZ-Pages</option>
    <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
    <option value="<?php echo $var_linksList[$i]['link'];?>"><?php echo $var_linksList[$i]['name'];?></option>
    <?php } ?><?php } // end FOR loop ?>
    </select>
    </form>
    Hope this helps!

  6. #6
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by rbarbour View Post
    I thought it was a conflict with other JS I had installed but nope - still doesn't work. So this is what I have for I just simplified my code to give you an idea how to do the ez-pages.

    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select onchange="if (this.value) window.location.href=this.value">
    <option>Where to go?</option>
    <option value="http://google.com/">google.com</option>
    <option value="http://yahoo.com/">yahoo.com</option>
    </select>
    </form>

    Now with my code this will work for the EZ-Pages header links, you will have to change accordingly for your code.

    in /includes/templates/YOUR_TEMPLATE/templates/tpl_ezpages_bar_header.php

    find:
    Code:
    <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
      <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?>
    <?php } // end FOR loop ?>
    replace with:
    Code:
    <?php echo zen_draw_form('Jump', '', ''); ?>
    <select onchange="if (this.value) window.location.href=this.value">
    <option>EZ-Pages</option>
    <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
    <option value="<?php echo $var_linksList[$i]['link'];?>"><?php echo $var_linksList[$i]['name'];?></option>
    <?php } ?><?php } // end FOR loop ?>
    </select>
    </form>
    Hope this helps!
    Well the code I posted isn't giving me any errors and works.. **shrugs**

    Anyway as for the EX Pages code.. this does help..

    BUT..

    This replaces the Ex-Pages header bar with an EZ Pages header jump menu.. (which I can use for a different project.. so yes thanks for this ) What I REALLY need for what I am working on is not to replace the EZ Pager header bar, but a jump menu with other internal links (shipping policy, etc..) in addition to the EZ Page Header links.

    So I have menu options like this:
    Code:
    <?php
      if (DEFINE_SHIPPINGINFO_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_SHIPPING); ?>"><?php echo BOX_INFORMATION_SHIPPING; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_PRIVACY_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_PRIVACY); ?>"><?php echo BOX_INFORMATION_PRIVACY; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_CONDITIONS_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_CONDITIONS); ?>"><?php echo BOX_INFORMATION_CONDITIONS; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_CONTACT_US_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_CONTACT_US); ?>"><?php echo BOX_INFORMATION_CONTACT; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_SITE_MAP_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_SITE_MAP); ?>"><?php echo BOX_INFORMATION_SITE_MAP; ?></option>
    <?php } ?>
    And I'd like to add the EZ Pages header links to this..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Creating a Jump Menu using the zen_draw_form function

    I would just put rbarbour's version of the ez-pages output in the desired position in your link list:
    PHP Code:
    <?php for ($i=1$n=sizeof($var_linksList); $i<=$n$i++) {  ?>
    <option value="<?php echo $var_linksList[$i]['link'];?>"><?php echo $var_linksList[$i]['name'];?></option>
    <?php ?><?php // end FOR loop ?>
    You may need to ensure that the module file for ezpages_header is always run before your menu runs, so $var_linksList will be set.

    You might want to wrap it in a test to verify that there are ez-page links to output, similar to your other links.

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Creating a Jump Menu using the zen_draw_form function

    PHP Code:
    if (!isset($var_links_list)) {
      include(
    DIR_WS_MODULES zen_get_module_directory('ezpages_bar_header.php'));

    This would fetch all ez-page links set for the header; you might actually want a customized version of ezpages_bar_header.php and even customized db fields and admin entry so you can set what appears in this particular menu.

  9. #9
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by gjh42 View Post
    [php]and even customized db fields and admin entry so you can set what appears in this particular menu.
    LOL, sorry had too.

  10. #10
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Creating a Jump Menu using the zen_draw_form function

    Quote Originally Posted by gjh42 View Post
    I would just put rbarbour's version of the ez-pages output in the desired position in your link list:
    PHP Code:
    <?php for ($i=1$n=sizeof($var_linksList); $i<=$n$i++) {  ?>
    <option value="<?php echo $var_linksList[$i]['link'];?>"><?php echo $var_linksList[$i]['name'];?></option>
    <?php ?><?php // end FOR loop ?>
    You may need to ensure that the module file for ezpages_header is always run before your menu runs, so $var_linksList will be set.

    You might want to wrap it in a test to verify that there are ez-page links to output, similar to your other links.
    Quote Originally Posted by gjh42 View Post
    PHP Code:
    if (!isset($var_links_list)) {
      include(
    DIR_WS_MODULES zen_get_module_directory('ezpages_bar_header.php'));

    This would fetch all ez-page links set for the header; you might actually want a customized version of ezpages_bar_header.php and even customized db fields and admin entry so you can set what appears in this particular menu.
    Okay.. so I tried this and end up with a partial blank page. This is my jump menu code thus far:

    Code:
    <?php echo zen_draw_form('jumpMenu', '', ''); ?> 
    
    <select name="Menu" onchange="location=document.jumpMenu.Menu.options[document.jumpMenu.Menu.selectedIndex].value;" value="GO">
    <option value="">Our Shop</option>
    
    <?php
      if (DEFINE_SHIPPINGINFO_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_SHIPPING); ?>"><?php echo BOX_INFORMATION_SHIPPING; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_PRIVACY_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_PRIVACY); ?>"><?php echo BOX_INFORMATION_PRIVACY; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_CONDITIONS_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_CONDITIONS); ?>"><?php echo BOX_INFORMATION_CONDITIONS; ?></option>
    <?php } ?>
    
    <?php
      if (DEFINE_SITE_MAP_STATUS <= 1) {
    ?>
    <option value="<?php echo zen_href_link(FILENAME_SITE_MAP); ?>"><?php echo BOX_INFORMATION_SITE_MAP; ?></option>
    <?php } ?>
    
    <?php
    if (!isset($var_links_list)) {
      include(DIR_WS_MODULES . zen_get_module_directory('ezpages_bar_header.php'));
    }  
    ?>
     <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
    <option value="<?php echo $var_linksList[$i]['link'];?>"><?php echo $var_linksList[$i]['name'];?></option>
    <?php } ?><?php } // end FOR loop ?> 
    
    </select>
    </form>
    Last edited by DivaVocals; 8 Oct 2013 at 03:42 PM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 [NOT A BUG] SSL in function zen_draw_form wrong code
    By truonghoang in forum Bug Reports
    Replies: 6
    Last Post: 15 Apr 2014, 10:26 PM
  2. Creating a jump menu for outside links
    By delia in forum General Questions
    Replies: 9
    Last Post: 27 Apr 2010, 01:30 PM
  3. Where does zen_draw_form function definition reside?
    By MaxPowers in forum General Questions
    Replies: 1
    Last Post: 23 May 2007, 12:34 AM
  4. How to done this jump to page function
    By JohnsonY in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 17 May 2007, 05:41 AM
  5. Creating a drop down menu for the diff type of CC's using zen basic mod.
    By estrange in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 17 Jan 2007, 04:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg