Forums / Customization from the Admin / Product Quantity by Location/Warehouse

Product Quantity by Location/Warehouse

Views: 1,721

Results 1 to 13 of 13
20 Feb 2025, 8:54 PM
#1
get2go avatar

get2go

New Zenner

Join Date:
Jul 2021
Posts:
12
Plugin Contributions:
0

Product Quantity by Location/Warehouse

By default zencart edit product page has one quantity field.
Is it possible to have multiple quantity field for same product especially when site owner has more than one warehouse or location.
Stock by attribute only works with attributes. What we are looking for to have multiple quantity fields by location on product page.
Please advise if they is any plugin available or suggestion to achieve this.

20 Feb 2025, 10:58 PM
#2
jimmie avatar

jimmie

Totally Zenned

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

Re: Product Quantity by Location/Warehouse

U can install numinix product fields and create as many different fields as desired, you'll have to custom code to retrieve info from fields also if desired.

21 Feb 2025, 1:25 AM
#3
get2go avatar

get2go

New Zenner

Join Date:
Jul 2021
Posts:
12
Plugin Contributions:
0

Re: Product Quantity by Location/Warehouse

jimmie:

U can install numinix product fields and create as many different fields as desired, you'll have to custom code to retrieve info from fields also if desired.

Jimmie,
Thank you for suggestion. I have created two fields as qty1 and qty2.
How I can make main product default quantity field (Qty) to get info from these fields like
Qty = qty1 + qty2

After every purchase qty should subtract from qty1 field by default but if qty1 is 0 or less then it should substract from qty2 field and update Qty total accordingly.

That's where I am having hard time. If you can point which files/code need edit so I can accomplish this task.

21 Feb 2025, 7:02 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,727
Plugin Contributions:
56

Re: Product Quantity by Location/Warehouse

How I can make main product default quantity field (Qty) to get info from these fields like Qty = qty1 + qty2

Not something that can be easily done. You'd need to get a developer to do the requisite custom programming.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Feb 2025, 10:27 AM
#5
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,305
Plugin Contributions:
39

Re: Product Quantity by Location/Warehouse

Create the product as a subcategory with the locations stock as products under it

~Melanie

23 Feb 2025, 8:14 AM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Product Quantity by Location/Warehouse

Do you mind explaining why this process is needed for the business? It may help determine a way forward.

I've seen a plug-in that helped with drop shipping, but required a little bit of human intervention to balance things out. It seemed to work on a similar concept of offering a method and later a way to adhere the request to something in reality.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

23 Feb 2025, 2:58 PM
#7
get2go avatar

get2go

New Zenner

Join Date:
Jul 2021
Posts:
12
Plugin Contributions:
0

Re: Product Quantity by Location/Warehouse

mc12345678:

Do you mind explaining why this process is needed for the business? It may help determine a way forward.

I've seen a plug-in that helped with drop shipping, but required a little bit of human intervention to balance things out. It seemed to work on a similar concept of offering a method and later a way to adhere the request to something in reality.

Have multiple locations for physical stores and would like to share quantity from each store with site so qty field get total qty available to ship.

qty1 and qty2 are being used to show availability of actual qty on each store, plus using these fields to send data to Google for local pick up/physical stores.

In future plan on using qty 1 and qty 2 fields to show delivery date per customer location to offer faster delivery options.

23 Feb 2025, 2:59 PM
#8
get2go avatar

get2go

New Zenner

Join Date:
Jul 2021
Posts:
12
Plugin Contributions:
0

Re: Product Quantity by Location/Warehouse

Thank you but that will create too many sub categories (as site has over 5K items) and 2 of each products.

23 Feb 2025, 4:53 PM
#9
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,807
Plugin Contributions:
22

Re: Product Quantity by Location/Warehouse

get2go:

Have multiple locations for physical stores and would like to share quantity from each store with site so qty field get total qty available to ship.

qty1 and qty2 are being used to show availability of actual qty on each store, plus using these fields to send data to Google for local pick up/physical stores.

In future plan on using qty 1 and qty 2 fields to show delivery date per customer location to offer faster delivery options.

IMO, you'll need to get your hands dirty and get the coding done. A simple approach would be to add 2 more fields (let's say qty1 and qty2) in the database and add logic to update products_quantity based on the values in those fields. Javascript can do it in admin product page.
As for frontend, you'd need a new function that would be called during checkout_process - you could for example use NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL notifier to get this part done. This would be a bit more fun because you need to run through all products and be careful not to go into negative values (for example, qty1 is 2, qty2 is 5, ordered 4).
Using these fields for Google will require your GPSF module to be modified, just like you'll need custom code for delivery dates per location.

Don't forget to handle cases in admin when order is cancelled or deleted and you need to restock.

My site - Pro ZC Help
My portfolio | My plugins

23 Feb 2025, 9:25 PM
#10
get2go avatar

get2go

New Zenner

Join Date:
Jul 2021
Posts:
12
Plugin Contributions:
0

Re: Product Quantity by Location/Warehouse

balihr:

IMO, you'll need to get your hands dirty and get the coding done. A simple approach would be to add 2 more fields (let's say qty1 and qty2) in the database and add logic to update products_quantity based on the values in those fields. Javascript can do it in admin product page.
As for frontend, you'd need a new function that would be called during checkout_process - you could for example use NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL notifier to get this part done. This would be a bit more fun because you need to run through all products and be careful not to go into negative values (for example, qty1 is 2, qty2 is 5, ordered 4).
Using these fields for Google will require your GPSF module to be modified, just like you'll need custom code for delivery dates per location.

Don't forget to handle cases in admin when order is cancelled or deleted and you need to restock.

Thank you for your suggestions.
Qty1 and Qty2 are in DB and IMS update data in these fields from each location. That's done.

GPSF will take data from these DB columns for qty1 and qty 2 for each location. That's done.

I have qty1 and qty 2 fields on edit product page and it's inserting/updating values fine. That's done.

What I am trying to achieve now is :

When customer complete checkout it should substract from qty1 field by default unless it is 0 than from qty 2 but for available stock check it should take qty1 + qty 2 = total quantity instead of just qty1 field. I am thinking to mark zc default qty as qty1 to simplify as zc by default subtract from it. So just need to add/update code to include qty from qty2 field and apply check to subtract qty from qty 2 when qty1 is <1.

So I think somewhere on front end where Available quantity check is that's what need to be customized to achieve. Site is using One page checkout. Any idea which files/code need to be customize in there.

24 Feb 2025, 12:10 AM
#11
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,118
Plugin Contributions:
56

Re: Product Quantity by Location/Warehouse

get2go:

Thank you for your suggestions.
Qty1 and Qty2 are in DB and IMS update data in these fields from each location. That's done.

GPSF will take data from these DB columns for qty1 and qty 2 for each location. That's done.

I have qty1 and qty 2 fields on edit product page and it's inserting/updating values fine. That's done.

What I am trying to achieve now is :

When customer complete checkout it should substract from qty1 field by default unless it is 0 than from qty 2 but for available stock check it should take qty1 + qty 2 = total quantity instead of just qty1 field. I am thinking to mark zc default qty as qty1 to simplify as zc by default subtract from it. So just need to add/update code to include qty from qty2 field and apply check to subtract qty from qty 2 when qty1 is <1.

So I think somewhere on front end where Available quantity check is that's what need to be customized to achieve. Site is using One page checkout. Any idea which files/code need to be customize in there.
One-Page Checkout has no bearing in the creation/recording of the order; that's all performed in the checkout_process page.

24 Feb 2025, 12:54 AM
#12
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,807
Plugin Contributions:
22

Re: Product Quantity by Location/Warehouse

get2go:

When customer complete checkout it should substract from qty1 field by default unless it is 0 than from qty 2 but for available stock check it should take qty1 + qty 2 = total quantity instead of just qty1 field. I am thinking to mark zc default qty as qty1 to simplify as zc by default subtract from it. So just need to add/update code to include qty from qty2 field and apply check to subtract qty from qty 2 when qty1 is <1.

So I think somewhere on front end where Available quantity check is that's what need to be customized to achieve. Site is using One page checkout. Any idea which files/code need to be customize in there.

Yes, and this is exactly the interesting part where you get some fun.
As lat9 mentioned, it has nothing to do with OPC. Qty check and subtraction happens during checkout_process (includes/modules/checkout_process.php), or includes/classes/order.php to be exact. I'd use the notifier mentioned earlier, but you might prefer the ones found in create_add_products() function. Or just modify that function if you're happy with modifying core file, although the observer approach helps during upgrades and maintenance.
Your observer (or hack) could then update qty1 and qt2 based on your custom logic (you'll need to come up with that, sorry), and Zen Cart will process the main quantity anyway. If you're not updating qty1 and qty2 from anywhere else, products_quantity will always match qty1+qty2.

My site - Pro ZC Help
My portfolio | My plugins

24 Feb 2025, 1:37 AM
#13
get2go avatar

get2go

New Zenner

Join Date:
Jul 2021
Posts:
12
Plugin Contributions:
0

Re: Product Quantity by Location/Warehouse

balihr:

Yes, and this is exactly the interesting part where you get some fun.
As lat9 mentioned, it has nothing to do with OPC. Qty check and subtraction happens during checkout_process (includes/modules/checkout_process.php), or includes/classes/order.php to be exact. I'd use the notifier mentioned earlier, but you might prefer the ones found in create_add_products() function. Or just modify that function if you're happy with modifying core file, although the observer approach helps during upgrades and maintenance.
Your observer (or hack) could then update qty1 and qt2 based on your custom logic (you'll need to come up with that, sorry), and Zen Cart will process the main quantity anyway. If you're not updating qty1 and qty2 from anywhere else, products_quantity will always match qty1+qty2.

Balihr,
Thank you for detailed directions.
I came up with another approach and I think it will work better instead of customizing core files. I am going to give it a try in next few days and will post update.
I am thinking to use SBA and customize it as it will allow manage qty for both locations and it is also part of GPSF so data will be included in it auto.