Inventory Backorder Notification Customization

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
tachia
Lieutenant (LT)
Lieutenant (LT)
Posts: 61
Joined: Tue Dec 30, 2008 6:30 pm

Inventory Backorder Notification Customization

Post by tachia » Tue Jan 13, 2009 10:41 am

Does anyone have a solution or customization for customers to be able to order backordered/out of stock items, but it does give them a notification on the page and/or basket that the item is on backorder?

I would like customers to be able to order an item that is out of stock, but would like to note that it’s on backorder in the basket/product page. Now, if I have show out of stock on the product page, but allow backorders the product does not show the customer that it’s "out of stock." Can this be corrected or is this a modification that is needed. Can this be modified?

A good example is bare necessities: http://www.barenecessities.com/Chantell ... ,size,.htm
(try ordering the 36G in Black and it tells you that it’s on backorder, but you can still add it to the cart. Also, when you add to the basket, it shows up in red as a reminder that this item will not ship for 2 to 3 weeks). If anyone can work on this customization for me, please let me know. I'm a new user for ablecommerce and I really do not do any development work.

Tachia

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Inventory Backorder Notification Customization

Post by mazhar » Tue Jan 13, 2009 11:19 am

Give a try and locate the following code in ConLib/BuyProductDialog.ascx.cs file

Code: Select all

if (store.EnableInventory && store.Settings.InventoryDisplayDetails
            && (_Product.InventoryMode != InventoryMode.None) && (!_Product.AllowBackorder))
and make it look like

Code: Select all

if (store.EnableInventory && store.Settings.InventoryDisplayDetails
            && (_Product.InventoryMode != InventoryMode.None) )
Now locate the following code

Code: Select all

if ((inv.InventoryMode == InventoryMode.None) || (inv.AllowBackorder)) return;
and make it look like

Code: Select all

if ((inv.InventoryMode == InventoryMode.None)) return;
Save the file and give it a try.

tachia
Lieutenant (LT)
Lieutenant (LT)
Posts: 61
Joined: Tue Dec 30, 2008 6:30 pm

Re: Inventory Backorder Notification Customization

Post by tachia » Thu Jan 15, 2009 3:13 pm

Thanks Mazhar,

It's working on the product page, but does not show the backorder in the shoppong cart. Can the backorder reminder be added to the shopping cart page?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Inventory Backorder Notification Customization

Post by mazhar » Fri Jan 16, 2009 11:22 am

It's working on the product page, but does not show the backorder in the shoppong cart. Can the backorder reminder be added to the shopping cart page?
You can put the message in LineMessage field of the product being purchased and then use this info in basket page.

Edit the ConLib/BuyProductDialog.ascx.cs file and locate the GetBasketItem method and findout its very last statement

Code: Select all

return basketItem;
and replace it with following code

Code: Select all

InventoryManagerData imd = InventoryManager.CheckStock(_ProductId);
        if ( _Product.InventoryMode == InventoryMode.Product && imd.InStock <= 0 )
        {
            string outOfStockformat = Token.Instance.Store.Settings.InventoryOutOfStockMessage;
            string outOfStockMessage = string.Format(outOfStockformat, imd.InStock);
            basketItem.LineMessage = outOfStockMessage;
        }
        else
        if (_Product.InventoryMode == InventoryMode.Variant && AvailableProductOptionsCount() == 0)
        {
            string outOfStockformat = Token.Instance.Store.Settings.InventoryOutOfStockMessage;
            string outOfStockMessage = string.Format(outOfStockformat, 0);
            basketItem.LineMessage = outOfStockMessage;
        }

        return basketItem;
Now edit the ConLib/Utility/BasketItemDetails.ascx.cs file and locate the following code

Code: Select all

phProductName.Controls.Add(new LiteralControl(link));
and make it look like

Code: Select all

phProductName.Controls.Add(new LiteralControl(link));
                    phProductName.Controls.Add(new LiteralControl("<br />" + _BasketItem.LineMessage + "<br />"));
That's it. Now the backorder message will be available in basket as well.

TIP When customer will checkout and order will be placed these basket item messages will be copied in order items line messages. So this information will be available to you in order confirmation email as well. All you need to iterate over the order items and print their line messages and you will have these back order messages in Email sent to customer as well.

CASE
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 49
Joined: Tue Jan 22, 2008 7:18 am

Re: Inventory Backorder Notification Customization

Post by CASE » Wed Jun 03, 2009 11:57 am

Is there a way to just have the shopping basket display the backorder message. We are using an external catalog and adding products to the cart from there. Ideally, we'd like to tell the cart to look at the product inventory, and if it =0, then tell the purchaser that the item is on backorder. Is this possible?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Inventory Backorder Notification Customization

Post by mazhar » Thu Jun 04, 2009 2:55 am

Yes possible when customer is redirected to the cart with product you can check product.InStock value and if its 0 then you can display back order message to customer.

wilhud
Lieutenant (LT)
Lieutenant (LT)
Posts: 66
Joined: Mon Mar 30, 2009 7:44 pm

Re: Inventory Backorder Notification Customization

Post by wilhud » Tue Oct 06, 2009 12:22 pm

Hi Mazhar,

This was a very helpful post in helping me get the In Stock/Backorder status shown easily on the site.

I tried using the code for the basket and alsthough I can see the line breaks, for some reason it's not outputting the _BasketItem.LineMessage

Just shows up blank. Is there an extra step I'm missing? I even tried removing the if then from my GetBasketItem to just send a static LineMessage value and the content still would not display. I've got to be missing something, just not sure what it would be.

I'm currently running AC 7.0.2

Wil

wilhud
Lieutenant (LT)
Lieutenant (LT)
Posts: 66
Joined: Mon Mar 30, 2009 7:44 pm

Re: Inventory Backorder Notification Customization

Post by wilhud » Tue Oct 06, 2009 1:35 pm

Actually, upon further testing, it does work when adding a product from the product page. However, when adding a product from any list page, the Message does not show in the cart. I'm guessing the code will need to be placed elsewhere. I'll dig deeper into it to see if I can find where to put it.

Wil

Diavan
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Mon Dec 14, 2009 11:38 pm

Re: Inventory Backorder Notification Customization

Post by Diavan » Thu Apr 01, 2010 3:24 pm

One thing I noticed that if a line message is added to the Basket Item when Add to Cart button is clicked from anywhere in the site "multiple" times - it would create separate basket Items, even though the product being added is the same.

Instead of adding this Info to the line message on the Add To Cart clicks I rather added the similar code to the BasketItemDetail control to grab the Inventory info and display a text if the total added items to cart exceed the stock count.

May have to do the same thing while checking out so the messages are saved to the ordered items.

Post Reply