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

#   Custom Metadata

##

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

Less More

- Posts: 1
- Thank you received: 0
-
-

12 years 7 months ago [\#147426](#147426) by [funkyasa](/forum/user/31551-funkyasa "View funkyasa's Profile")  *[Custom Metadata](/forum/31-development/866469-custom-metadata#147426 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")* was created by *[funkyasa](/forum/user/31551-funkyasa "View funkyasa's Profile")*

Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.

The meta desc and keywords on product page normally will use the product's metadata.
But if the product's metada empty, it will use the site's default meta keyword and description, am i right?

I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.

If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.

I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?).
Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3!
![:)](/media/kunena/emoticons/8.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2NjQ2OS1jdXN0b20tbWV0YWRhdGE/dG1wbD1tYXJrZG93bg==) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14266
-
-

12 years 7 months ago [\#147436](#147436) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#147436 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

Hi,

It's indeed the components/com_hikashop/views/product/view.html.php file that you need to edit. It's those lines: Code:

$doc = JFactory::getDocument(); $product_name = $this-&gt;element-&gt;product_name; $product_page_title = $this-&gt;element-&gt;product_page_title; $product_description = $element-&gt;product_meta_description; $product_keywords = $element-&gt;product_keywords; if(!empty($this-&gt;element-&gt;main)){ $product_name = $this-&gt;element-&gt;main-&gt;product_name; if(!empty($this-&gt;element-&gt;main-&gt;product_page_title)){ $product_page_title = $this-&gt;element-&gt;main-&gt;product_page_title; } if(!empty($this-&gt;element-&gt;main-&gt;product_meta_description)){ $product_description = $this-&gt;element-&gt;main-&gt;product_meta_description; } if(!empty($this-&gt;element-&gt;main-&gt;product_keywords)){ $product_keywords = $this-&gt;element-&gt;main-&gt;product_keywords; } } if(!empty($product_keywords)){ $doc-&gt;setMetadata('keywords', $product_keywords); } if(!empty($product_description)){ $doc-&gt;setMetadata('description', $product_description); }

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

- **[aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")**
- [![aran.gibbs's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar42033.png)](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")
- [ Offline](/forum/user/42033-aran-gibbs)

Less More

- Posts: 23
- Thank you received: 0
-
-
-

10 years 2 months ago -  10 years 2 months ago [\#248285](#248285) by [aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")  Replied by *[aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#248285 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

Hi Nicolas,

Is this tweak still valid? I'd like to be able to auto create Metadescription with Product Name, Brand, Category &amp; Price if it's left blank?

To test I have set lines 1327-1329 to this: Code:

if(!empty($product_description)){ $doc-&gt;setMetadata('description', $productname only $price); }

But it still just seems to set the meta to the text from the product description.

Aran
(2.6.3 Business)

Last edit: 10 years 2 months ago by [aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2NjQ2OS1jdXN0b20tbWV0YWRhdGE/dG1wbD1tYXJrZG93bg==) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14266
-
-

10 years 2 months ago [\#248287](#248287) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#248287 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

Hi,

Sure, you need to add to the end of that code something like that: Code:

else{ $doc-&gt;setMetadata('description', 'My custom meta description'); }

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

- **[aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")**
- [![aran.gibbs's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar42033.png)](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")
- [ Offline](/forum/user/42033-aran-gibbs)

Less More

- Posts: 23
- Thank you received: 0
-
-
-

10 years 2 months ago -  10 years 2 months ago [\#248333](#248333) by [aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")  Replied by *[aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#248333 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

Hi,

Thanks for coming back to me. I've added that code but still no joy. I've attached a copy of the file.

Are you sure its not pulling it from somewhere else too? I'm editing the file stored in /components/com_hikashop/views/product and even if I delete that file completely it still just put the text from the product description into the meta data.

Aran

Last edit: 10 years 2 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2NjQ2OS1jdXN0b20tbWV0YWRhdGE/dG1wbD1tYXJrZG93bg==) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14266
-
-

10 years 2 months ago [\#248338](#248338) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#248338 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

Hi,

You're not editing the correct file. That's the view.feed.php but you need to edit the view.html.php file.

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

- **[aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")**
- [![aran.gibbs's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar42033.png)](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")
- [ Offline](/forum/user/42033-aran-gibbs)

Less More

- Posts: 23
- Thank you received: 0
-
-
-

10 years 2 months ago -  10 years 2 months ago [\#248387](#248387) by [aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")  Replied by *[aran.gibbs](/forum/user/42033-aran-gibbs "View aran.gibbs's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#248387 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

HI,

I am editing the view.html.php file. Must have attached the wrong one.

- [ ![Screen&#95;Shot&#95;2016-08-24&#95;at&#95;20&#95;28&#95;19.png](/forum/attachment/33175) ](/forum/attachment/33175 "...t&#95;20&#95;28&#95;19.png") [ ](/forum/attachment/33175?download=1 "...t&#95;20&#95;28&#95;19.png")

Last edit: 10 years 2 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

10 years 2 months ago [\#248390](#248390) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Custom Metadata](/forum/31-development/866469-custom-metadata#248390 "Hi there, i'm wondering what file that i have to edit to change the meta desc and meta keyword on a product page.  The meta desc and keywords on product page normally will use the product's metadata. But if the product's metada empty, it will use the site's default meta keyword and description, am i right?  I wanted to change it's behaviour, so if the metadata of the product is empty, it will use my custom words instead of using site's default metadata.  If it's empty, i want to make something like: Get this $productname now for only $price ! Or find other similar product in $category.  I tried to check and change in view.html.php but i don't know which line to edit (or wrong file to edit?). Please help me to locate which file to edit and what line / part of the file. Thanks a lot for the nice components that support J3! :)")*

Hi,

The code Code:

if(!empty($product_description)){ $doc-&gt;setMetadata('description', $productname only $price); }

is unfortunately incorrect, it is not a valid PHP code so I think it generates you fatal errors.
So I recommend you to use some like : Code:

$doc-&gt;setMetadata('description', $product_name . ' - ');

If you want to generate a string with variables, you need to "concat" them.
Such kind of modification requires some PHP/Development skills and if you want to add a price in the meta description, it will require a more complexe modification.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2NjQ2OS1jdXN0b20tbWV0YWRhdGE/dG1wbD1tYXJrZG93bg==) 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.303 seconds

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

[](#top)
