Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    140
    Plugin Contributions
    0

    Default ajax chained select on main page issue

    I have been trying to implement a 3 chain select
    on the main zen-cart page using ajax.

    The script is essentially
    blueicestudios.com/chained-select-boxes-using-php-mysql-ajax/

    with php and mysql modifications made to meet my requirements.

    I put the following code in the template html_header.php page
    between the head tags.

    Code:
    <?php include('func.php'); ?>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
    
    <script type="text/javascript">
    $(document).ready(function() {
    	$('#wait_1').hide();
    	$('#drop_1').change(function(){
    	  $('#wait_1').show();
    	  $('#result_1').hide();
    	  $('#result_2').hide();
          $.get("func.php", {
    		func: "drop_1",
    		drop_var: $('#drop_1').val()
          }, function(response){
            $('#result_1').fadeOut();
            setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400);
          });
        	return false;
    	});
    });
    
    function finishAjax(id, response) {
      $('#wait_1').hide();
      $('#'+id).html(unescape(response));
      $('#'+id).fadeIn();
    }
    function finishAjax_tier_three(id, response) {
      $('#wait_2').hide();
      $('#'+id).html(unescape(response));
      $('#'+id).fadeIn();
    }
    </script>
    I then put

    Code:
    <form action="test.php" method="get">
      
        <select name="drop_1" id="drop_1">
        
          <option value="" selected="selected" disabled="disabled">Select a Category</option>
          
          <?php getTierOne(); ?>
        
        </select> 
        
        <span id="wait_1" style="display: none;">
        <img alt="Please Wait" src="ajax-loader.gif"/>
        </span>
        <span id="result_1" style="display: none;"></span>
        <span id="wait_2" style="display: none;">
        <img alt="Please Wait" src="ajax-loader.gif"/>
        </span>
        <span id="result_2" style="display: none;"></span> 
      
    </form>
    I place the func.php in my zen-cart folder root.

    When I try to load view the page it appears to stop when
    it tries to stop executing at the getTierOne(); as nothing appears after that and hen I comment out that line all the usuall zen-cart
    links etc.. load. The func.php files contain the sql to out the new select menus.

    I think the issue I am having my be related to the func.php location on the server to where the function executes in the main page.

  2. #2
    Join Date
    Feb 2010
    Posts
    140
    Plugin Contributions
    0

    Default Re: ajax chained select on main page issue

    Issue resolved

 

 

Similar Threads

  1. select products for main page
    By anthony0217 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Jul 2011, 06:30 PM
  2. "Select State/Province" on Login Page Issue
    By lucky-nz in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 22 Feb 2010, 12:14 AM
  3. Chained Select Menu
    By HarleyBill in forum General Questions
    Replies: 4
    Last Post: 26 Sep 2008, 04:59 AM
  4. Main Page Issue...
    By khopek in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 May 2008, 10:19 PM
  5. Select categories to show on main page?
    By thesuper in forum Customization from the Admin
    Replies: 0
    Last Post: 5 Feb 2008, 09:18 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR