display stock quantity to specific vendor (ver 3.60)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
alex7166 wrote:
hi, ladies and gentlemen,
i update my question here:


a customer's email account is [email protected]
the vendor - testVender's email is set to [email protected]
a known variable of the stockQuantity is in Libraries\Nop.Services\Catalog\ProductExtensions.cs line#102

how to get the emails of the current customer and the vendor?
i want to add a condition in this program block to judge whether these two emails are the same

the answer i need becomes simpler, but still need help
thank you :)


for getting the logged in customer email you have to use _workContext.CurrentCustomer.Email

and for getting the vendor email you need to use product.Vendor.Email

or first you need to get the vendor = _vendorservice.getVendorById(product.VendorId)
and then use vendor.Email
8 years ago
thanks,
but i can't implement _vendorService
what should i do first to use all the object(?) with underscore?

the current logged in user's email, i use
EngineContext.Current.Resolve<IWorkContext>().CurrentCustomer.Email
this works. may no problem this way i guess
8 years ago
alex7166 wrote:
thanks,
but i can't implement _vendorService
what should i do first to use all the object(?) with underscore?

the current logged in user's email, i use
EngineContext.Current.Resolve<IWorkContext>().CurrentCustomer.Email
this works. may no problem this way i guess


you need to use like


_vendorService=EngineContext.Current.Resolve<IVendorService>();

var vendor=_vendorService.GetVendorById(product.VendorId);

string vendorEmail=vendor.Email


or other way you can just create global variable of IVendorService use in constructor similar like other services so it will initialize it
8 years ago
ok, ladies and gentlemen
i've solved my question

the current logged in user's email is:
EngineContext.Current.Resolve<IWorkContext>().CurrentCustomer.Email
the vendor's email of the current product is:
EngineContext.Current.Resolve<IVendorService>().GetVendorById(product.VendorId).Email

i use this two variables to solve my problem and it seems works fine

thanks your help
you all good people
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.