Zen Cart Logo
Forums / General Questions / Updating delivered product quantity is not working

Updating delivered product quantity is not working

Views: 748

Results 1 to 2 of 2
13 Sep 2012, 9:06 PM
#1
axl_gold_racing avatar

axl_gold_racing

New Zenner

Join Date:
Mar 2011
Posts:
5
Plugin Contributions:
0

Updating delivered product quantity is not working

I am trying to ad a new form into Delivery control. In this form i want to ad the quantity of delivered products next to the orderd quantity, So i can see if the order is complet or not. Updating the delivered quantity is not working, in stead if updating the quantity ,it is set to 0.

The field i want to update is called prod_quantity_del. The input field is called quantitydel.

Hope someone can help me out here.

Here is the code i use

<?php // // +----------------------------------------------------------------------+ // |zen-cart Open Source E-commerce | // +----------------------------------------------------------------------+ // | Copyright (c) 2003 The zen-cart developers | // | | // | <http://www.zen-cart.com/index.php> | // | | // | Portions Copyright (c) 2003 osCommerce | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | <http://www.zen-cart.com/license/2_0.txt>. | // | If you did not receive a copy of the zen-cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | [email protected] so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id: products_expected.php 3295 2006-03-28 07:27:49Z drbyte $ // require('includes/application_top.php'); // require(DIR_WS_CLASSES . 'delivery.php'); define('DELIVERED_TEXT_CONFIRM_QUANTITY', 'Aantal geleverd .'); define('DELIVERED_TEXT_CONFIRM_ADDNOW', 'Bevestigen'); //bof RECEIVED DELIVERY ******************* $action = (isset($_GET['action']) ? $_GET['action'] : ''); $dID = (isset($_GET['dID']) ? $_GET['dID'] : ''); $quantitydel = zen_db_prepare_input($_POST['quantitydel']); if ($action == 'verw') { $db->Execute("UPDATE delivery SET del_status = '2', del_delivered = '".date('y-m-d')."' WHERE del_id = '".$dID."' "); $messageStack->add(' Status aangepast.'); } if ($action == 'gel') { // zelf bijgeplaatst voor update aantal geleverd $geleverd = $db->Execute("SELECT prod_id AS gid, prod_quantity AS quantityl, prod_quantity_del AS quantity_del FROM delivery_products WHERE del_id = '".$dID."' "); while (!$geleverd->EOF){ $db->Execute("UPDATE delivery_products SET prod_quantity_del = '".$quantitydel."' WHERE del_id = '".$dID."' and prod_id = ' ".$geleverd->fields[gid]."' "); $geleverd->MoveNext(); } // einde zelf bijgeplaatst $messageStack->add('DB upgedate! Bestelling '.$dID.' Geleverde produktaantallen aangepast.', 'success'); } //eof RECEIVED DELIVERY ******************* ?> <!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"> <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> <script language="javascript" src="includes/menu.js"></script> <script language="javascript" src="includes/general.js"></script> <script type="text/javascript"> <!-- function init() { cssjsmenu('navbar'); if (document.getElementById) { var kill = document.getElementById('hoverJS'); kill.disabled = true; } } // --> </script> </head> <body onLoad="init()"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <!-- body_text //--> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td width="50%" class="pageHeading"> <?php echo ('<a href="' . zen_href_link(FILENAME_DELIVERY, '', 'NONSSL') . '"> Niet geleverde bestellingen</a>'); ?>   <?php echo ('<a href="' . zen_href_link(FILENAME_DELIVERY_NEW, 'action=new', 'NONSSL') . '">Nieuwe Bestelling maken</a>'); ?>   </td> <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table> </td> </tr> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" valign="top"><?php echo TABLE_HEADING_SUPPLIER_ID; ?></td> <td class="dataTableHeadingContent" valign="baseline"><?php echo TABLE_HEADING_SUPPLIER; ?></td> <td class="dataTableHeadingContent" align="center" valign="top"><?php echo TABLE_HEADING_DATE_EXPECTED; ?></td> <td class="dataTableHeadingContent" align="center" valign="top">Date Delivered</td> <td class="dataTableHeadingContent" align="center" valign="top"><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php $del_query_raw = "select del_id as id, del_name as name, del_date as date, del_status as status, del_delivered as delivered from delivery where del_status = '2' order by del_id ASC";

$del_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $del_query_raw, $del_query_numrows);

$del = $db->Execute($del_query_raw);

while (!$del->EOF) {

if ((!isset($_GET['dID']) || (isset($_GET['dID']) && ($_GET['dID'] == $del->fields[id]))) && !isset($dInfo)) {
$dInfo = new objectInfo($del->fields);
}

// bof delivery listing
if ($dID == $del->fields[id])
{
echo '<tr id="defaultSelected" class="dataTableRowSelected">' . "\n";
}
else
{
echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_DELIVERED_PRE, 'dID=' . $del->fields[id] . '\'">' . "\n");
}
?>
<td class="dataTableContent"><?php echo $del->fields[id]; ?></td>
<td class="dataTableContent"><?php echo $del->fields[name]; ?></td>
<td class="dataTableContent" align="center"><?php echo zen_date_short($del->fields[date]); ?></td>
<td class="dataTableContent" align="center"><?php echo zen_date_short($del->fields[delivered]); ?></td>
<td class="dataTableContent" align="center"><?php echo('<a href="' . zen_href_link(FILENAME_DELIVERY, 'dID=' . $del->fields[id] .'&action=not', 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_reset.gif', "Levering als niet geleverd markeren") . '</a> ');

	if ($dID == $del->fields[id]) 
		{ 
		echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); 
		} 
	else
		{
	 echo '<a href="' . zen_href_link(FILENAME_DELIVERED_PRE, 'dID=' . $del->fields[id]) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; 
	 } ?> </td>

</tr>
<?php // eof delivery listing $del->MoveNext(); } ?>
          <tr>
            <td colspan="3">
            <table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td class="smallText" valign="top"><?php echo $del_split->display_count($del_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_DELIVERY); ?></td>
                <td class="smallText" align="right"><?php echo $del_split->display_links($del_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
              </tr>
            </table>
			</td>
          </tr>
        </table>
        </td>
<?php if (isset($dID)) { $prod_query_raw = "SELECT d.prod_id AS id, d.prod_quantity AS quantity, d.prod_quantity_del AS prodquantitydel, p.products_model AS model, pd.products_name AS name FROM delivery_products d LEFT JOIN products p ON d.prod_id = p.products_id LEFT JOIN products_description pd ON d.prod_id = pd.products_id and pd.language_id='" . $_SESSION['languages_id'] ."' WHERE d.del_id = '".$dID."'"; $prod = $db->Execute($prod_query_raw); if ($prod->RecordCount() > 0) { ?>
    <td width="50%" valign="top">              		
     <table width="100%" cellpadding="0" cellspacing="0" style="border-left-color: #003D00; border-left-style:solid; border-left-width:thick">
     	<tr class="infoBoxHeading">
        	<td class="infoBoxHeading"><b>Bestelde producten:</b></td>
        </tr>
        <tr>
        	<td>
                  <form name='Levering bijwerken' method='post' action='gel&dID='> 
               	 <table width="100%" cellpadding="0" cellspacing="0" >
                <tr class="dataTableHeadingRow">
                        <td class="dataTableHeadingContent" valign="top" width="5%">ID</td>
                        <td class="dataTableHeadingContent" valign="top" width="15%">Produkt nr </td>
                        <td class="dataTableHeadingContent" valign="top" width="40%">Beschrijving </td>
                        <td class="dataTableHeadingContent" align="right" valign="top" width="10%">Besteld</td>
                        <td class="dataTableHeadingContent" align="right" valign="top" width="10%">Geleverd</td>
                        <td class="dataTableHeadingContent" align="center" valign="top" width="3%"> </td>
                </tr>
                <?php 
                // bof product listing	??? class='infoBoxContent'
                 $i=0;
                 while (!$prod->EOF) {
           

                            echo ("<tr class='dataTableRow' onmouseover='rowOverEffect(this)' onmouseout='rowOutEffect(this)'>
                                <td>".$prod->fields[id]."</td>
               <td>".$prod->fields[name]."</td>
                                <td>".$prod->fields[model]."</td>
                                <td align='right'>".$prod->fields[quantity]."</td>
                                <td align='right'><input name='quantitydel' size='3' value='".$prod->fields[prodquantitydel]."'></td>
                                <td align='center'> </td>													
                                <tr>");
                   ++$i;
                   $prod->MoveNext();
                    }	
                // eof product listing	
                ?></table>                        	                   
				</form>
	        </td>
		 </td>
     
            
<?php
		}
		else
		{
			  ?>
  
    <td width="50%" valign="top">              		
     <table width="100%" cellpadding="0" cellspacing="0" style="border-left-color: #003D00; border-left-style:solid; border-left-width:thick">
     	<tr class="infoBoxHeading">
        	<td class="infoBoxHeading"><b>Geen produkt in deze levering:</b></td>                                
<?php
		}

}
else
{
?>
	<td width="50%" valign="top">
     <table width="100%" cellpadding="0" cellspacing="0" style="border-left-color: #003D00; border-left-style:solid; border-left-width:thick">
     	<tr class="infoBoxHeading">
        	<td class="infoBoxHeading"><b>Geen levering geselecteerd:</b></td>
        </tr>
        <tr>
        	<td>                       
               	Selecteer een levering om de produkten te zien...                      	                   
	        </td>
<?php
	
}	

?>
</tr>
</table>
<br>
<center>
<?php
if (isset($prod) && is_object($prod) && ($prod->RecordCount() > 0)) {
echo ('<a href="' . zen_href_link(FILENAME_DELIVERED, 'action=rec&dID=' . $dID, 'NONSSL') . '"> Levering afgewerkt </a> ');
}

                                     if (isset($prod) && is_object($prod) && ($prod->RecordCount() > 0)) {
		echo ('<a href="' . zen_href_link(FILENAME_DELIVERED_PRE, 'action=gel&dID=' . $dID, 'NONSSL') . '">   Aantallen updaten  </a> '); 
	}
                                    ?>
<br> <br>
     <?php
                                    if (isset($prod) && is_object($prod) && ($prod->RecordCount() > 0)) {
		echo ('<a href="' . zen_href_link(FILENAME_DELIVERY, '' . $dID, 'NONSSL') . '"> Terug    </a> '); 
	}

                                   		?>

    </center>
     </td>
  </tr>
</table>
	</td>
<!-- body_text_eof //--> </tr> </table> </table> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
19 Sep 2012, 3:05 PM
#2
axl_gold_racing avatar

axl_gold_racing

New Zenner

Join Date:
Mar 2011
Posts:
5
Plugin Contributions:
0

Re: Updating delivered product quantity is not working

Problem solved,

After a few days of headscratching, i managed to solve teh problem.