Hide "contact seller" and "sold by" button for unregistered users

  • Posts: 127
  • Thank you received: 3
4 years 5 months ago #319760

-- url of the page with the problem -- : www.abierto.uy
-- HikaShop version -- : 4.3.0
-- HikaMarket version -- : 3.1.0
-- Joomla version -- : 3.9.18
-- PHP version -- : 7.3

Hello

Given the characteristics of the site business I'm working on, site visitors need to be unable to see the vendor´s data, or contact the vendors unless they register as users.
In the hikamarket configuration I can hide or show the "sold by" section, but I would hide it for everyone, visitors and users, similar happens with the hikashop configuration, "Show the contact button on the product page" can be hidden , but for everyone, visitors and users.

Is there a way that only registered users can see the "sold by" section and the "contact button"?

Thank you very much, greetings!

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
4 years 5 months ago #319819

Hello,

There is no option to do that.
The way that HikaMarket integrate with HikaShop to display that information is based on a plugin trigger.
So if you want to change the way that information is displayed, the best is to deactivate the feature and use a view override for the HikaShop product page and display the information with your conditions.

Since the vendor object is available in the view, you can retrieve easily the vendor name and display it.
CF : www.hikashop.com/forum/23-market-how-to/...-product.html#171023

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: zetap

Please Log in or Create an account to join the conversation.

  • Posts: 127
  • Thank you received: 3
4 years 5 months ago #319826

Hello, thanks for answering

When it comes to programming, I am quite a novice, but I will try to follow your instructions.
What is the function that I should deactivate, is it a plugin that I find in the extensions manager?

I understand that by canceling that function, I should add the code in view for the HikaShop product page, with which to check if there is a session started on the site, to show or hide a link to the seller page, correct?
In this regard, two questions:
1- in object this->element->vendor do I find the url of the vendor page?
2- I was reviewing joomla documentation and it seems that the user object connected at the moment, I get it as follows

use Joomla\CMS\Factory;
$ user = Factory::getUser();

I understand that if $user is null, it is because there is no user connected, is that so?

I really appreciate your help, regards!

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
4 years 5 months ago #319879

Hello,

1 - The URL must be generated ; you can find some code sample in our forum, like that forum thread :
www.hikashop.com/forum/20-market-feature...username.html#175004

2 - That's the kind of idea yes :)

Please understand that our help regarding the custom development is limited, we can help regarding the triggers or specialties of our components but if you need help regarding the usage of the Joomla API, the Joomla forum or HikaShop partners might be more useful.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 127
  • Thank you received: 3
4 years 5 months ago #319919

Good Morning

I fully understand and am very happy with the help they have given me.
With this information, I think I can solve my need

Thank you very much for your great help.

The following user(s) said Thank You: Jerome

Please Log in or Create an account to join the conversation.

  • Posts: 127
  • Thank you received: 3
4 years 5 months ago #319993

Hello, I hope you are very well

I am modifying the view of the product page, following your instructions and everything works as you mentioned.

But I have a problem, in the post you recommended to me, www.hikashop.com/forum/20-market-feature...username.html#175004

in the code to generate the url of the vendor that is published there, in the first line it must be saved in a variable, the user id joomla of the vendor

$joomla_user_id = 0; /* This variable must contain the joomla user id */
The problem is that the vendor is dynamic, it depends on the product that is being shown on the page.

Can you help me get the vendor user id for the product?

I also thought that there could be another option to do this if, the session started control is done in the file where the message "sold by ..." is generated?

Thank you very much, greetings!

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
4 years 5 months ago #320000

Hello,

You don't need the first part of the code since in the product page you have already access to the vendor object (cf the message #319819)
So it's mostly the "end" of the code that you want in the other post ; from the line

if(!empty($vendor) && !empty($vendor->vendor_published)) {
But with $this->element->vendor instead of $vendor.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: zetap

Please Log in or Create an account to join the conversation.

  • Posts: 127
  • Thank you received: 3
4 years 5 months ago #320029

Hello

It is true, do not check the messages back and keep the latest.

It worked perfectly, thank you very much, you are very kind.

Cheers!

Please Log in or Create an account to join the conversation.

  • Posts: 127
  • Thank you received: 3
4 years 5 months ago #320049

Hello

I ask you something else about it.
Can you tell me the view corresponding to the items (products) listed? Attached screenshot, to include the same access control to the seller page.

Thanks greetings!

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
4 years 5 months ago #320054

Hello,

HikaShop setting "display view files" : www.hikashop.com/support/documentation/5...g.html#advanced_main

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: zetap

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.066 seconds
Powered by Kunena Forum