[SOLVED] show video in product detail from custom field

  • Posts: 290
  • Thank you received: 22
5 years 1 month ago #304454

-- HikaShop version -- : 4.0.2
-- Joomla version -- : 3.9.3
-- PHP version -- : 7.3.2

Hi,
I'm trying to display a video where the name is coming from a custom field (named video).
When I just want to display the field with the mp4 tags around it I used this to test :

{mp4}<?php echo $this->row->video; ?>{/mp4}

And that show {mp4}123456{/mp4} ... so that looks OK.

But we use the AllVideo plugin so we need to do something extra to make it render this. I've tried this code but then the name of the custom field is not filled so all I have is 'source: '/images/.mp4', instead of 'source: '/images/123456.mp4'
The code I tried is this :

<?php echo JHtml::_('content.prepare', '{mp4}<?php echo $this->row->video; ?>{/mp4}');?>

Am I trying something that is not going to work or is the code wrong ?

Thanks for any tips.

Last edit: 5 years 1 month ago by nico.van.leeuwen. Reason: solved

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
5 years 1 month ago #304456

Hi,

The code is wrong.
You are already inside PHP tags so you can't/don't need to use PHP tags again.
The code should be:

<?php echo JHtml::_('content.prepare', '{mp4}'.$this->row->video.'{/mp4}');?>

The following user(s) said Thank You: nico.van.leeuwen

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

  • Posts: 290
  • Thank you received: 22
5 years 1 month ago #304489

Thanks you very much, this works :)

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

Time to create page: 0.038 seconds
Powered by Kunena Forum