[SOLVED] How to Map "Vendor Edition" fields?

  • Posts: 205
  • Thank you received: 12
3 years 11 months ago #318061

-- HikaShop version -- : 4.3.0
-- HikaMarket version -- : 3.0.3
-- Joomla version -- : 3.9.18
-- PHP version -- : 7.2.30

Hello

We have bought your both excellent plugins, "HikaShop Essential" and "HikaMarket Multi-vendor".

On our usecase, we have a website dedicated to a specific business industry and we use community builder for our registered companies accounts. Each registered user is a company. The site currently works as a communication platform between these companies, using almost all CB's plugins (timeline, CBSubs, messging etc).

We want to keep everything as is on this site, but also give the ability to our registered companies to sell their products through their vendor pages. Our problem is that we do not know the way to populate CB table values to the vendor's page.

For example...

When a user clicks on "Vendor Edition" he has to fill again the details for his company. Our users have already provided these info during registration.

Please tell us how to map...

Vendor name *
Contact email * -> (this one is already populated somehow)
Vendor image
Company
Address*
City*

to our desired community builder field values?

Last edit: 3 years 10 months ago by liaskas. Reason: Marked post as solved

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
3 years 11 months ago #318063

Hello,

These values are stored in the HikaMarket vendor table ; when the vendor is created (depending your HikaMarket configure regarding the regsitration), HikaMarket use the user email for the contact email of the vendor, but the vendor name (or address) are not loaded to because we can't know them and we don't want to make public some private information.
The contact email is not shown and only use to redirect the notification emails, that's why we can use it from the user account.

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: 205
  • Thank you received: 12
3 years 11 months ago #318073

Thank you for your reply.

I understand your point about privacy, but the question is a bit different. Probably i did not explain well!

The HikaMarket on our site is to be used by already registered members. If someone is registered with our site, then he can become a vendor.

So someone is registered with our site, he has already provided his details through Community builder (Company Name, company logo, Address, telephone, etc...) and these info are not private information! They show on his community builder profile.

What we ask is...

How to auto fill the following fields with the corresponding values from community builder...

Page: Vendor Registration (Attachment vendor_registration)

  • Vendor name -> Auto fill the field with the value "Company Name" from his community builder account table

Page: Edit your vendor details
  • Vendor image -> Auto fill the field with the value from his community builder profile (avatar) table
  • Company -> Auto fill the field with the value "Company Name" from his community builder account table
  • Address -> Auto fill the field with the value from "Address" column of the community builder account table
  • City -> Auto fill the field with the value from "City" column of the community builder account table
  • State -> Auto fill the field with the value from "State" column of the community builder account table
  • Country -> Auto fill the field with the value from "Country" column of the community builder account table
  • Description -> Auto fill the field with the value from "Description" column of the community builder account table

Attachments:
Last edit: 3 years 11 months ago by liaskas.

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
3 years 11 months ago #318098

Hello,

You can use the trigger "onBeforeVendorCreate" in order to populate the vendor object thanks to the current user data.
www.hikashop.com/support/documentation/1...onBeforeVendorCreate

And via the HikaMarket settings, you can remove most of the fields from the vendor registration page, which will let your plugin populate them at the vendor creation.

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: 205
  • Thank you received: 12
3 years 11 months ago #318112

Thank you for your reply...

I really appreciate your willing to help. As we are completely new to HikaShop and HikaMarket, can you please guide us where the following php code has to be used?

public function onBeforeVendorCreate(&$vendor, &$do) {
}

Is there a tutorial page or an example page somewhere that will help us understand how it is used and on what files?

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
3 years 11 months ago #318139

Hello,

Since you wanted to populate the data from your Community Builder structure, one solution is to create a custom plugin and use the trigger that I gave you.
The trigger gives a direct access to the vendor object before the creation of the entry in the database.

If you do not have development skills to create a Joomla plugin ; you can also see to use a view override for the "vendormarket / registration".
There thanks to

if( !isset($this->element->vendor_id) ) {
}
You can add some PHP code to populate the "$this->element" with data coming from your CB.
The vendor_image will be the difficult field since it contains the relative path to the image from the HikaShop upload folder.

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: liaskas

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

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