PDA

View Full Version : oscommerce mod to oscmax instruction help



tcshadow
05-04-2011, 05:38 PM
Hello,

I'm trying to install a mod for oscommerce into oscmax and I have questions on 2 bits of instructions. Can you tell me the equivalent oscmax 2.5 instructions for the following?


Edit Left Column File
catalog/includes/column_left.php

Add before require(DIR_WS_BOXES . 'whats_new.php');

// Printer Ink & Toner Filter
require(DIR_WS_BOXES . 'filter_printer.php');



Edit
catalog/admin/includes/boxes/catalog.php
Add after '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .

// Printer Ink & Toner Filter
'<a href="' . tep_href_link(FILENAME_PRINTER_CATEGORY, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_FILTER_PRINTER . '</a><br>' .

Much thanks in advance :)

tcshadow
05-04-2011, 06:11 PM
This is the full instruction file just in case there's somethng in there that also doesn't match up but I think everything else works fine.


Back up Database

Back up following files that will be edited:
catalog/includes/database_tables.php
catalog/includes/filenames.php
catalog/admin/includes/database_tables.php
catalog/admin/includes/filenames.php
catalog/admin/includes/boxes/catalog.php
catalog/admin/includes/languages/english.php

#######

--- Begin Installation ---

#######

Database

Run only one SQL file. Choose either printer_category.sql or printer_category_with-sample-data.sql

If you are using this module for another type of filter install sql with no sample data

printer_category.sql provides only structure with no sample data
printer_category_with-sample-data.sql this is recommended as it will install sample data with many major printer models

#######

Include New Files

Catalog:
catalog/filter_printer.php
catalog/includes/boxes/filter_printer.php
catalog/includes/languages/english/filter_printer.php
catalog/js/ajaxd.js

Admin:
catalog/admin/filter_printer_category.php
catalog/admin/filter_printer_products.php
catalog/admin/includes/languages/english/filter_printer_category.php
catalog/admin/includes/languages/english/filter_printer_products.php

#######

**** Edit existing files ****

Edit Database Tables File
catalog/includes/database_tables.php

Add after: define('TABLE_ORDERS_TOTAL', 'orders_total');

// Printer Ink & Toner Filter
define('TABLE_PRINTER_CATEGORY', 'printer_category');

###
Edit Filenames File
catalog/includes/filenames.php

Add after define('FILENAME_DOWNLOAD', 'download.php');

// Printer Ink & Toner Filter
define('FILENAME_FILTER_PRINTER', 'filter_printer.php');
define('FILENAME_FILTER_PRINTER_FINDER', 'filter_printer.php?filterid=1');

###

Edit Left Column File
catalog/includes/column_left.php

Add before require(DIR_WS_BOXES . 'whats_new.php');

// Printer Ink & Toner Filter
require(DIR_WS_BOXES . 'filter_printer.php');


Edit Main Language File
catalog/includes/languages/english.php

Add after define('BOX_INFORMATION_CONTACT', 'Contact Us');

// Printer Ink & Toner Filter
define('BOX_HEADING_FILTER_PRINTER', 'Printer Filter');
define('BOX_INFORMATION_FILTER_PRINTER', 'Ink &amp; Toner Finder');

###

Admin Section:

Edit Database Tables File
catalog/admin/includes/database_tables.php

After define('TABLE_ORDERS_TOTAL', 'orders_total');
Add
// Printer Ink & Toner Filter
define('TABLE_PRINTER_CATEGORY', 'printer_category');


Edit Filenames File
catalog/admin/includes/filenames.php

Add after define('FILENAME_POPUP_IMAGE', 'popup_image.php');

// Printer Ink & Toner Filter
define('FILENAME_PRINTER_CATEGORY', 'filter_printer_category.php');
define('FILENAME_PRINTER_PRODUCTS', 'filter_printer_products.php');


Edit
catalog/admin/includes/boxes/catalog.php
Add after '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .

// Printer Ink & Toner Filter
'<a href="' . tep_href_link(FILENAME_PRINTER_CATEGORY, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_FILTER_PRINTER . '</a><br>' .


Edit
catalog/admin/includes/languages/english.php
Add after define('BOX_CATALOG_MANUFACTURERS', 'Manufacturers');

// Printer Ink & Toner Filter
define('BOX_CATALOG_FILTER_PRINTER', 'Ink &amp; Toner Filter');


____
Done

Notes:

Please go in admin panel and in file access give proper file access

pgmarshall
05-05-2011, 12:50 AM
Edit
catalog/admin/includes/boxes/catalog.php
Add after

'<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .

// Printer Ink & Toner Filter
'<a href="' . tep_href_link(FILENAME_PRINTER_CATEGORY, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_FILTER_PRINTER . '</a><br>' .


Edit
catalog/admin/includes/languages/english.php
Add after define('BOX_CATALOG_MANUFACTURERS', 'Manufacturers');

// Printer Ink & Toner Filter
Should read:


Add after:
tep_admin_jqmenu(FILENAME_SPECIALS, BOX_CATALOG_SPECIALS, 'TOP') .

tep_admin_jqmenu(FILENAME_PRINTER_CATEGORY, BOX_CATALOG_FILTER_PRINTER, 'TOP') .

Edit
catalog/admin/includes/languages/core.php

define('BOX_CATALOG_FILTER_PRINTER', 'Ink &amp; Toner Filter');

You will also need to add the files to the permission in admin ... see the wiki for more instructions ...

Regards,

tcshadow
05-05-2011, 12:55 AM
ok cool that confirms what i had already... now I just need the left column code stuff...

pgmarshall
05-05-2011, 01:47 AM
Column_left is pulled from the database ... you need to add a new infobox in infobox manager (under templates) ... I think there is a wiki article on how to do this.

Regards,

tcshadow
05-05-2011, 06:09 PM
I added a new infobox, with the filename filter_printer.php and everything seems to now be working fine back-end, the infobox is on and active but won't display in the catalog...

Any ideas what I may have missed?

tcshadow
05-05-2011, 06:42 PM
ok so I got my infobox up...Turns out I can't read and didn't have the infobox set up right... Except now in the title of the infobox it says

BOX_HEADING_FILTER_PRINTER instead of the proper title (now fixed for some reason I missed the file edit to define language when I did the other file edits) and there is simply a link that links to filter_printer.php

I have gone through every instruction again... The only thing I was unsure about was the

catalog/js/ajaxd.js file so I placed it both in

catalog/js/ajaxd.js and
catalog/javascript/ajaxd.js

tcshadow
05-10-2011, 12:23 AM
anyone have any suggestions?

tcshadow
05-14-2011, 04:40 AM
I've tracked the problem down to being with the code in one of these two php files Unfortunately my skills in php extend to being able to change the names of files and define's... I have no idea how to fix whatever it is that isn't working correctly.

Also the script is designed to open a window with the specific dropdown menus. What I would prefer would be to have the dropdown menus simply appear in the infobox like the manufacturer dropdown menu for example.



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


if(isset($_REQUEST['filterid'])&&($_REQUEST['filterid']!=''))
{
$filterid = $_REQUEST['filterid'];

$filterqueery = tep_db_query("select * from ".TABLE_PRINTER_CATEGORY." where parent_id = '0' AND printer_category_id = '".$filterid."'");
if(mysql_num_rows($filterqueery)>0)
{
$showfilter = true;


}

}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FILTER_PRINTER);

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_INKTONERFINDER));
?>
<!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>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript" src="js/ajaxd.js" ></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><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; ?></td>
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main">


<?php if($showfilter){?>

<p>Find products by selecting the printer make and model</p>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main">
<div>
<?php getprintercatoptions($filterid); ?>
</div>
</td>
</tr>
<tr>
<td class="main">
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td class="bodyContent">
<?php
$printerid = 0;
if(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='showlist'))
{
$printerid= $_REQUEST['printer_cat_'.$filterid];
}
elseif(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='searchlist'))
{
$vehidrow = @mysql_fetch_array(mysql_query("SELECT printer_category_id FROM ".TABLE_PRINTER_CATEGORY." where category_name = '".$_REQUEST['keywords']."'"));
if($vehidrow['printer_category_id']!='')
{
$printerid= $vehidrow['printer_category_id'];
}
}
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
'PRODUCT_LIST_BUY_NOW' => 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 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';
break;
case 'PRODUCT_LIST_NAME':
$select_column_list .= 'pd.products_name, ';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$select_column_list .= 'm.manufacturers_name, ';
break;
case 'PRODUCT_LIST_QUANTITY':
$select_column_list .= 'p.products_quantity, ';
break;
case 'PRODUCT_LIST_IMAGE':
$select_column_list .= 'p.products_image, ';
break;
case '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 " . $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."')";
}

?>
<?php
if($productids!='')
{
include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
}
}
?>
</td>
</tr>
</tbody>
</table>

<?php }?>

<?php
function getprintercatoptions($printer_category_id="",$curprintercatid="")
{

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

$printer_category_id = $_REQUEST['printer_cat_'.$printer_category_id];
$str = getprintercatpath($printer_category_id,"");
$chkbottomROW = mysql_fetch_array(mysql_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="")
{
?>
<table align="left" width="100%" cellpadding="0" cellspacing="0" border="0">
<?php
$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(mysql_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']);
}
?>
<tr><td align="left" valign="top">
<?php
if($cntvarr==$i+1)
{
$selval = $printer_category_id;
}

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

echo tep_draw_pull_down_menu('printer_cat_'.$val, $veh_cat_array, $selval, 'onchange="document.frmveh.printer_cat_'.$fieldid.'.value=thi s.value;document.frmveh.submit();"');
?>
</td></tr>
<?php
$i++;
}
}
?>
</table>

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

}

?>
<form name="frmveh" action="" method="get">
<input type="hidden" name="printer_cat_<?php echo $filterid;?>" value="<?php echo $_REQUEST['printer_cat_1'];?>">
<input type="hidden" name="filterid" value="<?php echo $filterid;?>" />
<input type="hidden" name="mode" value="showlist" />
</form>

</td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</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'); ?>


or


<?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
*/
?>
<!-- Printer Filter //-->
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_FILTER_PRINTER);

new infoBoxHeading($info_box_contents, false, false);

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

new infoBox($info_box_contents);
?>
</td>
</tr>
<!-- Printer Filter eof //-->