logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Jay  
#1 Posted : Wednesday, September 14, 2022 11:31:55 AM(UTC)
Jay

Rank: Member

Groups: Authorized User, Developers
Joined: 11/12/2018(UTC)
Posts: 25

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
AbleCommerce 9.0.6. I must be missing something simple. I am testing using the demo store. Under Configure > Store > General, I have Enable Inventory Management checked, and Display Inventory set to Yes. The various messages are left at their defaults. For a product, under Inventory Control I have Inventory set to Track Product, and "Allow product to be purchased if out-of-stock" is checked. When I view the product details, no inventory information is shown (see attached image). (If I uncheck "Allow product to be purchased if out-of-stock", the Add to Cart button is hidden and the Out of Stock message is shown).
No Inv.PNG (363kb) downloaded 3 time(s).

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Jay  
#2 Posted : Wednesday, September 14, 2022 3:48:24 PM(UTC)
Jay

Rank: Member

Groups: Authorized User, Developers
Joined: 11/12/2018(UTC)
Posts: 25

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
I think I figured it out. The image in the previous post was when the quantity on hand for the product was zero. My goal is to allow a product to be ordered if it is out of stock, but also show the stock status message(s) if it is out of stock. To accomplish that, I had to make the following changes in Code\BuyProductDialog\PrepareProductDialogDataAttribute.cs.

Line 208/209: Change
Code:
if (store.Settings.EnableInventory && store.Settings.InventoryDisplayDetails
    && (product.InventoryMode != InventoryMode.None) && (!product.AllowBackorder))


to
Code:
if (store.Settings.EnableInventory && store.Settings.InventoryDisplayDetails
    && (product.InventoryMode != InventoryMode.None))


Line 217: Change
Code:
if ((inv.InventoryMode == InventoryMode.None) || (inv.AllowBackorder)) return;

to
Code:
if (inv.InventoryMode == InventoryMode.None) return;

Edited by user Wednesday, September 14, 2022 3:49:30 PM(UTC)  | Reason: additional details

Katie S  
#3 Posted : Thursday, September 15, 2022 11:25:18 AM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 421

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Thanks for posting your code changes Jay. As you found out, this is how the inventory feature works. The 'Allow product to be purchased if out of stock' option disables the inventory message.
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.