Eco-$mart Product List -

" . "" . "
" . "Please Log In" . "
" . "Username: " . "" . "
" . "Password: " . "" . "
" . "" . "" . "
"); exit(); }else{ $dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1'); mysql_select_db('ecosmar_products', $dbcnx); $itemstart = "PV"; $catalogpage = "http://www.ecosmartinc.com/catpave.php"; $page = $name; $pageback = "catpave.php"; }//logged in $bglo_units = "white"; $bgcase = "white"; $bgdescript = "white"; $bgitem = "white"; $newheadbg = "white"; $newheadcolor = "green"; ////////////////////////////////////////////////////////////newly if($newly == "yes"){ $newitems = $_POST[newitems]; $newskus = $_POST[newskus]; $newMFGs = $_POST[newMFGs]; $newlists = $_POST[newlists]; $newretails = $_POST[newretails]; $newspecials = $_POST[newspecials]; $newdealers = $_POST[newdealers]; $newdealer_los = $_POST[newdealer_los]; $newdistributors = $_POST[newdistributors]; $newcosts = $_POST[newcosts]; $newunits = $_POST[newunits]; $newlo_unitss = $_POST[newlo_unitss]; $newcss = $_POST[newcss]; $newmins = $_POST[newmins]; $newup_dates = $_POST[newup_dates]; $newdescriptions = $_POST[newdescriptions]; $newcount = count($newitems); $i = 0; while($i < $newcount){ $item = $newitems[$i]; if($newitems[$i] != ""){ $whatif = substr($newitems[$i],0,2); if($whatif == $itemstart){ $check = mysql_query("SELECT sku FROM price WHERE item='$item'"); if(!$check){ echo("

Could not check for duplicate item numbers. Error: ".mysql_error()."

"); }else{ $numbrows = mysql_num_rows($check); if($numbrows > 0){ $stop = "on"; $airitem[] = $item; $air[] = "Item already exists. Edit below."; }//number of rows is greater than 0 }//checked $sku = $newskus[$i]; $MFG = $newMFGs[$i]; $list = sprintf("%01.2f", $newlists[$i]); $retail = sprintf("%01.2f", $newretails[$i]); $special = sprintf("%01.2f", $newspecials[$i]); $dealer = sprintf("%01.2f", $newdealers[$i]); $dealer_lo = sprintf("%01.2f", $newdealer_los[$i]); $distributor = sprintf("%01.2f", $newdistributors[$i]); $cost = sprintf("%01.2f", $newcosts[$i]); $unit = $newunits[$i]; $lo_units = $newlo_unitss[$i]; $cs = $newcss[$i]; $min = $newmins[$i]; /////testing input if($dealer_lo > 0 and $lo_units == ""){ $stop = "on"; $airitem[] = $item; $air[] = "Dealer Low price, but no Low units."; $bglo_units = "yellow"; $airsku[] = $newskus[$i]; $airMFG[] = $newMFGs[$i]; $airlist[] = sprintf("%01.2f", $newlists[$i]); $airretail[] = sprintf("%01.2f", $newretails[$i]); $airspecial[] = sprintf("%01.2f", $newspecials[$i]); $airdealer[] = sprintf("%01.2f", $newdealers[$i]); $airdealer_lo[] = sprintf("%01.2f", $newdealer_los[$i]); $airdistributor[] = sprintf("%01.2f", $newdistributors[$i]); $aircost[] = sprintf("%01.2f", $newcosts[$i]); $airunit[] = $newunits[$i]; $airlo_units[] = $newlo_unitss[$i]; $aircs[] = $newcss[$i]; $airmin[] = $newmins[$i]; $airdescript[] = stripslashes($newdescriptions[$i]); }//no lo units for dealer lo if($unit == "CS" and $cs == ""){ $stop = "on"; $air[] = "Units = CS, but no case lot specified."; $bgcase = "yellow"; if(!in_array($item, $airitem)){ $airitem[] = $item; $airsku[] = $newskus[$i]; $airMFG[] = $newMFGs[$i]; $airlist[] = sprintf("%01.2f", $newlists[$i]); $airretail[] = sprintf("%01.2f", $newretails[$i]); $airspecial[] = sprintf("%01.2f", $newspecials[$i]); $airdealer[] = sprintf("%01.2f", $newdealers[$i]); $airdealer_lo[] = sprintf("%01.2f", $newdealer_los[$i]); $airdistributor[] = sprintf("%01.2f", $newdistributors[$i]); $aircost[] = sprintf("%01.2f", $newcosts[$i]); $airunit[] = $newunits[$i]; $airlo_units[] = $newlo_unitss[$i]; $aircs[] = $newcss[$i]; $airmin[] = $newmins[$i]; $airdescript[] = stripslashes($newdescriptions[$i]); }//not already in air array }//no lot for cases $descript = stripslashes($newdescriptions[$i]); $description = htmlspecialchars($descript, ENT_QUOTES, 'utf-8'); if($stop != "on"){ if($description != ""){ $newup = mysql_query("INSERT INTO price SET item='$item',sku='$sku',MFG='$MFG',list='$list',retail='$retail',special='$special',dealer='$dealer',dealer_lo='$dealer_lo',distributor='$distributor',cost='$cost',unit='$unit',lo_units='$lo_units',cs='$cs',min='$min',up_date='$dtnum',description='$description' "); if(!$newup){ echo("

Could not insert $item. Error: ".mysql_error()."

"); }else{ $inned[] = $item; } }//there is a description else{ $air[] = "No Product Description"; $bgdescript = "yellow"; if(!in_array($item, $airitem)){ $airitem[] = $item; $airsku[] = $newskus[$i]; $airMFG[] = $newMFGs[$i]; $airlist[] = sprintf("%01.2f", $newlists[$i]); $airretail[] = sprintf("%01.2f", $newretails[$i]); $airspecial[] = sprintf("%01.2f", $newspecials[$i]); $airdealer[] = sprintf("%01.2f", $newdealers[$i]); $airdealer_lo[] = sprintf("%01.2f", $newdealer_los[$i]); $airdistributor[] = sprintf("%01.2f", $newdistributors[$i]); $aircost[] = sprintf("%01.2f", $newcosts[$i]); $airunit[] = $newunits[$i]; $airlo_units[] = $newlo_unitss[$i]; $aircs[] = $newcss[$i]; $airmin[] = $newmins[$i]; $airdescript[] = stripslashes($newdescriptions[$i]); }//not already in air array } }//stop is not on }//item number has correct prefix else{ $air[] = "Incorrect Item Number"; $bgitem = "yellow"; if(!in_array($item, $airitem)){ $airitem[] = $item; $airsku[] = $newskus[$i]; $airMFG[] = $newMFGs[$i]; $airlist[] = sprintf("%01.2f", $newlists[$i]); $airretail[] = sprintf("%01.2f", $newretails[$i]); $airspecial[] = sprintf("%01.2f", $newspecials[$i]); $airdealer[] = sprintf("%01.2f", $newdealers[$i]); $airdealer_lo[] = sprintf("%01.2f", $newdealer_los[$i]); $airdistributor[] = sprintf("%01.2f", $newdistributors[$i]); $aircost[] = sprintf("%01.2f", $newcosts[$i]); $airunit[] = $newunits[$i]; $airlo_units[] = $newlo_unitss[$i]; $aircs[] = $newcss[$i]; $airmin[] = $newmins[$i]; $airdescript[] = stripslashes($newdescriptions[$i]); }//not already in air array } }//item number is present $i=$i+1; }//while counting newitems if(!empty($airitem)){ $newheadbg = "maroon"; $newheadcolor = "yellow"; echo("

Some items not inserted:"); $aircount = count($airitem); $a=0; while($a < $aircount){ echo("
$airitem[$a] : $air[$a]"); $a=$a+1; }//while counting air items echo("

"); }//there are air items if(!empty($inned)){ echo("

INSERTED: "); foreach($inned as $value){ echo("$value ¦¦ "); } } }//newly is yes /////////////////////////////////////////////////////////////newlylot if($newlylot == "yes"){ $stop = "off"; $inputer = $_POST['inputer']; $detail = rtrim($inputer, "\r\n"); $excol = explode("\r\n", $detail); $excount = count($excol); echo("

Processing $excount rows...

"); foreach($excol as $value){ $overwrite = "off"; $splits = explode("\t", $value); $countem = count($splits); if($countem == 16){ $whatif = substr($splits[0],0,2); if($whatif == $itemstart){ $item = $splits[0]; $check = mysql_query("SELECT sku FROM price WHERE item='$item'"); if(!$check){ echo("

Could not check for duplicate item numbers. Error: ".mysql_error()."

"); }else{ $numbrows = mysql_num_rows($check); if($numbrows > 0){ $overwrite = "on"; $overitem[] = $item; }//there are dupes }//checked $sku = $splits[1]; $MFG = $splits[2]; $list = sprintf("%01.2f", $splits[3]); $retail = sprintf("%01.2f", $splits[4]); $special = sprintf("%01.2f", $splits[5]); $dealer = sprintf("%01.2f", $splits[6]); $dealer_lo = sprintf("%01.2f", $splits[7]); $distributor = sprintf("%01.2f", $splits[8]); $cost = sprintf("%01.2f", $splits[9]); $unit = $splits[10]; $lo_units = $splits[11]; $cs = $splits[12]; $min = $splits[13]; /////testing input if($dealer_lo > 0 and $lo_units == ""){ $stop = "on"; $airitem[] = $item; $air[] = "Wholesale Low price, but no Low units."; } if($unit == "CS" and $cs == ""){ $stop = "on"; $airitem[] = $item; $air[] = "Units = CS, but no case lot specified."; } $descript = stripslashes($splits[15]); $description = htmlspecialchars($descript, ENT_QUOTES, 'utf-8'); if($stop != "on"){ if($overwrite != "on"){ if($description != ""){ $newup = mysql_query("INSERT INTO price SET item='$item',sku='$sku',MFG='$MFG',list='$list',retail='$retail',special='$special',dealer='$dealer',dealer_lo='$dealer_lo',distributor='$distributor',cost='$cost',unit='$unit',lo_units='$lo_units',cs='$cs',min='$min',up_date='$dtnum',description='$description' "); if(!$newup){ echo("

Could not insert $item. Error: ".mysql_error()."

"); }else{ $inned[] = $item; } }//there is a description else{ $airitem[] = $item; $air[] = "No Product Description"; } }//overwrite is not on else{ $oitem[] = $splits[0]; $osku[] = $splits[1]; $oMFG[] = $splits[2]; $olist[] = sprintf("%01.2f", $splits[3]); $oretail[] = sprintf("%01.2f", $splits[4]); $ospecial[] = sprintf("%01.2f", $splits[5]); $odealer[] = sprintf("%01.2f", $splits[6]); $odealer_lo[] = sprintf("%01.2f", $splits[7]); $odistributor[] = sprintf("%01.2f", $splits[8]); $ocost[] = sprintf("%01.2f", $splits[9]); $ounit[] = $splits[10]; $olo_units[] = $splits[11]; $ocs[] = $splits[12]; $omin[] = $splits[13]; $odescript[] = stripslashes($splits[15]); }//overwrite is on }//stop is not on }else{ $airitem[] = $item; $air[] = "Incorrect Item Number"; } }//15 columns else{ $airitem[] = $item; $air[] = "Column Mismatch"; } }//4each row if(!empty($airitem)){ echo("

Some items not inserted:"); $aircount = count($airitem); $a=0; while($a < $aircount){ echo("
$airitem[$a] : $air[$a]"); $a=$a+1; }//while counting air items echo("

"); }//there are air items if(!empty($inned)){ echo("

INSERTED: "); foreach($inned as $value){ echo("$value ¦¦ "); } }//products inned if(!empty($oitem)){ echo("

" . "

Overwrite these Item Numbers?"); $countows = count($oitem); $i = 0; while($i < $countows){ echo("
 " . "$oitem[$i]  ¦ " . "$osku[$i] ¦ " . "$oMFG[$i] ¦ " . "$olist[$i] ¦ " . "$oretail[$i] ¦ " . "$ospecial[$i] ¦ " . "$odealer[$i] ¦ " . "$odealer_lo[$i] ¦ " . "$odistributor[$i] ¦ " . "$ocost[$i] ¦ " . "$ounit[$i] ¦ " . "$olo_units[$i] ¦ " . "$ocs[$i] ¦ " . "$omin[$i] ¦ " . "$odescript[$i] ¦ "); $i = $i+1; }//while counting ows echo("

" . "" . "" . "" . "
"); }//overwrite is on }//newlylot is yes ////////////////////////////////////////////////uppy if($uppy == "yes"){ $outitems = $_POST[outitems]; if(!empty($outitems)){ echo("

REMOVED: "); foreach($outitems as $value){ $newitem = "9".$value; $hide = mysql_query("UPDATE price SET item='$newitem' WHERE item='$value' "); if(!$hide){ echo("

Could not trash $value. Error: ".mysql_error()."

"); }else{ echo("$value ¦¦ "); } }//4each echo("
Retrieve Deleted Items"); }//there are out items $changeitems = $_POST[changeitems]; $items = $_POST[items]; $skus = $_POST[skus]; $MFGs = $_POST[MFGs]; $lists = $_POST[lists]; $retails = $_POST[retails]; $specials = $_POST[specials]; $dealers = $_POST[dealers]; $dealer_los = $_POST[dealer_los]; $distributors = $_POST[distributors]; $costs = $_POST[costs]; $units = $_POST[units]; $lo_unitss = $_POST[lo_unitss]; $css = $_POST[css]; $mins = $_POST[mins]; $descriptions = $_POST[descriptions]; $itemcount = count($items); $changecount = count($changeitems); if($changecount < 1){ echo("

No changes made. You must check the box next to the item you wish to edit.

"); }else{ $i=0; while($i < $itemcount){ if(in_array($items[$i], $changeitems)){ $item = $items[$i]; $sku = $skus[$i]; $MFG = $MFGs[$i]; $list = sprintf("%01.2f", $lists[$i]); $retail = sprintf("%01.2f", $retails[$i]); $special = sprintf("%01.2f", $specials[$i]); $dealer = sprintf("%01.2f", $dealers[$i]); $dealer_lo = sprintf("%01.2f", $dealer_los[$i]); $distributor = sprintf("%01.2f", $distributors[$i]); $cost = sprintf("%01.2f", $costs[$i]); $unit = $units[$i]; $lo_units = $lo_unitss[$i]; $cs = $css[$i]; $min = $mins[$i]; $descript = stripslashes($descriptions[$i]); $description = htmlspecialchars($descript, ENT_QUOTES, 'utf-8'); $uppit = mysql_query("UPDATE price SET sku='$sku',MFG='$MFG',list='$list',retail='$retail',special='$special',dealer='$dealer',dealer_lo='$dealer_los[$i]',distributor='$distributor',cost='$cost',unit='$unit',lo_units='$lo_units',cs='$cs',min='$min',up_date='$dtnum',description='$description' WHERE item='$item'"); if(!$uppit){ echo("

Unable to update $item[$i]. Error: ".mysql_error()."

"); }else{//add items to list of successful changes $upped[] = $item; } }//if item is in changeitems array $i = $i + 1; }//while counting items }//there are items checked to be changed if(!empty($upped)){ echo("

EDITED: "); foreach($upped as $value){ echo("$value ¦¦ "); } echo("

"); }//upped is not empty }//uppyisyes /////////////////////////////////////START DISPLAY $getmfgs = mysql_query("SELECT co_name FROM mfg ORDER BY co_name"); if(!$getmfgs){ echo("

Could not Get Manufacturers List
".mysql_error()."

"); }else{ while($meg = mysql_fetch_array($getmfgs)){ $mfglist[]=$meg[0]; } } $getit = mysql_query("SELECT item,sku,MFG,list,retail,special,dealer,dealer_lo,distributor,cost,unit,lo_units,cs,min,up_date,description FROM price WHERE item LIKE '$itemstart%' ORDER BY item"); if(!$getit){ echo("

Could not Get Item List
".mysql_error()."

"); }else{ $numrows = mysql_num_rows($getit); if($numrows < 1){ echo("

No Items Available with prefix $itemstart.

"); }else{ echo("
" . "" . ""); $rouse = 0; while($row = mysql_fetch_array($getit)){ $rippy = $rouse/10; if(is_int($rippy) and $rippy != 0){ echo(""); } if($row[10] == "CS"){ $csbg = "#ffffc0"; $unbg = "#ffffc0"; }else{ $csbg = "#ffffff"; $unbg = "#ffffff"; } $shortdesc = substr($row[15], 0, 50); echo("" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . "" . ""); $rouse = $rouse+1; }//while getting it echo("
DEL" . " Edit " . "Item" . "sku" . "MFG" . "List" . "Retail" . "Special" . "Wholesale" . "Wholesale Lo" . "Distributor" . "Cost" . "Unit" . "Lo Units" . "Case" . "Minimum" . "Updated" . "Description" . "
DEL" . "Edit" . "Item" . "sku" . "MFG" . "List" . "Retail" . "Special" . "Wholesale" . "Wholesale Lo" . "Distributor" . "Cost" . "Unit" . "Lo Units" . "Case" . "Minimum" . "Updated" . "Description" . "
$row[0]
" . "" . "" . "" . "" . "" . "
"); }//there are products in numrows }//gotit ?>
Add Items Please Read Notes Below
Item sku MFG List Retail Special Wholesale Wholesale Lo Distributor Cost Unit Lo Units Case Minimum Updated Description
Insert RowsPlease Read Notes Below
Copy and Paste Rows from an Excel Spread Sheet into the Text Area below:

WARNING! Columns must match or item will be rejected. Get Template Below.

MUST READ:

IMPORTANT: The Item Number is the key in the Product Data Base. This is why the Item Number cannot be Duplicated or Edited in this program. If a product requires a new Item Number, it must be Added like a new product. Then the old Item Number should be removed. Notification of the change to applicable parties is recommended.

 Item Numbers must begin with to be accepted. If they do not, you will receive a message telling you so, and the item will not be added.

 When adding rows from a spread sheet, you must select the CONTENT of the rows to be added.
Simply selecting the rows in Excel will not work. You must select the actual fields in the spread sheet.

 Rows from a spread sheet must match columns in the data base.
To ensure a match, copy and paste the text in the text area below into the first row of your spreadsheet.

1. Right Click in the text area and click "Select All".   2. Right Click and Click "Copy" (Ctrl+C).   3. Select the first cell of the row where you are pasting in Excel.
4. Right Click and Click "Paste" (Ctrl+V).   Should Excel ask for more information, this is a Tab seperated list. (default)

 Errors: There are several reasons that a row of data may be rejected:
   : The Item Number may not match the category of the page from which it is being posted.
   : A Wholesale Low price is specified, but Low Units is not.
   : Case has been specified as the Unit, but there is no case lot specified.
   : A Description has not been given for the item.
If entering data using the "Add Items" form table, your data will not be lost and you will be able to correct the error and send again. If you are entering data using the "Insert Rows" function, you will need to correct the data in your spreadsheet and copy and paste the rows again.

 PRICE DISPLAY: There are two areas where prices effect display.:
   : In the Eco-$mart Catalog. To display prices and activate the shopping cart, at least a Retail price must be designated. If List & Retail prices are set to 0.00, a "Quote Request" button will be displayed for that item instead of an "Add to Cart" button.
   : In the Representative Quoting area. If prices are ALL set to 0.00, the item will not be displayed for quoting. NOTE: Setting all prices to 0.00 does not remove the item from the catalog.

© 2010 Eco-$mart, Inc. eco-smart.com Administration Eco-$mart Products Add Manufacturer Print List Web Page Trash Bin
Administration Eco-$mart Products Add Items Add Manufacturer Print List Trash