We display information for a certain group of users
We display information for a certain group of users
Creation, development, manufacturing sites | WEB-STYDIA.COM

Greetings to the distinguished visitor of our site.

Today I want to write here a small solution for online stores based on Opencart, which will allow you to display on the pages of your store any text, banner, or any information with a binding to the user group.

I often use this solution when creating online stores that work with wholesale sales, that is, when the store has several groups of customers, for example, wholesale buyers, dropshipping, retail ...

So, often there is a question as for a group of wholesalers to show what that certain text, but at the same time for retail this text should not be visible. Consider, for example, an online clothing store "Maksim-ka "which I did for one of the customers.

In this store there are all three groups of customers that I described above, the client had to make it possible to display information for downloading the export files of goods and pictures in the customer's account, this block should be displayed only for a group of wholesalers and dropshippers, it is not necessary, it will be superfluous, accordingly it will be simply not enough to specify the information in the account.tpl file, it must also be attached to the buyer group.

Well, as they say, we must mean. On the Internet, a lot of this question is discussed, somebody suggests some complicated methods, some simpler solutions to this question, sometimes there are delusions about how to make information output dependent on the buyer group. In fact, everything is simple to nowhere, and in order to bind a block to the buyer group in opencart, you just need to enclose it in a check like this:

That is, in the specified method, we check the authorized user or not and check the user group ID, if the ID is the same as the one you specified, the block is shown if the same ID does not match the block, and we do not display it.

As you can see the number 2 in the line, this is just our customer group ID for which the check is carried out. In the above store, this is a group of dropshippers, the actual text will appear only for dropshippers after they enter your account, for all other users the block will be hidden.

How to find the buyer group ID in opencart? Yes, everything is simple, in contrast to the group of the buyer created in the admin panel, change the computer and look at the browser line, at the very end it will be the group ID.

So you can display any information in the store and indicate who can see it and who does not. In the example, I indicated exactly the output of information in the user's cabinet, but in fact you can use it in any place you need.

That's all, I will be happy if someone it will be useful, well, in general, this article as well as many others on our site is written primarily for myself as a note.

Good luck to you in our hard, but such an exciting business as web programming :)  :)  :)  :).

PS: If someone suddenly becomes interested in buying a ready-made online store based on opencart, if you do not want to bother with an independent creation of it, there is no time or no desire to learn all these subtleties, then welcome to the section where you can buy already ready site for online store.

 

You may also like

No Comment

You can post first response comment.

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter a message.