Jump to content
PupStar

Possible Bootstrap & AJAX conflict

Recommended Posts

Hi Guys,

 

I am having a bit of trouble finishing off a conversion of a modded version of this contribution http://addons.oscommerce.com/info/7116 

 

Now it works to a degree but I am having trouble with the ajax selection in the dropdowns, basically the script is not triggered when I make the first selection.

 

If I enter the full url

 

http://localhost/printer/parts_finder.php?parts_cat_1=3028&filterid=1&mode=showlist

 

then all dropdowns are filled and data displayed correctly and the view source seems ok

<div><select name="parts_cat_1" onchange="document.frmveh.parts_cat_1.value=this.value;document.frmveh.submit();" class="form-control"><option value="">Select One</option><option value="3024" selected="selected">Stihl</option><option value="3025">Viking</option></select></div>

<div><select name="parts_cat_3024" onchange="document.frmveh.parts_cat_1.value=this.value;document.frmveh.submit();" class="form-control"><option value="">Select One</option><option value="3026" selected="selected">Chainsaws</option></select></div>

<div><select name="parts_cat_3026" onchange="document.frmveh.parts_cat_1.value=this.value;document.frmveh.submit();" class="form-control"><option value="">Select One</option><option value="3027" selected="selected">MS170, MS170 C</option></select></div>

<div><select name="parts_cat_3027" onchange="document.frmveh.parts_cat_1.value=this.value;document.frmveh.submit();" class="form-control"><option value="">Select One</option><option value="3028" selected="selected">Air Filter & Shroud</option></select></div>

This is the code and the ajaxd.js file that is being called

<?php
require('includes/application_top.php');

if(isset($_REQUEST['filterid'])&&($_REQUEST['filterid']!='')) {
 $filterid = $_REQUEST['filterid'];
 $filterquery = tep_db_query("select * from ".TABLE_PRINTER_CATEGORY."  where parent_id = '0' AND printer_category_id = '".$filterid."'");
  if(tep_db_num_rows($filterquery)>0) {
   $showfilter = true;
  }
}

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FILTER_PRINTER);
  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_FILTER_PRINTER_FINDER));
  require(DIR_WS_INCLUDES . 'template_top.php');

	$printerid = 0;
	if(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='showlist'))
	{
	    $printerid= $_REQUEST['parts_cat_'.$filterid];
	}
		elseif(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='searchlist'))
	{

    $vehidrow = @mysql_fetch_array(mysql_query("SELECT printer_category_name, printer_category_id, categories_image, machine_image FROM ".TABLE_PRINTER_CATEGORY." where category_name = '".$_REQUEST['keywords']."'"));
    $vehidrow = tep_db_fetch_array($query);

	if($vehidrow['printer_category_id']!='') {
	$printerid= $vehidrow['printer_category_id'];
    $printerid= $vehidrow['categories_image'];
	}
	}
	$catimage_query = tep_db_query("select categories_image, category_image_name, categories_image_large FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$printerid."'");
?>

<?php if($showfilter) { ?>
<div class="panel panel-default">
 <div class="panel-body">
   <div>
 	<div class="row">
 	 <div class="col-sm-3"><?php getprintercatoptions($filterid); ?></div>
 	 <div class="col-sm-9"><?php echo TEXT_PARTS_FINDER_DESCRIPTION;?></div>
	</div>
   </div>
  </div>
 </div>

<div class="bodyContent">
<?php

$define_list = array('PARTS_PRODUCT_LIST_MEDIACAT_PART_NO' => PARTS_PRODUCT_LIST_MEDIACAT_PART_NO,
                     'PARTS_PRODUCT_LIST_MEDIACAT_QUANTITY' => PARTS_PRODUCT_LIST_MEDIACAT_QUANTITY,
					 'PARTS_PRODUCT_LIST_MODEL' => PARTS_PRODUCT_LIST_MODEL,
                     'PARTS_PRODUCT_LIST_NAME' => PARTS_PRODUCT_LIST_NAME,
                     'PARTS_PRODUCT_LIST_IMAGE_ICON' => PARTS_PRODUCT_LIST_IMAGE_ICON,
                     'PARTS_PRODUCT_LIST_MANUFACTURER' => PARTS_PRODUCT_LIST_MANUFACTURER,
                     'PARTS_PRODUCT_LIST_PRICE' => PARTS_PRODUCT_LIST_PRICE,
                     'PARTS_PRODUCT_LIST_QUANTITY' => PARTS_PRODUCT_LIST_QUANTITY,
                     'PARTS_PRODUCT_LIST_WEIGHT' => PARTS_PRODUCT_LIST_WEIGHT,
                     'PARTS_PRODUCT_LIST_BUY_NOW' => PARTS_PRODUCT_LIST_BUY_NOW);

						asort($define_list);
						$column_list = array();
						reset($define_list);
						while (list($key, $value) = each($define_list)) {
						  if ($value > 0) $column_list[] = $key;
						}
						 $select_column_list = '';

						for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
						  switch ($column_list[$i]) {
							case 'PARTS_PRODUCT_LIST_MEDIACAT_PART_NO':
							  $select_column_list .= 'pd.mediacat_part_no, ';
							  break;
							case 'PARTS_PRODUCT_LIST_MEDIACAT_QUANTITY':
							  $select_column_list .= 'p.products_mediacat_quantity, ';
							  break;
							case 'PARTS_PRODUCT_LIST_MODEL':
							  $select_column_list .= 'p.products_model, ';
							  break;
							case 'PARTS_PRODUCT_LIST_NAME':
							  $select_column_list .= 'pd.products_name, ';
							  break;
							case 'PARTS_PRODUCT_LIST_IMAGE_ICON':
							  $select_column_list .= '';
							  break;
							case 'PARTS_PRODUCT_LIST_MANUFACTURER':
							  $select_column_list .= 'm.manufacturers_name, ';
							  break;
							case 'PARTS_PRODUCT_LIST_QUANTITY':
							  $select_column_list .= 'p.products_quantity, ';
							  break;
							case 'PARTS_PRODUCT_LIST_IMAGE':
							  $select_column_list .= 'p.products_image, ';
							  break;
							case 'PARTS_PRODUCT_LIST_WEIGHT':
							  $select_column_list .= 'p.products_weight, ';
							  break;
						  }
						}
						if($printerid>0)
						{
							$printercat_query = tep_db_query("SELECT * FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$printerid."'");
							$printercat_row = tep_db_fetch_array($printercat_query);
							$productids = $printercat_row['productids'];
							if($productids!='')
							{
								$listing_sql = "select distinct " . $select_column_list . " p.products_id, products_model, p.manufacturers_id, p.products_image, p.products_price, pd.mediacat_part_no, products_name, products_description, products_mediacat_quantity, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and FIND_IN_SET(p.products_id,'".$productids."' )";
								$listing_sql .= " order by pd.mediacat_part_no";
							}

						 while ($category_image = tep_db_fetch_array($catimage_query)) {

                         if($productids!='')	{
?>

 <div class="row">
  <div class="col-sm-5">
	<div class="panel panel-primary">
     <div class="panel-heading"><?php echo '' . $category_image['category_image_name'];?></div>
  	  <div class="panel-body"><?php echo '' . tep_image_parts(DIR_WS_IMAGES_PARTS . $category_image['categories_image'], '', '');?></div>
	 </div>
    </div>
  <div class="col-sm-7">
   <div class="panel panel-primary">
  	<div class="panel-heading"><?php echo TEXT_PART_FINDER_LISTING;?></div>
   	 <div class="panel-body">
   	  <div class="panel-table">
  		<?php
      	 include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING_LIST);
  	   	 }
  		?>
  	  </div>
   	 </div>
  	</div>
</div>
<?php
  	  }
     }
	}

function getprintercatoptions($printer_category_id="",$curprintercatid="") {
	$fieldid = $printer_category_id;
	if(isset($_REQUEST['parts_cat_'.$printer_category_id])&&($_REQUEST['parts_cat_'.$printer_category_id]!='')) {

		 $printer_category_id = $_REQUEST['parts_cat_'.$printer_category_id];
   	     $str = getprintercatpath($printer_category_id,"");
		 $query1 = tep_db_query("SELECT count(printer_category_id) FROM " . TABLE_PRINTER_CATEGORY . "  where parent_id = '".$printer_category_id."'");
		 $chkbottomROW = tep_db_fetch_array($query1);

		 if($str =="") {$str = "0,";}
		 if($chkbottomROW[0]>0) {
		 	$str .= $printer_category_id.",";
		 }

		$catarr = explode(",",substr($str,0,-1));
		sort($catarr);
		editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid);

	}else{

		if($curprintercatid>0) {
			 $str = getprintercatpath($curprintercatid,"");
			if($str =="") {
			 $str = $curprintercatid.",";
			}else{
			 $str .= $curprintercatid.",";
			}
		}else{
			$str = getprintercatpath($printer_category_id,"");
			if($str =="") {$str = $printer_category_id.",";}
		}

		$catarr = explode(",",substr($str,0,-1));
		sort($catarr);
		editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid);
	}
}


function editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid="") {
	$i=0;
	$cntvarr = count($catarr);
	foreach($catarr as $val) {
		$veh_cat_array = array(array('id' => '', 'text' => 'Select One'));
		$printers_query = tep_db_query("select * from " . TABLE_PRINTER_CATEGORY . "  where parent_id = '".$val."' order by category_name");
		if(tep_db_num_rows($printers_query)>0) {
			while ($printers = tep_db_fetch_array($printers_query)) {
				$veh_cat_array[] = array('id' => $printers['printer_category_id'],
										 'text' => $printers['category_name']);
			}

			if($cntvarr==$i+1) {
			 $selval = $printer_category_id;
			}else{
			 $selval = $catarr[$i+1];
			}
?>

<div><?php echo tep_draw_pull_down_menu_parts('parts_cat_'.$val, $veh_cat_array, $selval, 'onchange="document.frmveh.parts_cat_'.$fieldid.'.value=this.value;document.frmveh.submit();"');?></div>

<?php
	$i++;
  }
 }
}

function getprintercatpath($printer_category_id, $str) {
	$str1 = $str;
	$printers_query = tep_db_query("select parent_id from " . TABLE_PRINTER_CATEGORY . "  where printer_category_id = '".$printer_category_id."'");
	$printers = tep_db_fetch_array($printers_query);
    $parent_id = $printers['parent_id'];
	if($parent_id==0) {
	 return  $str1;
	}else{
	 $str1 .= $parent_id.",";
	 $str1 = getprintercatpath($parent_id, $str1);
	 return $str1;
	}
}
?>
</div>
<form name="frmveh" action="" method="get">
<input type="hidden" name="parts_cat_<?php echo $filterid;?>" value="<?php echo $_REQUEST['parts_cat_1'];?>">
<input type="hidden" name="filterid" value="<?php echo $filterid;?>" />
<input type="hidden" name="mode" value="showlist" />
</form>
<?php require(DIR_WS_INCLUDES . 'template_bottom.php'); ?>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
// JavaScript Document
var req=null;
var console=null;
var READY_STATE_UNINITIALIZED=0;
var READY_STATE_LOADING=1;
var READY_STATE_LOADED=2;
var READY_STATE_INTERACTIVE=3;
var READY_STATE_COMPLETE=4;

function sendRequest(url,params,HttpMethod)
{
	if (!HttpMethod)
	{
		HttpMethod="POST";
	}
	req=initXMLHTTPRequest();
	if (req)
	{
		req.onreadystatechange=onReadyState;
		req.open(HttpMethod,url,true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(params);
	}
}

//****************************creating the XMLHTTPRequest object
function initXMLHTTPRequest()
{
	var xRequest=null;
	if (window.XMLHttpRequest)
	{
		xRequest=new XMLHttpRequest();
	} else if (window.ActiveXObject)
	{
		xRequest=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xRequest;
}

I have also uploaded a  screenshot to see what the end result should look like

 

I would very much appreciate it if someone would help me debug as I am now stuck on this final piece of the puzzle.

 

I am also not sure if it is a conflict with bootstrap or not

 

Thanks

 

Mark


Bootstrap 3 ROCKS!

(or it will if I ever get my head around it lol)

(and I think I have now (w00t) )

Share this post


Link to post
Share on other sites

Hi - could you save the entire web page including the .js files as it appears when you first get there (i.e. the one that doesn't work)?

 

If you can then zip it and attach here.

 

If you can't then have a look in the console of your browser and see if there's any errors - chances are there's none as the onchange sounds like it is not firing - if your on 234BS then you could revamp the js code to use jQuery

Share this post


Link to post
Share on other sites

Hi Bob

 

Hi - could you save the entire web page including the .js files as it appears when you first get there (i.e. the one that doesn't work)?

 

If you can then zip it and attach here.

 

for some reason the uploader wont allow me to attach a zip or txt file urgh, view source pasted below

 

 

If you can't then have a look in the console of your browser and see if there's any errors - chances are there's none as the onchange sounds like it is not firing - if your on 234BS then you could revamp the js code to use jQuery

 

 

I have googled on how to switch the code out as my js skills are terrible lol

 

Thanks

 

Mark


<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Parts Finder Development</title>
<base href="http://localhost/printer/">

<link href="ext/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="custom.css" rel="stylesheet">
<link href="user.css" rel="stylesheet">
<link href="parts.css" rel="stylesheet">

<link rel="stylesheet" href="ext/bootstrap-magnify/css/bootstrap-magnify.min.css">

<!--[if lt IE 9]>
   <script src="ext/js/html5shiv.js"></script>
   <script src="ext/js/respond.min.js"></script>
   <script src="ext/js/excanvas.min.js"></script>
<![endif]-->

<script src="ext/jquery/jquery-1.11.1.min.js"></script>
<script src="ext/js/ajaxd.js" ></script>

<!-- font awesome -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

<noscript><div class="no-script"><div class="no-script-inner"><p><strong>JavaScript seems to be disabled in your browser.</strong></p><p>You must have JavaScript enabled in your browser to utilize the functionality of this website. <a href="http://www.enable-javascript.com/" target="_blank" rel="nofollow">Click here for instructions on enabling javascript in your browser</a>.</div></div></noscript>
<style>.no-script { border: 1px solid #ddd; border-width: 0 0 1px; background: #ffff90; font: 14px verdana; line-height: 2; text-align: center; color: #2f2f2f; } .no-script .no-script-inner { margin: 0 auto; padding: 5px; } .no-script p { margin: 0; }</style>
</head>
<body>

  <nav class="navbar navbar-inverse navbar-no-corners navbar-no-margin navbar-fixed-top" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-navbar-collapse-1">
        <span class="sr-only">Toggle Navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <div class="collapse navbar-collapse" id="bs-navbar-collapse-1">
      <div class="container-fluid">
        <ul class="nav navbar-nav">
          <li><a class="store-brand" href="http://localhost/printer/index.php"><i class="fa fa-home fa-lg"></i><span class="hidden-sm"> Home</span></a></li>          <li><a class="store-brand" href="http://localhost/printer/index.php"><i class="fa fa-mobile-phone fa-lg"></i><span class="hidden-sm"> Call us on 0800 123456</span></a></li>        </ul>
        <ul class="nav navbar-nav navbar-right">
          <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="glyphicon glyphicon-cog"></i><span class="hidden-sm"> Site Settings</span> <span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li class="text-center text-muted bg-primary"><abbr title="Selected Language">L:</abbr> English <abbr title="Selected Currency">C:</abbr> GBP</li>
              <li class="divider"></li><li><a href="http://localhost/printer/parts_finder.php?filterid=1&currency=USD">U.S. Dollar</a></li><li><a href="http://localhost/printer/parts_finder.php?filterid=1&currency=EUR">Euro</a></li><li><a href="http://localhost/printer/parts_finder.php?filterid=1&currency=GBP">Pounds Sterling</a></li>            </ul>
          </li>
          <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="glyphicon glyphicon-user"></i><span class="hidden-sm"> My Account</span> <span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li><a href="http://localhost/printer/login.php"><i class="glyphicon glyphicon-log-in"></i> Log In</a><li><a href="http://localhost/printer/create_account.php"><i class="glyphicon glyphicon-pencil"></i> Register</a>              <li class="divider"></li>
              <li><a href="http://localhost/printer/account.php">My Account</a></li>
              <li><a href="http://localhost/printer/account_history.php">My Orders</a></li>
              <li><a href="http://localhost/printer/address_book.php">My Address Book</a></li>
              <li><a href="http://localhost/printer/account_password.php">My Password</a></li>
            </ul>
          </li>
          <li class="nav navbar-text"><i class="glyphicon glyphicon-shopping-cart"></i> 0 items</li>        </ul>
      </div>
    </div>
  </div>
</nav>

  <div id="bodyWrapper" class="container-fluid">
    <div class="row">

      
<div class="modular-header">
  <div id="storeLogo" class="col-sm-8 logo-height">
  <a href="http://localhost/printer/index.php"><img src="product_images/store_logo.png" alt="Parts Finder Development" title="Parts Finder Development" width="200" height="50" class="img-responsive" /></a></div>


<div class="col-sm-4 logo-height">
  <div class="searchbox-margin"><form name="quick_find" action="http://localhost/printer/advanced_search_result.php" method="get" class="form-horizontal">  <div class="input-group"><input type="text" name="keywords" required placeholder="Search" class="form-control" /><span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="glyphicon glyphicon-search"></i></button></span>  </div></div></form></div>



<div id="catMenu" class="col-sm-12">
	 <nav class="navbar navbar-default hidden-xs" role="navigation">
      <div class="navbar-header">
		<button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target="#bs-navbar-collapse">
			<span class="sr-only">Toggle Navigation</span>
			<i class="fa fa-eye"></i> 		</button>
      </div>
      <div class="collapse navbar-collapse" id="bs-navbar-collapse">

       <ul class="nav navbar-nav">
          <li><a href="http://localhost/printer/index.php"><i class="fa fa-home fa-lg"></i><span class="hidden-sm"> Home</span></a></li>          <li><a href="http://localhost/printer/parts_finder.php?filterid=1">Parts Finder</a></li>          <li class="dropdown"><ul class="nav navbar-nav"><li class="dropdown"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">Hardware <span class="fa fa-caret-down"></span></a><ul class="dropdown-menu"><li><a href="http://localhost/printer/index.php?cPath=1"><strong><span"><span class="fa fa-list"></span> Hardware</span><li class="visible-xs divider"></li></strong></a></li><li><a href="http://localhost/printer/index.php?cPath=1_17">CDROM Drives</a></li><li><a href="http://localhost/printer/index.php?cPath=1_4">Graphics Cards</a></li><li><a href="http://localhost/printer/index.php?cPath=1_8">Keyboards</a></li><li><a href="http://localhost/printer/index.php?cPath=1_16">Memory</a></li><li><a href="http://localhost/printer/index.php?cPath=1_9">Mice</a></li><li><a href="http://localhost/printer/index.php?cPath=1_6">Monitors</a></li><li><a href="http://localhost/printer/index.php?cPath=1_5">Printers</a></li><li><a href="http://localhost/printer/index.php?cPath=1_7">Speakers</a></li></ul></li><li class="dropdown"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">Stihl Spare Parts <span class="fa fa-caret-down"></span></a><ul class="dropdown-menu"><li><a href="http://localhost/printer/index.php?cPath=22"><strong><span"><span class="fa fa-list"></span> Stihl Spare Parts</span><li class="visible-xs divider"></li></strong></a></li><li class="dropdown dropdown-submenu"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">Chainsaws<span class="tsimi"></span></a><ul class="dropdown-menu"><li><a href="http://localhost/printer/index.php?cPath=22_23"><strong><span"><span class="fa fa-list"></span> Chainsaws</span><li class="visible-xs divider"></li></strong></a></li><li class="dropdown dropdown-submenu"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">MS170, MS170 C<span class="tsimi"></span></a><ul class="dropdown-menu"><li><a href="http://localhost/printer/index.php?cPath=22_23_24"><strong><span"><span class="fa fa-list"></span> MS170, MS170 C</span><li class="visible-xs divider"></li></strong></a></li><li><a href="http://localhost/printer/index.php?cPath=22_23_24_25">Air Filter & Shroud</a></li></ul></li></ul></li></ul></li><li class="dropdown"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">Software <span class="fa fa-caret-down"></span></a><ul class="dropdown-menu"><li><a href="http://localhost/printer/index.php?cPath=2"><strong><span"><span class="fa fa-list"></span> Software</span><li class="visible-xs divider"></li></strong></a></li><li><a href="http://localhost/printer/index.php?cPath=2_19">Action</a></li><li><a href="http://localhost/printer/index.php?cPath=2_18">Simulation</a></li><li><a href="http://localhost/printer/index.php?cPath=2_20">Strategy</a></li></ul></li><li class="dropdown"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">DVD Movies <span class="fa fa-caret-down"></span></a><ul class="dropdown-menu"><li><a href="http://localhost/printer/index.php?cPath=3"><strong><span"><span class="fa fa-list"></span> DVD Movies</span><li class="visible-xs divider"></li></strong></a></li><li><a href="http://localhost/printer/index.php?cPath=3_10">Action</a></li><li><a href="http://localhost/printer/index.php?cPath=3_13">Cartoons</a></li><li><a href="http://localhost/printer/index.php?cPath=3_12">Comedy</a></li><li><a href="http://localhost/printer/index.php?cPath=3_15">Drama</a></li><li><a href="http://localhost/printer/index.php?cPath=3_11">Science Fiction</a></li><li><a href="http://localhost/printer/index.php?cPath=3_14">Thriller</a></li></ul></li><li><a href="http://localhost/printer/index.php?cPath=21">Gadgets</a></li></ul></li>
		  <li><a href="http://localhost/printer/specials.php"><i class="glyphicon glyphicon-fire"></i><span class="hidden-sm"> Special Offers</span></a></li>       </ul>
      </div>
    </nav>
</div></div>

<div class="clearfix"></div>

<div class="body-sans-header clearfix">


      <div id="bodyContent" class="col-md-12 ">

<div class="panel panel-default">
 <div class="panel-body">
   <div>
 	<div class="row">
 	 <div class="col-sm-3">
<div><select name="parts_cat_1" onchange="document.frmveh.parts_cat_1.value=this.value;document.frmveh.submit();" class="form-control"><option value="">Select One</option><option value="3024">Stihl</option><option value="3025">Viking</option></select></div>

</div>
 	 <div class="col-sm-9">Please use the dropdown boxes to select the make and model of the machine you require parts for.<br><br>To help identify a spare part we use exploaded parts diagrams. A parts diagram is an image of the parts or all of a machine. The image is a line drawing of all of the component parts used to make the machine and the parts are shown in a logical order as per the build of your machine.<br><br>The parts diagram drawing has numbers next to each part and these numbers can be cross referenced into part numbers by using parts table below.</div>
	</div>
   </div>
  </div>
 </div>

<div class="bodyContent">
</div>

<form name="frmveh" action="" method="get">
<input type="hidden" name="parts_cat_1" value="">
<input type="hidden" name="filterid" value="1" />
<input type="hidden" name="mode" value="showlist" />
</form>


      </div> <!-- bodyContent //-->


    </div> <!-- row -->

  
</div>

<footer>
  <div class="footer">
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3">
  <div class="footerbox contact">
    <h2>How To Contact Us</h2>
    <address>
      <strong>Parts Finder Development</strong><br>
      Address Line 1<br />
Address Line 2<br />
Country<br />
Phone<br>
      <abbr title="Phone">P:</abbr> 555-1234<br>
      <abbr title="Email">E:</abbr> tessthepup@gmail.com    </address>
    <ul class="list-unstyled">
      <li><a class="btn btn-success btn-sm btn-block" role="button" href="http://localhost/printer/contact_us.php"><i class="glyphicon glyphicon-send"></i> Contact Us</a></li>
    </ul>
  </div>
</div>

<div class="col-sm-3">
  <div class="footerbox information">
    <h2>Information</h2>
    <ul class="list-unstyled">
      <li><a href="http://localhost/printer/shipping.php">Shipping & Returns</a></li>
      <li><a href="http://localhost/printer/privacy.php">Privacy & Cookie Policy</a></li>
      <li><a href="http://localhost/printer/conditions.php">Terms & Conditions</a></li>
      <li><a href="http://localhost/printer/contact_us.php">Contact Us</a></li>
    </ul>  
  </div>
</div>

<div class="col-sm-3">
  <div class="footerbox generic-text">
    <h2>About Us</h2>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>  </div>
</div>
      </div>
    </div>
  </div>
  <div class="footer-extra">
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-12 footer-suffix">
  
  <p>
    <i class="fa fa-mobile fa-lg"></i>
    <i class="fa fa-tablet fa-lg"></i>
    <i class="fa fa-laptop fa-lg"></i>
    <i class="fa fa-desktop fa-lg"></i>
  </p></div>
      </div>
    </div>
  </div>
</footer>


<script src="ext/bootstrap/js/bootstrap.min.js"></script>

<script src="ext/bootstrap-magnify/js/bootstrap-magnify.min.js"></script>


  </div> <!-- bodyWrapper //-->

</body>
</html>

Bootstrap 3 ROCKS!

(or it will if I ever get my head around it lol)

(and I think I have now (w00t) )

Share this post


Link to post
Share on other sites

Hi - if I use the original sql from the add-on and run your code in 234BS then I have to make a couple of changes - the first is simply because I do not have tep_draw_pull_down_menu_parts so I substitute tep_draw_pull_down_menu

 

That gives me a dropdown menu 'Please select' and a list of printers, choose one, nothing happens (which is what I think you are getting)

 

What I see in function getprintercatoptions() is that there is:

 

if($chkbottomROW[0]>0) {
$str .= $printer_category_id.",";
}
 
That's always going to fail as the preceding sql query actually only returns an array of:
$chkbottomROW[count(printer_category_id)] => 0 - there is no $chkbottomROW[0] anywhere.
 
try making the two changes below in the function
function getprintercatoptions($printer_category_id="",$curprintercatid="") { 
	$fieldid = $printer_category_id;
	if(isset($_REQUEST['parts_cat_'.$printer_category_id])&&($_REQUEST['parts_cat_'.$printer_category_id]!='')) {

		 $printer_category_id = $_REQUEST['parts_cat_'.$printer_category_id];
   	     $str = getprintercatpath($printer_category_id,"");
		 
		 // change thefollowing add alias of count
		 $query1 = tep_db_query("SELECT count(printer_category_id) as count FROM " . TABLE_PRINTER_CATEGORY . "  where parent_id = '".$printer_category_id."'");
		 $chkbottomROW = tep_db_fetch_array($query1);
		

		 if($str =="") {$str = "0,";}
		 //change here use alias
		 if($chkbottomROW['count'] > 0) {
		 	$str .= $printer_category_id.",";
		 }

		$catarr = explode(",",substr($str,0,-1));
		sort($catarr);
		editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid);

	}else{

		if($curprintercatid>0) {
			 $str = getprintercatpath($curprintercatid,"");
			if($str =="") {
			 $str = $curprintercatid.",";
			}else{
			 $str .= $curprintercatid.",";
			}
		}else{
			$str = getprintercatpath($printer_category_id,"");
			if($str =="") {$str = $printer_category_id.",";}
		}

		$catarr = explode(",",substr($str,0,-1));
		sort($catarr);
		editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid);
	}
}

Share this post


Link to post
Share on other sites

 

Hi - if I use the original sql from the add-on and run your code in 234BS then I have to make a couple of changes - the first is simply because I do not have tep_draw_pull_down_menu_parts so I substitute tep_draw_pull_down_menu

 

That gives me a dropdown menu 'Please select' and a list of printers, choose one, nothing happens (which is what I think you are getting)

 

What I see in function getprintercatoptions() is that there is:

 

if($chkbottomROW[0]>0) {
$str .= $printer_category_id.",";
}
 
That's always going to fail as the preceding sql query actually only returns an array of:
$chkbottomROW[count(printer_category_id)] => 0 - there is no $chkbottomROW[0] anywhere.
 
try making the two changes below in the function
function getprintercatoptions($printer_category_id="",$curprintercatid="") { 
	$fieldid = $printer_category_id;
	if(isset($_REQUEST['parts_cat_'.$printer_category_id])&&($_REQUEST['parts_cat_'.$printer_category_id]!='')) {

		 $printer_category_id = $_REQUEST['parts_cat_'.$printer_category_id];
   	     $str = getprintercatpath($printer_category_id,"");
		 
		 // change thefollowing add alias of count
		 $query1 = tep_db_query("SELECT count(printer_category_id) as count FROM " . TABLE_PRINTER_CATEGORY . "  where parent_id = '".$printer_category_id."'");
		 $chkbottomROW = tep_db_fetch_array($query1);
		

		 if($str =="") {$str = "0,";}
		 //change here use alias
		 if($chkbottomROW['count'] > 0) {
		 	$str .= $printer_category_id.",";
		 }

		$catarr = explode(",",substr($str,0,-1));
		sort($catarr);
		editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid);

	}else{

		if($curprintercatid>0) {
			 $str = getprintercatpath($curprintercatid,"");
			if($str =="") {
			 $str = $curprintercatid.",";
			}else{
			 $str .= $curprintercatid.",";
			}
		}else{
			$str = getprintercatpath($printer_category_id,"");
			if($str =="") {$str = $printer_category_id.",";}
		}

		$catarr = explode(",",substr($str,0,-1));
		sort($catarr);
		editprintercat($catarr,$fieldid,$printer_category_id,$curprintercatid);
	}
}

 

@Bob Terveuren

 

Thanks Bob, that did the trick and it works lovely now (will give it some hammer and try to break it lol)

 

Its strange how the original script worked flawlessly on osc 2.3.2 but not on BS

 

I have one other little issue now and that when you select the first dropdown it breaks the footer (see image), I am presuming its a <div> issue but can not see it.

 

http://s19.postimg.org/t24fidqdf/broken_footer.png

Edited by PupStar

Bootstrap 3 ROCKS!

(or it will if I ever get my head around it lol)

(and I think I have now (w00t) )

Share this post


Link to post
Share on other sites

Hi - likely to be an extra closing tag or maybe an unclosed opening tag - (needle in a haystack time).

 

The problem may also in the original page and is only visible after the extra HTML is added - if you grab the HTML for both pages you could identify the extra code added for the second dropdown and see what that shows.

 

If you see nothing then you could try the W3C validator - that is a can of worms as it will report things that aren't really wrong - e.g. on yours double opening <body> tags but that's only because it sees the <noscript> in the <head> and tells itself that there's an opening <body> there too.

 

Try checking the <form> and get it into a single <div> - there's something hooky with the <div></divs> around that point in the page so maybe start there.

 

You can also try something like http://www.aliciaramirez.com/closing-tags-checker/

 

Good luck Mr Bond - it's the type of job I hate......

Share this post


Link to post
Share on other sites

Hi - likely to be an extra closing tag or maybe an unclosed opening tag - (needle in a haystack time).

 

The problem may also in the original page and is only visible after the extra HTML is added - if you grab the HTML for both pages you could identify the extra code added for the second dropdown and see what that shows.

 

If you see nothing then you could try the W3C validator - that is a can of worms as it will report things that aren't really wrong - e.g. on yours double opening <body> tags but that's only because it sees the <noscript> in the <head> and tells itself that there's an opening <body> there too.

 

Try checking the <form> and get it into a single <div> - there's something hooky with the <div></divs> around that point in the page so maybe start there.

 

You can also try something like http://www.aliciaramirez.com/closing-tags-checker/

 

Good luck Mr Bond - it's the type of job I hate......

 

@Bob Terveuren

 

Thank you 'Q' managed to get the formatting problem sorted, it was a misplaced }

 

:thumbsup:


Bootstrap 3 ROCKS!

(or it will if I ever get my head around it lol)

(and I think I have now (w00t) )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×