Working with shipping by total source code

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I am having trouble working with the source code for the shipping by total plugin.  I am using nopcommerce version 2.4, and I am using Visual Studio 2010 Professional.

This is how I tried to do it:

1) downloaded the plugin to the computer and unziped.

2) opened up visual studio with nopcommerce

3) right clicked on the plugin folder in the solution explore on the left had side of visual studio...
     Add   ---->   Existing Project

4) Went to the downloaded shipping by total file.  
    
   Nop.Plugin.Shipping.ByTotal  --->  source  --->  Nop.Plugin.Shipping.ByTotal ---> Nop.Plugin.Shipping.ByTotal

  Once I had selected the Nop.Plugin.Shipping.ByTotal I clicked open.

When I did these steps the shipping by total showed up in the solution explore in visual studio.
However when I tried to debug the solution in order to run nopcommerce.  I got 20 errors.

Can someone show me what I did wrong?

I am not a developer so please show me the steps.  Thanks in advance!
12 years ago
I found out a solution for now, but I still can't edit the source code.
12 years ago
can you provide some of the errors you're seeing?
I suspect you may have to re-add some references (right click References subfolder under the project in VS Solution explorer - do you see yellow triangles?)
12 years ago
Thanks for the reply!  I am sorry but I don’t have Visual Studio 2010 Professional with me today.   Yesterday, I went somewhere where I was allowed to use Visual Studio 2010 Professional.  That is why I created an account “Tim23” instead of using “Tim2376”…. I forgot my password.  At home the nopcommerce website remembers me.

I think you are right about the references.   If I remember right, it was mentioning “references” and “name something.”   I did find out how I can install the plugin without source code on my computer with a source code version of nopcommerce, it works with the professional or express version.  So, at least I can test the plugin from my computer.

I think that what I wanted to change in the shipping by total plugin would be a nice option for plugin.  I sent a PM to the author of the plugin, but I am not sure what the best place to suggest a new feature for a plugin is.

Thanks for taking the time to reply.  I guess I must have logged off just a few minutes before your reply.
12 years ago
If you explained the shipping scenario you're trying to deal with, I can let you know if Shipping Director could do it.
12 years ago
Thanks for taking the time to reply.

Basically what I need to do is similar to what the Shipping by total plug-in does, but a little different.
I need to find the shipping by total based off of the total cost of the products instead of the total price of the products.  Since I am using drop shipping, this would allow me to use the rates of my supplier.  Thanks!
12 years ago
ByTotal shipping computation uses _priceCalculationService.GetSubTotal:

    foreach (var shoppingCartItem in getShippingOptionRequest.Items)
        ...
        subTotal += _priceCalculationService.GetSubTotal(shoppingCartItem, true);

GetSubTotal is a fairly complex and nested set of methods that take into account any Discounts, Customer Entered Price, etc.
If your just looking to use the Product cost, then you can easily modify the code like so:

        
    foreach (var shoppingCartItem in getShippingOptionRequest.Items)
        ...
        subTotal += shoppingCartItem.ProductVariant.ProductCost;


Of if you want to use Shipping Director, then you can use something similar to what I've blogged here

http://noptools.com/blog/5/shipping-by-weight-brackets

But instead of referencing [$TotalCost] you'd first set up a variable that sums the product cost:

Decimal     TotalProductCost       Items.Sum(Quantity * ProductVariant.ProductCost)

And, if you needed different methods (Ground, Air, etc), then you would use Option  instead of  OptionExit, and your expression would have to check the range.  E.g.
 ...
Option      Ground    [TotalProductCost] >= 10 and [TotalProductCost] < 50        5.95
Option      Ground    [TotalProductCost] >= 50 and [TotalProductCost] < 100       10.95
...
Option      Air       [TotalProductCost] >= 10 and [TotalProductCost] < 50        8.95
Option      Air       [TotalProductCost] >= 50 and [TotalProductCost] < 100       13.95
...


You can PM me, or use the nopTools contact form if you have more questions
12 years ago
Thanks for the reply, and showing how I could code this.

I have been thinking about it and it looks like it might be easier to change the shipping by total plugin the way you showed.  However, I am not sure how to implement the source code of the shipping by total plugin with the source code of nopcommerce.  As you mentioned, I think that it was references, etc. that caused the errors.  I am not a developer so I am not sure how to fix this.

Is there any article that tells how to implement the source code of the shipping by total plugin with the source code of nopcommerce?

If not, is anyone willing to show the steps to implementing the source code of the shipping by total plugin with the source code version of nopcommerce 2.4?

I think it would be a great feature to be able to find the shipping by total based off of the cost of the products instead of the price.  If anyone wants to contribute this feature it would be great!
12 years ago
Adding Existing project as you described is correct procedure.  However, I'd copy the content of the plugin source code directly to ...\src\Plugins\Nop.Plugin.Shipping.ByTotal folder, rather than point to whatever was unzipped.  Also, if using Windows 7, then before zip extract, right-click the zip file, click properties, and click the Unblock button (bottom right general tab).

In the ByTotal project,  open References folder.  If any files have yellow triangle, then remove, and re-Add them.  What I've done (which may not be the best way...), is to open another project (e.g. byWeight), and copy the path of the reference.  When Adding, click on the Browse tab, and paste the path.  Do them (remove/add) one at a time to keep track.
12 years ago
Thanks!  I really appreciate the time that you have taken to help me.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.