Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contrib] Quick Price Updates for SPPC


Jan Zonjee

Recommended Posts

A version of Quick Price Updates has been uploaded today that is adapted for Separate Pricing Per Customer (SPPC). If you don't have this installed, don't use it! Use this thread for questions.

 

This version is based on the Quick Price Updates version 2.6 of Februari 2005. The "only" additional feature is that you can choose a customer group and then the prices for that customer group will be shown and can then be changed. So you can only change prices for products for one particular customer group, not all at once (I don't think it is even possible). Maybe not ideal, but it might be helpful.

 

The newer versions of Quick Price Updates all seem to cater to people with particular contributions installed, so I opted to use the latest one that was still kind of generic.

 

The features that were already in, like selecting according to category and manufacturer (or both), sorting (sorting on price will be according to retail price) and editing of model, product status, title, tax etcetera are still in.

 

It appears to work OK, but since this is a new version: be careful and backup your database first before using it.

 

For the record: the contribution can be found here.

Link to comment
Share on other sites

  • 2 months later...
  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

  • 6 months later...

Hi,

 

I've just installed Quick Updates for SPPC and I've encountered a strange problem. (I have a small problem with my Admin Access Level Contrib - so I'm not sure if that's affecting that...)

 

I got it installed with a few minor problems and then when I was using Quick Updates, everytime I selected a value in the pull down menus along the top it would take me back into the Admin Login Page.

 

If someone could shed some light on this it would be much appreciated.

Link to comment
Share on other sites

I've just installed Quick Updates for SPPC and I've encountered a strange problem. (I have a small problem with my Admin Access Level Contrib - so I'm not sure if that's affecting that...)

 

I got it installed with a few minor problems and then when I was using Quick Updates, everytime I selected a value in the pull down menus along the top it would take me back into the Admin Login Page.

There is nothing special about that. The link that is generated for the form is the regular tep_href_link function which uses: HTTP_SERVER . DIR_WS_ADMIN to which the page name is added. Look at the source code of the page to see what that is in your case. Probably something wrong with admin/included/configure.php

 

I use for example (local machine in a local network):

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', 'http://192.168.0.9'); // eg, http://localhost - should not be empty for productive servers
 define('HTTP_CATALOG_SERVER', 'http://192.168.0.9');
 define('HTTPS_CATALOG_SERVER', '');
 define('ENABLE_SSL_CATALOG', 'false'); // secure webserver for catalog module
 define('DIR_FS_DOCUMENT_ROOT', '/Library/WebServer/Documents/catalog3/'); // where the pages are located on the server
 define('DIR_WS_ADMIN', '/catalog3/admin/'); // absolute path required
 define('DIR_FS_ADMIN', '/Library/WebServer/Documents/catalog3/admin/'); // absolute pate required
 define('DIR_WS_CATALOG', '/catalog3/'); // absolute path required
 define('DIR_FS_CATALOG', '/Library/WebServer/Documents/catalog3/'); // absolute path required

This PHP snippet:

<!-- SPPC mod: next tr changed for better HTML -->
									<tr><td colspan="5" class="smalltext">?</td></tr>
<tr align="center">
 <td class="smalltext"><?php echo tep_draw_form('row_by_page', FILENAME_QUICK_UPDATES, '', 'get'); echo tep_draw_hidden_field( 'manufacturer', $manufacturer); echo tep_draw_hidden_field( 'cPath', $current_category_id);
 // BOF Separate Pricing Per Customer
 echo tep_draw_hidden_field('customers_group_id', $customers_group_id);
 ?></td>

generates the following html:

<!-- SPPC mod: next tr changed for better HTML -->
									<tr><td colspan="5" class="smalltext">?</td></tr>
<tr align="center">
 <td class="smalltext"><form name="row_by_page" action="http://192.168.0.9/catalog3/admin/quick_updates.php" method="get"><input type="hidden" name="manufacturer"><input type="hidden" name="cPath" value=""><input type="hidden" name="customers_group_id"></td>

Link to comment
Share on other sites

There is nothing special about that. The link that is generated for the form is the regular tep_href_link function which uses: HTTP_SERVER . DIR_WS_ADMIN to which the page name is added. Look at the source code of the page to see what that is in your case. Probably something wrong with admin/included/configure.php

 

I use for example (local machine in a local network):

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', 'http://192.168.0.9'); // eg, http://localhost - should not be empty for productive servers
 define('HTTP_CATALOG_SERVER', 'http://192.168.0.9');
 define('HTTPS_CATALOG_SERVER', '');
 define('ENABLE_SSL_CATALOG', 'false'); // secure webserver for catalog module
 define('DIR_FS_DOCUMENT_ROOT', '/Library/WebServer/Documents/catalog3/'); // where the pages are located on the server
 define('DIR_WS_ADMIN', '/catalog3/admin/'); // absolute path required
 define('DIR_FS_ADMIN', '/Library/WebServer/Documents/catalog3/admin/'); // absolute pate required
 define('DIR_WS_CATALOG', '/catalog3/'); // absolute path required
 define('DIR_FS_CATALOG', '/Library/WebServer/Documents/catalog3/'); // absolute path required

This PHP snippet:

<!-- SPPC mod: next tr changed for better HTML -->
									<tr><td colspan="5" class="smalltext"> </td></tr>
<tr align="center">
 <td class="smalltext"><?php echo tep_draw_form('row_by_page', FILENAME_QUICK_UPDATES, '', 'get'); echo tep_draw_hidden_field( 'manufacturer', $manufacturer); echo tep_draw_hidden_field( 'cPath', $current_category_id);
 // BOF Separate Pricing Per Customer
 echo tep_draw_hidden_field('customers_group_id', $customers_group_id);
 ?></td>

generates the following html:

<!-- SPPC mod: next tr changed for better HTML -->
									<tr><td colspan="5" class="smalltext"> </td></tr>
<tr align="center">
 <td class="smalltext"><form name="row_by_page" action="http://192.168.0.9/catalog3/admin/quick_updates.php" method="get"><input type="hidden" name="manufacturer"><input type="hidden" name="cPath" value=""><input type="hidden" name="customers_group_id"></td>

 

Hi, thanks for that - that actually fixed another problem I had with File Access in Admin Levels, however I'm still getting bounced out, and I have no idea what it is.

 

On Quick Updates, I can click the sorting or the arrow to go to the product etc, but still all the pull down menus, and the Update button - all take me to the Admin Login page.

Link to comment
Share on other sites

  • 6 months later...

Hi There,

 

I have been using SPPC 415 succesfully. I have installed the Quick Price Updates, but when I select any price group from the top right drop down box, I am always immediately returned to the Retail group. I am unable to pull up any other price group.

 

Any Suggestions?

 

Thanks in advance.

Link to comment
Share on other sites

I love this quick update contribution. It is a real time saver. I was wanting to find out if there is a way to make the date available to be editable in this contribution.

 

I have a lot of products and it takes forever for the page to load going through the catalog/products.

 

btw, thanks janz for the help with the code to update all of the products through sql.

 

 

Mike

Link to comment
Share on other sites

I love this quick update contribution. It is a real time saver. I was wanting to find out if there is a way to make the date available to be editable in this contribution.

 

I have a lot of products and it takes forever for the page to load going through the catalog/products.

My guess is it might not be very easy to add that, especially not with the JavaScript calender for the date as in categories.php.

 

Perhaps it has been done already however. You could check the regular quick updates contribution if anybody has added that as a mod, or perhaps there is a thread for that contribution in which it has been mentioned.

Link to comment
Share on other sites

  • 1 month later...

Hello Jan,

 

a member of the German Forum has changed the Quick Updates Contrib to use it with Gross Prices( tax included) today.

 

He made only a few changes but I am not able to transfer them to the Quick Updates with SPPC Contrib. The coder himself doesn´t use SPPC.

 

Could you please watch this out if you have some time??

 

Here is the thread from the German Forum. If you read from the bottom upwards you will find the post quickly ;)

 

http://forums.oscommerce.de/index.php?showtopic=52582

 

 

Thanks,

Carsten

Edited by Hondo
Link to comment
Share on other sites

a member of the German Forum has changed the Quick Updates Contrib to use it with Gross Prices( tax included) today.

 

He made only a few changes but I am not able to transfer them to the Quick Updates with SPPC Contrib. The coder himself doesn´t use SPPC.

I couldn't find the exact position quickly either but I took a look at his new file and it looks like the updating of gross if you make changes in net and vice versa isn't working. Did I miss something? Wouldn't that be the whole point of adding that extra input field (making the use of a wide screen almost mandatory to be able to update prices :) )?

Link to comment
Share on other sites

I took a look at his new file and it looks like the updating of gross if you make changes in net and vice versa isn't working. Did I miss something?

Apparently that only works when both DISPLAY_TAX and MODIFY_TAX are set to true in the settings for Quick Updates. Otherwise JavaScript will error with elements["product_new_tax[" + product_id + "]"] having no property :(

Link to comment
Share on other sites

Apparently that only works when both DISPLAY_TAX and MODIFY_TAX are set to true in the settings for Quick Updates. Otherwise JavaScript will error with elements["product_new_tax[" + product_id + "]"] having no property :(

 

Hi Jan!

 

Thank you for your efforts!

 

There is a note of the coder in the german forums regarding this. I will post it like it is in German to avoid of translation missunderstandings. I think you understand German as you mentioned last time. Here it is:

 

Dann noch die letzte Änderung:

if(DISPLAY_TAX == 'true'){if(MODIFY_TAX == 'true')echo "<td class=\"smallText\" align=\"left\">".tep_draw_pull_down_menu("product_new_tax[".$products['products_id']."]", $tax_class_array, $products['products_tax_class_id'])."</td>\n";else echo "<td class=\"smallText\" align=\"left\">" . $tax_rate['tax_class_title'] . "</td>";}else{ echo "<td class=\"smallText\" align=\"center\"></td>";}

 

Hier sollte allerdings noch beim Ändern der Tax zuerst die updateNet und dann die updateGross aufgerufen werden. Weiss aber auf die Schnelle nicht wie und hab jetzt die Schnauze voll... Irgendwie mit onchange. wink.gif

Link to comment
Share on other sites

Hi Jan!

 

Thank you for your efforts!

 

There is a note of the coder in the german forums regarding this. I will post it like it is in German to avoid of translation missunderstandings. I think you understand German as you mentioned last time. Here it is:

 

Dann noch die letzte Änderung:

if(DISPLAY_TAX == 'true'){if(MODIFY_TAX == 'true')echo "<td class=\"smallText\" align=\"left\">".tep_draw_pull_down_menu("product_new_tax[".$products['products_id']."]", $tax_class_array, $products['products_tax_class_id'])."</td>\n";else echo "<td class=\"smallText\" align=\"left\">" . $tax_rate['tax_class_title'] . "</td>";}else{ echo "<td class=\"smallText\" align=\"center\"></td>";}

 

Hier sollte allerdings noch beim Ändern der Tax zuerst die updateNet und dann die updateGross aufgerufen werden. Weiss aber auf die Schnelle nicht wie und hab jetzt die Schnauze voll... Irgendwie mit onchange. wink.gif

 

Not able to edit my last post :angry:

 

Translation of the last bold sentence should be like this:

 

When changing the tax at this position updateNet and updateGross should be accessed first of all. But I´m not sure how to do this for the moment. Perhaps in some way with onchange.

Link to comment
Share on other sites

When changing the tax at this position updateNet and updateGross should be accessed first of all. But I´m not sure how to do this for the moment. Perhaps in some way with onchange.
Why updating the net price? That is price without tax IMHO.

Anyway, these are the total changes (apart from adding the JavaScript code, that part is the same). This starts around line 584 in the original file quick_updates.php (the SPPC version of course):

//// get the specials products list
/*   deleted code */
//// check specials
//  original: if ( in_array($products[$x]['products_id'],$specials_array)) {
	if (tep_not_null($products[$x]['specials_id'])) {		
/* deleted code */
		echo "<td class=\"smallText\" align=\"left\">    <input type=\"text\" size=\"8\" name=\"product_new_price[".$products[$x]['products_id']."]\" value=\"".$products[$x]['products_price']."\" disabled > <a target=blank href=\"".tep_href_link (FILENAME_SPECIALS, 'sID='.$products[$x]['specials_id']).'&action=edit'."\">". tep_image(DIR_WS_IMAGES . 'icon_info.gif', TEXT_SPECIALS_PRODUCTS) ."</a></td>\n";
	} else {
		if ($flag_spec == 'true') {
			   echo "<td class=\"smallText\" align=\"left\">    <input type=\"text\" size=\"8\" name=\"product_new_price[".$products[$x]['products_id']."]\" "; if(DISPLAY_TVA_UP == 'true'){ echo "onKeyUp=\"display_ttc('keyup', this.value" . ", " . $tax_rate['tax_rate'] . ", 1);\"";} echo " value=\"".$price ."\">". tep_draw_checkbox_field('update_price['. $products[$x]['products_id'] .']','yes','checked','no')."</td>\n";
		} else { 
	echo "<td class=\"smallText\" align=\"left\">    <input type=\"text\" size=\"6\" name=\"product_new_price_gross[".$products[$x]['products_id']."]\" ";
  echo "onkeyup=\"updateNet(".$products[$x]['products_id'].");\"";
  echo " value=\"".($price*(1+$tax_rate['tax_rate']/100)) ."\">  <input type=\"text\" size=\"6\" name=\"product_new_price[".$products[$x]['products_id']."]\" "; 
	echo "onkeyup=\"updateGross(".$products[$x]['products_id'].");\""; 
	echo " value=\"".$price ."\" style=\"background-color: lightyellow;\">".tep_draw_hidden_field('update_price['.$products[$x]['products_id'].']','yes'). "</td>\n";}
	} // end if-else (tep_not_null($products[$x]['specials_id']))
  if (DISPLAY_TAX == 'true') { 
   if (MODIFY_TAX == 'true') { 
	  echo "<td class=\"smallText\" align=\"left\">". tep_draw_pull_down_menu("product_new_tax[". $products[$x]['products_id'] ."]", $tax_class_array, $products[$x]['products_tax_class_id'], 'onchange="updateGross('.$products[$x]['products_id'].')"')."</td>\n";
	   } else {
		  echo "<td class=\"smallText\" align=\"left\">" . $tax_rate['tax_class_title'] . "<input type=\"hidden\" name=\"product_new_tax[". $products[$x]['products_id'] ."]\" value=\"" . $products[$x]['products_tax_class_id'] . "\"></td>";
   } // end if-else (MODIFY_TAX == 'true')
  }  else { 
	echo "<td class=\"smallText\" align=\"center\"><input type=\"hidden\" name=\"product_new_tax[". $products[$x]['products_id'] ."]\" value=\"" . $products[$x]['products_tax_class_id'] . "\"></td>";
	   }
//// links to preview or full edit

Added a light yellow background to the net price column. Found it a bit confusing without. It changes the gross price when you change the tax in the drop-down menu. The JavaScript updating works also when DISPLAY_TAX or MODIFY_TAX are false.

Link to comment
Share on other sites

Anyway, these are the total changes...

 

Thank you very much, Jan! The code works perfect and changing prices will be much easier for me in the future.

 

I don´t want to be brazen but will ask for it nevertheless:

 

The ultimate thing would be to change also the special prices with gross and net using Quick Updates. Beeing back to the use of a wide screen... ;)

 

Perhaps you´ll find a minute for that :rolleyes:

 

Cheers, Hondo

Link to comment
Share on other sites

Actually, I once adapted a contribution of Carine Bruyndoncx that kind of has that: Admin Specials by Categories for SPPC ;)

 

 

Hi Jan,

 

the contribution is generally great to update specials. Thank you very much!

 

But for my retail store it would be very helpful to type in the gross price directly in the same way you did it for Quick Updates.

 

Could you please include this when you find some time??

 

Thanks,

Carsten

Link to comment
Share on other sites

  • 3 months later...

Hi All!

 

JanZ, when you have time, would you mind taking a look at the file below?

 

I used the Quick Price Updates for SPPC as a base for what I needed, and evrything works fine except that instead of updating one value (when appropriate) it updates everything present (as indicated by the update status response in green on top of page after an update).

 

So, as the not needed updated values don't get changed, technically it all works, but in time it will be updating a lot of values unnecessarily, therefore I would like to be able to resolve this.

 

Example: When updating one value (when there are a total of three inserts, with three values each) the updated status indicates: "9 Gift Certificate(s) Updated! 9 Value(s) changed", when it should indicate 1 Gift Certificate(s) Updated! 1 Value(s) changed.

 

Would very much appreciate any help with this!

 

Thanks.

 

John

 

<?php /*

Core Code: Copyright (c) osCommerce - www.oscommerce.com
Modified Code: based on the following:

 $Id: quick_updates.php for SPPC, v 1.1 2007/05/04 $
 based on version 2.6 of quick_updates.php/Quick Update Prices with Gross Price Beta 1 of April 30, 2007

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

 Based on the original script contributed by Burt ([email protected])
	and by Henri Bredehoeft ([email protected])

 This version was contributed by Mathieu ([email protected])

Core & Modified Code released via GNU General Public License

*/

require('includes/application_top.php');

($row_by_page) ? define('MAX_DISPLAY_ROW_BY_PAGE' , $row_by_page ) : $row_by_page = MAX_DISPLAY_SEARCH_RESULTS; define('MAX_DISPLAY_ROW_BY_PAGE' , MAX_DISPLAY_SEARCH_RESULTS );

switch ($HTTP_GET_VARS['action']) {
 case 'update' :
 $count_update=0;
 $item_updated = array();

 if($HTTP_POST_VARS['giftcertificate_new_id']){
  foreach($HTTP_POST_VARS['giftcertificate_new_id'] as $id => $new_id) {
if ($HTTP_POST_VARS['giftcertificate_new_id'][$id] != $HTTP_POST_VARS['giftcertificate_old_id'][$id]) {
 $count_update++;
 $item_updated[$id] = 'updated';
 tep_db_query("update ".TABLE_COUPON_GV_BLOCK_TEMP." set coupon_id='" . $new_id . "'where coupon_id = '" . $id . "'");
}
  }
 }

 if($HTTP_POST_VARS['giftcertificate_new_code']){
  foreach($HTTP_POST_VARS['giftcertificate_new_code'] as $code => $new_code) {
if ($HTTP_POST_VARS['giftcertificate_new_code'][$code] != $HTTP_POST_VARS['giftcertificate_old_code'][$code]) {
 $count_update++;
 $item_updated[$code] = 'updated';
 tep_db_query("update ".TABLE_COUPON_GV_BLOCK_TEMP." set coupon_code='" . $new_code . "'where coupon_code = '" . $code . "'");
}
  }
 }

 if($HTTP_POST_VARS['giftcertificate_new_time']){
  foreach($HTTP_POST_VARS['giftcertificate_new_time'] as $time => $new_time) {
if ($HTTP_POST_VARS['giftcertificate_new_time'][$time] != $HTTP_POST_VARS['giftcertificate_old_time'][$time]) {
 $count_update++;
 $item_updated[$time] = 'updated';
 tep_db_query("update ".TABLE_COUPON_GV_BLOCK_TEMP." set access_time='" . $new_time . "'where access_time = '" . $time . "'");
}
  }
 }

 $count_item = array_count_values($item_updated);
 if ($count_item['updated'] > 0) $messageStack->add($count_item['updated'].' '.TEXT_GIFTCERTIFICATE_UPDATED . " $count_update " . TEXT_QTY_UPDATED, 'success');
 break;

}

 if (($_REQUEST['gc_id'] != '') && ($_REQUEST['gc_code'] != '')) {
$_REQUEST['gc_id'] = $gc_id;
$_REQUEST['gc_code'] = $gc_code;
tep_db_query("insert into ".TABLE_COUPON_GV_BLOCK_TEMP." set coupon_id='".$gc_id."',coupon_code='".$gc_code."',access_time=now()");
 }

 if ($HTTP_GET_VARS['action']=='delete' && isset($HTTP_GET_VARS['id'])) {
tep_db_query("delete from " . TABLE_COUPON_GV_BLOCK_TEMP . " where coupon_id='".$HTTP_GET_VARS['id']."'");
 }

$row_bypage_array = array(array());
 for ($i = 2; $i <=10; $i=$i+2) { //   for ($i = 20; $i <=100; $i=$i+20) {
  $row_bypage_array[] = array('id' => $i, 'text' => '   ' . $i);
 }

// <!--  blocked time amount -->
	if (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'one') {
	  $hrdiff = '<b><font color="#ff0000">'. 1 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOUR;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'two') {
	  $hrdiff = '<b><font color="#ff0000">'. 2 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'three') {
	  $hrdiff = '<b><font color="#ff0000">'. 3 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'six') {
	  $hrdiff = '<b><font color="#ff0000">'. 6 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'nine') {
	  $hrdiff = '<b><font color="#ff0000">'. 9 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'twelve') {
	  $hrdiff = '<b><font color="#ff0000">'. 12 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'eighteen') {
	  $hrdiff = '<b><font color="#ff0000">'. 18 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	} elseif (MODULE_PAYMENT_GOOGLECHECKOUT_GIFTCERTIFICATE_BLOCK_TIME == 'twentyfour') {
	  $hrdiff = '<b><font color="#ff0000">'. 24 .'</font></b>'. TEXT_BLOCKED_TIME_LENGTH_HOURS;
	}
// <!-- /blocked time amount -->

?>

<!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; ?>">
<meta http-equiv="imagetoolbar" content="no">
<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 <?php echo ONLOAD_3; ?>oncontextmenu="return false" ondragstart="return false">

<!--  positioning table Part 1 of 3 -->
<table border="0" width="100%" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr><td align="center" valign="top">
<!-- /positioning table Part 1 of 3 -->

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

<!--  body -->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td valign="top">
<!--  left navigation -->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- /left navigation -->
</td>
<!--  body text -->
	<td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
 <td height="50" class="pageHeading"><?php echo HEADING_TITLE; ?></td>	 
  </tr>
</table>
</td>
 </tr>
 <tr>
<td align="center">
  <table width="100%" cellspacing="0" cellpadding="0" border="0" height="100">
 <tr>
   <td align="center">
<table cellspacing="0" cellpadding="0" border="0">
 <tr align="center">
<td align="right" class="smallText">
<?php echo TEXT_MAXI_ROW_BY_PAGE; ?>: 
 </td>
<?php echo tep_draw_form('row_by_page', FILENAME_GV_BLOCK_TEMP, '', 'get'); ?>
 <td class="smallText">
<?php echo tep_draw_pull_down_menu_select('row_by_page', $row_bypage_array, $row_by_page, 'onChange="this.form.submit();"'); ?>
</form>
</td>
 </tr>
</table>
   </td>
 </tr>
 <tr><td height="17"></td></tr>
 <tr><td align="center" class="smallText">
<?php echo '<a href="' . tep_href_link(FILENAME_MODULES,"set=payment&module=googlecheckout&action=edit") . '">' . TEXT_BLOCKED_TIME_LENGTH_LINK . '</a><br>' . TEXT_BLOCKED_TIME_LENGTH . $hrdiff . ')'; ?>
 </td></tr>
 <tr><td height="17"></td></tr>
<!--  data -->
<tr>
 <td>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td align="center" valign="top">
	  <table border="0" cellspacing="0" cellpadding="2">
		<tr class="dataTableHeadingRow">

			<td width="25"></td>

			<td class="dataTableHeadingContent" align="center">
			  <table border="0" cellspacing="0" cellpadding="0">
				<tr class="dataTableHeadingRow">
				 <td class="dataTableHeadingContent" align="center">
				  <?php echo "<a href=\"" . tep_href_link( FILENAME_GV_BLOCK_TEMP, '&sort_by=coupon_id ASC&page=' . $page.'&row_by_page=' . $row_by_page)."\" >".tep_image(DIR_WS_IMAGES . 'arrow_up.gif', TEXT_SORT_ALL . IMAGE_GIFT_CERT_IDS . TEXT_ASCENDINGLY)."</a>
							  <a href=\"" . tep_href_link( FILENAME_GV_BLOCK_TEMP, '&sort_by=coupon_id DESC&page=' . $page.'&row_by_page=' . $row_by_page)."\" >".tep_image(DIR_WS_IMAGES . 'arrow_down.gif', TEXT_SORT_ALL . IMAGE_GIFT_CERT_IDS . TEXT_DESCENDINGLY)."</a>
				  <br>" . TABLE_HEADING_GIFT_CERT_IDS; ?>
				 </td>
				</tr>
			  </table>
			</td>

			<td width="10"></td>

			<td class="dataTableHeadingContent" align="center">
			  <table border="0" cellspacing="0" cellpadding="0">
				<tr class="dataTableHeadingRow">
				 <td class="dataTableHeadingContent" align="center">
				  <?php echo "<a href=\"" . tep_href_link( FILENAME_GV_BLOCK_TEMP, '&sort_by=coupon_code ASC&page=' . $page.'&row_by_page=' . $row_by_page)."\" >".tep_image(DIR_WS_IMAGES . 'arrow_up.gif', TEXT_SORT_ALL . IMAGE_GIFT_CERT_CODES . TEXT_ASCENDINGLY)."</a>
							  <a href=\"" . tep_href_link( FILENAME_GV_BLOCK_TEMP, '&sort_by=coupon_code DESC&page=' . $page.'&row_by_page=' . $row_by_page)."\" >".tep_image(DIR_WS_IMAGES . 'arrow_down.gif', TEXT_SORT_ALL . IMAGE_GIFT_CERT_CODES . TEXT_DESCENDINGLY)."</a>
				  <br>" . TABLE_HEADING_GIFT_CERT_CODES; ?>
				 </td>
				</tr>
			  </table>
			</td>

			<td width="10"></td>

			<td class="dataTableHeadingContent" align="center">
			  <table border="0" cellspacing="0" cellpadding="0">
				<tr class="dataTableHeadingRow">
				 <td class="dataTableHeadingContent" align="center">
				  <?php echo " <a href=\"" . tep_href_link( FILENAME_GV_BLOCK_TEMP, '&sort_by=access_time ASC&page=' . $page.'&row_by_page=' . $row_by_page)."\" >".tep_image(DIR_WS_IMAGES . 'arrow_up.gif', TEXT_SORT_ALL . IMAGE_GIFT_ACCESS_TIMES . TEXT_ASCENDINGLY)."</a>
							   <a href=\"" . tep_href_link( FILENAME_GV_BLOCK_TEMP, '&sort_by=access_time DESC&page=' . $page.'&row_by_page=' . $row_by_page)."\" >".tep_image(DIR_WS_IMAGES . 'arrow_down.gif', TEXT_SORT_ALL . IMAGE_GIFT_ACCESS_TIMES . TEXT_DESCENDINGLY)."</a>
				  <br>" . TABLE_HEADING_GIFT_ACCESS_TIMES; ?>
				 </td>
				</tr>
			  </table>
			</td>

			<td width="10"></td>

			<td class="dataTableHeadingContent" align="center">
			  <table border="0" cellspacing="0" cellpadding="0">
				<tr class="dataTableHeadingRow">
				 <td class="dataTableHeadingContent" align="center">
				   <table border="0" cellspacing="0" cellpadding="0">
					 <tr><td height="5"></td></tr>
					 <tr>
					   <td class="dataTableHeadingContent" align="center">
						 <?php echo TABLE_HEADING_INSERT; ?><br><?php echo TABLE_HEADING_DELETE; ?>
					   </td>
					 </tr>

				   </table>
				 </td>
				</tr>
			  </table>
			</td>

			<td width="25"></td>

		   </tr>
		   <tr bgcolor="#ffff00"><td height="7" colspan="9"></td></tr>

<?php
echo tep_draw_form('insert', FILENAME_GV_BLOCK_TEMP, 'row_by_page=' . $row_by_page, 'post');
// echo tep_draw_form('insert', FILENAME_GV_BLOCK_TEMP, 'action=process&row_by_page=' . $row_by_page, 'NONSSL');

	echo "<tr bgcolor=\"#ffff00\">";
	echo "<td width=\"25\"></td>\n";
	echo "<td align=\"center\"><input type=\"text\" size=\"7\" onfocus=\"this.select()\" name=\"gc_id\" style=\"text-align: center\"></td>\n";
	echo "<td width=\"10\"></td>\n";
	echo "<td align=\"center\"><input type=\"text\" size=\"14\" onfocus=\"this.select()\" name=\"gc_code\" style=\"text-align: center\"></td>\n";
	echo "<td width=\"10\"></td>\n";
	echo "<td align=\"center\" class=\"smallText\"><b>Present Time</b></td>\n";
	echo "<td width=\"10\"></td>\n";
	echo "<td align=\"center\">" . tep_image_submit('button_insert.gif', IMAGE_INSERT_GV_BALANCE_ACCOUNT) . "</td>\n";
	echo "<td width=\"25\"></td>\n";
	echo "</tr>\n";

echo "</form>";

?>

		   <tr bgcolor="#ffff00"><td height="5" colspan="9"></td></tr>
		   <tr class="dataTableRow"><td height="10" colspan="9"></td></tr>

<?php

echo tep_draw_form('update', FILENAME_GV_BLOCK_TEMP, 'action=update&row_by_page=' . $row_by_page, 'post');

//// control string sort page
 if ($sort_by && !ereg('order by',$sort_by)) $sort_by = 'order by '.$sort_by;
//// define the string parameters for good back preview product
 $origin = FILENAME_GV_BLOCK_TEMP."?info_back=$row_by_page";
//// controle length (lines per page)
 $split_page = $page;
 if ($split_page > 1) $rows = $split_page * MAX_DISPLAY_ROW_BY_PAGE - MAX_DISPLAY_ROW_BY_PAGE;

$coupons_query_raw = "select coupon_id, coupon_code, access_time from ".TABLE_COUPON_GV_BLOCK_TEMP." $sort_by";

  $coupons_split = new splitPageResults($split_page, MAX_DISPLAY_ROW_BY_PAGE, $coupons_query_raw, $coupons_query_numrows);
  $coupons_query = tep_db_query($coupons_query_raw);
  while ($coupons = tep_db_fetch_array($coupons_query)) {

// debug:   echo '<pre>coupons array'; print_r($coupons);

 $rows++;
 if (strlen($rows) < 2) {
  $rows = '0' . $rows;
 }

	echo "<tr class=\"dataTableRow\">";
	echo "<td width=\"25\"></td>\n";
	echo "<td align=\"center\"><input type=\"text\" size=\"7\" onfocus=\"this.select()\" name=\"giftcertificate_new_id[".$coupons['coupon_id']."]\" value=\"".$coupons['coupon_id']."\" style=\"text-align: right; padding-right: 5\"></td>\n";
	echo "<td width=\"10\"></td>\n";
	echo "<td align=\"center\"><input type=\"text\" size=\"14\" onfocus=\"this.select()\" name=\"giftcertificate_new_code[".$coupons['coupon_code']."]\" value=\"".$coupons['coupon_code']."\" style=\"text-align: right; padding-right: 5\"></td>\n";
	echo "<td width=\"10\"></td>\n";
	echo "<td align=\"center\"><input type=\"text\" size=\"21\" onfocus=\"this.select()\" name=\"giftcertificate_new_time[".$coupons['access_time']."]\" value=\"".$coupons['access_time']."\" style=\"text-align: right; padding-right: 5\"></td>\n";
	echo "<td width=\"10\"></td>\n";
	echo "<td align=\"center\"><a href=\"" . tep_href_link(FILENAME_GV_BLOCK_TEMP,'action=delete&id=' . $coupons['coupon_id'] . '&row_by_page=' . $row_by_page,'NONSSL'). "\">" . tep_image_button('button_bin.gif', IMAGE_DELETE_GV_BALANCE_ACCOUNT) . "</a></td>\n";
	echo "<td width=\"25\"></td>\n";
/*
//// Hidden parameters for cache old values

  echo tep_draw_hidden_field('giftcertificate_old_id['.$coupons['coupon_id'] .']',$coupons['coupon_id']);
  echo tep_draw_hidden_field('giftcertificate_old_code['.$coupons['coupon_code'] .']',$coupons['coupon_code']);
  echo tep_draw_hidden_field('giftcertificate_old_time['.$coupons['access_time'] .']',$coupons['access_time']);
*/
}

?>
		</tr>
		<tr class="dataTableRow"><td height="10" colspan="9"></td></tr>
	  </table>
	</td>
  </tr>
</table>
 </td>
</tr>
<!-- /data -->

<tr>
<td align="center">
<table cellspacing="0" cellpadding="0" border="0" width="40%">
 <tr><td height="19" colspan="2"></td></tr>
 <tr>
<td align="center">
<?php echo '<a href="' . tep_href_link(FILENAME_GV_BLOCK_TEMP,"&row_by_page=$row_by_page") . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?>
</td>
<td align="center">
<?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE, "action=update&row_by_page=$row_by_page");?>
</td>
  </tr>
 <tr><td height="3" colspan="2"></td></tr>
</table>

</td>
</tr>

<tr>
 <td align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr><td height="10" colspan="4"></td></tr>
 <tr>
 <td width="50"></td>
<td class="smallText" valign="top">
<?php echo $coupons_split->display_count($coupons_query_numrows, MAX_DISPLAY_ROW_BY_PAGE, $split_page, TEXT_DISPLAY_NUMBER_OF_BLOCKED_GC);  ?>
</td>
<td class="smallText" align="right">
<?php echo $coupons_split->display_links($coupons_query_numrows, MAX_DISPLAY_ROW_BY_PAGE, MAX_DISPLAY_PAGE_LINKS, $split_page, '&sort_by='.$sort_by . '&row_by_page=' . $row_by_page); ?>
</td>
<td width="50"></td>
</table>

 </td>
</tr>

</form>
	</table></td>
  </tr>
</table></td>
<!-- /body text -->
 </tr>
</table>
<!-- /body -->

<!-- positioning table Part 2 of 3 -->
</td></tr>
<tr><td align="center" valign="bottom">
<!-- /positioning table Part 2 of 3 -->

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

<!-- positioning table Part 3 of 3 -->
</td></tr>
</table>
<!-- /positioning table Part 3 of 3 -->

</body></html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

I used the Quick Price Updates for SPPC as a base for what I needed, and evrything works fine except that instead of updating one value (when appropriate) it updates everything present (as indicated by the update status response in green on top of page after an update).

 

So, as the not needed updated values don't get changed, technically it all works, but in time it will be updating a lot of values unnecessarily, therefore I would like to be able to resolve this.

 

Example: When updating one value (when there are a total of three inserts, with three values each) the updated status indicates: "9 Gift Certificate(s) Updated! 9 Value(s) changed", when it should indicate 1 Gift Certificate(s) Updated! 1 Value(s) changed.

Haven't gone through your code, but from what I remember I think I would use an extra column in the table with a checkbox associated with the id and only update those values for which the checkbox is checked (checkboxes that are not checked are not in the $_POST array, so you only have to check for its presence).

 

You could even add some JavaScript to the input field that would check the checkbox on the onkeyup event of an input field so you wouldn't have to do the checking manually when you change something.

Link to comment
Share on other sites

Haven't gone through your code, but from what I remember I think I would use an extra column in the table with a checkbox associated with the id and only update those values for which the checkbox is checked (checkboxes that are not checked are not in the $_POST array, so you only have to check for its presence).

 

You could even add some JavaScript to the input field that would check the checkbox on the onkeyup event of an input field so you wouldn't have to do the checking manually when you change something.

 

Thanks for responding Jan!

 

I had used the file as a base for another need awhile back, which involved products, and it didn't require a checkbox to update properly.

 

Am guessing my issue now is associated with the fact that this present need does not involve products (I removed all code associated with products this time).

 

It's such a great base code to use for a number of needs. I'll try messing with it some more, though I've been messing with it for days now. I don't think the checkbox by itself will solve it because it now is showing each value as an insert/item (showing 9 inserts/items & 9 values on any update - when there are only in total 3 inserts/items with 3 values each).

 

Anyhow, I was just hoping that it might be something obvious to you that wasn't obvious to me.

 

Thanks again, for taking a stab at it Jan!

 

John

Link to comment
Share on other sites

I'll try messing with it some more, though I've been messing with it for days now. I don't think the checkbox by itself will solve it because it now is showing each value as an insert/item (showing 9 inserts/items & 9 values on any update - when there are only in total 3 inserts/items with 3 values each).

It is hard to check that file because of all your gift certificate code (it actually give a fatal error because of a missing function tep_draw_pull_down_menu_select). However, I don't see any checkboxes (tep_draw_checkbox_field). If you would check for the presence of a checkbox associated with the id of the stuff that needs updating you can add that as an extra conditional (&&) in the foreach loops in the top with tep_update query at the end. No checkbox: no update. That was the general idea.

Link to comment
Share on other sites

It is hard to check that file because of all your gift certificate code (it actually give a fatal error because of a missing function tep_draw_pull_down_menu_select). However, I don't see any checkboxes (tep_draw_checkbox_field). If you would check for the presence of a checkbox associated with the id of the stuff that needs updating you can add that as an extra conditional (&&) in the foreach loops in the top with tep_update query at the end. No checkbox: no update. That was the general idea.

Jan,

 

I'm very sorry. It didn't even occur to me that you might look at the file in a browser. I should have cleaned it up, removing what didn't pertain to the issue.

 

I more or less just am able to sometimes modify code that others have written. I can't code myself. Please excuse my thoughtlessness.

 

That function is just a copy of the tep_draw_pull_down_menu, with a selected option "select" so that it wasn't blank.

 

Thanks for looking at it again... this is more than I anticipated. I'll clean it up and post it. Maybe you'll be feeling forgiving! :)

 

John

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...