• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

SPCteam
#1 Posted : Monday, October 28, 2013 4:51:06 AM(UTC)
SPCteam

Rank: Member

Joined: 8/22/2013(UTC)
Posts: 11
United States

Thanks: 4 times
I need to set and check for the dollar amount of a specific vendor's products within an order, not the order as a whole.

Example:
Products from Vendor A reach a total of $40.
Vendor A has a minimum order policy of $75.
Our customer places $100 in products from Vendor B in cart.
Vendor A minimum order still hasn't been reached.
Order level minimum will not work, in this case.

I don't mind working with the code, but I don't want to change what doesn't need to be changed. I don't know if the answer to this need would be addressed with a "workflow", and if so, how would I go about creating one.

Note: this could also be desired to be enforced by Category or Manufacturer.

Thanks,
Steve
Aaron
#2 Posted : Thursday, October 31, 2013 7:43:49 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Steve,

Sorry for the slow reply. I was hoping to prepare a blog post to answer your question in detail but with the BVC 2013 promo ending this week things have been busy. So, rather than delay my response any further I wanted to give you the top-level view of how to solve this problem.

Originally Posted by: SPCteam Go to Quoted Post
I need to set and check for the dollar amount of a specific vendor's products within an order, not the order as a whole.

Example:
Products from Vendor A reach a total of $40.
Vendor A has a minimum order policy of $75.
Our customer places $100 in products from Vendor B in cart.
Vendor A minimum order still hasn't been reached.
Order level minimum will not work, in this case.

I don't mind working with the code, but I don't want to change what doesn't need to be changed. I don't know if the answer to this need would be addressed with a "workflow", and if so, how would I go about creating one.

You're on the right track! Creating a custom order workflow step is the ideal way to solve this problem.

Take a look at the CheckForZeroDollarOrders workflow step in the Core. This can be found here:
\source\BVSoftware.Bvc5.Core\BusinessRules\OrderTasks\CheckForZeroDollarOrders.vb

Create a new class in the App_Code folder of your website (you may want to create a folder in App_Code to contain your custom code). Be sure to change the GUID value returned by the TaskId function; otherwise the application will confuse your new workflow step with the CheckForZeroDollarOrders workflow step.

In the Execute function you can use the OrderTaskContext object "context", which contains an Order object for the customer order, to check your order for minimum levels. If you encounter an order minimum that is not met your Execute function should return false, which will cause this workflow step's workflow to terminate and rollback.

If you want to get clever or hack-ish, depending on your point of view, you could re-purpose one of the Vendor object fields to enter the minimum order amount. Then your workflow step can look up the minimum for each vendor rather than having to hard code those values.

Once your workflow step is complete it's time to wire it up. Open the TaskLoader.Custom.vb class in App_Code. Use this class, rather than TaskLoader.vb, for any custom work. Find the LoadCustomOrderTasks method around line 15. Add an instance of your new workflow step to the OrderTask collection object "result". Now BV Commerce will recognize your new workflow step in the admin.

The final step is to add your newly created workflow step to the Checkout Selected and Checkout Started workflows.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
SPCteam
#3 Posted : Thursday, October 31, 2013 7:53:32 AM(UTC)
SPCteam

Rank: Member

Joined: 8/22/2013(UTC)
Posts: 11
United States

Thanks: 4 times
Aaron, Thanks for the detailed nudge in the right direction!!! No worries on the delay... I figured you were pretty busy about now.

It would be great to have that detailed post, when you get more time ;-)

Thanks, again!
Steve
sternyy
#4 Posted : Wednesday, August 27, 2014 11:06:22 AM(UTC)
sternyy

Rank: Member

Joined: 1/10/2005(UTC)
Posts: 714

Thanks: 14 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: SPCteam Go to Quoted Post
Aaron, Thanks for the detailed nudge in the right direction!!! No worries on the delay... I figured you were pretty busy about now.

It would be great to have that detailed post, when you get more time ;-)

Thanks, again!
Steve


Did you happen to get this to work? We are looking to do the same thing.

Bryan

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.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012