Page 5 of 8 FirstFirst ... 34567 ... LastLast
Results 41 to 50 of 74
  1. #41
    Join Date
    Jan 2013
    Posts
    808
    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 />";
    			}
    		}
    	}

  2. #42
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    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 has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #43
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    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.

  4. #44
    Join Date
    Jan 2013
    Posts
    808
    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.

  5. #45
    Join Date
    Jan 2013
    Posts
    808
    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');

  6. #46
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    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 has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  7. #47
    Join Date
    Jul 2009
    Posts
    14
    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.

  8. #48
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    Default Re: Inventory Updater...

    Quote Originally Posted by jadebox View Post
    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.
    thank you for the useful review.

    i agree that the situation you are describing is tricky. perhaps, instead of changing the user inputs on the screen, i could change the logic. one could run into a couple of tricky situations, ie:

    product a -> system inventory = 10; actual inventory 8.

    prior to doing the update with this plugin, an order comes in for 2, so the system inventory is now 8. when the plugin does the update, it could calculate 10 - 8; and subtract 2 from the system inventory. the tricky part could be if a customer orders all 10 or 9, and now the plugin would calculate 0 or -1, and need to turn the item off... or alternatively, if the admin was increasing the inventory from 10 to 15, and during that period an order came in for 10, which resulted in the items status now going to off. should the plugin turn the item back on?

    little bit of food for thought.

    again, thanks for the input.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #49
    Join Date
    Jul 2009
    Posts
    14
    Plugin Contributions
    1

    Default Re: Inventory Updater...

    I had it easier with my standalone utility since I was the only one using it! :-)

  10. #50
    Join Date
    Mar 2021
    Location
    Campbell, Texas USA
    Posts
    13
    Plugin Contributions
    0

    Default Re: Inventory Updater...

    Great Module. How hard would it be to modify it to show inventory stock on attributes??

 

 
Page 5 of 8 FirstFirst ... 34567 ... LastLast

Similar Threads

  1. Dynamic Price Updater
    By Chrome in forum All Other Contributions/Addons
    Replies: 1667
    Last Post: 7 Oct 2023, 10:21 PM
  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

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR