Jump to content
Sign in to follow this  
ttstitches

ANY JAVA GURUS OUT THERE WILLING TO HELP

Recommended Posts

I am making some improvements on Specials by Category. I've added most of the what is needed (I think) but obviously not everything. Specials by Category presently does not have an end time or a start time, I would like to fix that. So I have used other contributions to kind of MoshPosh something together. I have a picture of it below

Picture1.png

I've got it mostly working, I just can't get the calendars to pop up like they are supposed to, you click on the arrow to bring them up and nothing happens. I know NOTHING about javascript , but I pulled everything that seemed to reference it from specials.php which uses the calendar for the start date.

If any one can give me a push as to what I have done wrong, I would love to get this working for myself and other that might want to use it. I've very clearly commented areas that I messed with/added or changed.

Thanks bunches for any help!

Teresa

<?php
/*
 $Id: specialsbycategory.php,v 2.0 2006/11/07 18:18:00 stephenwald Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
?>
<!--****MY ADDTIONS IN AN ATTEMPT TO GET POP UP CALENDAR************************************//-->
<!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>
<?php
 if ( ($action == 'new') || ($action == 'edit') ) {
?>
<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">
<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>
<?php
 }
?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<div id="popupcalendar" class="text"></div>

<!--*****MY ADDITIONS IN AN ATTEMPT TO GET POP UP CALENDAR***********************************//-->
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->

</table>
 </td>

 <!-- body_text //-->
 <td valign="top">

<!----------------------- Actual code for Specials Admin starts here ------------------------->
<?php
 //Fetch all variables
 $categories = (isset($_GET['categories']) ? (int)$_GET['categories'] : '0');
 $manufacturer = (isset($_GET['manufacturer']) ? (int)$_GET['manufacturer'] : '0');

 if ($manufacturer) {
  $man_filter = " and manufacturers_id = '$manufacturer' ";
 } else {
$man_filter = ' ';
 }

 if (array_key_exists('discount',$_GET)) {
  if (is_numeric($_GET['discount'])) {
	$discount = (float)$_GET['discount'];
} else {
	$discount = -1;		
}
 } else { 
  $discount = -1;
 }
if($_POST['submit']) {
foreach($_POST['master'] as $m) {
 $fullprice = (isset($m['fullprice']) ? $m['fullprice'] : '');
 $productid = (isset($m['productid']) ? (int)$m['productid'] : '0');
 $inputspecialprice = (isset($m['inputspecialprice']) ? $m['inputspecialprice'] : 'none');
 if ($fullprice == 'yes') {
tep_db_query("DELETE FROM " . TABLE_SPECIALS . " WHERE products_id=$productid;");
continue;
 }
 if($inputspecialprice != "none"){
if (substr($inputspecialprice, -1) == '%') {
  $productprice = (isset($m['productprice']) ? (float)$m['productprice'] : '');
  $specialprice = ($productprice - (($inputspecialprice / 100) * $productprice));
} else if (substr($inputspecialprice, -1) == 'i') {
  $taxrate = (isset($m['taxrate']) ? (float)$m['taxrate'] : '1');
  $productprice = (isset($m['productprice']) ? (float)$m['productprice'] : '');
  $specialprice = ($inputspecialprice /(($taxrate/100)+1));
} else {
 	$specialprice = $inputspecialprice;
}
$alreadyspecial = tep_db_query ("SELECT * FROM " . TABLE_SPECIALS . " WHERE products_id=$productid");
$specialproduct= tep_db_fetch_array($alreadyspecial);
if ($specialproduct["specials_id"]){
//	  print ("Database updated. Status:".$specialproduct["status"]);
  tep_db_query ("UPDATE " . TABLE_SPECIALS . " SET specials_new_products_price='$specialprice' where products_id=$productid  "); 
} else{
//	  print("New product added to specials table");
}
//******ADDED IN ATTEMPT TO GET A POP UP CALENDAR FOR INPUT********FORM SPECIALS.PHP******//
 $day = tep_db_prepare_input($HTTP_POST_VARS['day']);
	$month = tep_db_prepare_input($HTTP_POST_VARS['month']);
	$year = tep_db_prepare_input($HTTP_POST_VARS['year']);
	$vday = tep_db_prepare_input($HTTP_POST_VARS['vday']);
	$vmonth = tep_db_prepare_input($HTTP_POST_VARS['vmonth']);
	$vyear = tep_db_prepare_input($HTTP_POST_VARS['vyear']);
  // check if valid from date is later than expires date
	if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year) &&
		tep_not_null($vday) && tep_not_null($vmonth) && tep_not_null($vyear)) {

		if (($vyear > $year) ||
			($vmonth > $month && $vyear == $year) ||
			($vday > $day && $vmonth == $month && $vyear == $year))
			{
				// if so, swap the dates
				$tempdate = $vyear; $vyear = $year; $year = $tempdate;
				$tempdate = $month; $vmonth = $month; $month = $tempdate;
				$tempdate = $vday; $vday = $day; $day = $tempdate;
			}


  $today = date("Y-m-d H:i:s");
	$expires_date = '';
	if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
	  $expires_date = $year;
	  $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
	  $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
	}

	$validfrom_date = '';
	if (tep_not_null($vday) && tep_not_null($vmonth) && tep_not_null($vyear)) {
	  $validfrom_date = $vyear;
	  $validfrom_date .= (strlen($vmonth) == 1) ? '0' . $vmonth : $vmonth;
	  $validfrom_date .= (strlen($vday) == 1) ? '0' . $vday : $vday;
//*******ADDED IN ATTEMPT TO GET A POP UP CALENDAR FOR INPUT *********FROM SPECIALS.PHP*******//		 
	}

// Fix v1.3 - spell out columns so this also works when columns have been added to the specials table.
// Fix v1.4 - set default expiration date to '0' and last modified to $today.

// ORIGINAL	 tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " VALUES ('','$productid','$specialprice','$today','','','','1')");
//*******ADDED BELOW IN ATTEMPT TO GET ADD BEGIN AND END TO SPECIAL CATEGORIES CONTRIBUTION*******FROM SPECIALS*******//
	tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " (specials_id, products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status, valid_from_date) VALUES ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), now(), '" . tep_db_input($expires_date) . "', now(), '1', '".  tep_db_input($validfrom_date)  ."')");

}
 }
}
}
?>

<form action="<?php echo $current_page; ?>" method="get">
<table><tr class="dataTableHeadingRow"><td class="dataTableHeadingContent" colspan="6">
<?php
 echo TEXT_SELECT_CAT .' ' . tep_draw_pull_down_menu('categories', tep_get_category_tree(), $categories);

 //BoF Added v1.4 allow selection by manufacturer
 $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
							 'text' => $manufacturers['manufacturers_name']);
 }
 echo TEXT_SELECT_MAN . ' ' . tep_draw_pull_down_menu('manufacturer',$manufacturers_array, $manufacturer) .'   ';
 //EoF Added v1.4

 echo TEXT_ENTER_DISCOUNT . ':  ';
?>
<input type="text" size="4" name="discount" value="<?php 
 if ($discount > 0) { echo $discount; }
 echo '">' . TEXT_PCT_AND . ' '; 

?>
<!--*********MY ADDTITIONS FROM SPECIALS********************//-->
		<?php echo TEXT_SPECIALS_VALIDFROM_DATE; ?> 
		<?php echo tep_draw_input_field('vday', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('vmonth', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('vyear', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('BTN_valid_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_valid_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_valid_date', 'img_Date_DOWN');showCalendar('new_special','vday', 'vmonth', 'vyear','dte_valid_When','BTN_valid_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_valid_date"'); ?></a>

		<?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> 
		<?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special', 'day', 'month','year', 'dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a>
  <!--******MY ADDITIONS FROM SPECIALS***********************  -->

<input type="submit" value="<?php echo TEXT_BUTTON_SUBMIT; ?>">
</form></td></tr>
<tr class="dataTableContent"><td class="dataTableContent" colspan="6">
<ul><li><?php echo TEXT_INSTRUCT_1; ?></li>
<li><?php echo TEXT_INSTRUCT_2; ?></li>
</ul>
</td></tr>
<?
 if ($discount == -1) {
  //echo 'do nothing';
 } else if ($discount == 0) {
  //BoF Changed v1.4 
  if ($categories) {
  $result2 = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . 
						  " ptc where p.products_id=ptc.products_id and ptc.categories_id=$categories" . $man_filter);
} else {
  $result2 = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p where 1=1" . $man_filter);
}
  //EoF Changed v1.4 

while ( $row = tep_db_fetch_array($result2) ){
  $allrows[] = $row["products_id"];
}
tep_db_query("DELETE FROM " . TABLE_SPECIALS . " WHERE products_id in ('".implode("','",$allrows)."')");
 } else if ($discount > 0) {  
$specialprice = $discount / 100;

  //BoF Changed v1.4 
  if ($categories) {
  $result2 = tep_db_query("select p.products_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . 
						  " ptc where p.products_id=ptc.products_id and ptc.categories_id=$categories" . $man_filter);
} else {
	$result2 = tep_db_query("select p.products_id, p.products_price from " . TABLE_PRODUCTS . " p where 1=1 " . $man_filter);
}
  //EoF Changed v1.4 

while ( $row = tep_db_fetch_array($result2) ){
  $hello2 = $row["products_price"];
  $hello3 = $hello2 * $specialprice;
  $hello4 = $hello2 - $hello3;
  $number = $row["products_id"];
  $result3 = tep_db_query("select * from " . TABLE_SPECIALS . " where products_id = $number");
  $num_rows = tep_db_num_rows($result3);
  if ($num_rows == 0){
	  //echo "Insert into specials (products_id, specials_new_products_price) values ($number, '$hello4')"; 
	//Fix v1.4 set default expiration date to '0' and status active.
	//ORIGINAL  tep_db_query("Insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price) values ($number, '$hello4')");
//*******MY ATTEMPT AT GETTING START AND END IN SPECIALS CATEGORIES*****FROM SPECIALS**********		 
	  tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status, valid_from_date ) VALUES '" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), now(), '" . tep_db_input($expires_date) . "', now(), '1', '".  tep_db_input($validfrom_date)  ."')");


  } else {
	//echo "Update specials set specials_new_products_price='$hello4' where products_id=$number";
	tep_db_query ("Update " . TABLE_SPECIALS . " set specials_new_products_price='$hello4' where products_id=$number");
  }
}
 }
 print ("
		<tr class=\"dataTableHeadingRow\">
		<td class=\"dataTableHeadingContent\">". TABLE_HEADING_PRODUCTS ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_PRODUCTS_PRICE ."</td>
		<td class=\"dataTableHeadingContent\">Products Cost</td>
 <!--***********MY ADDITIONS FROM ADD TABLE HEADINGS************************//-->
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_START_DATE ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_END_DATE ."</td>
 <!--***********MY ADDITIONS FROM ADD TABLE HEADINGS************************//-->		  
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_PRICE ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_PCT_OFF ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_FULL_PRICE . "</td>
		</tr>");

 //BoF Changed v1.4			 
 if ($categories) {
  $result2 = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . 
					  " ptc, " . TABLE_PRODUCTS . " p where pd.products_id=ptc.products_id and p.products_id=ptc.products_id 
		   and ptc.categories_id = $categories and pd.language_id = " .(int)$languages_id . $man_filter . " order by pd.products_name asc ");
 } else if ($manufacturer) {
  $result2 = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p where pd.products_id=p.products_id 
		   and pd.language_id = " .(int)$languages_id . $man_filter . " order by pd.products_name asc ");
 } else {
  $result2 = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . 
					  " ptc, " . TABLE_PRODUCTS . " p where pd.products_id=ptc.products_id and p.products_id=ptc.products_id 
		   and ptc.categories_id = $categories and pd.language_id = " .(int)$languages_id . $man_filter . " order by pd.products_name asc ");	  
 }
	//EoF Changed v1.4 
print("<form action=\"$current_page?categories=$categories&manufacturer=$manufacturer\" method=\"post\">");
$base=-1;
 while ( $row = tep_db_fetch_array($result2) ) {
$base++;
$number = $row["products_id"];
$result3 = tep_db_query("SELECT * FROM " . TABLE_SPECIALS . " where products_id=$number");
$num_rows = tep_db_num_rows($result3);
if ($num_rows == 0) {
  $specialprice = "none";
  $implieddiscount = '';
} else {
  while ( $row2 = tep_db_fetch_array($result3) ) {
	$specialprice = $row2["specials_new_products_price"];
	if ($row["products_price"] > 0) {
	  $implieddiscount = '-'.(int)(100-(($specialprice / $row["products_price"])*100)).'%';
	} else {
		$implieddiscount = '';
	}
  }
 }
$tax_rate = tep_get_tax_rate($row['products_tax_class_id']);

/////BELOW IS THE EDITING AREA - NEED TO FIGURE OUT HOW TO ADD START AND END TO THIS /////
print("
<tr class=\"dataTableRow\" onmouseover=\"rowOverEffect(this)\" onmouseout=\"rowOutEffect(this)\" >
<td class=\"dataTableContent\">" . $row["products_name"] . "</td>
<td class=\"dataTableContent\">" . $row["products_price"] . "</td>
<td class=\"smallText\" style=\"color:#777777\">" . $row["products_cost"] . "</td>
<td class=\"dataTableContent\"><input name=\"master[".$base."][inputspecialprice]\" type=\"text\" value=\"$specialprice\"></td>
<td class=\"dataTableContent\">$implieddiscount </td>
<td class=\"dataTableContent\"><input type=\"checkbox\" name=\"master[".$base."][fullprice]\" value=\"yes\"></td>
<td class=\"dataTableContent\"><input type=\"hidden\" name=\"master[".$base."][categories]\" value=\"" . $categories ."\">
<input type=\"hidden\" name=\"master[".$base."][productprice]\" value=\"" . $row["products_price"] . "\">
<input type=\"hidden\" name=\"master[".$base."][taxrate]\" value=\"" . $tax_rate . "\">	
<input type=\"hidden\" name=\"master[".$base."][productid]\" value=\"" . $number . "\">
  ");
 }
 print ("</table>");
 if($base>=0)  print ("<input type=\"submit\" name=\"submit\" value=\"" . TEXT_BUTTON_UPDATE . "\"></form>");
?>
<!------------------------ Code for Specials Admin ends here --------------------------->

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

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

</body>
</html>

Share this post


Link to post
Share on other sites

Okay, well still plugging along.... any input would be great!!!

I've cleaned up some more

 require('includes/application_top.php');
?>
<!--****MY ADDTIONS IN AN ATTEMPT TO GET POP UP CALENDAR************************************//-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <title><?php echo HEADING_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>
<!--*****MY ADDITIONS IN AN ATTEMPT TO GET POP UP CALENDAR***********************************//-->
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

 

now I put the below code just before the form action, thinking that would be a good place for it, but then I noticed above the form action was an "insert" too....I think it is kind of like a "case" but not as formally set up, so maybe this should go higher above that line....I'll play with that, but in the interim, here is the chunk of code:

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

<script language="javascript">

var valid_from_date = new ctlSpiffyCalendarBox("valid_from_date", "specialsbycategory", "dfrom", "btnDate1","<?php echo $dfrom; ?>",scBTNMODE_CUSTOMBLUE);

var expires_date = new ctlSpiffyCalendarBox("expires_date", "specialsbycategory", "dto", "btnDate2","<?php echo $dto; ?>",scBTNMODE_CUSTOMBLUE);

</script>

 

Okay now we are in the gray table shown in the picture in the first post and I've addedthe start date and end date where the calendars are supposed to pop up - this is an area I need to work on as I pulled this from Specials.php and I don't want it to break out into date Month year, one entry with all combined - so I will be messing with this today

  echo TEXT_ENTER_DISCOUNT . ':  ';
?>
<input type="text" size="4" name="discount" value="<?php 
 if ($discount > 0) { echo $discount; }
 echo '">' . TEXT_PCT_AND . ' '; 

?>
<!--*********MY ADDTITIONS FROM SPECIALS********************//-->
		<?php echo TEXT_SPECIALS_VALIDFROM_DATE; ?> 
		<?php echo tep_draw_input_field('vday', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('vmonth', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('vyear', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('BTN_valid_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_valid_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_valid_date', 'img_Date_DOWN');showCalendar('new_special','vday', 'vmonth', 'vyear','dte_valid_When','BTN_valid_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_valid_date"'); ?></a>

		<?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> 
		<?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special', 'day', 'month','year', 'dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a>
  <!--******MY ADDITIONS FROM SPECIALS***********************  -->

<input type="submit" value="<?php echo TEXT_BUTTON_SUBMIT; ?>">
</form></td></tr>
<tr class="dataTableContent"><td class="dataTableContent" colspan="6">
<ul><li><?php echo TEXT_INSTRUCT_1; ?></li>
<li><?php echo TEXT_INSTRUCT_2; ?></li>
</ul>
</td></tr>

okay now this is the area in the picture below the grey box where the list of individual specials that were pulled from the categories you chose will print out and be visible so this code will set up the table headers

   //ORIGINAL  tep_db_query("Insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price) values ($number, '$hello4')");
//*******MY ATTEMPT AT GETTING START AND END IN SPECIALS CATEGORIES*****FROM SPECIALS**********		 
	  tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status, valid_from_date ) VALUES '" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), now(), '" . tep_db_input($expires_date) . "', now(), '1', '".  tep_db_input($validfrom_date)  ."')");


  } else {
	//echo "Update specials set specials_new_products_price='$hello4' where products_id=$number";
	tep_db_query ("Update " . TABLE_SPECIALS . " set specials_new_products_price='$hello4' where products_id=$number");
  }
}
 }
 print ("
		<tr class=\"dataTableHeadingRow\">
		<td class=\"dataTableHeadingContent\">". TABLE_HEADING_PRODUCTS ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_PRODUCTS_PRICE ."</td>
		<td class=\"dataTableHeadingContent\">Products Cost</td>
 <!--***********MY ADDITIONS FROM ADD TABLE HEADINGS************************//-->
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_START_DATE ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_END_DATE ."</td>
 <!--***********MY ADDITIONS FROM ADD TABLE HEADINGS************************//-->		  
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_PRICE ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_PCT_OFF ."</td>
		<td class=\"dataTableHeadingContent\">" . TABLE_HEADING_FULL_PRICE . "</td>
		</tr>");

Now we are cruising along almost done but WHOA big speed bump for me. This the are where once all the specials are listed (as I mentioned before) a couple of the columns will allow you to edit the specials shown. Say you made a mistake or out of the whole category there was one item you didn't want on sale, here you could click and say "Full Price" on this item...Now sure it would be nice to be able to fix the end date are start date here, but if I get the above working I would be happy with that, what I am thinkins is just to print the start and end dates here, but I have never seen code set up quite like this (lots and lots of slashes) and I don't know what to do here, so I have been saving it for last---any suggestions

/////BELOW IS THE EDITING AREA - NEED TO FIGURE OUT HOW TO ADD START AND END TO THIS /////
print("
<tr class=\"dataTableRow\" onmouseover=\"rowOverEffect(this)\" onmouseout=\"rowOutEffect(this)\" >
<td class=\"dataTableContent\">" . $row["products_name"] . "</td>
<td class=\"dataTableContent\">" . $row["products_price"] . "</td>
<td class=\"smallText\" style=\"color:#777777\">" . $row["products_cost"] . "</td>
<td class=\"dataTableContent\"><input name=\"master[".$base."][inputspecialprice]\" type=\"text\" value=\"$specialprice\"></td>
<td class=\"dataTableContent\">$implieddiscount </td>
<td class=\"dataTableContent\"><input type=\"checkbox\" name=\"master[".$base."][fullprice]\" value=\"yes\"></td>
<td class=\"dataTableContent\"><input type=\"hidden\" name=\"master[".$base."][categories]\" value=\"" . $categories ."\">
<input type=\"hidden\" name=\"master[".$base."][productprice]\" value=\"" . $row["products_price"] . "\">
<input type=\"hidden\" name=\"master[".$base."][taxrate]\" value=\"" . $tax_rate . "\">	
<input type=\"hidden\" name=\"master[".$base."][productid]\" value=\"" . $number . "\">
  ");
 }
 print ("</table>");
 if($base>=0)  print ("<input type=\"submit\" name=\"submit\" value=\"" . TEXT_BUTTON_UPDATE . "\"></form>");
?>
<!------------------------ Code for Specials Admin ends here --------------------------->

So anyways that's what I have so far any help would be great

Teresa

Share this post


Link to post
Share on other sites

NO ONE IS HELPING.....

Okay I have it the calendar is not 3 inputs (date month year) as in the first picture...Its not laid out nicely, still trying to figure out the format but at least it is just one input not 3 BUT still not working Darn it!

heres the code

			<?php echo TEXT_SPECIALS_VALIDFROM_DATE; ?><br><small>(YYYY-MM-DD)</small> 
		  <?php echo tep_draw_input_field('dfrom', (isset($sInfo->valid_from_date) ? substr($sInfo->valid_from_date, 0, 10) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('btnDate1', 'img_Date_OVER',true);" onmouseout="calSwapImg('btnDate1', 'img_Date_UP',true);" onclick="calSwapImg('btnDate1', 'img_Date_DOWN');showCalendar("dfrom", "specialsbycategory", "valid_from_date", "btnDate1");return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="btnDate1"'); ?></a><script language="javascript">drom.writeControl(); dfrom.dateFormat="yyyy-MM-dd";</script>		

	   <?php echo TEXT_SPECIALS_EXPIRES_DATE; ?><br><small>(YYYY-MM-DD)</small> 
		<?php echo tep_draw_input_field('dto', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 10) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('btnDate2', 'img_Date_OVER',true);" onmouseout="calSwapImg('btnDate2', 'img_Date_UP',true);" onclick="calSwapImg('btnDate2', 'img_Date_DOWN');showCalendar("dfrom", "specialsbycategory", "expires_date", "btnDate2");return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="btnDate1"'); ?></a><script language="javascript">dto.writeControl(); dto.dateFormat="yyyy-MM-dd";</script>		
  <!--******MY ADDITIONS FROM SPECIALS***********************  -->

and here is another picture

Picture2.png

I do have a MAJOR question...

in the java script

var valid_from_date = new ctlSpiffyCalendarBox("dfrom", "specialsbycategory", "valid_from_date", "btnDate1","<?php echo $dfrom; ?>",scBTNMODE_CUSTOMBLUE);

valid_from_date is the name of the field in specials table

dfrom is the make up name to shorten it like a global I think

specialsbycategory is the filename that I am working in

again valid_from_date is the field in that I am using the calendar to input into the specials table

btnDate1 a shortened global like reference to the date in javascript...I probably have these wrong since I don't ANY java, so any help would be great.

Teresa

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
Sign in to follow this  

×