[Skip to main content](#vessel-content)

#   Generate product name from custom fields

##

- **[Impress51](/forum/user/34807-impress51 "View Impress51's Profile")**
- [![Impress51's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34807-impress51 "View Impress51's Profile") Topic Author
- [ Offline](/forum/user/34807-impress51)

Less More

- Posts: 11
- Thank you received: 0
-
-

11 years 3 months ago [\#210408](#210408) by [Impress51](/forum/user/34807-impress51 "View Impress51's Profile")  *[Generate product name from custom fields](/forum/31-development/878542-generate-product-name-from-custom-fields#210408 "-- url of the page with the problem -- :   www.impress51websites.co.uk/tophat/  -- HikaShop version -- : 2.5.0 Business -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5 -- Browser(s) name and version -- : Firefox 39.0  Hi,  I have three custom fields setup as text/dropdowns and all three are required. I'd like to populate the product name based upon these values as follows:  productName = artist . ' - ' . album . '(' . type . ')';  Which files would I need to override to achieve this?  Kind Regards  Jaz")* was created by *[Impress51](/forum/user/34807-impress51 "View Impress51's Profile")*

-- url of the page with the problem -- : [ www.impress51websites.co.uk/tophat/](http://www.impress51websites.co.uk/tophat/)
-- HikaShop version -- : 2.5.0 Business
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.5
-- Browser(s) name and version -- : Firefox 39.0

Hi,

I have three custom fields setup as text/dropdowns and all three are required. I'd like to populate the product name based upon these values as follows:

productName = artist . ' - ' . album . '(' . type . ')';

Which files would I need to override to achieve this?

Kind Regards

Jaz

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODU0Mi1nZW5lcmF0ZS1wcm9kdWN0LW5hbWUtZnJvbS1jdXN0b20tZmllbGRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14293
-
-

11 years 3 months ago [\#210412](#210412) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Generate product name from custom fields](/forum/31-development/878542-generate-product-name-from-custom-fields#210412 "-- url of the page with the problem -- :   www.impress51websites.co.uk/tophat/  -- HikaShop version -- : 2.5.0 Business -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5 -- Browser(s) name and version -- : Firefox 39.0  Hi,  I have three custom fields setup as text/dropdowns and all three are required. I'd like to populate the product name based upon these values as follows:  productName = artist . ' - ' . album . '(' . type . ')';  Which files would I need to override to achieve this?  Kind Regards  Jaz")*

Hi,

The best would be to create a custom HikaShop plugin and implement the onBeforeProductUpdate and onBeforeProductCreate triggers in your plugin and force the value of the product name based on these fields.
[ www.hikashop.com/support/support/documen...ntation.html#product](http://www.hikashop.com/support/support/documentation/62-hikashop-developer-documentation.html#product)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODU0Mi1nZW5lcmF0ZS1wcm9kdWN0LW5hbWUtZnJvbS1jdXN0b20tZmllbGRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Impress51](/forum/user/34807-impress51 "View Impress51's Profile")**
- [![Impress51's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34807-impress51 "View Impress51's Profile") Topic Author
- [ Offline](/forum/user/34807-impress51)

Less More

- Posts: 11
- Thank you received: 0
-
-

11 years 2 months ago [\#212459](#212459) by [Impress51](/forum/user/34807-impress51 "View Impress51's Profile")  Replied by *[Impress51](/forum/user/34807-impress51 "View Impress51's Profile")* on topic *[Generate product name from custom fields](/forum/31-development/878542-generate-product-name-from-custom-fields#212459 "-- url of the page with the problem -- :   www.impress51websites.co.uk/tophat/  -- HikaShop version -- : 2.5.0 Business -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5 -- Browser(s) name and version -- : Firefox 39.0  Hi,  I have three custom fields setup as text/dropdowns and all three are required. I'd like to populate the product name based upon these values as follows:  productName = artist . ' - ' . album . '(' . type . ')';  Which files would I need to override to achieve this?  Kind Regards  Jaz")*

Hi,
I have created the plugin (attached files) and it works, but when the quantity is updated when a customer adds it to their cart it runs then too and messes up the changes, how do I stop this from happening?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODU0Mi1nZW5lcmF0ZS1wcm9kdWN0LW5hbWUtZnJvbS1jdXN0b20tZmllbGRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14293
-
-

11 years 2 months ago [\#212475](#212475) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Generate product name from custom fields](/forum/31-development/878542-generate-product-name-from-custom-fields#212475 "-- url of the page with the problem -- :   www.impress51websites.co.uk/tophat/  -- HikaShop version -- : 2.5.0 Business -- Joomla version -- : 3.4.3 -- PHP version -- : 5.5 -- Browser(s) name and version -- : Firefox 39.0  Hi,  I have three custom fields setup as text/dropdowns and all three are required. I'd like to populate the product name based upon these values as follows:  productName = artist . ' - ' . album . '(' . type . ')';  Which files would I need to override to achieve this?  Kind Regards  Jaz")*

The problem is in your plugin's code.
Of course, the product will be updated each time it is necessary. When the stock changes, even when someone merely display the product page (in order to update the hit count), etc.
It's your job in the plugin to do your processing only when necessary.
So you should add a condition like this: Code:

if(!isset($product-&gt;album) &#124;&#124; !isset($product-&gt;type) &#124;&#124; !isset($product-&gt;artist)) return;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3ODU0Mi1nZW5lcmF0ZS1wcm9kdWN0LW5hbWUtZnJvbS1jdXN0b20tZmllbGRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.050 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
