Zen Cart Logo
Forums / Addon Admin Tools / Inventory Updater...

Inventory Updater...

Views: 21,468

Results 41 to 60 of 81
20 Sep 2020, 12:16
#41
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
969
Plugin Contributions:
0

Inventory Updater...

products_barcode varchar(32) is what i have there.
$products_barcode = '';

$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 />";
			}
		}
	}
20 Sep 2020, 12:46
#42
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,953
Plugin Contributions:
8

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.

20 Sep 2020, 16:37
#43
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Inventory Updater...

carlwhat:

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.

20 Sep 2020, 18:52
#44
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
969
Plugin Contributions:
0

Re: Inventory Updater...

ok changed line to this, ```
$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.
20 Sep 2020, 19:00
#45
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
969
Plugin Contributions:
0

Re: Inventory Updater...

i also have the wholesale module installed and installed that into your module as well.
here is my complete file.

<?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 .= ' - ';
	$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">×</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">×</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">×</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">×</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> 
                </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');
21 Sep 2020, 15:04
#46
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,953
Plugin Contributions:
8

Re: Inventory Updater...

DrByte:

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:

				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.

06 Oct 2020, 19:43
#47
jadebox avatar

jadebox

New Zenner

Join Date:
Jul 2009
Posts:
18
Plugin Contributions:
1

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.

06 Oct 2020, 21:51
#48
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,953
Plugin Contributions:
8

Re: Inventory Updater...

jadebox:

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.

07 Oct 2020, 01:39
#49
jadebox avatar

jadebox

New Zenner

Join Date:
Jul 2009
Posts:
18
Plugin Contributions:
1

Re: Inventory Updater...

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

21 May 2021, 19:30
#50
tedjmaines avatar

tedjmaines

New Zenner

Join Date:
Mar 2021
Location:
Campbell, Texas USA
Posts:
13
Plugin Contributions:
0

Re: Inventory Updater...

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

21 May 2021, 22:18
#51
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,953
Plugin Contributions:
8

Re: Inventory Updater...

tedjmaines:

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

thanks for the props! :thumbsup:

with regards to your question, i have no idea.

ZC does not come out of the box with an inventory stock with attributes. so now we are talking about a plugin. which plugin? i see a few different SBA plugins.... but its hard to tell which is the one that most people are using. or what it does.

i have not really played with attributes, as i chose to rely on the base ZC for inventory type functions.

i have a feeling that the bigger work is getting the SBA plugin working properly, and modifying this module should not be too hard, but i'm only guessing as i do not have a development site running any SBA plugin.

how's that for a waffle?

however, as i tell most people given enough time and money, anything is possible... :D

best.

24 May 2022, 16:27
#52
mike_harmon avatar

mike_harmon

New Zenner

Join Date:
Sep 2018
Location:
Texas
Posts:
33
Plugin Contributions:
0

Re: Inventory Updater...

Hello,
I am having problems with sitelock firewall when logged in to admin area and trying to add quantity to existing products or editing the listing itself. It gives me error 15.

I have 3 questions I think would help other users as well:

1] Using this inventory plugin will bypass sitelock firewall?

2] Would it be safe to use this possible bypass OR a VPN with a whitelisted IP?

3] Why does the sitelock firewall cause problems when it should realize that the admin is the one who brought forth the page that is to be altered in the first place?

I stay pretty angry at sitelock lately.

Thanks in advance

24 May 2022, 16:33
#53
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Inventory Updater...

Mike Harmon:

Hello,
I am having problems with sitelock firewall when logged in to admin area and trying to add quantity to existing products or editing the listing itself. It gives me error 15.

I have 3 questions I think would help other users as well:

1] Using this inventory plugin will bypass sitelock firewall?

2] Would it be safe to use this possible bypass OR a VPN with a whitelisted IP?

3] Why does the sitelock firewall cause problems when it should realize that the admin is the one who brought forth the page that is to be altered in the first place?

I stay pretty angry at sitelock lately.

Thanks in advance

Interesting in that I had sitelock for years on an older store and never had these types of issues.

Most all of these plugins work through the same admin interface so I do not see this helping nor do I see it making things worse. Are you accessing via HTTPS? This seems to be an issue not associated with this particular plugin unless I am totally missing the point. If you cannot edit items in the admin, then you have to solve that first.

24 May 2022, 17:20
#54
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,953
Plugin Contributions:
8

Re: Inventory Updater...

g2ktcf:

Interesting in that I had sitelock for years on an older store and never had these types of issues.

Most all of these plugins work through the same admin interface so I do not see this helping nor do I see it making things worse. Are you accessing via HTTPS? This seems to be an issue not associated with this particular plugin unless I am totally missing the point. If you cannot edit items in the admin, then you have to solve that first.

concur.

25 May 2022, 00:15
#55
mike_harmon avatar

mike_harmon

New Zenner

Join Date:
Sep 2018
Location:
Texas
Posts:
33
Plugin Contributions:
0

Re: Inventory Updater...

Hi,

I am not using any plugin at the moment but was asking if this inventory plugin would solve my problem.

I have had sitelock and my current hosting provider for years with no problem like this before. I also had Hughes satellite for about 3 years as well.

Sitelock says it is an issue with the firewall AND mentioned that my satellite provider has had issues with the IP and sitelock firewall like I am having now and cases seem to be increasing. Hughes net is my satellite provider. Just a few minutes ago the sitelock rep said simply whitelisting has not worked and he was going to try another approach which lowers the firewall strength [that is how he explained it to me who is partially dumb]. It has been past the time he said it would take to go into effect.

I am getting this error after pulling up a product to add inventory or edit:

Access Denied
Error 15
https://www.xxxxxxxxxxxxxxx.com
2022-05-24 23:50:57 UTC
logo
What happened?
This request was blocked by the security rules
Your IP: xxxxxxxxxxxxxxxxxxxxxxx
Proxy IP: xxxxxxxxxxxxxx (ID xxxxxxxxxx)
Incident ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[NOTE: Proxy address is staying the same but ID does change regardless what IP address I use by using my VPN]

I was hoping that this inventory script/plugin would help bypass the problem.
Regardless, once this problem is worked out, I am eager to try it! It sounds like a life and time saver.
The sitelock rep I just talked to seemed confident he could fix it. The first time this happened on 5-9-22 they resolved in withing 30 seconds by whitelisting. But that I am assuming did not stop the problem as my IP did change after that. I am a small company and do not alter our listing so I really have no clue when the problem started. I need to add inventory now and am at "-1" on the product that I was trying to restock to when I found the problem

25 May 2022, 00:21
#56
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Inventory Updater...

I have never used this plugin so I cannot comment on it. I use EZ Populate and can do much more than "just" update qty.

25 May 2022, 03:56
#57
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,953
Plugin Contributions:
8

Re: Inventory Updater...

g2ktcf:

I have never used this plugin so I cannot comment on it. I use EZ Populate and can do much more than "just" update qty.

i have never used EZ populate. but last time i checked this was the support thread for my inventory updater...

as far as bypassing sitelock, i doubt it. but i have no idea, as i have never used sitelock...

it seems more valuable to figure out your sitelock issues as opposed to attempting to bypass them with my plugin... but you are more than welcome to try... this plugin has a very easy install and there are no core code scripts modified...

hope that helps.

@g2ktcf if you have never used this plugin and can not comment on it, then please tell what you are doing commenting on it?

25 May 2022, 05:10
#58
mike_harmon avatar

mike_harmon

New Zenner

Join Date:
Sep 2018
Location:
Texas
Posts:
33
Plugin Contributions:
0

Re: Inventory Updater...

If you can just delete my post please. I see no where to do it

25 May 2022, 12:01
#59
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Inventory Updater...

carlwhat:

i have never used EZ populate. but last time i checked this was the support thread for my inventory updater...

as far as bypassing sitelock, i doubt it. but i have no idea, as i have never used sitelock...

it seems more valuable to figure out your sitelock issues as opposed to attempting to bypass them with my plugin... but you are more than welcome to try... this plugin has a very easy install and there are no core code scripts modified...

hope that helps.

@g2ktcf if you have never used this plugin and can not comment on it, then please tell what you are doing commenting on it?

@Carlwhat, I did not even realize which forum this was in. Please accept my sincerest apologies. I did not even realize this was your plugin.

26 May 2022, 17:36
#60
mike_harmon avatar

mike_harmon

New Zenner

Join Date:
Sep 2018
Location:
Texas
Posts:
33
Plugin Contributions:
0

Re: Inventory Updater...

Using 1.5.6 zencart and php 7.3

Hello,
I downloaded this plugin and it works great. In my instance it is allowing me to have a semblance of normalcy as I have ongoing problems with a hacked site or server.
I am ignorant but stubborn so I would like to ask for patience.
I downloaded the zip file and can not figure the file structure.
I read them to be that upon unwrapping , I would be creating OR adding to the following folders for the zencart 1.5.6 version I am using:

admin: [ i have that naturally]
includes: [ I have that]I added inventory.php here and set permissions
Drilling down then
extra_datafiles = [I had that and added the inventory.php]
languages => English [I had those but didn't have folder "extra_definitions so I uploaded the folder extra_definitions] it installed inventory.php also

At this point it is working and I am loving it.

What should I do with the other files in the zip file like folders font_wesome-4.2.0,fonts. js, less and zc_plugins?

I opened a support thread pertaining to my ongoing problem and yes, I am using this to circumvent that problem and am not advising anyone to do that but am saying the plugin is remarkable and I will use it daily! It makes zencart fun again frankly.