How to change position for custom fields

  • Posts: 15
  • Thank you received: 1
3 years 10 months ago #328483

-- HikaShop version -- : HikaShop Business 4.3.0
-- Joomla version -- : Joomla! 3.9.21
-- PHP version -- : 7,2

Hi.
I need to do two custom groups in product view.
The first group stays in its original position in the "specification". (I have a tabular layout). This group describes the standard parameters of the product: dimensions, weight, colors.
I would like to do the second group in a separate place, apart from the tabular layout. This group would show shipping times, shipping costs, returns, etc.
Is it real? How to get the code to such a group, or how to do it differently?

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
3 years 10 months ago #328489

Hi,

The simplest would be to just turn off the display of the second group of custom fields, and then edit the show_tabular.php view file via the menu Display>Views to manually display them with custom code such as:
<?php echo $this->element->xxx; ?>
where xxx is the column name of the custom field.

The following user(s) said Thank You: 48media

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

  • Posts: 15
  • Thank you received: 1
3 years 10 months ago #328515

Super it is works.
Now the question is, can we display the name of this field? With the parameter if empty, do not show?

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

  • Posts: 15
  • Thank you received: 1
3 years 10 months ago #328530

Ok, I did it:
<?php if(!empty($this->element->inneparametry2)) {
echo '<div class="x">';
echo $this->element->inneparametry2;
echo '</div>';
}
?>

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
3 years 10 months ago #328518

Hi,

Sure. For example:
<?php if(!empty($this->element->xxx)) { echo 'yyy: '.$this->element->xxx; } ?>
where yyy is the name of the field.

The following user(s) said Thank You: 48media

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

  • Posts: 17
  • Thank you received: 3
  • Hikashop Business
1 year 1 month ago #356665

Hello,
<?php echo $this->element->xxx; ?> works for me but the corresponding value of the custom field doesn't change in relation to the variants of the product even if i fill it in every single variant.
How can i solve this?
Thanks in advance

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 1 month ago #356667

Hi,

That will be difficult. You need to change the javascript code in product / show_block_characteristic.php to handle a new area and then create a new div around the code you posted above with a specific id ending with _main, and then edit the product / show.php to add the display of the custom field for each variant.
So it requires developer skills to be able to do that.

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

  • Posts: 17
  • Thank you received: 3
  • Hikashop Business
1 year 1 month ago #356674

Thank You nicolas,

i copied this code :

<?php
echo $specif_tab_content;
?>

under the price block and it works even for variants changes. I also commented it to hide in the tab in tubular layout but now i have product dimensions duplicated. Is it possible to hide them in the new position?

Attachments:

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

  • Posts: 17
  • Thank you received: 3
  • Hikashop Business
1 year 1 month ago #356679

I solved wrapping the code in a div and hiding the dimension block using css display none.
Maybe someone can find a better solution.
Thanks

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 1 month ago #356676

Hi,

This should be possible with CSS code.
Could you provide the URL of that page so that we can look at the HTML ? This would be necessary if you want us to provide you with that CSS code.

The following user(s) said Thank You: fullwater

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

  • Posts: 17
  • Thank you received: 3
  • Hikashop Business
1 year 1 month ago #356691

Thank you nicolas,
I already did it.
I wrapped the block in a div and styled it with css.

Last edit: 1 year 1 month ago by fullwater.
The following user(s) said Thank You: Philip

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

Time to create page: 0.094 seconds
Powered by Kunena Forum