Developer forum

Forum » PIM » Group customer number in the price matrix

Group customer number in the price matrix

Davy Capiau
Reply

Hi,

 

What does the "group customer number" do in the price matrix and how is it managed? I can't find info in the documentation

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Good question.

This is what it does

  • A group can have a customer number
  • A user can be member of one or more groups
  • If a price has group customer number on it, the current user will get the price if they are member of that group
  • If a user is member of 2 or more groups, where more of them have a group specific price, the lowest will be used.
  • If a user have a customer or user specific price also, all prices come into consideration and the lowest will be used.

Use case

  • You can use it for price groups
    • Users might have a customer number on them selfes - that can give them user or customer specific prices
    • But users can also instead be in a more generic group - i.e a price group and get price group specific prices

In user management, consider this group structure.

  • Accounts
    • Company A (User 1, User 2) - All users share the same customer number, maybe also the group have that customer number.
    • Company B (User 3, User 4) - All users share the same customer number, maybe also the group have that customer number.
  • Price groups
    • Price group 1 (User 1, User 2, User 3, User 4)
    • Price group 2 (Other users)

Since you can just use the group field instead, that would be the same - difference is that this might be easier to integrate since group customer number can hold any ID - where as the group field needs the group id.

This is the code:

private static bool CheckUserGroupCustomerNumbers(Price price, User user)
        {
            if (!string.IsNullOrWhiteSpace(price.CustomerGroupId))
            {
                if (user is null)
                {
                    return false;
                }

                foreach (var g in user.Groups)
                {
                    if (string.Equals(price.CustomerGroupId, g.CustomerNumber, StringComparison.OrdinalIgnoreCase))
                    {
                        return true;
                    }
                }

                return false;
            }

            return true;
        }
Votes for this answer: 1
 
Davy Capiau
Reply

Hi Nicolai,

Thank you for the clear answer.

Is it correct that the supplied code is only needed if I were to generate the price somewhere custom? By default DW will use this logic on product and category pages?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Davy

Yes - Dynamiweb uses that code to find the price - it was just so you could see the actual logic (which of course only makes sense for developers :-))

BR Nicolai

 

You must be logged in to post in the forum