Jump to content



Latest News: (loading..)

PupStar

Member Since 19 Jul 2009
ONLINE Last Active Today, 04:25 PM
*****

Topics I've Started

Watermarking Images

13 May 2013 - 08:59 PM

Does anyone know of an easy to integrate watermarking script either using pure php or jquery?

Thanks

Mark

Code modification help

27 April 2013 - 07:53 PM

Hi Guys,

Attached File  screenshot_parts.jpg   57.86K   19 downloads

I need the following code modded to only show products from the selected category.

If you look at the title it is 'Air Filter & Shroud' however the code below is listing all products in all categories.

This maybe a simple fix but for the life of me can not get my head around it.

Any help would be appreciated.

Thanks

Mark

<?php
/*
Parts Filter
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 ( preg_match("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');
if (tep_not_null($action)) {
switch ($action) {
case 'assign_products':
	 $productids = "";
	 $mediacat_ref_no = "";
	 $mediacat_quantity = "";
$selvalarray = array();
$pagearray = array();
$remproductarray = array();
$products_query_raw = 'select p.products_id, products_mediacat_quantity, products_mediacat_ref_no 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');
}
require(DIR_WS_INCLUDES . 'template_top.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']);
?>
<table border="0" align="center" width="100%" cellspacing="2" cellpadding="2">
<tr>
<!-- body_text //-->
<td width="100%" valign="top">
	 <table border="0" width="100%" cellspacing="4" cellpadding="0">
	 <tr>
		 <td>
		 <table border="0" width="100%" cellspacing="1" cellpadding="1">
			 <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>
				 <?php echo tep_draw_form('categorie', FILENAME_PRINTER_PRODUCTS, '', 'get'); echo tep_draw_hidden_field( 'row_by_page', $row_by_page);?>
				 <td class="smallText" align="right" valign="top">
				 </td></form>
			 <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="0">
				 <tr class="dataTableHeadingRow">
				 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_ID; ?></td>
				 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_MODEL;?></td>
				 <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_PRODUCT_NAME;?></td>
				 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_CATEGORY_NAME;?></td>
				 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_MEDIACAT_REF_NO;?></td>
				 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_MEDIACAT_QUANTITY;?></td>
				 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_SELECT;?></td>
				 </tr>
<?php
	 $products_query_raw = 'select distinct p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_id, p.products_mediacat_ref_no, p.products_mediacat_quantity 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_id asc';
	 $products_split = new splitPageResults($_REQUEST['page'], '20', $products_query_raw, $products_query_numrows);
	 $products_query = tep_db_query($products_query_raw);
	 while ($products = tep_db_fetch_array($products_query))
	 {
if ( strpos( tep_get_product_path($products['products_id']), "_" ) == FALSE ) {
$result = tep_get_category_name( tep_get_product_path( $products['products_id'] ) );
} else {
$pieces = explode("_", tep_get_product_path($products['products_id']) );
	 $categories_array = array();
	 $categories_array = tep_get_categories( $categories_array, $pieces[0] );
	 for ( $j = 0 ; $j < count($categories_array) ; $j++ ) {
	 if ( $categories_array[ $j ]['id'] == $pieces[ count( $pieces ) - 1 ] ) {
	 $result = $categories_array[ $j ][ 'text' ];
	 break;
	 }
}
}
?>
				 <tr>
				 <td class="dataTableContentBorder" valign="middle" align="center"><?php echo $products['products_id'];?></td>
				 <td class="dataTableContentBorder" align="center" valign="middle"><?php echo $products['products_model'];?></td>
				 <td class="dataTableContentBorder" valign="middle"><?php echo $products['products_name'];?></td>
				 <td class="dataTableContentBorder" valign="middle" align="center"><?php echo $result; ?></td>
				 <td class="dataTableContentBorder" valign="middle" align="center"><?php echo $products['products_mediacat_ref_no'];?></td>
				 <td class="dataTableContentBorder" valign="middle" align="center"><?php echo $products['products_mediacat_quantity'];?></td>
				 <td class="dataTableContentBorder" valign="middle" align="center"><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
?>
<tr>
<td class="smallText" align="right" colspan="7" style="padding: 12px"><div class="assign_parts">
	 <?php echo tep_draw_button(IMAGE_ASSIGN_PARTS, null, null, 'primary'); ?></div>
</td>
</tr>
			 </table></form>
			 </td>
		 </tr>
		 <tr>
<td ><table border="0" width="100%" cellspacing="0" cellpadding="2">
<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 //-->
<?php
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Tabbed Category Box

18 March 2013 - 06:50 PM

I have combined the category and manufacturers boxes with a tabbed display.

I am however not entirely satisfied with the tabs/box header and have been fiddling with it for quite a while now and can not achieve a decent look.]

The code is

$data = '<div id="tabs_box" style="padding: 0px;">' .
		 '<ul>' .
			 '<li><div class="ui-widget infoBoxHeading"><a href="#tabs-1">' . MODULE_BOXES_CATEGORIES_BOX_TITLE . '</a></div></li>' .
			 '<li><div class="ui-widget infoBoxHeading"><a href="#tabs-2">' . MODULE_BOXES_MANUFACTURERS_BOX_TITLE . '</a></div></li>' .
		 '</ul>' .
		 '<div class="ui-widget-content-cat ui-corner-bottom infoBoxContainer" id="tabs-1">' .
		 '' . $categories_string . '' .
		 '</div>' .
		 '<div class="infoBoxContainer" id="tabs-2">' .
		 '' . $manufacturers_content . '' .
		 '</div>' .
		 '</div>' .
		 '<script>' .
		 ' $(function(){' .
		 '		 $("#tabs_box").tabs();' .
		 ' });' .
		 '</script>';
	 return $data;
}

I have attached screenshots of how it looks.

Can I throw this open to suggestions / improvements please guys.

Thanks

Mark

Modifying Contact Us Page

23 February 2013 - 09:15 PM

Hi Guys,

I am at it again (w00t)

I am looking for suggestions on how to modify the contact us 'success' code so that it opens in a jquery dialog rather than changing the page.

Suggestions on a postcard to........

Mark

A very simple jquery dialog question

11 February 2013 - 10:33 PM

I have a popup contact form that is triggered by this script

<script type="text/javascript">
$('#contactus').dialog({
  autoOpen: false,
  width: 500,
});
</script>

my questions are ..... how do I have the website behind the dialog box fade out???

Is there an effect that can be applied or would I need to add a class to the stylesheet and if so how to incorporate that into the script???

Thanks

Mark