Display custom field checkbox with ONLY selected

  • Posts: 12
  • Thank you received: 0
8 years 6 months ago #238944

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.4.45
-- Browser(s) name and version -- : Chrome x.x.x
-- Error-message(debug-mod must be tuned on) -- : no error message

I have a checkbox set of entries. The entry list is pretty long. I need to display ONLY those checkboxes that have been checked, not the whole field layout. Here is what I have a that moment for my code. What do I need to do instead of the Display I am showing? I don't want it actually showing the checkboxes on the front-end. That makes no sense!

I tried to find information about the different parameters for the "DIsplay" function, but cannot find it in the documentation.

Code:

<?php /* Get Applicable to Press Type Custom Field */
if(!empty($this->fields)){
foreach($this->fields as $fieldName => $oneExtraField){
if($fieldName!='applicabletopresstype') continue;

?>
<p>Applicable to Press Type:

<?php
echo $this->fieldsClass->display($oneExtraField,$this->element->$fieldName,'data[product]',false);

}
}

?>
</p>

For example, if they have chosen JUST "ALL" value, I only want it to show:

Applicable to Press Type: ALL

If they have chose more than one press type, I want it to show:

Applicaple to Press Type: Press 1, Press 2, Press 3,

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 6 months ago #239007

Hi,

I'm sorry but we need more precise information to be able to help you.
Could you provide the link of the page you're talking about and a screenshot of the settings of the custom field you're talking about ?

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

  • Posts: 12
  • Thank you received: 0
8 years 6 months ago #239052

Please go here:

shopdev.komorikare.com

Login as hikashop / H!k@Sh0p for the popup

Then login as demo1 / demo1 as a user

Go to "SHop by Category / Speciality Products / BW / IC Cleaning Cloths

Then, click an item.

On the detail view at the bottom, you will see "Applicable to press type". The field is showing checkboxes. I'd like to be able to only show the values that were selected and not checkboxes as well.

As an example, one of the values is ALL. I'd like the field to show:

Applicable to Press Type: ALL

and that would be it. it wouldn't show the 30 other checkboxes.

If it has more than one press type, like GL40 and LSX29, I'd like it to show something like this:

Applicable to Press Type: GL40, LSX29

Last edit: 8 years 6 months ago by andrewkatz. Reason: more info

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 6 months ago #239068

Hi,

If I understand correctly, it's not:
echo $this->fieldsClass->display($oneExtraField,$this->element->$fieldName,'data[product]',false);

that you want, but:
echo $this->fieldsClass->show($oneExtraField,$this->element->$fieldName);

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

Time to create page: 0.068 seconds
Powered by Kunena Forum