New Shipping Module Issues In Nop 1.9

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 年 前
Hi Guys,
Im in the process of upgrading my custom shipping module..
I'm getting a value cannot be null:

The Type.GetType(srcm.ClassName) is returning null

-------------------------------------------------------------------------------------------------------------
Server Error in '/' Application.
Value cannot be null.
Parameter name: type
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: type

Source Error:

Line 913:            foreach (var srcm in shippingRateComputationMethods)
Line 914:            {
Line 915:                if (allowedShippingRateComputationMethodId.HasValue &&
Line 916:                    allowedShippingRateComputationMethodId.Value > 0 &&
Line 917:                    allowedShippingRateComputationMethodId.Value != srcm.ShippingRateComputationMethodId)

var iShippingRateComputationMethod = Activator.CreateInstance(Type.GetType(srcm.ClassName)) as IShippingRateComputationMethod;


Source File: C:\tomdev\PodPeople\PodPeople\Site\Libraries\Nop.BusinessLogic\Shipping\ShippingService.cs    Line: 915
------------------------------------------------------------------------------------------------------------------------------------------
My custom shipping module is a ship by country module with fixed price per country or "Zone"

var iShippingRateComputationMethod = Activator.CreateInstance(Type.GetType(srcm.ClassName)) as IShippingRateComputationMethod;


in the dependancy resolver I have
container.RegisterType<IShippingByCountryService, ShippingByCountryService>(new UnityPerExecutionContextLifetimeManager());


srcm.ClassName is NopSolutions.NopCommerce.Shipping.Methods.ShippingByCountryCM.ShippingByCountryComputationMethod, Nop.Shipping.ShippingByCountry


Under the shipping Folder I have a class project: Nop.Shipping.ShippingByCountry
which contains ShippingByCountryComputationMethod.cs

in the namespace: NopSolutions.NopCommerce.Shipping.Methods.ShippingByCountryCM

which has been setup like so: public class ShippingByCountryComputationMethod : IShippingRateComputationMethod


i then use Ioc to resolve: IoC.Resolve<IShippingByCountryService>() where applicable

and then in BusinessLogic.Shipping have
namespace NopSolutions.NopCommerce.BusinessLogic.Shipping
{
    public partial interface IShippingByCountryService
    {
        ShippingByCountry GetById(int shippingByCountryId);
        void DeleteShippingByCountry(int shippingByCountryId);
        List<ShippingByCountry> GetAll();
        ShippingByCountry InsertShippingByCountry(int shippingMethodId, int countryId, decimal shippingChargeAmount);
        ShippingByCountry UpdateShippingByCountry(int shippingByCountryId, int shippingMethodId, int countryId, decimal shippingChargeAmount);
        List<ShippingByCountry> GetAllByShippingMethodIdAndCountryId(int shippingMethodId, int countryId);
    }
}


which is then implemented in the ShippingByCountryService class


I have gone through and found all references for shippingbyweightandcountry and added a similar refernce in the base files for shippingbycountry..

i just can't seem to get this working!!!
13 年 前
any help would be greatly appreciated
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.