How to put data into custom fields

  • Posts: 252
  • Thank you received: 1
8 years 2 months ago #249432

-- HikaShop version -- : HikaShop Business 2.6.3
-- Joomla version -- : 3.5
-- PHP version -- : 5.5.12

Hi,
We created a custom field for product which need to be showed in front end product list and product detail page.
The problem is the data comes from another table in my system, do I need to do a table join? or if I need to do this in my plugin, would you give me a direction?

Thanks in advance
Best regards

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 2 months ago #249439

Hi,

I'm not following you.
How did you create a custom field that isn't in the hikashop_product table ?
Or maybe you mean that it's not an actual "hikashop custom product field", but an input that you added to the products and which is saved somewhere else, not related to the custom fields system of HikaShop ?

In any case, if you want to load data from another table for each products on a listing, the simplest is to have a query for each product in your view file override (listing_img_title by default) basing yourself on $this->row->product_id
You sure could add a join on the products loading query, but it's more complex than just overriding the view file and adding a query there.

The following user(s) said Thank You: twscott

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

  • Posts: 252
  • Thank you received: 1
8 years 2 months ago #249472

Got it, thank you very much, Nicolas.
I have another question that If I fill in the data in listing_img_title, will the product objects be reused in the session? I mean in the product detail page and checkout process, do I need to query DB table again for the value or the object will pass down until user make another product list query ?

Best Regards
Scott

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 2 months ago #249474

The product data is not stored in the session.
You would have to query the DB everywhere where you want to use it.

The following user(s) said Thank You: twscott

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

Time to create page: 0.056 seconds
Powered by Kunena Forum