Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Printer Ink & Toner Filter


nsb

Recommended Posts

Hi there,

I think there are still some errors, the link in boxes/filter_printer.php should be:

 

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_FILTER_PRINTER_FINDER) . '">Ink & Toner Finder</a>');

instead of:

$info_box_contents[] = array('text' => '<a "href=' . tep_href_link(FILENAME_FILTER_PRINTER_FINDER) . '">Ink & Toner Finder</a>');

 

Also in IE8 there is no action when you choose a filter, so you take "Apple" and nothing happens. In Firefox it works great. If everything can be fixed I will make a german translation, it's a great contrib, saves a lot of search time.

Link to comment
Share on other sites

Yes, you are right, I have uploaded new version.

 

I'm not sure what the problem is with IE8 but to render as IE7 use code in header found here:

http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx

 

or

http://snipplr.com/view/13271/add-http-header-to-force-ie8-to-render-in-ie7-mode-phpversion/

 

The above can be a fix for now. When I have some time I will attempt to re-write catalog/filter_printer.php to be IE8 compatible.

Link to comment
Share on other sites

  • 4 weeks later...

nsb,

 

Would it be possible to add another selection field into your filter? i.e. Make, Type, Model Number?

 

If so, can you show me exactly what to modify?

 

Thanks

 

You can create 3 levels of categories. Make, Type, Model Number.

 

These can be managed in admin section

 

You can edit the top level to be called what you like. Could be Vehicle for example. Then next level you can create 2nd level categories or 'types'. The next level categories is the Model Number. To add products to the Model number click Model Number name or Info icon then on right side click 'Manage Products' here you can select products. Click save then click Back to Category List.

 

I hope this answers your question. If I misunderstood please provide a bit more detail about what you want to achieve.

Link to comment
Share on other sites

nsb,

 

As you correctly guessed, it is for my car parts site,

 

I want to be able to select as follows:

 

Make,

Model,

Variant,

Year.

 

I am aware of another add-on that does this, but the way of adding items to vehicles is particularly clumsy. Your tick box type addition is by far an easier way of doing things, If it can be done!

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

Hi Adam,

 

What a wonderful contribution, and this is what I really need.

 

After finishing the installation, I found there is a problem.

 

when I am be to the admin to add products to the printer model, but there is no "manage products" button under edit and delete button.

 

I checked the installation instruction in readme, can't find the problem.

 

Many thanks!

 

Dansino

Link to comment
Share on other sites

You can create 3 levels of categories. Make, Type, Model Number.

 

These can be managed in admin section

 

You can edit the top level to be called what you like. Could be Vehicle for example. Then next level you can create 2nd level categories or 'types'. The next level categories is the Model Number. To add products to the Model number click Model Number name or Info icon then on right side click 'Manage Products' here you can select products. Click save then click Back to Category List.

 

I hope this answers your question. If I misunderstood please provide a bit more detail about what you want to achieve.

 

 

nsb,

 

Any ideas on this? It should work similarly to YMM, but with the capability of distinguishing models within models.

 

Thanks,

Rob

Link to comment
Share on other sites

Hi Adam,

 

What a wonderful contribution, and this is what I really need.

 

After finishing the installation, I found there is a problem.

 

when I am be to the admin to add products to the printer model, but there is no "manage products" button under edit and delete button.

 

I checked the installation instruction in readme, can't find the problem.

 

Many thanks!

 

Dansino

Please see this image. Manage Products is underlined in Red.

 

manage-products.jpg

Link to comment
Share on other sites

nsb,

 

Any ideas on this? It should work similarly to YMM, but with the capability of distinguishing models within models.

 

Thanks,

Rob

You can actually go down to four levels.

 

So you can name each level as required:

Make,

Model,

Variant,

Year.

 

On the year level you can Manage Products and add them to the appropriate year.

 

I also have a version I am working on where you can add products from the Product page. You actually go to the product page then add to the Filter. The opposite of the way we do it now. This will allow you to add one product to multiple filters. Would you like the code to do it this way or is the current method of adding product to filter OK?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

I've been over the steps and can't seem to figure out what I missed. My "Manage Products" link is non-existent. Therefore, I cannot manage products.

 

Any ideas?

 

I can't find the manage products link either.

Ah, the world wide web. What a wonderful place.

Link to comment
Share on other sites

To manage products click the Category/Filter name or the Info icon. Don't click the folder.

 

When you click the name or Info icon you will see buttons on the right side Edit and Delete. Underneath you will see Manage Products.

 

I hope this helps.

Link to comment
Share on other sites

  • 3 weeks later...

A new version has been uploaded http://addons.oscommerce.com/info/7116

 

To upgrade replace all files. No need to edit any other files.

I have YMM and EP installed and working but would like to try your printer filter

addon. I am having problems with the sql query. When I add it to my sql I get the

following message.

SQL query:

 

--------------------------------------------------------------------------

-- Dumping data for table `printer_category`

--

INSERT INTO `printer_category` ( `printer_category_id` , `parent_id` , `category_name` , `lablename` , `productids` , `status` )

VALUES ( 1, 0, 'Filter', 'Filter', '', 'Y' ) ,

 

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6

----------------------------------------------------------------------------

 

I am fairly new to sql and php so this message is not clear to me.

My SQL version is 5.1 working thru Xammp localhost.

Link to comment
Share on other sites

Nice addon, but with over 9000 items in the shop i needed a search function in the admin. Have made it posible to search. Cant get it to show all result, only the 'max search number' and when i go to next page it shows all items again. But my smal change make it posible to find a item easy an add it.

 

i post the code here if someone want to use it or make it bether.

 

admin/filter_printer_products.php

<?php
/*
  Printer Ink & Toner Filter
  V1.7 for Oscommerce v2.2 RC2a
  September 2010
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
$printer_category_id = $_REQUEST['printer_category_id'];
$parent_id = $_REQUEST['parent_id'];
if(isset($_REQUEST['printer_category_id'])&&($_REQUEST['printer_category_id']!=''))
{
$vehcat_query = tep_db_query("SELECT * FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$_REQUEST['printer_category_id']."'");
$vehcat_row = tep_db_fetch_array($vehcat_query);
}

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
// Ultimate SEO URLs v2.1
// If the action will affect the cache entries
   if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

 if (tep_not_null($action)) {

   switch ($action) {
 case 'assign_products':

       $productids = "";
	$selvalarray = array();
	$pagearray = array();
	$remproductarray = array();
	/** page product ids **/
	$products_query_raw = 'select p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';
	$products_query = tep_db_query($products_query_raw);
	$products_split = new splitPageResults($_REQUEST['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
	$products_query = tep_db_query($products_query_raw);
	while ($products = tep_db_fetch_array($products_query))
	{
		array_push($pagearray,$products['products_id']);
	}

	if(isset($HTTP_POST_VARS['productids']))
	{
		foreach($HTTP_POST_VARS['productids'] as $val)
		{
			if($val!='')
			{
				array_push($selvalarray,$val);					
				$productids .= $val.",";
			}
		}
	}
	foreach($pagearray as $val)
	{
		if(!in_array($val,$selvalarray))
		{
			array_push($remproductarray,$val);		
		}
	}

	$olderdata = $vehcat_row['productids'];
	$finaldata = "";
	if($olderdata!='')
	{
		 $oldprodarray = explode(",",$olderdata);
		 foreach($oldprodarray as $val)
		 {
		 	if(!in_array($val,$remproductarray))
			{
				if(!in_array($val,$selvalarray))
				{
					array_push($selvalarray,$val);
				}
			}
		 }
		 $productids = "";
		 foreach($selvalarray as $val)
		 {
		 	$productids .= $val.",";
		 }
		 $finaldata = substr($productids,0,-1);
	}
	else
	{
		 $finaldata = substr($productids,0,-1);
	}

	$update_sql_data = array('productids' => $finaldata);

       tep_db_perform(TABLE_PRINTER_CATEGORY, $update_sql_data, 'update', "printer_category_id = '" . (int)$printer_category_id . "'");
      tep_redirect(tep_href_link(FILENAME_PRINTER_PRODUCTS, 'parent_id=' . $parent_id.'&printer_category_id='.$printer_category_id.'&page='.$_REQUEST['page'] ));
       break;

}
 }
// check if the catalog image directory exists
 if (is_dir(DIR_FS_CATALOG_IMAGES)) {
   if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
 } else {
   $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<script language="JavaScript1.2">

function cOn(td)
{
if(document.getElementById||(document.all && !(document.getElementById)))
{
td.style.backgroundColor="#CCCCCC";
}
}

function cOnA(td)
{
if(document.getElementById||(document.all && !(document.getElementById)))
{
td.style.backgroundColor="#CCFFFF";
}
}

function cOut(td)
{
if(document.getElementById||(document.all && !(document.getElementById)))
{
td.style.backgroundColor="DFE4F4";
}
}
</script>
<?php
$vehcat_query = tep_db_query("SELECT * FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$_REQUEST['printer_category_id']."'");
$vehcat_row = tep_db_fetch_array($vehcat_query); 
$prodidsarr = explode(",",$vehcat_row['productids']);



if(isset($_POST['send']))
{
$searchfield = "%" . $_POST[prodmod] . "%";
}
else { 
$searchfield="%";}
?> 

<table border="0" align="center" width="90%" cellspacing="2" cellpadding="2">
 <tr>
<!-- body_text //-->
   <td width="100%" valign="top">
</td></tr><tr><td><form action="<? echo $PHP_SELF; ?>" method="post">
<table border="0" width="300" cellspacing="0" cellpadding="0"><tr>
<td class="dataTableContent" width="70"><?php echo TEXT_SEARCH_HEAD; ?></td>	 
</tr><tr>
<td class="dataTableContent" width="70"><input type="text" name="prodmod" value="" /></td>		  
</tr></table>
<tr><td><input name="send" type="submit" value="<?php echo TEXT_SEARCH_SEND; ?>"><br><br>


   <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE." ".$vehcat_row['category_name']; ?></td>
           <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_PRINTER_CATEGORY, 'printer_category_id='.$printer_category_id.'&parent_id=' . $parent_id ) . '">Back To Category List</a>';?> </td>
           <td align="right"></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td>

	<table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top">
		<?php 
		echo tep_draw_form('printerfilter', FILENAME_PRINTER_PRODUCTS, 'action=assign_products&parent_id='.$parent_id.'&printer_category_id='.$printer_category_id.'&page='.$_REQUEST['page'], 'post');
		?>
		<table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent" ><?php echo TABLE_HEADING_PRODUCT_ID; ?></td>
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_IMAGE;?></td>
   			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_NAME;?></td>
			<td class="dataTableHeadingContent" ><?php echo tep_image_submit('button_save.gif', IMAGE_SAVE); ?></td>
             </tr>
             <?php 
		  $products_query_raw = 'select p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and (p.products_id like "'.$searchfield.'" or pd.products_name like "'.$searchfield.'" or pd.products_description like "'.$searchfield.'") order by pd.products_name asc';
		  $products_split = new splitPageResults($_REQUEST['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
			$products_query = tep_db_query($products_query_raw);
			while ($products = tep_db_fetch_array($products_query))
			{
				?>
			<tr onMouseOver="cOn(this); this.style.cursor='pointer'; " onMouseOut="cOut(this);" bgcolor='#DFE4F4' >
				<td class="dataTableContent" valign="top"> <?php echo $products['products_id'];?> </td>
				<td class="dataTableContent" valign="top"> <?php echo tep_image(DIR_WS_CATALOG_IMAGES .$products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);?> </td>
				<td class="dataTableContent" valign="top"> <?php echo $products['products_name'];?> </td>
				<td class="dataTableContent" valign="top" style="padding-left:25px;"><input type="checkbox" name="productids[]" value="<?php echo $products['products_id'];?>" <?php if(in_array($products['products_id'],$prodidsarr)) echo 'checked';?> /></td>
		   </tr>
				<?php 
			} // End of while
		  ?>

           </table></form></td>

         </tr>
	  <tr>
			<td ><table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBoxContent">
			 <tr>
			  <td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_REQUEST['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
			  <td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_REQUEST['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID', 'action'))); ?></td>
			 </tr>
			</table></td>
		   </tr>
       </table>

	</td>
     </tr>
   </table>
   </td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

in

admin/includes/languages/your language/filter_printer_products.php

yust add before ?>

define('TEXT_SEARCH_HEAD', 'Search model mumber, name or description:');
define('TEXT_SEARCH_SEND', 'Send');

Edited by stClem
Link to comment
Share on other sites

now i can search and add products, but cat remove products :) :(

 

<?php
/*
  Printer Ink & Toner Filter
  V1.7 for Oscommerce v2.2 RC2a
  September 2010
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
$printer_category_id = $_REQUEST['printer_category_id'];
$parent_id = $_REQUEST['parent_id'];
if(isset($_REQUEST['printer_category_id'])&&($_REQUEST['printer_category_id']!=''))
{
       $vehcat_query = tep_db_query("SELECT * FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$_REQUEST['printer_category_id']."'");
       $vehcat_row = tep_db_fetch_array($vehcat_query);
}

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
// Ultimate SEO URLs v2.1
// If the action will affect the cache entries
   if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

 if (tep_not_null($action)) {

   switch ($action) {
        case 'assign_products':

       $productids = "";
               $selvalarray = array();
               $pagearray = array();
               $remproductarray = array();
               /** page product ids **/
               $products_query_raw = 'select p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';
               $products_query = tep_db_query($products_query_raw);
               $products_split = new splitPageResults($_REQUEST['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
               $products_query = tep_db_query($products_query_raw);
               while ($products = tep_db_fetch_array($products_query))
               {
                       array_push($pagearray,$products['products_id']);
               }

               if(isset($HTTP_POST_VARS['productids']))
               {
                       foreach($HTTP_POST_VARS['productids'] as $val)
                       {
                               if($val!='')
                               {
                                       array_push($selvalarray,$val);                                  
                                       $productids .= $val.",";
                               }
                       }
               }
               foreach($pagearray as $val)
               {
                       if(!in_array($val,$selvalarray))
                       {
                               array_push($remproductarray,$val);              
                       }
               }

               $olderdata = $vehcat_row['productids'];
               $finaldata = "";
               if($olderdata!='')
               {
                        $oldprodarray = explode(",",$olderdata);
                        foreach($oldprodarray as $val)
                        {
                               if(!in_array($val,$remproductarray))
                               {
                                       if(!in_array($val,$selvalarray))
                                       {
                                               array_push($selvalarray,$val);
                                       }
                               }
                        }
                        $productids = "";
                        foreach($selvalarray as $val)
                        {
                               $productids .= $val.",";
                        }
                        $finaldata = substr($productids,0,-1);
               }
               else
               {
                        $finaldata = substr($productids,0,-1);
               }

               $update_sql_data = array('productids' => $finaldata);

       tep_db_perform(TABLE_PRINTER_CATEGORY, $update_sql_data, 'update', "printer_category_id = '" . (int)$printer_category_id . "'");
      tep_redirect(tep_href_link(FILENAME_PRINTER_PRODUCTS, 'parent_id=' . $parent_id.'&printer_category_id='.$printer_category_id.'&page='.$_REQUEST['page'] ));
       break;

       }
 }
// check if the catalog image directory exists
 if (is_dir(DIR_FS_CATALOG_IMAGES)) {
   if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
 } else {
   $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<script language="Javascript1.2">

function cOn(td)
{
if(document.getElementById||(document.all && !(document.getElementById)))
{
td.style.backgroundColor="#CCCCCC";
}
}

function cOnA(td)
{
if(document.getElementById||(document.all && !(document.getElementById)))
{
td.style.backgroundColor="#CCFFFF";
}
}

function cOut(td)
{
if(document.getElementById||(document.all && !(document.getElementById)))
{
td.style.backgroundColor="DFE4F4";
}
}
</script>
<?php
$vehcat_query = tep_db_query("SELECT * FROM ".TABLE_PRINTER_CATEGORY." WHERE printer_category_id = '".$_REQUEST['printer_category_id']."'");
$vehcat_row = tep_db_fetch_array($vehcat_query); 
$prodidsarr = explode(",",$vehcat_row['productids']);



if(isset($_POST['send']))
{
$searchfield = "%" . $_POST[prodmod] . "%";
}
else { 
$searchfield="%";}
?> 

<table border="0" align="center" width="90%" cellspacing="2" cellpadding="2">
 <tr>
<!-- body_text //-->
   <td width="100%" valign="top">
	</td></tr><tr><td><form action="<? echo "$PHP_SELF?printer_category_id=$printer_category_id&parent_id=$parent_id"; ?>" method="post">
<table border="0" width="300" cellspacing="0" cellpadding="0"><tr>
<td class="dataTableContent" width="70"><?php echo TEXT_SEARCH_HEAD; ?></td>     
</tr><tr>
<td class="dataTableContent" width="70"><input type="text" name="prodmod" value="" /></td>                
</tr></table>
<tr><td><input name="send" type="submit" value="<?php echo TEXT_SEARCH_SEND; ?>"><br><br>
</form>

   <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE." ".$vehcat_row['category_name']; ?></td>
           <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_PRINTER_CATEGORY, 'printer_category_id='.$printer_category_id.'&parent_id=' . $parent_id ) . '">Back To Category List</a>';?> </td>
           <td align="right"></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td>

               <table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top">
                       <?php 
                       echo tep_draw_form('printerfilter', FILENAME_PRINTER_PRODUCTS, 'action=assign_products&parent_id='.$parent_id.'&printer_category_id='.$printer_category_id.'&page='.$_REQUEST['page'], 'post');
                       ?>
                       <table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent" ><?php echo TABLE_HEADING_PRODUCT_ID; ?></td>
                               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_IMAGE;?></td>
                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_NAME;?></td>
                               <td class="dataTableHeadingContent" ><?php echo tep_image_submit('button_save.gif', IMAGE_SAVE); ?></td>
             </tr>
             <?php 
                         $products_query_raw = 'select p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and (p.products_id like "'.$searchfield.'" or pd.products_name like "'.$searchfield.'" or pd.products_description like "'.$searchfield.'") order by pd.products_name asc';
                         $products_split = new splitPageResults($_REQUEST['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
                               $products_query = tep_db_query($products_query_raw);
                               while ($products = tep_db_fetch_array($products_query))
                               {
                                       ?>
                               <tr onmouseover="cOn(this); this.style.cursor='pointer'; " onmouseout="cOut(this);" bgcolor='#DFE4F4' >
                                       <td class="dataTableContent" valign="top"> <?php echo $products['products_id'];?> </td>
                                       <td class="dataTableContent" valign="top"> <?php echo tep_image(DIR_WS_CATALOG_IMAGES .$products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);?> </td>
                                       <td class="dataTableContent" valign="top"> <?php echo $products['products_name'];?> </td>
                                       <td class="dataTableContent" valign="top" style="padding-left:25px;"><input type="checkbox" name="productids[]" value="<?php echo $products['products_id'];?>" <?php if(in_array($products['products_id'],$prodidsarr)) echo 'checked';?> /></td>
                          </tr>
                                       <?php 
                               } // End of while
                         ?>

           </table></form></td>

         </tr>
                 <tr>
                               <td ><table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBoxContent">
                                <tr>
                                 <td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_REQUEST['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
                                 <td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_REQUEST['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID', 'action'))); ?></td>
                                </tr>
                               </table></td>
                          </tr>
       </table>

               </td>
     </tr>
   </table>
   </td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

  • 1 month later...

Hi Guys,

 

I am porting this contribution over to the new 2.3 and I have an admin error that is annoying me

 

Deprecated: Function eregi() is deprecated in C:\wamp\www\catalog\admin\filter_printer_products.php on line 26

 

which is this line

 

if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

 

now this is because eregi is gone in php 5.3

 

Any ideas on what to replace it with???

 

Thanks

 

PS

Link to comment
Share on other sites

Hi Guys,

 

I am porting this contribution over to the new 2.3 and I have an admin error that is annoying me

 

 

 

which is this line

 

if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

 

now this is because eregi is gone in php 5.3

 

Any ideas on what to replace it with???

 

Thanks

 

PS

 

ok I sorted it by changing it to preg_match

Link to comment
Share on other sites

I think I may have found another little issue.

 

I am testing with 2 products that I have linked to each other, the issue is that that both products show twice when selecting the top level category (see screenshot below)

 

Anyone know a work around for this?

 

Thanks

 

screen1on.jpg

Link to comment
Share on other sites

ok sussed it out, I changed

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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."')";

 

to

 

$listing_sql = "select distinct " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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."')";

 

All I added was 'distinct'

 

Regards

 

PS

Link to comment
Share on other sites

  • 2 weeks later...

 

I also have a version I am working on where you can add products from the Product page. You actually go to the product page then add to the Filter. The opposite of the way we do it now. This will allow you to add one product to multiple filters. Would you like the code to do it this way or is the current method of adding product to filter OK?

 

I would love any updates to this addon you have

 

thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...