Save Manufacturer as a text in custom field

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #102538

Configuring a filter scheme I found this bad limitation:

In a text box I can enter text and assign several fields to be matched. This works fine.

But when I write the brand of a product it is not found because the product_manufacturer_id field is storing an id number and not the text name of the brand.

So I should create an extra field where the text of the category gets stored, but how?

I already have the code to show a manufacturer by its name in products listing, is something like this:

	$db = JFactory::getDBO();
	$db->setQuery('SELECT category_name FROM '.hikashop_table('category').' WHERE category_id='.(int)$this->row->product_manufacturer_id);
	$brandName = $db->loadResult();
but how and where I should finish this code to make it save the $brandName in a cutom_brand_field each time a product gets Submited/saved?

please understand I am not a PHP coder so don't get any knowledge for granted, I really don't know where to start from, I need very precise indication.


Thanks!

Last edit: 11 years 6 months ago by Jerome.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #102557

Hi,

You have the triggers in the Product API
www.hikashop.com/en/support/documentatio...ntation.html#product

Like : onAfterProductCreate and onAfterProductUpdate

You will have to create a little plugin in the hikashop category.

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: 634
  • Thank you received: 16
11 years 6 months ago #102563

I don't dare to send you a "Thank you" click until I try this, I never made a plugin but hope is as simple as it looks in the instructions... so we'll stay in contact for this.

thank you for the advice!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #102573

Hi,

You can find some tutorial in the joomla website.
You can use a little plugin like "hikashop history". You will have the structure of the XML file and you can remove the no-useful function in the php file.
By renaming the files, changing the names in the XML and creating a zip (with the files), you will have a little plugin.

It is not really complicated but some development skills are required.

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

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

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #102574

Thanks for your support, I will try sometime during this week. knowing your support team is so close it makes me more dareful to try it!

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

Time to create page: 0.057 seconds
Powered by Kunena Forum