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

Notification

Icon
Error

jacobk
#1 Posted : Tuesday, October 15, 2013 6:32:44 PM(UTC)
jacobk

Rank: Member

Joined: 6/13/2012(UTC)
Posts: 16

Thanks: 2 times
We have a client with very specific shipping requirements that are beyond the scope of the shipping rate rule functionality, and we'd like to create a custom shipping provider. It looks like most of the logic for the existing methods happens in the compiled code, is it possible to add another custom shipping provider without recompiling?

Digging through the existing providers, being able to customize or override something like the GetRates function from the Per Item provider here would be ideal:

/BVSoftware.Bvc5.Core/Shipping/Provider/PerItem.vb

If something like this is do-able, would it be possible for you to provide some sort of simple shipping provider template that we could drop into the /BVModules/Shipping/ folder and modify to meet our needs?
Aaron
#2 Posted : Wednesday, October 16, 2013 1:56:49 PM(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)
Jake,
Kathy send me the additional info below about this challenge:

Quote:
We have a client with a store wide minimum shipping rate $12.

Then, they charge %15 of cart value if that value is more than the min $12 shipping fee.

Then, if a person orders multiples of the same item, they need to be able to adjust the shipping. For example, people sometimes order 6 panels for all their kitchen cabinets. It costs less to ship 6 metal panels than %15 or cart order.

I'm thinking if we can get the first 2 rules to work, we could use the shipping rules If Then to say if 3 of Item number, then adjust cost by x.

The first two rules are actually easy to handle by using the "By Order Total Mixed" shipping method. Take a look at the attached screenshot to see how it works. Once that is in place you can probably use the Shipping Rate Rule Providers to achieve the remaining functionality as Kathy is suggesting.
Aaron attached the following image(s):
ByOrderTotalMixed.png (14kb) downloaded 20 time(s).

You cannot view/download attachments. Try to login or register.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
jacobk
#3 Posted : Monday, October 21, 2013 12:14:04 PM(UTC)
jacobk

Rank: Member

Joined: 6/13/2012(UTC)
Posts: 16

Thanks: 2 times
Aaron, thanks for the reply. I had actually set up something similar using the Shipping Rate Rule Provider functionality, but the "By Order Total Mixed" method is cleaner.

Unfortunately, the snag I've come across is that our client has many oversized products that they need to use the "Extra Ship Fee" field for. The client wants these per-product fees to be used in only one of the shipping options, so the comparison would be something like:

Base shipping fee of $12 + all product Extra Shipping Fees - vs - 15% of the sub-total (without the extra product shipping fees), take whichever is greater.

To further complicate things, the client has also expressed an interest in only charging extra shipping fees for 2 or 3 of the same product, and having additional instances of that product ship free in the same order.

I've tried to simplify things and offered other 'normal' structured shipping options, but the client has been pretty adamant about keeping things this way. It seems like using a custom function to be able to loop through the items in an order and do custom calculations based on those items may be a quick way to handle these, if possible.

Would it be possible to do a custom shipping provider without compiling? Or to add some ways to handle the extra shipping fees in the shipping rule provider?
Aaron
#4 Posted : Monday, October 21, 2013 12:51:21 PM(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)
Originally Posted by: jacobk Go to Quoted Post
Base shipping fee of $12 + all product Extra Shipping Fees - vs - 15% of the sub-total (without the extra product shipping fees), take whichever is greater.

This part is actually pretty easy.

Create two shipping methods:
  1. "Per Order" method set to charge $12 per order
  2. "By Order Total Mixed" method set to charge 15% per order

Now create an "Order Rules" method with these rules:
  1. When Rates From "Per Order method" is greater than Rates From "By Order Total Mixed method" × 1, Cost = Rates From "Per Order method" × 1.
  2. For all remaining orders, Cost = Rates From "By Order Total Mixed method" × 1.

Originally Posted by: jacobk Go to Quoted Post
To further complicate things, the client has also expressed an interest in only charging extra shipping fees for 2 or 3 of the same product, and having additional instances of that product ship free in the same order.

Offhand I'm not sure how you would achieve this without custom development.

Originally Posted by: jacobk Go to Quoted Post
Would it be possible to do a custom shipping provider without compiling? Or to add some ways to handle the extra shipping fees in the shipping rule provider?

Yes, you can create your own shipping provider without recompiling. Create a class in the /App_Code folder that inherits from the BVSoftware.Bvc5.Core.Shipping.ShippingProvider class. Then in the /App_Code/TaskLoader.Custom.vb file instantiate an instance of your new provider class and add it to a collection of shipper providers and return that from the LoadCustomShippingProviders function. If you need an admin interface for your provider you will need to create a folder in /BVModules/Shipping/ folder with the same name as your provider. Then add an Edit.ascx control to the folder.

Just look at the code for the existing providers as a guide for how to do this.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
 1 user thanked Aaron for this useful post.
jacobk
#5 Posted : Tuesday, October 22, 2013 5:59:44 PM(UTC)
jacobk

Rank: Member

Joined: 6/13/2012(UTC)
Posts: 16

Thanks: 2 times
Originally Posted by: Aaron Go to Quoted Post
Originally Posted by: jacobk Go to Quoted Post
Base shipping fee of $12 + all product Extra Shipping Fees - vs - 15% of the sub-total (without the extra product shipping fees), take whichever is greater.

This part is actually pretty easy.

Create two shipping methods:
  1. "Per Order" method set to charge $12 per order
  2. "By Order Total Mixed" method set to charge 15% per order

Now create an "Order Rules" method with these rules:
  1. When Rates From "Per Order method" is greater than Rates From "By Order Total Mixed method" × 1, Cost = Rates From "Per Order method" × 1.
  2. For all remaining orders, Cost = Rates From "By Order Total Mixed method" × 1.



Thanks, but I'm still seeing the same results with this since it looks like this compares both and then adds the extra shipping fees.

As an example, there is one product that is $45.25 but has an $8 extra shipping fee. If a customer orders four of these, the product subtotal would be $181 and the extra shipping fees would be $32.

Based on our clients requests, I believe what we are looking for in rates to compare is:

$44 ($12 base + $32 extra shipping fees) vs $27.15 (15% of $181)

Instead, what we're seeing is

$44 ($12 base + $32 extra shipping fees) vs $59.15 ($27.15 or 15% + $32 extra shipping fees)

Originally Posted by: Aaron Go to Quoted Post
Yes, you can create your own shipping provider without recompiling. Create a class in the /App_Code folder that inherits from the BVSoftware.Bvc5.Core.Shipping.ShippingProvider class. Then in the /App_Code/TaskLoader.Custom.vb file instantiate an instance of your new provider class and add it to a collection of shipper providers and return that from the LoadCustomShippingProviders function. If you need an admin interface for your provider you will need to create a folder in /BVModules/Shipping/ folder with the same name as your provider. Then add an Edit.ascx control to the folder.

Just look at the code for the existing providers as a guide for how to do this.


Perfect, thanks for these tips! This is a great place to start, I'll see what I can come up with, hopefully it's possible to work with the extra shipping fees within the shipping provider code.
jacobk
#6 Posted : Tuesday, October 22, 2013 6:39:44 PM(UTC)
jacobk

Rank: Member

Joined: 6/13/2012(UTC)
Posts: 16

Thanks: 2 times
Actually, it looks like the relevant code handling the ExtraShipFees is in Order.vb, separate from the providers, and it is always added to each rate:

Code:

        Protected Sub ApplyExtraShipFees(ByVal rates As Utilities.SortableCollection(Of Shipping.ShippingRate))
            'Get Extra ship fees
            Dim extraShipFees As Decimal = 0D
            For Each item As LineItem In Me.Items
                If item.AssociatedProduct IsNot Nothing Then
                    If item.AssociatedProduct.ExtraShipFee <> 0 Then
                        extraShipFees += Math.Round((item.AssociatedProduct.ExtraShipFee * item.Quantity), 2)
                    End If
                End If
            Next

            'Apply Extra ship fees
            For Each rate As Shipping.ShippingRate In rates
                rate.Rate += extraShipFees
            Next
        End Sub


If I could override this function, I would be able to fix both of our issues:

- Only apply extra shipping fee to first 2 qty of a product
- Don't add extra shipping fees to the 15% shipping method

I guess I'm not entirely clear on overrides in VB.NET. Is it is possible to override (or shadow?) this Sub without compiling, even if it's not marked as overridable? If so, could you point me a little further in the right direction in how to accomplish that?
Aaron
#7 Posted : Tuesday, October 22, 2013 9:29:48 PM(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)
Originally Posted by: jacobk Go to Quoted Post
Thanks, but I'm still seeing the same results with this since it looks like this compares both and then adds the extra shipping fees.

Right. Sorry, I missed that part of your original message.

Originally Posted by: jacobk Go to Quoted Post
Actually, it looks like the relevant code handling the ExtraShipFees is in Order.vb, separate from the providers, and it is always added to each rate:

Correct.

Originally Posted by: jacobk Go to Quoted Post
If I could override this function, I would be able to fix both of our issues:

- Only apply extra shipping fee to first 2 qty of a product
- Don't add extra shipping fees to the 15% shipping method

I guess I'm not entirely clear on overrides in VB.NET. Is it is possible to override (or shadow?) this Sub without compiling, even if it's not marked as overridable? If so, could you point me a little further in the right direction in how to accomplish that?

You will need to modify this function and recompile. Don't fear customization! This is the whole point of a platform like BV Commerce: you can bend it to your will.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
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