Multi-Buy promotion not working #185
Replies: 24 comments 5 replies
-
Did you go through the Scheduler Setup? https://doc.openstore-ecommerce.com/ It'll call the DoWork function on the MultiBuyPromoScheduler which should update your prices. |
Beta Was this translation helpful? Give feedback.
-
Sorry. I spoke too soon. I don't use this feature but I tried and ran into some issues. It looks like we may need to overload GetProductData with the portalid so we can inject this into a new ctor for ProductData. Otherwise we fail at line 52 in the ProductData class since there won't be any PortalSettings.Current.PortalId when the scheduler executes. Dave may have some insight here. It's possible I'm overlooking something. |
Beta Was this translation helpful? Give feedback.
-
Not quite sure why would I need a scheduler for this feature? If I setup a promo and say if you buy 5 items you only pay for 4. |
Beta Was this translation helpful? Give feedback.
-
I think the fixes for the portal id usage are here. If you have you're dev environment up you can give it a test drive. I'll PR it once it's marinated a couple of days. https://github.com/DNNMonster/Open-Store/tree/bugfix/portal-id-usage |
Beta Was this translation helpful? Give feedback.
-
The scheduler is needed because it processors on a bulk update method. This was a plugin my client wanted and at the time I found a problem with speed. It calculates the prices and saves them to the product data. So all data required is already calculated. It's not the best way, but it works. So, basically you need the scheduler running. |
Beta Was this translation helpful? Give feedback.
-
P.S. You should always have the scheduler running, it cleans up old carts in the DB. |
Beta Was this translation helpful? Give feedback.
-
The scheduler is running. Here's the log: OK Service Start. Failed. providername: NBrightBuy.PromoProvider Nevoweb.DNN.NBrightBuy.Providers.PromoProvider.MultiBuyPromoScheudler Portal:LHF Designs Error:System.NullReferenceException: Object reference not set to an instance of an object. at Nevoweb.DNN.NBrightBuy.Components.ProductData.ResetData(Int32 productId, String lang, Boolean hydrateLists, String typeCode) at Nevoweb.DNN.NBrightBuy.Components.ProductUtils.GetProductData(Int32 productId, String lang, Boolean hydrateLists, String typeCode) at Nevoweb.DNN.NBrightBuy.Providers.PromoProvider.PromoUtils.CalcMultiBuyPromoItem(NBrightInfo p) at Nevoweb.DNN.NBrightBuy.Providers.PromoProvider.PromoUtils.CalcMultiBuyPromo(Int32 portalId) at Nevoweb.DNN.NBrightBuy.Components.NBrightBuyScheduler.DoWork() |
Beta Was this translation helpful? Give feedback.
-
I've just checked one of our clients website and cannot see any problem with the promotions. This does look like data issue. Make sure you have some promotions setup, I do notice the blank entry at the top of the image... not sure why, but maybe you need a minimum. What version of OpenStore and DNN are you using? |
Beta Was this translation helpful? Give feedback.
-
I'm running DNN 9.7.0 with OpenStore 4.1.4 Here are some screenshots: |
Beta Was this translation helpful? Give feedback.
-
I think @DNNMonster has fixed this for you. I have merged the change into the next version. @DNNMonster may have a install package you can use before we release the official version. |
Beta Was this translation helpful? Give feedback.
-
No unofficial releases are happening. If you want to get ahead of the official release cycle then it's best if you fork the project. Then you could compile and also help contribute if something is in your wheelhouse. All open source projects can always use extra help! |
Beta Was this translation helpful? Give feedback.
-
As mentioned I'm running DNN 9.7.0 with OpenStore 4.1.4. I did not want to upgrade to the latest version, so I just made the changes with the missing portalid and recompiled 4.1.4. The job runs now without any exceptions. I guess the issue running the scheduled job is resolved, but the calculation is still not working. When I have 5 items of the same product in my cart it still shows the price of 5 and not 4. As mentioned, on the details page I can see the promo message for the product. I looked at the CalculatePromotion method in the PromoProvider. Inside the loop there is this line: Problem is that the current CART xml does not even have "genxml/productxml/genxml/hidden/promotype" and that's why the calculation doesn't work. |
Beta Was this translation helpful? Give feedback.
-
Can you verify that your dates are valid (your screen shot looks good but it may not match your current state). You'll see a date check that wraps a call to the function that should be setting the promotype value. It's possible this is affecting you. If the dates look good then you could put a breakpoint in the FlagProductMultiBuy function and help us get to the root problem. My install I tested against worked as expected for the percentage based discounts. I don't think I tested the amount based so it's possible I missed something. I will re-visit it if you still see issues after a date check. |
Beta Was this translation helpful? Give feedback.
-
I think the dates look good.
|
Beta Was this translation helpful? Give feedback.
-
I don't see any promo node in the product xml |
Beta Was this translation helpful? Give feedback.
-
I believe this may be a math confusion issue related to our help text which we can improve upon. For amount based group discounts the help text should read "amount discounted from the unit cost" If you view the code for amount based discounts and you'll see that the discount amt that get's applied is using a formula which takes the unit cost of an item and then subtracts the input value which you enter into the promo configuration. If I understand things correctly, in your situation you're product has a unit price of 5.50 and you're amount entered into your input for the promo configuration discount amount is also 5.50. I believe this results in an actual applied discount amount of 0. I wanted to suggest trying a 100% off discount for a quantity above 4. Then adding a max qty for the product of 5. Unfortunately I am seeing an issue with this max qty not being enforced so it won't work just yet. Someone will inevitably come and try to buy your entire stock for the price of 4 units. For now you may have to consider adjusting you're offering to something that works with the supported case scenarios, Buy 4 items and get $2 off each additional item. Or Buy 4 and get 10% off each additional item. You should be able to verify this by altering your offering to test a supported multi-buy discount scenario, run the OS scheduler and making sure once again that the math matches expectations. If the numbers are still wrong we'll keep digging. |
Beta Was this translation helpful? Give feedback.
-
I changed the discount from amount to percentage, but it is still not working. When I delete the whole promotion, I can still see the message "If you buy 4 items you will get 1 item free" for each product on the details page. I already ran the NBS Scheduler multiple times and also reset the whole site. Is this a known issue or did I do anything wrong? |
Beta Was this translation helpful? Give feedback.
-
I am not able to reproduce the error so it's hard to say. Both amount based and percentage based multi-buy promotions work as expected on the installation I'm testing against. |
Beta Was this translation helpful? Give feedback.
-
The calculated prices are saved on the "PRD" type record. Can you soo them and are they OK. it could be a template related issue. |
Beta Was this translation helpful? Give feedback.
-
The only item missing is "defaultcadid" |
Beta Was this translation helpful? Give feedback.
-
Do you have any scheduler errors in the DNN logs? |
Beta Was this translation helpful? Give feedback.
-
Can you check the event log in DNN. If the scheduler finished, it will say OK even if a plugin failed. The errors are recorded in the event log. |
Beta Was this translation helpful? Give feedback.
-
I checked the DNN event logs too. There is nothing. The last error I can see was about a week ago (which I posted earlier) before I included the fix. I removed the promotion "MultiBuy" a few days ago as mentioned before and ran into the issue that the promotion description was not removed. I ended up to manually remove the xml item through SQL for all products. |
Beta Was this translation helpful? Give feedback.
-
Trying to use the multi buy promotion option. I created a new promotion property "Discountable" and assigned the property to all my products. I added a new promo "Buy 4 get 1 free" and selected the new property "Discountable" and a quantity of 4. In the amount I put in the amount of 5.50 (which is the prize of all my products). I also added a valid date from/until. When I select a product in the shop I can see the message from the promo "Buy 4 get 1 free", but when I select the quantity to 5 or more and click on the "Buy" button I don't see the correct prize in the cart. I tried different options (select more than 4 products of one product, select one product of 5 different products etc.) but none are working. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions