0

I have been developing an Inventory system (PHP Codeigniter & MySQL), I have setup almost everything except one feature which one of my clients wants to implement to the system - A multi - unit support feature for the system.

Currently my system only supports single unit per item per transaction:

item_desc: Item1
default_unit: pc
reorder: 1
in_stock: 25
remain: 25

In multi - unit feature, this would become:

item_desc: Item1
default_unit: pc
big_unit: pack
pack_size: 50
reorder: 1
in_stock: 25 pack
remain: 24 pack 5 pc

Can someone give me hint on probably the easy way to implement this? I just want to know where to start on this thing. I would appreciate much if someone could share an idea regarding on this one :)

PinoyPal
  • 388
  • 3
  • 12

1 Answers1

1

We just launched v2 of our website and I've gone through 8 months of all kinds of questions like this myself. The best way to do it is to separate your tables into products, inventory and listings.

Products holds product specific information only, things that will never change. Inventory holds information about current inventory only, ie quantity on hand, backorder, location in warehouse etc. Listings are how you handle the multi item support. This table would hold listing information and draw from the other two tables for the product and quantity data. So you'd have a basic table structure something like this

Products

  • productId
  • productName
  • productModel
  • productDescription

Inventory

  • inventoryId
  • productId
  • quantityOnHand
  • location

Listings

  • listingId
  • inventoryId
  • quantityInListing
  • numberOfListings
  • price

Our company sells a lot of preowned things so the listings change regularly, but you could always set the listings up to auto-populate based on inventory if you're selling new things that you just restock. Doing it this way means you don't end up with a ton of data duplication as you would if you just created products for the multiples. It also allows you to sell any item in any quantity and set prices for those quantities manually.

Rick Calder
  • 18,310
  • 3
  • 24
  • 41
  • what does quantityInListing and numberOfListings actually holds? – PinoyPal Mar 04 '13 at 12:46
  • That would be the number of units in the listing. so in your example above the first listing would have quantityInListing of 1 and 25 for numberOfListings, the second would be 50 quantityInListing and 25 for numberOfListings – Rick Calder Mar 04 '13 at 12:54
  • @Rick can u pls provide the table with sample data of listings table? – Ajt Jan 20 '17 at 16:09