Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Printer Ink & Toner Filter - Help required upgrading to 2.3.4 Bootstrap


PupStar

Recommended Posts

Hi Guys,

 

I am currently trying to upgrade my heavily modified code to work on the great Bootstrap version of 2.3.4

 

Basically on 2.3.? the code works great generating the result in the first image below but when moving over to the responsive site it falls down and the drop downs have stopped working altogether as in the second image

 

 

 

 

 

Link to comment
Share on other sites

and the second image below

 

I wonder if someone would mind taking a look at the code and try and see if  I am missing something obvious.

<?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));

  $head_tag .= '<script type="text/javascript" src="js/ajaxd.js" ></script>' . "\n";
  $head_tag .= '<script type="text/javascript" src="ext/jquery/jqzoom.pack.1.0.1.js"></script>' . "\n";

  $oscTemplate->addBlock( $head_tag, 'header_tags' );

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {
    $error = false;
    $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
    $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
    $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
    $part = tep_db_prepare_input($HTTP_POST_VARS['part']);
    $makemodel = tep_db_prepare_input($HTTP_POST_VARS['makemodel']);

    if (!tep_validate_email($email_address)) {
      $error = true;
      $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    }

    $actionRecorder = new actionRecorder('ar_contact_us', (tep_session_is_registered('customer_id') ? $customer_id : null), $name);
    if (!$actionRecorder->canPerform()) {
      $error = true;
      $actionRecorder->record(false);
      $messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15)));
    }

    if ($error == false) {
      tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address, $part, $makemodel);
      $actionRecorder->record();
      tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
    }
  }

  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<script type="text/javascript">
    $(function(){
        var options = {
                zoomType: 'reverse',
				alwaysOn : false,
				zoomWidth: 250,
				zoomHeight:250,
				position:'right',
				xOffset: 10,
				yOffset: 10,
                showEffect: "fadein",
                hideEffect: "fadeout",
                fadeinSpeed: "slow",
                fadeoutSpeed: "slow",
                showPreload: true,
                lens: true,
                title: false,
                imageOpacity: 0.3,
       };
       $('.jqzoom').jqzoom(options);
   });
</script>

<?php
  $printerid = 0;
	if(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='showlist'))
 	 {
	  $printerid= $_REQUEST['part_cat_'.$filterid];
	 }
	  elseif(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='searchlist'))
	 {
	  $vehidrow = @[member=tep]_db_fetch_array(tep_db_query("SELECT printer_category_name, printer_category_id, categories_image, machine_image FROM ".TABLE_PRINTER_CATEGORY." where category_name = '".$_REQUEST['keywords']."'"));
		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, category_imagemap_name FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$printerid."'");
?>

<div style="clear: both; padding:3px;"></div>
<div class="contentContainer">
  <div class="contentContainer">
  <div class="panel-body" style="padding:0px; background-image:url('images/background/striped.png'); height:245px;">

   <?php if($showfilter) { ?>

    <div class="wrapper_parts" style="padding:11px;">
        <div class="left_parts">
         <div style="clear: both;"></div>
            <?php getprintercatoptions($filterid); ?>
         </div>
        <div class="panel-body right_parts" style="padding:10px;">
            <?php echo TEXT_PARTS_FINDER_DESCRIPTION;?>
        </div>
    </div>
</div>

<div style="clear: both; padding:2px;"></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, p.manufacturers_id, p.products_image, p.products_price, pd.mediacat_part_no, 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";
							}

						?>

						<?php
						 while ($category_image = tep_db_fetch_array($catimage_query)) {

							if($productids!='')	{
							$imagemap = $category_image['category_imagemap_name'];
							echo '<div style="clear: both; padding:2px;"></div><div class="contentContainer"><div class="ui-widget-header ui-corner-top infoBoxHeading partsfinderheader">' . $category_image['category_image_name'] . '</div></div>';
							echo '<div class="ui-widget ui-widget-content-parts-finder ui-corner-bottom" style="margin: 0px auto;"><a href="'.tep_href_link(DIR_WS_IMAGES_PARTS . $category_image['categories_image_large']).'" class="jqzoom" style="padding-left: 20px; padding-top:10px; padding-bottom:10px;">' . tep_image_maps(DIR_WS_IMAGES_PARTS . $category_image['categories_image'], '', $imagemap, '') . '</a></div>';


    						include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING_LIST);
							}else if (isset($category_image['categories_image'])) {
							echo '<div style="clear: both; padding:2px;"></div><div class="contentContainer"><div class="ui-widget-header ui-corner-top infoBoxHeading partsfinderheader">' . $category_image['category_image_name'] . '</div>';
							echo '<div class="ui-widget ui-widget-content-parts-finder ui-corner-bottom" style="margin: 0px auto;"><a href="'.tep_href_link(DIR_WS_IMAGES_PARTS . $category_image['categories_image_large']).'" class="jqzoom" style="padding-left: 20px; padding-top:10px; padding-bottom:10px;">' . tep_image_maps(DIR_WS_IMAGES_PARTS . $category_image['categories_image'], '', $imagemap, '') . '</a></div></div>';

  if ($messageStack->size('contact') > 0) {
    echo $messageStack->output('contact');
  }

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>

<div class="contentContainer">
  <div class="contentText">
    <?php echo TEXT_SUCCESS; ?>
  </div>

  <div style="float: right;">
    <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
  </div>
</div>

<?php
  } else {

  if (tep_session_is_registered('customer_id')) {
    $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
    $account = tep_db_fetch_array($account_query);

    $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
    $email = $account['customers_email_address'];
  }
?>

<?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', '', true); ?>
<div style="clear: both; padding:4px;"></div>
<div class="contentContainer">
  <div class="ui-widget ui-widget-content-parts-finder ui-corner-all contentText" style="background-image:url('product_images/background/striped.png'); height:400px; padding-left:10px;">
    <table border="0" width="100%" cellspacing="0" cellpadding="4">
      <tr>
        <td><?php echo TEXT_PARTS_CONTACT_DESCRIPTION; ?></td>
      </tr>
    </tr>
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td class="fieldKey"><?php echo ENTRY_NAME; ?></td>
        <td class="fieldValue">
				<?php if (tep_session_is_registered('customer_id')) {
                        echo tep_draw_hidden_field('name', $name);
						echo '  <strong>' . $name . '</strong>';
		?></td>
		<?php } else { ?>
		<td class="fieldValue">
           <?php echo tep_draw_input_field('name', '', $parameters = 'size="50"');  } ?>
        </td>
      </tr>
     </table>
     <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td class="fieldKey"><?php echo ENTRY_EMAIL; ?></td>
        <td class="fieldValue"><?php if (tep_session_is_registered('customer_id')) {
				echo tep_draw_hidden_field('email', $email);
                echo '  <strong>' . $email . '</strong>';
        ?></td>
		<?php } else { ?>
        <td class="fieldValue"><?php echo tep_draw_input_field('email', '', $parameters = 'size="50"'); } ?></td>
      </tr>
     </table>
    <table border="0" width="100%" cellspacing="0" cellpadding="4">
      <tr>
        <td class="fieldKey"><?php echo ENTRY_MAKE_MODEL; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('makemodel', $category_image['category_image_name'], $parameters = 'size="50"'); ?></td>
      </tr>
      <tr>
        <td class="fieldKey" valign="bottom"><?php echo ENTRY_PARTS; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('part', '', $parameters = 'size="50"'); ?></td>
      </tr>
      <tr>
        <td class="fieldKey" valign="top"><?php echo ENTRY_PARTS_ENQUIRY; ?></td>
        <td class="fieldValue"><?php echo tep_draw_textarea_field('enquiry', 'soft', 40, 5); ?></td><td width="20"> </td>
      </tr>
      <tr>
        <td colspan="2" align="center"><span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_SEND, 'triangle-1-e', null, 'primary'); ?></span></td>
      </tr>
    </table>
  </div>
</div>
</form>

<div style="clear: both; padding:20px;"></div>

<?php
		}
	   }
  	  }
     }
	}
?>
</div></div>
<?php
 function getprintercatoptions($printer_category_id="",$curprintercatid="")
  {

	$fieldid = $printer_category_id;
	if(isset($_REQUEST['part_cat_'.$printer_category_id])&&($_REQUEST['part_cat_'.$printer_category_id]!=''))
	{

		 $printer_category_id = $_REQUEST['part_cat_'.$printer_category_id];
		  $str = getprintercatpath($printer_category_id,"");
		 $chkbottomROW = tep_db_fetch_array(tep_db_query("SELECT count(printer_category_id) FROM " . TABLE_PRINTER_CATEGORY . "  where parent_id = '".$printer_category_id."'"));
		 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="")
{
	?>
	<?php
	$i=0;
	$cntvarr = count($catarr);
	foreach($catarr as $val)
	{
		$veh_cat_array = array(array('id' => '', 'text' => 'Click to Select'));
		$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']);
			}
			?>
			<?php
			if($cntvarr==$i+1)
			{
				 $selval = $printer_category_id;
			}

			else
			{
				$selval = $catarr[$i+1];
			}
?>

			<div class="parts_finder" align="left" valign="top">
             <?php echo tep_draw_pull_down_menu_parts('part_cat_'.$val, $veh_cat_array, $selval, 'style="width:150px; background:#fff;" onchange="document.frmveh.part_cat_'.$fieldid.'.value=this.value;document.frmveh.submit();"');?>
			</div>
			<?php
			$i++;
		}
	}
}
?>

<?php
 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>
</div>
<div>
<form name="frmveh" action="" method="get">
<input type="hidden" name="part_cat_<?php echo $filterid;?>" value="<?php echo $_REQUEST['part_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');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Thanks

 

Mark

Link to comment
Share on other sites

@@burt

 

tep_draw_input_field('email', '', $parameters = 'size="50"')

 

should be (eg):

 

tep_draw_input_field('email')

 

Hi Gary,

 

Sorry to sound dumb here but what is wrong with what I have?

 

Also surely that would not cause problems with my dropdown selections?

 

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...