Developer forum

Forum » Ecommerce - Standard features » Can't reorder products without stock

Can't reorder products without stock

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I am trying to implement reordering functionality in the customer center. I have a URL like this:

https://ode.order.goodsource.localtest.me/Default.aspx?ID=7&CCPage3=2&CC3=Orders&ReorderID=ORDER74&reorder

When ORDER74 has products that are not in stock, they are not added (or automatically rermoved) to the cart. I looked at the cart moodule and set 'Unavailable products' to "Ignore". In the backend I set the products to always show, except when they are not active. But the products are still being removed. As soon as I change the quantity to a positive value, the product shows up.

What am I missing?

Imar

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Imar

Dunno - a cold beer maybe :-). No, I cannot figure it out - I'll have someone see if it can even be done. The setting on the cart is probably not used here since it is the customer center that handles the process of creating a new cart.

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Here's what I found in Order.RemoveNoneActiveProducts (which is called from CustomerCenterHandler.HandleReorder)

'Remove the products that don't exist or is not active
For Each productLine As OrderLine In productLines
    Dim doRemove As Boolean = True
    Dim product As Product = productLine.Product
    For Each dbProduct As Product In productsFromDatabase
        If product.ID = dbProduct.ID AndAlso _
           product.VariantID = dbProduct.VariantID AndAlso _
           product.LanguageID = dbProduct.LanguageID _
        Then
            If dbProduct.Active Then doRemove = False
            If Not doRemove AndAlso doCheckPrice AndAlso dbProduct.Price.Price <= 0 Then doRemove = True
            If Not doRemove AndAlso doCheckStock AndAlso dbProduct.Type <> ProductType.Service AndAlso dbProduct.UnitStock <= 0 Then doRemove = True
            Exit For
        End If
    Next
    If doRemove Then
        OrderLines.Remove(productLine)
        productLine.Delete()
    End If
Next

Shoudn't If Not doRemove  be If doRemove?

Thanks,

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Never mind the previous, I think I found it in CartCatch.OrderLineBuilder:

If ProductReserve.Enabled AndAlso ProductToPutInCart.Type <> ProductType.Service AndAlso ol.HasType({OrderLine.OrderLineType.Product, OrderLine.OrderLineType.PointProduct}) Then

                Dim cartStock As Double = ProductReserve.GetReservedAmount(ol.ProductID, ol.ProductVariantID) + QuantityOrderLine
                If ProductReserve.GetReserveMode = ProductReserve.ReserveMode.modeCheckout Then
                    ' When products is reserved only in checkout step we should take into account is there such product exist in cart
                    cartStock += EcomCart.OrderLines.Where(Function(cartLine) cartLine.ProductID = ProductID AndAlso cartLine.ProductVariantID = VariantID).Select(Function(cartLine) cartLine.Quantity).FirstOrDefault()
                End If

                If ProductToPutInCart.UnitStock < cartStock Then
                    Return Nothing
                End If

            End If

The last few lines seem to skip adding the line when there's not enough stock, even though "Don't show products that are not in stock" is not set.

Is there a manual way to handle reordering? In our case we're using it not to reorder, but to enable editing of an order. We create a reorder command, keep track of the original ID and then let the user perform the checkout. On integration time we send the order contents but also send it the original ID. With the items that are out of stock removed, this no longer works.

Thanks,

Imar

 
Nicolai Høeg Pedersen
Reply

Hi Imar

I do not think there is a manual way to handle reorder, none that I know of. We should probably change the behavior to take the setting into consideration at this stage also?

BR Nicolai

 
Vladimir
Reply

Hi Imar,

There are 2 conflicting settings here: "Don't show products that are not in stock" and enabled ProductReserve (feature from DW8.3 - http://developer.dynamicweb.com/releases/older-releases/dynamicweb-8-3.aspx)

It seems ProductReserve should take into consideration setting "Don't show products that are not in stock" - I will register a bug to fix that.

May be it would be an appropriate workaround to disable Product reservation functionality?

MC -> Ecommerce -> Advanced configuration -> General -> "Minutes the products in cart are reserved" should be 0 

Best regards,

Vladimir

 
Vladimir
Reply

PS: Bug 23736

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Vladmir,

Thanks for that. Unfortunately, turning off reservations won't work. The stock is very critical in our situation so we can't run the risk of two people ordering the same product without making reservations.

I found that if I changed this:

If ProductToPutInCart.UnitStock < cartStock Then
  Return Nothing
End If

to this:

If ProductToPutInCart.UnitStock < cartStock And doCheckStock Then
  Return Nothing
End If

where doCheckStock is linked to the setting in GloablSettings, it works for me. Is that what you're thinking about too?

Imar

 
Vladimir
Reply

Hi Imar,

almost:) I'm going to place a chek in upper "if" statement:
    If ProductReserve.Enabled AndAlso doCheckStock

then it will be looked more close to a similar fix in OrderLineHandler function

Best regards,

Vladimir

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Sounds good, thanks!

 
Harald Brouwers
Reply

Hi there,

I'm having te same problem as Imar described. Is the solution Vladimir suggested implementend in a new release? Or could sombody post the fixed file?

Thanx in advance.

 
Jonas Krarup Dam
Reply

Hi Harald,

This has been implemented in the upcomming 8.9 release.

If this is urgent, and you need as a hotfix for an earlier version, let us know.

Regards, Jonas

 
Harald Brouwers
Reply

Hi Jonas,

Thank you for your reply. This issue is blocking a release, zo if you could help me out with a hotfix for version 8.8.0.6 that would be great!

Thanx in advance.

 
Christian Rud Skovgaard
Reply
This post has been marked as an answer

Hi Harald,

I have requested a merge of this fix to the 8.8.1 and 8.8 branch.

A hotfix 8.8.0.13 will be appearing later this week if everything works as expected.

Kind Regards

Christian

Votes for this answer: 1
 
Harald Brouwers
Reply

Hello Christian,

Thats great! I'll wait for te hotfix, thanx!!

 
Kristian Kirkholt
Reply

Hi Imar and Harald

The problem TFS#23736 "Can't reorder products without stock"  has now been fixed in version 8.8.0.14

You are able to find this build in the download section:

http://developer.dynamicweb-cms.com/downloads/dynamicweb-8.aspx

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Harald Brouwers
Reply

Hi Kristian,

Thanx for the fix it's working fine. Only I run into another problem after the upgrade.

I upgraded from 8.8.0.6 to 8.8.0.14, and for some productinformation in the productlist I was using the:

DefaultVariantComboName

But that value is gone and the information which was in here (the variant color) is not findable anymore! When I run product.TemplateTags(), I don't have the color of my product variants available anymore in any of the fields.

Could you help me out?

Edit:

I solved it by looping throug the "VariantCombinations" Loop. And using the color value available in "Ecom:VariantCombination.VariantText"

 
Jonas Krarup Dam
Reply

Hi Harald,

This is an other change that you've run.

Basically, before 8.8.0.8, DefaultVariantComboName contained the selected variant combo name, not the default, which was wrong. My guess is that you do not actually have a default variant combo set on your product, which would result in that tag not being rendered.

Regards, Jonas

 

You must be logged in to post in the forum