I now got it. Because of you, I learned how the widget works in nopCommerce. Thank you so much for the great help!!!
For my second question about changing item price during the check-out, I think only approved sales rep should be able to change the item price only when they impersonate customers. The real customers should not be able to change the item price.
I really like your plugin here and also would really like it so that we can change the price for a customer if needed, this could be very useful for me.
But I do not program - can you upload the plugin as ready to install in NOP ? ( I do not know how to compile in visual studio)
Start VS and open up the nopCommerce solution. Right Click on the plugin, select "Build" and then look for the compiled binaries in what probably looks like:
I just learned that an option "Customer enters price" in each product detail page allows customers change the item price when adding to a cart. When the option is checked, the min & max price range boxes are displayed.
This option works for sales reps who want to change the item price but allows everyone change the prices. It would be nice if this option works based on customer roles. That's my opinion.
I realize that the customer role will not solve the customizing price issue when the impersonate option is used. The variable of checking only approved sales reps impersonate and activate the customized price option. Any other suggestions?
you want to check roles against the backend _workContext.OriginalCustomerIfImpersonated, not the frontend customer.
Look at the productModelFactory for an example:
if (product.CallForPrice && //also check whether the current user is impersonated (!_orderSettings.AllowAdminsToBuyCallForPriceProducts || _workContext.OriginalCustomerIfImpersonated == null)) { model.CallForPrice = true; } else {...
you can check your Sales Rep roles with something like:
var permissions = workContext.OriginalCustomerIfImpersonated.CustomerRoles; if (permissions != null) var repCanEnterPrice = (permissions.Any(role => role.SystemName == "YOUR_REP_ACCOUNT")) ? true : false;
you'll then need to look at overriding PrepareProductPriceModel in the ProductModelFactory to something like:
if (product.CustomerEntersPrice || repCanEnterPrice ) { model.CustomerEntersPrice = true; }
and probably other stuff as well, but that should point you in the right direction
I just noticed that the option "Customers enter price" does display the minimum price you set, not the default price. It is the big problem. I'm trying to figure out how the default price can be automatically entered instead of the minimum price.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.