Entity Event not working in ShippingByWeightByTotalRecord

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 năm cách đây
Hi, If I try to add, delete or update a record, none of the events are getting triggered using the ShippingByWeightByTotalRecord entity. Can somebody please advise?
I'm using 4.20. Thanks.


    public class FixedByWeightByTotalController : BasePluginController,
        IConsumer<EntityInsertedEvent<ShippingByWeightByTotalRecord>>,
        IConsumer<EntityUpdatedEvent<ShippingByWeightByTotalRecord>>,
        IConsumer<EntityDeletedEvent<ShippingByWeightByTotalRecord>>
        {
        public void HandleEvent(EntityUpdatedEvent<ShippingByWeightByTotalRecord> eventMessage)
        {
            //using event
        }
        public void HandleEvent(EntityDeletedEvent<ShippingByWeightByTotalRecord> eventMessage)
        {
            //using event
        }
        public void HandleEvent(EntityInsertedEvent<ShippingByWeightByTotalRecord> eventMessage)
        {
            //using event
        }
4 năm cách đây
You need to call the Publish method with ShippingByWeightByTotalRecord instance. For example, to listen Entity insert event, you need to add this line of code in ShippingByWeightByTotalService.InsertShippingByWeightRecord method.

_eventPublisher.EntityInserted(shippingByWeightRecord);



4 năm cách đây
I'm curious:  why would you even want to handle events on the ShippingByWeightByTotalRecord?
(Is your need to monitor/audit an administrator making changes to the configuration?)
4 năm cách đây
mhsjaber wrote:
You need to call the Publish method with ShippingByWeightByTotalRecord instance. For example, to listen Entity insert event, you need to add this line of code in ShippingByWeightByTotalService.InsertShippingByWeightRecord method.

_eventPublisher.EntityInserted(shippingByWeightRecord);





Thanks mhsjaber, you answered my question.
4 năm cách đây
New York wrote:
I'm curious:  why would you even want to handle events on the ShippingByWeightByTotalRecord?
(Is your need to monitor/audit an administrator making changes to the configuration?)


Good question.
I need to allow my vendors to create his/her own warehouses and they should only have access to their warehouse. So when a vendor is logged in and created
a warehouse, I link that warehouse to the vendor - reason why I needed the EntityInsertedEvent.

I'm also allowing the vendor to create specific Manual (Fixed or By Weight and By Total configuration.

Currently, all warehouses created are displayed to all vendors. What if you have a vendor that only wants to see their own warehouse?
Not sure why it was designed like that. Same with the pickup points, it's not vendor specific.
4 năm cách đây
jake1234 wrote:
...vendor ...Not sure why it was designed like that. Same with the pickup points, it's not vendor specific.


Because it was not designed to support a "marketplace" where vendors have the additional control.  Options are:
a) vendor includes shipping in their product price, either directly or via "additional shipping charge"
b) I think there is a 3rd party version of nopC that better supports vendor/marketplace functionality.  check GitHub
c) or, as you are doing ;)   customize the solution.
2 năm cách đây
//Calling MessageTokenProvider.ProductListToHtmlTable method using event and without overriding

features : Extends Order.Product(s) token extend with extra table data.

-->public class EventConsumer :  IConsumer<EntityTokensAddedEvent<Order, Token>>

-->public void HandleEvent(EntityTokensAddedEvent<Order, Token> eventMessage)
        {
            var order = eventMessage.Entity;
            var tokens = eventMessage.Tokens;

            var productListToHtmlTable = _ptxMessageTokenProvider.ProductListToHtmlTable(order, order.CustomerLanguageId, 0);

            tokens.Remove(tokens.FirstOrDefault(t => t.Key == "Order.Product(s)"));
            tokens.Add(new Token("Order.Product(s)", productListToHtmlTable, true));
        }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.