Narrowing Down USPS shipping methods in 1.5

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 14 años
Thanks mb, you have been a great help. I have done with your recommendations and the now the international portions works listing all the available international shipping options. I need to do that, can you please advice as where and how to add the filtrations. Thanks
Hace 14 años
shokokoo, can you post the updated dll that you've made?  I'd really appreciate that.

By the way, what are you guys using to compile the solution?  I tried the express version of Visual Studio, but can't get it to compile.  I was thinking the solution was too complex for the the express version and required the professional version.  Either that or I'm not doing something right.  I can't tell what that would be; I tried compiling the source without modification and still the same errors.
Hace 14 años
shokokoo wrote:
Thanks mb, you have been a great help. I have done with your recommendations and the now the international portions works listing all the available international shipping options. I need to do that, can you please advice as where and how to add the filtrations. Thanks


To filter out unwanted USPS international rates, add the following code to the ParseResponse() method in file: Shipping\Nop.Shipping.USPS\USPSComputationMethod.cs:

Existing code in the method is shown below underlined and is to help you locate where to place the code (don't add the underlined lines).

    [...]
    while (!((tr.Name == postageStr) && (tr.NodeType == XmlNodeType.EndElement)));

    // [mb] Add this new code block
    switch(serviceCode)
    {
        //case "Global Express Guaranteed (GXG)":
        case "Global Express Guaranteed Non-Document Rectangular":
        case "Global Express Guaranteed Non-Document Non-Rectangular":
        case "USPS GXG Envelopes":
        //case "Express Mail International":
        case "Express Mail International Flat Rate Envelope":
        //case "Priority Mail International":
        case "Priority Mail International Large Flat Rate Box":
        case "Priority Mail International Medium Flat Rate Box":
            continue;
    }

    if (shippingOptions.Find((s) => s.Name == serviceCode) == null)
    [...]
The logic behind this is the opposite of filtering domestic rates; comment out the lines (add // at the start of the line) you want to display to the customer as shipping service options (at least one line must be commented out, else you will receive an error as no USPS international shipping options will be loaded). With the above code, international customers would see rates for "Global Express Guaranteed (GXG)", "Express Mail International", and "Priority Mail International".

And you will of course have to recompile the project.

.
Hace 14 años
NewYorkWedge wrote:
By the way, what are you guys using to compile the solution?  I tried the express version of Visual Studio, but can't get it to compile.  I was thinking the solution was too complex for the the express version and required the professional version.  Either that or I'm not doing something right.  I can't tell what that would be; I tried compiling the source without modification and still the same errors.


I use Visual Studio 2008 Standard Edition. The Microsoft Visual Web Developer 2008 express edition doesn't support the solution folders (Libraries, Shipping, Tax, Payment, etc.), but can still compile the solution.  

What errors are you getting? Are you using the source version of nopCommerce 1.50?

.
Hace 14 años
Sorry for the delay.  I redownloaded the source and tried again from scratch.  Yes, I downloaded the source; I know I've gotten at least that right.

I used VS 2008 Express before and I believe they were similiar errors.  I used VS 2010 Express to generate these errors.  15 Errors, 81 Warning.  No change to the code made.

Error  82  The type name 'RoleProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreRoleProvider.cs  33  46  Nop.BusinessLogic
Error  83  The type name 'MembershipProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  34  52  Nop.BusinessLogic
Error  84  The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  87  25  Nop.BusinessLogic
Error  85  The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  87  192  Nop.BusinessLogic
Error  86  The type name 'MembershipUserCollection' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  135  25  Nop.BusinessLogic
Error  87  The type name 'MembershipUserCollection' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  148  25  Nop.BusinessLogic
Error  88  The type name 'MembershipUserCollection' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  160  25  Nop.BusinessLogic
Error  89  The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  191  25  Nop.BusinessLogic
Error  90  The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  202  25  Nop.BusinessLogic
Error  91  The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  371  41  Nop.BusinessLogic
Error  92  The type name 'MembershipPasswordFormat' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreMembershipProvider.cs  527  25  Nop.BusinessLogic
Error  93  The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Customer\CustomerManager.cs  975  59  Nop.BusinessLogic
Error  94  The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Customer\CustomerManager.cs  1022  58  Nop.BusinessLogic
Error  95  The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Customer\CustomerManager.cs  1070  50  Nop.BusinessLogic
Error  96  Metadata file 'C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\bin\Release\Nop.BusinessLogic.dll' could not be found  Nop.Shipping.USPS
Warning  1  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:TransactionID', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3130, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  2  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:GrossRefundAmount', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3184, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  3  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:TransactionID', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3130, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  4  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:apis:eBLBaseComponents:PaymentTransactionDetails', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3184, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  5  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:apis:eBLBaseComponents:MerchantPullPaymentDetails', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3130, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  6  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:apis:eBLBaseComponents:BillUserResponseDetails', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3184, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  7  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:StartDate', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3130, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  8  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:apis:eBLBaseComponents:PaymentTransactions', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3184, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  9  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:MassPayItem', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3130, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  10  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:ReferenceID', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3130, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  11  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:apis:eBLBaseComponents:BAUpdateResponseDetails', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Line 3184, position 8.  C:\Users\Wedge\Desktop\nop\Payment\Nop.Payment.PayPal\Web References\PayPalSvc\Reference.map  1  1  Nop.Payment.PayPal
Warning  12  Custom tool warning: Schema validation error: Schema with targetNamespace='urn:ebay:apis:eBLBaseComponents' has invalid syntax. Wildcard '##any' allows element 'urn:ebay:api:PayPalAPI:Email', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined wi
Hace 14 años
mb wrote:
To filter out unwanted USPS international rates, add the following code to the ParseResponse() method in file: Shipping\Nop.Shipping.USPS\USPSComputationMethod.cs:

Existing code in the method is shown below underlined and is to help you locate where to place the code (don't add the underlined lines).
The logic behind this is the opposite of filtering domestic rates; comment out the lines (add // at the start of the line) you want to display to the customer as shipping service options (at least one line must be commented out, else you will receive an error as no USPS international shipping options will be loaded). With the above code, international customers would see rates for "Global Express Guaranteed (GXG)", "Express Mail International", and "Priority Mail International".

And you will of course have to recompile the project.


THANKS mb
Hace 14 años
NewYorkWedge wrote:
shokokoo, can you post the updated dll that you've made?  I'd really appreciate that.

By the way, what are you guys using to compile the solution?  I tried the express version of Visual Studio, but can't get it to compile.  I was thinking the solution was too complex for the the express version and required the professional version.  Either that or I'm not doing something right.  I can't tell what that would be; I tried compiling the source without modification and still the same errors.


Here is the updated dll with the international shipping working. Thanks to mb. Download here
Hace 14 años
NewYorkWedge wrote:
Sorry for the delay.  I redownloaded the source and tried again from scratch.  Yes, I downloaded the source; I know I've gotten at least that right.

I used VS 2008 Express before and I believe they were similiar errors.  I used VS 2010 Express to generate these errors.  15 Errors, 81 Warning.  No change to the code made.

Error  82  The type name 'RoleProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.  C:\Users\Wedge\Desktop\nop\Libraries\Nop.BusinessLogic\Profile\StoreRoleProvider.cs  33  46  Nop.BusinessLogic
[...]


The errors look like you are trying to run the site with .Net Framework 4.0 as the type names (RoleProvider, MembershipProvider, MembershipUser, etc.) listed in the errors have been moved in .Net 4.0. You can try the following to build and start the project. These instructions are for Microsoft Visual Web Developer 2008 Express Edition as I don't have VS 2010 Express; therefore, some of these instructions may differ.

When you open nopCommerce (1.50), select the NopCommerce.sln file.

1. Ensure the Target Framework is ".Net Framework 3.5"
    -In Solution Explorer, right-click NopCommerceStore and select Properties
    -On Application tab, Target Framework field, select ".Net Framework 3.5" if not selected, and Save.

2. Ensure NopCommerceStore is the startup project
    -In Solution Explorer, right-click NopCommerceStore and select "Set as Start Up project",
    -Project name NopCommerceStore will be bold

3. Clean the solution
    -Menu: Build > Clean Solution (will remove built assemblies)

4. Build the solution
    -Menu: Build > Build Solution (will compile project assemblies)

5. Start solution
    -Menu: Debug > Start Without Debugging
    -This will build any modified projects and open NopCommerce in the ASP.NET Development Server
    -The site will open in a web browser

.
Hace 14 años
mb wrote:


To filter out unwanted USPS international rates, add the following code to the ParseResponse() method in file: Shipping\Nop.Shipping.USPS\USPSComputationMethod.cs:

Existing code in the method is shown below underlined and is to help you locate where to place the code (don't add the underlined lines).

    [...]
    while (!((tr.Name == postageStr) && (tr.NodeType == XmlNodeType.EndElement)));

    // [mb] Add this new code block
    switch(serviceCode)
    {
        //case "Global Express Guaranteed (GXG)":
        case "Global Express Guaranteed Non-Document Rectangular":
        case "Global Express Guaranteed Non-Document Non-Rectangular":
        case "USPS GXG Envelopes":
        //case "Express Mail International":
        case "Express Mail International Flat Rate Envelope":
        //case "Priority Mail International":
        case "Priority Mail International Large Flat Rate Box":
        case "Priority Mail International Medium Flat Rate Box":
            continue;
    }

    if (shippingOptions.Find((s) => s.Name == serviceCode) == null)
    [...]
The logic behind this is the opposite of filtering domestic rates; comment out the lines (add // at the start of the line) you want to display to the customer as shipping service options (at least one line must be commented out, else you will receive an error as no USPS international shipping options will be loaded). With the above code, international customers would see rates for "Global Express Guaranteed (GXG)", "Express Mail International", and "Priority Mail International".

And you will of course have to recompile the project.

.


mb I have added this code as you suggested and it worked fine. It is listing the following shipping options
USPS Global Express Guaranteed (GXG) ($66.00)    
USPS Express Mail International ($35.50)    
USPS Priority Mail International ($30.00)    
USPS Priority Mail International Small Flat Rate Box ($15.45)    
USPS Priority Mail International Flat Rate Envelope ($15.45)    
USPS First-Class Mail International Package ($12.76)    
USPS First-Class Mail International Large Envelope ($12

I need to display only the bold options. I have tried commiting out different cases and never was able to get this output. Any suggestions
Thanks
Hace 14 años
shokokoo wrote:
mb I have added this code as you suggested and it worked fine. It is listing the following shipping options
USPS Global Express Guaranteed (GXG) ($66.00)    
USPS Express Mail International ($35.50)    
USPS Priority Mail International ($30.00)    
USPS Priority Mail International Small Flat Rate Box ($15.45)    
USPS Priority Mail International Flat Rate Envelope ($15.45)    
USPS First-Class Mail International Package ($12.76)    
USPS First-Class Mail International Large Envelope ($12

I need to display only the bold options. I have tried commiting out different cases and never was able to get this output. Any suggestions
Thanks


Sorry if it wasn't clear how to add new services to skip. I've changed the code to include additional services and to make it work similar to the domestic rates (uncomment service names to have their rates displayed -ensure at least one is uncommented).

Use the following instead of the previous code block (the services you wanted are already uncommented):

    switch (serviceCode)
    {
        //case "Global Express Guaranteed (GXG)":
        //case "Global Express Guaranteed Non-Document Rectangular":
        //case "Global Express Guaranteed Non-Document Non-Rectangular":
        //case "USPS GXG Envelopes":
        //case "Express Mail International Flat Rate Envelope":
        //case "Priority Mail International":
        //case "Priority Mail International Large Flat Rate Box":
        //case "Priority Mail International Medium Flat Rate Box":
        //case "Priority Mail International Small Flat Rate Box":
        //case "First-Class Mail International Large Envelope":

        case "Express Mail International":
        case "Priority Mail International Flat Rate Envelope":
        case "First-Class Mail International Package":
            break;
        default:
            continue;
    }

.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.