Results 1 to 10 of 81

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Location
    New Port Richey, Florida
    Posts
    969
    Plugin Contributions
    0

    Default Re: Inventory Updater...

    how do i delete the price, if i wanted to. not really the price but my barcode field does not let me delete the barcode unless i put a zero in. i want to delete some of them.
    also it doesnt let me it if there is a zero first in the number. ex this saves 7435666890 and this does not save 07435666890

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Inventory Updater...

    Quote Originally Posted by jimmie View Post
    how do i delete the price, if i wanted to. not really the price but my barcode field does not let me delete the barcode unless i put a zero in. i want to delete some of them.
    also it doesnt let me it if there is a zero first in the number. ex this saves 7435666890 and this does not save 07435666890
    • this really has nothing to do with this module.
    • my module, as packaged, does nothing with bar codes.
    • my package as delivered updates 2 fields; both of which are numeric.
    • that said, it sounds like you may have defined your bar code field as some sort of numeric integer field. perhaps, BIGINT. i really do not know, as this is not a field in a default ZC install.
    • you can see some of the mysql integer data type fields here: https://dev.mysql.com/doc/refman/8.0...ger-types.html
    • it looks like you would need to do an alter table command in mysql; i'm not sure how you access your database. some people use phpMyAdmin or something similar.
    • for my clients, i have the barcode field set up as VARCHAR(20). i am not sure what your maximum length barcode might be.
    • you can read about the differences between CHAR and VARCHAR here: https://dev.mysql.com/doc/refman/8.0/en/char.html
    • i am not sure what will happen to your data when you convert a field from BIGINT (or something similar) to VARCHAR. i would definitely make a backup of that table prior to doing any ALTER TABLE commands.
    • i am also not privy to the program you use to update your barcodes (other than the modified version of this program). and whether that program might need to get modified.
    • if your field is already set to a character field, it is entirely possible that you might be casting that field to an integer value as i do for the inventory number.
    • if you were to post the code for the update of the bar code, we could easily (hopefully) see what the problem might be.
    • that situation would be much easier to fix, as it would not involve changing the field types of any table.

    hope that helps!

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jan 2013
    Location
    New Port Richey, Florida
    Posts
    969
    Plugin Contributions
    0

    Default Re: Inventory Updater...

    products_barcode varchar(32) is what i have there.
    $products_barcode = '';
    Code:
    $products_barcode = '';
    
    	if (isset($_POST['update_']) && is_array($_POST['new_barcode']) && is_array($_POST['old_barcode'])) {
    		$old_barcode = $_POST['old_barcode'];
    		foreach ($_POST['new_barcode'] as $item => $barcode) {
    			if (array_key_exists($item, $old_barcode) && $old_barcode[$item] !== $barcode) {
    				if (is_numeric($barcode) and is_numeric($item)) {
    					$db->Execute("update " . TABLE_PRODUCTS . " set products_barcode = '" . convertToFloat($barcode) . "' where products_id = '" . intval($item) . "' and products_barcode = '" . (float)($old_barcode[$item]) . "' limit 0");
    					if ($db->affectedRows() == 1) {
    						$products_barcode++;
    					}
    				}
    			} else {
    				//echo "old: $old_qty[$item] , new: $qty <br />";
    			}
    		}
    	}

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Inventory Updater...

    get rid of the convertToFloat and the (float) in the update line. try that. leave everything else in. that should work.

    let us know.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Inventory Updater...

    Quote Originally Posted by carlwhat View Post
    get rid of the convertToFloat and the (float) in the update line. try that. leave everything else in. that should work.
    Er, um, don't merely get rid of those. Instead, replace them with calling zen_db_input() on them. Otherwise you risk creating security issues.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jan 2013
    Location
    New Port Richey, Florida
    Posts
    969
    Plugin Contributions
    0

    Default Re: Inventory Updater...

    ok changed line to this,
    Code:
    $db->Execute("update " . TABLE_PRODUCTS . " set products_barcode = '" . zen_db_input(($barcode)) . "' where products_id = '" . intval($item) . "' and products_barcode = '" . zen_db_input(($old_barcode[$item])) . "' limit 1");
    and i can now save when a zero is the first number, but still doesnt let me delete a zero. let me explain, we have over 11000 products, once when messing with EP it changed all barcodes to the same number or a zero. easier for me to see which products need fixed from your module.

  7. #7
    Join Date
    Jan 2013
    Location
    New Port Richey, Florida
    Posts
    969
    Plugin Contributions
    0

    Default Re: Inventory Updater...

    i also have the wholesale module installed and installed that into your module as well.
    here is my complete file.
    Code:
    <?php
    	/*  portions copyright by... zen-cart.com
    
    		developed and brought to you by proseLA
    		https://rossroberts.com
    
    		released under GPU
    		https://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    
    		06/2020  project: inventory v1.2.3 file: inventory.php
    	*/
    
    	require('includes/application_top.php');
    
    	require_once(DIR_WS_CLASSES . 'currencies.php');
    	$currencies = new currencies();
    
    	$cid = 0;
    	$cid_params = '';
    	if (isset($_GET['cid'])) {
    		$cid = $_GET['cid'];
    		$cid_params .= '&cid=' . $cid;
    	}
    
    	$action = isset($_GET['action']) ? $_GET['action'] : '';
    	$sort =  isset($_GET['sort']) ? $_GET['sort'] : '0';
    	$active = isset($_GET['active']) ? $_GET['active'] : '0';
    
    	if ($action == 'tg_stat' && isset($_GET['pid']) && is_numeric($_GET['pid'])) {
    		$rs_stat = $db->Execute("select products_status from " . TABLE_PRODUCTS . " where products_id=" . intval($_GET['pid']) . " LIMIT 1");
    		$db->Execute("update " . TABLE_PRODUCTS . " set products_status = '" . ($rs_stat->fields['products_status'] == '1' ? '0' : '1') . "' where products_id=" . intval($_GET['pid']) . " LIMIT 1");
    		zen_redirect(zen_href_link(FILENAME_INVENTORY, 'sort=' . $sort . '&active=' . $active . $cid_params,
    			'SSL'));
    	}
    
    	$update_qty = 0;
    
    	if (isset($_POST['update_']) && is_array($_POST['new_qty']) && is_array($_POST['old_qty'])) {
    		$old_qty = $_POST['old_qty'];
    		foreach ($_POST['new_qty'] as $item => $qty) {
    			if (array_key_exists($item, $old_qty) && $old_qty[$item] !== $qty) {
    				if (is_numeric($qty) and is_numeric($item)) {
    					$db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = '" . intval($qty) . "' where products_id = '" . intval($item) . "' and products_quantity = '" . intval($old_qty[$item]) . "' limit 1");
    					if ($db->affectedRows() == 1) {
    						$update_qty++;
    					}
    				}
    			} else {
    				//echo "old: $old_qty[$item] , new: $qty <br />";
    			}
    		}
    	}
    
    	$updated_count_price = 0;
    
    	if (isset($_POST['update_']) && is_array($_POST['new_price']) && is_array($_POST['old_price'])) {
    		$old_price = $_POST['old_price'];
    		foreach ($_POST['new_price'] as $item => $price) {
    			if (array_key_exists($item, $old_price) && $old_price[$item] !== $price) {
    				if (is_numeric($price) and is_numeric($item)) {
    					$db->Execute("update " . TABLE_PRODUCTS . " set products_price = '" . convertToFloat($price) . "' where products_id = '" . intval($item) . "' and products_price = '" . (float)($old_price[$item]) . "' limit 1");
    					if ($db->affectedRows() == 1) {
    						$updated_count_price++;
    					}
    				}
    			} else {
    				//echo "old: $old_qty[$item] , new: $qty <br />";
    			}
    		}
    	}
    
    $products_barcode = '';
    
    	if (isset($_POST['update_']) && is_array($_POST['new_barcode']) && is_array($_POST['old_barcode'])) {
    		$old_barcode = $_POST['old_barcode'];
    		foreach ($_POST['new_barcode'] as $item => $barcode) {
    			if (array_key_exists($item, $old_barcode) && $old_barcode[$item] !== $barcode) {
    				if (is_numeric($barcode) and is_numeric($item)) {
    					$db->Execute("update " . TABLE_PRODUCTS . " set products_barcode = '" . zen_db_input(($barcode)) . "' where products_id = '" . intval($item) . "' and products_barcode = '" . zen_db_input(($old_barcode[$item])) . "' limit 1");
    					if ($db->affectedRows() == 1) {
    						$products_barcode++;
    					}
    				}
    			} else {
    				//echo "old: $old_qty[$item] , new: $qty <br />";
    			}
    		}
    	}
    	
    $updated_count_price_w = 0;
    
    	if (isset($_POST['update_']) && is_array($_POST['new_price_w']) && is_array($_POST['old_price_w'])) {
    		$old_price_w = $_POST['old_price_w'];
    		foreach ($_POST['new_price_w'] as $item => $price_w) {
    			if (array_key_exists($item, $old_price_w) && $old_price_w[$item] !== $price_w) {
    				if (is_numeric($price_w) and is_numeric($item)) {
    					$db->Execute("update " . TABLE_PRODUCTS . " set products_price_w = '" . convertToFloat($price_w) . "' where products_id = '" . intval($item) . "' and products_price_w = '" . (float)($old_price_w[$item]) . "' limit 1");
    					if ($db->affectedRows() == 1) {
    						$updated_count_price_w++;
    					}
    				}
    			} else {
    				//echo "old: $old_qty[$item] , new: $qty <br />";
    			}
    		}
    	}	
    
    	$order_by = " ";
    	switch ($sort) {
    		case (0):
    			$order_by = " ORDER BY p.products_sort_order, pd.products_name";
    			break;
    		case (1):
    			$order_by = " ORDER BY pd.products_name";
    			break;
    		case (2);
    			$order_by = " ORDER BY p.products_model";
    			break;
    		case (3);
    			$order_by = " ORDER BY p.products_quantity, pd.products_name";
    			break;
    		case (4);
    			$order_by = " ORDER BY p.products_quantity DESC, pd.products_name";
    			break;
    		case (5);
    			$order_by = " ORDER BY p.products_price_sorter, pd.products_name";
    			break;
    		case (6);
    			$order_by = " ORDER BY p.products_price_sorter DESC, pd.products_name";
    			break;
    		case (7);
    			$order_by = " ORDER BY p.products_barcode, pd.products_name";
    			break;
    		case (8);
    			$order_by = " ORDER BY p.products_barcode DESC, pd.products_name";
    			break;	
    		case (9);
    			$order_by = " ORDER BY p.products_price_w_sorter, pd.products_name";
    			break;
    		case (10);
    			$order_by = " ORDER BY p.products_price_w_sorter DESC, pd.products_name";
    			break;	
    	}
    
    	$a_field = '';
    	switch ($active) {
    		case '1':
    			$a_field = '';
    			break;
    
    		case '0':
    		default:
    			$a_field = ' and p.products_status > 0';
    			break;
    	}
    
    	$categories = $db->Execute("select c.categories_id, cd.categories_name, c.sort_order "
    		. " from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd "
    		. " where c.categories_id = cd.categories_id and c.parent_id = " . $cid . " and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'"
    		. " order by sort_order ");
    
    	if ($categories->count() == 0) {
    		$categories = $db->Execute("select c.categories_id, cd.categories_name, c.sort_order "
    			. " from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd "
    			. " where c.categories_id = cd.categories_id and c.parent_id = 0 and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'"
    			. " order by sort_order ");
    	}
    
    	if ($cid <> 0) {
    		$prod_sql = "select p.products_id, p.products_type, p.products_date_available, p.products_status, p.products_quantity, p.products_barcode,
    	p.products_price, p.products_price_w, p.products_model, pd.products_name,  pc.categories_id, p.product_is_call, p.master_categories_id as catId "
    			. " from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc "
    			. " left join " . TABLE_CATEGORIES . " ct on ct.categories_id = pc.categories_id"
    			. " where p.products_id = pd.products_id and p.products_id = pc.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'"
    			. " and (pc.categories_id = " . intval($cid) . " or ct.parent_id = " . intval($cid) . ")" . $a_field;
    	} else {
    		$prod_sql = "select p.products_id, p.products_type, p.products_date_available, p.products_status, p.products_quantity, p.products_barcode, 
    	p.products_price, p.products_price_w, p.products_model, pd.products_name, p.product_is_call, p.master_categories_id as catId "
    			. " from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  "
    			. " where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" . $a_field;
    	}
    
    	$prod_sql .= $order_by;
    
    	$query_num_rows = 0;
    	$page = intval((isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1));
    	$products_page = new splitPageResults($page, MAX_DISPLAY_RESULTS_CATEGORIES, $prod_sql, $query_num_rows);
    	$prod_list = $db->Execute($prod_sql);
    
    	$query_string = '';
    	foreach ($_GET as $k => $v) {
    		if ($k != 'page') {
    			$query_string .= $k . '=' . $v . '&';
    		}
    	}
    
    	$pager = $products_page->display_count($query_num_rows, MAX_DISPLAY_RESULTS_CATEGORIES, $page,
    		TEXT_DISPLAY_NUMBER_OF_PRODUCTS);
    	$pager .= '&nbsp;-&nbsp;';
    	$pager .= $products_page->display_links($query_num_rows, MAX_DISPLAY_RESULTS_CATEGORIES, MAX_DISPLAY_PAGE_LINKS, $page,
    		$query_string);
    
    	$categories_products_sort_order_array = array(
    		array('id' => '0', 'text' => TEXT_SORT_PRODUCTS_SORT_ORDER_PRODUCTS_NAME),
    		array('id' => '1', 'text' => TEXT_SORT_PRODUCTS_NAME),
    		array('id' => '2', 'text' => TEXT_SORT_PRODUCTS_MODEL),
    		array('id' => '3', 'text' => TEXT_SORT_PRODUCTS_QUANTITY),
    		array('id' => '4', 'text' => TEXT_SORT_PRODUCTS_QUANTITY_DESC),
    		array('id' => '5', 'text' => TEXT_SORT_PRODUCTS_PRICE),
    		array('id' => '6', 'text' => TEXT_SORT_PRODUCTS_PRICE_DESC),
    		array('id' => '7', 'text' => TEXT_SORT_PRODUCTS_BARCODE),
    		array('id' => '8', 'text' => TEXT_SORT_PRODUCTS_BARCODE_DESC),
    		array('id' => '9', 'text' => TEXT_SORT_PRODUCTS_PRICE_W),
    		array('id' => '10', 'text' => TEXT_SORT_PRODUCTS_PRICE_W_DESC)
    	);
    ?>
        <!doctype html>
        <html <?= HTML_PARAMS; ?>>
        <head>
    		<?php require DIR_WS_INCLUDES . 'admin_html_head.php'; ?>
            <script src="includes/general.js"></script>
        </head>
        <body>
        <!-- header //-->
    	<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
        <!-- header_eof //-->
    
        <!-- body //-->
        <div class="container-fluid" id="pageWrapper">
            <div class="col-md-11 alert-box alert alert-info">
                <h3><?= INVENTORY_PAGE; ?></h3>
    			<?php
    				$parent_name = zen_get_category_name($cid, (int)$_SESSION['languages_id']);
    				if ($cid > 0) {
    					?>
                        <h3><?= $parent_name; ?></h3>
    				<?php } ?>
            </div>
            <div class="col-md-11">
    		<?php if (isset($update_barcode) && $update_barcode > '') { ?>
                    <div class="alert alert-success fade in alert-dismissible show">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="center"><?= $update_barcode . PRODUCTS_BARCODE_UPDATED; ?></h4>
                    </div>
    			<?php } ?>
    		
    			<?php if (isset($update_qty) && $update_qty > 0) { ?>
                    <div class="alert alert-success fade in alert-dismissible show">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="center"><?= $update_qty . PRODUCTS_UPDATED; ?></h4>
                    </div>
    			<?php } ?>
    
    			<?php if (isset($updated_count_price) && $updated_count_price > 0) { ?>
                    <div class="alert alert-success fade in alert-dismissible show">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="center"><?= $updated_count_price . PRODUCTS_PRICE_UPDATED; ?></h4>
                    </div>
    			<?php } ?>
    			<?php if (isset($updated_count_price_w) && $updated_count_price_w > 0) { ?>
                    <div class="alert alert-success fade in alert-dismissible show">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="center"><?= $updated_count_price_w . PRODUCTS_PRICE_W_UPDATED; ?></h4>
                    </div>
    			<?php } ?>
    
                <div>
    				<?= zen_draw_form('selection', FILENAME_INVENTORY, 'cid=' . $cid .'&cmd=' . FILENAME_INVENTORY, 'get', 'class="form-horizontal"'); ?>
    
    				<?= zen_draw_label(CATEGORY_SELECTOR, 'cid', 'class="col-sm-6 col-md-4 control-label"'); ?>
                    <div class="col-sm-6 col-md-8">
    					<?php
    						echo zen_draw_pull_down_menu('cid', zen_get_category_tree(), $cid, 'onChange="this.form.submit()" class="form-control"');
    					?>
                    </div>
    				<?= zen_draw_label(TEXT_CATEGORIES_PRODUCTS_SORT_ORDER_INFO, 'sort',
    					'class="col-sm-6 col-md-4 control-label"'); ?>
                    <div class="col-sm-6 col-md-8">
    					<?= zen_draw_pull_down_menu('sort', $categories_products_sort_order_array, $sort,
    						'onchange="this.form.submit();" class="form-control" id="sort"'); ?>
                    </div>
    				<?= zen_draw_label(ACTIVE_STATUS, 'active', 'class="col-sm-6 col-md-4 control-label"'); ?>
                    <div class="col-sm-6 col-md-8">
                        <select id="active" name="active" onChange="this.form.submit()" class="form-control">
                            <option value="0" <?= ($active == '0' ? 'SELECTED' : ''); ?>>Only Active
                            <option value="1" <?= ($active == '1' ? 'SELECTED' : ''); ?>>All Products
                        </select>&nbsp;
                    </div>
                    </form>
                </div>
                <hr/>
                <div>
    
                    <div class="row">
                        <div class="configurationColumnLeft">
                            <form action="" method="post">
                                <table class="table table-striped table-hover table-bordered">
                                    <thead>
    
                                    <tr>
                                        <td colspan="7" class="text-right"><?= $pager; ?></td>
                                    </tr>
    
                                    <tr class="dataTableHeadingRow">
                                        <th class="dataTableHeadingContent"><?= TABLE_HEADING_ID; ?></th>
                                        <th class="dataTableHeadingContent text-center"><?= TABLE_HEADING_MODEL; ?></th>
                                        <th class="dataTableHeadingContent"><?= TABLE_HEADING_NAME; ?></th>
                                        <th class="dataTableHeadingContent text-center"><?= TABLE_HEADING_STATUS; ?></th>
    									<th class="dataTableHeadingContent text-center"><?= TABLE_HEADING_BARCODE; ?></th>
                                        <th class="dataTableHeadingContent text-right"><?= TABLE_HEADING_QTY; ?></th>
                                        <th class="dataTableHeadingContent text-right"><?= TABLE_HEADING_BASE_PRICE; ?></th>
    									<th class="dataTableHeadingContent text-right"><?= TABLE_HEADING_BASE_PRICE_W; ?></th>
                                    </tr>
                                    </thead>
    
    								<?php while ($prod_list && !$prod_list->EOF) {
    
    									$type_handler = $zc_products->get_admin_handler($prod_list->fields['products_type']);
    									if (isset($bad_sku) && array_key_exists($prod_list->fields['products_id'],
    											$bad_sku)) {
    										$color = ' bgcolor="red" ';
    									} else {
    										$color = '';
    									} ?>
    
                                        <tr class="dataTableRow" onmouseover="rowOverEffect(this)"
                                            onmouseout="rowOutEffect(this)">
                                            <td <?= $color; ?> class="dataTableContent"
                                                               onclick="document.location.href='<?= zen_href_link($type_handler,
    											                   'page=1' . '&product_type=' . $prod_list->fields['products_type'] . '&pID=' . $prod_list->fields['products_id'] . '&action=new_product'); ?> '"><?= $prod_list->fields['products_id']; ?></td>
                                            <td class="dataTableContent text-center">
    											<?= $prod_list->fields['products_model']; ?>
                                            </td>
                                            <td class="dataTableContent"
                                                onclick="document.location.href='<?= zen_href_link(FILENAME_PRODUCT,
    											    'product_type=' . $prod_list->fields['products_type'] . '&pID=' . $prod_list->fields['products_id'] . '&cPath=' . $prod_list->fields['catId'] . '&action=new_product'); ?> '">
    											<?php
    												echo zen_get_products_name($prod_list->fields['products_id']);
    											?>
                                            </td>
                                            <td class="text-center">
    
                                                <a href="<?= zen_href_link(FILENAME_INVENTORY,
    												'action=tg_stat' . '&pid=' . $prod_list->fields['products_id'] . $cid_params . '&sort=' . $sort . '&active=' . $active,
    												'SSL'); ?>">
    												<?= ($prod_list->fields['products_status']
    													? zen_image(DIR_WS_IMAGES . 'icon_green_on.gif',
    														IMAGE_ICON_STATUS_ON)
    													: zen_image(DIR_WS_IMAGES . 'icon_red_on.gif',
    														IMAGE_ICON_STATUS_OFF)) ?>
                                                </a>
                                            </td>
    										
    										<td class="dataTableContent text-right">
                                                <input type="text"
                                                       name="new_barcode[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_barcode']; ?>" size="15"/>
                                                <input type="hidden"
                                                       name="old_barcode[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_barcode']; ?>"/>
                                            </td>
    										
                                            <td class="dataTableContent text-right">
                                                <input type="text"
                                                       name="new_qty[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_quantity']; ?>" size="5"/>
                                                <input type="hidden"
                                                       name="old_qty[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_quantity']; ?>"/>
                                            </td>
    
                                            <td class="dataTableContent text-right">
                                                <input type="text"
                                                       name="new_price[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_price']; ?>" size="7"/>
                                                <input type="hidden"
                                                       name="old_price[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_price']; ?>"/>
                                            </td>
    										
    										<td class="dataTableContent text-right">
                                                <input type="text"
                                                       name="new_price_w[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_price_w']; ?>" size="7"/>
                                                <input type="hidden"
                                                       name="old_price_w[<?= $prod_list->fields['products_id']; ?>]"
                                                       value="<?= $prod_list->fields['products_price_w']; ?>"/>
                                            </td>
    
    
    									<?php $prod_list->MoveNext();
    								}
    								?>
                                    <tr>
                                        <td colspan="7" class="text-right"><?= $pager; ?></td>
                                    </tr>
                                </table>
                                <div>
          <span class="floatButton text-right">
        	<input type="reset" value="reset" class="btn btn-danger"/>
        	<input type="submit" name="update_" value="<?= BUTTON_UPDATE; ?>" class="btn btn-primary"/>
          </span>
                                </div>
                            </form>
    
                        </div>
    
                    </div>
                </div>
            </div>
        </div>
    
        <!-- body_eof //-->
        <!-- footer //-->
    	<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
        <!-- footer_eof //-->
        <br/>
        </body>
        </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php');

  8. #8
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Inventory Updater...

    Quote Originally Posted by DrByte View Post
    Er, um, don't merely get rid of those. Instead, replace them with calling zen_db_input() on them. Otherwise you risk creating security issues.
    what he said.

    jimmie, i'm guessing your problem is here:

    PHP Code:
                    if (is_numeric($barcode) and is_numeric($item)) { 
    if you are trying to delete a '0' with a space, this if statement will fail, as a space is not numeric.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #9
    Join Date
    Jul 2009
    Posts
    18
    Plugin Contributions
    1

    Default Re: Inventory Updater...

    Thanks for working on this module. It is a useful addition to Zen Cart. I'm considering using it to replace a stand-alone utility that I wrote years ago.

    There is, however, the potential of a synchronization issue. For example, if an order for one or more of the products comes in while the admin is editing the quantities in the form then the quantity set when the form is submitted will not be correct.

    A simple fix is to have the user enter a positive or negative number which is added to the existing product inventory in the SQL statement. I find this useful because it matches the workflow for handing off-site sales and incoming inventory where it is more natural to enter the amount of products sold or received.

    A more robust fix would allow the user to enter either an absolute amount or a relative amount. For absolute quantities, you could include the current quantity for each product in hidden inputs in the form and when processing the updates add the difference to the quantity in the database.

    When entering absolute quantities, there is the issue that there may be pending orders for some of the products. I don't think there's a right way to handle that situation (other than possibly displaying a warning message) because the software can't know if the products in the pending orders have been pulled from inventory or not.

 

 

Similar Threads

  1. Dynamic Price Updater
    By Chrome in forum All Other Contributions/Addons
    Replies: 1683
    Last Post: 27 Apr 2026, 06:21 AM
  2. v154 Quick Updater
    By fabienne in forum General Questions
    Replies: 5
    Last Post: 30 Jan 2015, 01:46 AM
  3. Update Inventory with Suppliers XML inventory feed?
    By mafiasam in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 21 Jun 2007, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg