Inventory status message missing?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
satori
Lieutenant (LT)
Lieutenant (LT)
Posts: 64
Joined: Mon Jun 26, 2006 1:04 am
Location: Colorado Rockies above Boulder
Contact:

Inventory status message missing?

Post by satori » Wed May 21, 2008 12:00 pm

We applied SP3 a few weeks ago and after many customers getting irritated for ordering things they didn't know on backorder, I *just* noticed our inventory status message is no longer showing. Here's what I have configured and want to show, but it isn't.

"Enable Inventory Management": CHECKED
Display Inventory: YES
In Stock Message: "Available for immediate shipment: {0}"
Out of stock Message: "Backordered, will ship when arrives at warehouse."

Before the SP3 our inventory showed the # of items in inventory, as well as giving the backorder message. Did something change in the last SP? I don't think I touched anything to disable this.

User avatar
satori
Lieutenant (LT)
Lieutenant (LT)
Posts: 64
Joined: Mon Jun 26, 2006 1:04 am
Location: Colorado Rockies above Boulder
Contact:

Re: Inventory status message missing?

Post by satori » Wed May 21, 2008 12:36 pm

Oops, I should mention that this only happens on products where we do allow backorders!

I'd love to let them know that an item is on backorder when they order something on backorder. :)

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Inventory status message missing?

Post by AbleMods » Wed May 21, 2008 7:54 pm

Satori, I remember something I had to change when I upgraded to RC3 because out-of-stock msgs weren't being displayed.

I'll dig through my code and see if I can find it for you.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Sean@WMS
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Nov 20, 2007 8:23 pm
Location: NW California
Contact:

Re: Inventory status message missing?

Post by Sean@WMS » Wed Sep 10, 2008 11:05 pm

I hit on this same issue.

We're just launching our second AC7 site, and our client on that site needs inventory control and to allow back order on some items, but not on others. We were scratching our heads, though, as to why the inventory status message didn't display for products that were taged with backorder enabled, but only for those that weren't.

I dug around for a bit, and I'm not sure if there is actually a bug here, or if I just had to "hack" it into doing rendering what I wanted here, but here is what I found:

1) The first part of the problem is an argument in the /ConLib/BuyProductDialog.ascx.cs:

Code: Select all

        if (store.EnableInventory && store.Settings.InventoryDisplayDetails
            && (_Product.InventoryMode != InventoryMode.None) && (!_Product.AllowBackorder))
As (!_Product.AllowBackorder) returns false here for products tagged to allow backordering, UpdateInventoryDetails is never called for them. So, I removed that part of the argument. That was the easy part.

2) The rest of the problem is with the first argument in UpdateInventoryDetails:

Code: Select all

if ((inv.InventoryMode == InventoryMode.None) || (inv.AllowBackorder)) return;
Now, this seems a curious argument to me. For products where either backordering is allowed or not, inv.InventoryMode returns "Product"; so the argument (inv.InventoryMode == InventoryMode.None) always returns false. Ok, that shouldn't be a big deal, though, as there is an "OR" in the argument. However, here is where I got caught straching my head. For products where backordering is allowed, (inv.AllowBackorder) should return true, and it does . . . so, the argument ((inv.InventoryMode == InventoryMode.None) || (inv.AllowBackorder)) should return true for them, no? But somehow the whole IF statement returns false (??), so it only allows the rest of the process to move forward for products NOT tagged to allow backordering. I couldn't figure out why this behaves this way, so I just commented that whole condition out.

After getting past all of that, I realized that I just needed to clean up some logic here to allow "backorderable" products to allow order quantities above the current inventory available, and I added a bit of text to clarify that backorders are available for these products.

Here are the changes I made to BuyProductDialog.ascx.cs (now /ConLib/Custom/BuyProductDialog.ascx.cs):

1) Working around the first problem:

Code: Select all

        //if (store.EnableInventory && store.Settings.InventoryDisplayDetails
        //    && (_Product.InventoryMode != InventoryMode.None) && (!_Product.AllowBackorder))
2) Working around the second problem and adding some handling for products where backordering is allowed vs those for which it is not:

Code: Select all

    private void UpdateInventoryDetails(InventoryManagerData inv)
    {
        //if ((inv.InventoryMode == InventoryMode.None) || (inv.AllowBackorder)) return;
        if ((inv.InStock > 0) && (inv.AllowBackorder))
        {
            string inStockformat = Token.Instance.Store.Settings.InventoryInStockMessage;
            string inStockMessage = string.Format(inStockformat, inv.InStock);
            InventoryDetailsPanel.Controls.Clear();
            InventoryDetailsPanel.Controls.Add(new LiteralControl(inStockMessage + 
	"<br/><br/><strong>Backorders Are Allowed</strong><br/>Any quantity above " + inv.InStock + " will be backordered."));
        }
        else if (inv.InStock > 0)
        {
            string inStockformat = Token.Instance.Store.Settings.InventoryInStockMessage;
            string inStockMessage = string.Format(inStockformat, inv.InStock);
            InventoryDetailsPanel.Controls.Clear();
            InventoryDetailsPanel.Controls.Add(new LiteralControl(inStockMessage));
            Quantity.MaxValue = inv.InStock;
        }
        else
        {
            string outOfStockformat = Token.Instance.Store.Settings.InventoryOutOfStockMessage;
            string outOfStockMessage = string.Format(outOfStockformat, inv.InStock);
            InventoryDetailsPanel.Controls.Clear();
            InventoryDetailsPanel.Controls.Add(new LiteralControl(outOfStockMessage));
        }
    }
I've attached the resulting customized BuyProductDialog.ascx.cs file.
Sean Connors
Web Merchant Services
Supplying the services you need to succeed online
www.WMSmerchantservices.com

User avatar
Sean@WMS
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Nov 20, 2007 8:23 pm
Location: NW California
Contact:

Re: Inventory status message missing?

Post by Sean@WMS » Wed Sep 10, 2008 11:57 pm

I almost forgot . . . . as the whole issue here is to alert customers that some items may be placed on backorder above the current inventory in stock BEFORE they even add to cart, we can't allow them anymore to add to cart directly from anywhere but the product page ( similar when they need to select options/choices before ordering ).

To force this, simply find within AddtoCartLink.ascx.cs:

Code: Select all

            if (product.HasChoices)
And replace with:

Code: Select all

            if (true || product.HasChoices)
This really should be refined to argue something like:
if("Product Ineventory is Tracked" || product.HasChoices)
but I haven't had time to get there yet.

PS: Don't forget to modify this file in the /ConLib/Custom/ subdirectory so that it isn't overwritten by the next update!
Sean Connors
Web Merchant Services
Supplying the services you need to succeed online
www.WMSmerchantservices.com

User avatar
Sean@WMS
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Tue Nov 20, 2007 8:23 pm
Location: NW California
Contact:

Re: Inventory status message missing?

Post by Sean@WMS » Thu Sep 11, 2008 12:48 am

Ok this gets a tad deeper . . .

If forcing add to cart links to go to the product page rather then adding directly to cart, we need to change the code behind call to our custom AddtoCartLink.ascx & AddtoCartLink.ascx.cs. This can't be done using scriplets, so we have to manually edit the file that is being used to control content of category pages:

Simply find, near the top:

Code: Select all

<%@ Register Src="~/ConLib/AddToCartLink.ascx" TagName="AddToCartLink" TagPrefix="uc" %>
and replace with:

Code: Select all

<%@ Register Src="~/ConLib/Custom/AddToCartLink.ascx" TagName="AddToCartLink" TagPrefix="uc" %>
PS: Remember to copy your /ConLib/AddToCartLink.ascx.cs file over to /ConLib/Custom/AddToCartLink.ascx.cs
Sean Connors
Web Merchant Services
Supplying the services you need to succeed online
www.WMSmerchantservices.com

User avatar
bryancapitano
Ensign (ENS)
Ensign (ENS)
Posts: 13
Joined: Sun Oct 05, 2008 9:33 am
Location: Portland, Oregon
Contact:

Re: Inventory status message missing?

Post by bryancapitano » Mon Dec 08, 2008 3:21 pm

Maybe I'm completely missing it, but shouldn't the cart display a message for backorder items??? For example, "The item in your cart is out of stock, but you can back order it. We will notify you when it is in stock..."

...or something to that effect? Our backorder items do not give the customer any message, so it appears they're purchasing the item just like normal, and they can choose to have it shipped right away. What's wrong with this scenario?

Help!

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Inventory status message missing?

Post by AbleMods » Mon Dec 08, 2008 4:27 pm

You should see a message displayed that states what is configured in your store settings when the product is out of stock.

As for any sort of "warning" if the add-to-cart button is still clicked, no that isn't part of the page functionality.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply