How can I remove the span in the custom fields by override?

  • Posts: 18
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
3 years 11 months ago #331270

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.3.27
-- Browser(s) name and version -- : all browsers
-- Error-message(debug-mod must be tuned on) -- : No error, but question about override to speed up the page

Hi there,

In order to speed up the page where I have many (hundreds) of color-values in a custom field, I want to remove all the <span> tags inside the part

<label for="brnkmln_BM_01_k_01>
<input id="brnkmln_BM 01 K -1" .......>
<span>xxxxxxx<span>
</label>

Is this possible by using an override? I could not find te right override-file. In show_block_custom_item.php the value is echod, but where is the value set?

But maybe more important to speed up the page: is the a way to use Ajax to chooose the color-value dynamic? In that way all values don't have to be loaded on forehand.

Best regards,
Peter

Attachments:

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

  • Posts: 83404
  • Thank you received: 13497
  • MODERATOR
3 years 11 months ago #331271

Hi,

The code you're looking for is in the file administrator/components/com_hikashop/classes/field.php on the line:

$string .= '<label><input type="'.$type.'" name="'.$map.'" value="'.$oneValue.'" id="'.$id.'" '.$checked.' '.$options.' /> <span>'.$this->trans($title->value).'</span></label>';
However, I don't recommend you to directly edit the code there as you'll loose the change after each update.

Instead of that, I would rather recommand that you do your view override file show_block_custom_item.php in Display>Views.
There, you have the code:
echo $this->fieldsClass->display(
						$oneExtraField,
						$itemData,
						'data[item]['.$oneExtraField->field_namekey.']',
						false,
						' '.$onWhat.'="window.hikashop.toggleField(this.value,\''.$fieldName.'\',\'item\',0);"',
						false,
						$this->itemFields
					);
which display each custom field.
So what you can do is change it to:
echo str_replace(array('<span>', '</span>'), array('', ''), $this->fieldsClass->display(
						$oneExtraField,
						$itemData,
						'data[item]['.$oneExtraField->field_namekey.']',
						false,
						' '.$onWhat.'="window.hikashop.toggleField(this.value,\''.$fieldName.'\',\'item\',0);"',
						false,
						$this->itemFields
					));
to strip the span tags from the HTML from the custom fields.
That way, no worries for future updates.

The following user(s) said Thank You: remcovolbeda

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

  • Posts: 18
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
3 years 11 months ago #331285

Thank you very much Nicolas for this nice solution!

Regards,
Peter

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

Time to create page: 0.053 seconds
Powered by Kunena Forum