Ajax file custom field display

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
2 weeks 4 days ago #364749

-- HikaShop version -- : 5.1.2
-- Joomla version -- : 5.2
-- PHP version -- : 8.3.3

Im using product custom field Ajax file for audio mp3 file. Two problems:

1. If I enter in Format for each file field

<audio controls>
  <source src="images/audiosample/{value}" type="audio/mpeg" />
  Your browser does not support the audio tag.
</audio>
the "controls" audio tag is removed after saving the field.

2. How to show that field in template layout override for product?
If I use
<?php echo $this->row->mediafield; ?>
only the value is in html output.
Is there a way to show formated field?

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
2 weeks 4 days ago #364753

Hi,

1. Thank you for your feedback. I've made a patch to better handle this. Download again the install package of HikaShop on our website and install it on yours to get the patch.

2. Yes. We've covered this here for example:
www.hikashop.com/forum/product-category-...t-layout.html#339434

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
2 weeks 1 day ago #364771

1. OK now.
2. So solution for audio player for ajax file custom field:
In view override place (where "audiotest" is custom field column name)

<?php
$fieldClass = hikashop_get('class.field');
$field = $fieldClass->getField('audiotest', 'product');
echo $fieldClass->show($field,$this->element->audiotest) ;
?>
In format for each file field place code like
<div class="media-preview"><p>Audio preview</p><audio controls>
  <source src="images/audiosample/{value}" type="audio/mpeg" />
  Your browser does not support the audio tag.
</audio></div>
Where images/audiosample is folder for your audio files.
And final result is


This is game changer for custom fields. Thank you Hikashop!

Attachments:
The following user(s) said Thank You: nicolas

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

Time to create page: 0.063 seconds
Powered by Kunena Forum