Hello hezyz!
Thanks or your contribution on Nopcommerce it has really helped people like me.
i downloaded your old project on slip vendor order and i modified it so it can work will 3.9
everything was going fine until i get this error at the vendor service "Object Reference not set to an instance on an object" when i try to complete the order.
i have tried all i could but to no avail.
public virtual IList<VendorOrder> getVendorSoppingCartItems(IList<ShoppingCartItem> shoppingCartItems)
{
var vendorOrders = new List<VendorOrder>();
foreach (var item in shoppingCartItems)
{
var query = from ps in _productVendorRepository.Table
where ps.Id == item.Product.Id
select ps.Vendor;
var vendor = query.FirstOrDefault();
int index = vendorOrders.FindIndex(s => s.vendor == vendor);
if (index >= 0)
{
vendorOrders[index].ShoppingCartItems.Add(item);
}
else
{
var newVendorOrder = new VendorOrder();
newVendorOrder.vendor = vendor;
newVendorOrder.ShoppingCartItems.Add(item);
vendorOrders.Add(newVendorOrder);
}
}
return vendorOrders;
}
The product Repository keeps trowing a null exception Error. i don't know what am doing wrong here!.
but when i remove the product repository query and use this line of code
var vendor = item.Product.Vendor;
it doesn't throw the null object reference error. it actually splits the order number per vendor but its doesn't select the product per vendor hence it shows the total cost and all products of the customer order on both other numbers.
please i need help to fix this.
tahnk you.