Advertisement:

Author Topic: [SOLVED] Custom filelds - checkbox. How not to show unselected fields ?  (Read 598 times)

c4

  • Newbie
  • *
  • Posts: 25
Hey
I have a problem with custom fields. Custom field - check box. When selected, tick.png is displayed and is OK. If the field is not selected, cross.png is shown. I want the unselected fields not to be visible.

The same problem was here https://forums.osclass.org/3-5-x/custom-fields-checkbox/ but I can not deal with it probably different syntax of newer osclass files.

Please, help me.
« Last Edit: January 02, 2018, 09:18:24 pm by c4 »

c4

  • Newbie
  • *
  • Posts: 25
Re: Custom filelds - checkbox. How not to show unselected fields ?
« Reply #1 on: January 02, 2018, 07:57:31 pm »
I found the option responsible for this :)
in hItems.php

 } else if($meta['e_type']=="CHECKBOX") {
            if(osc_field(osc_item_meta(), 's_value', '')==1) {
                return '<img src="'.osc_current_web_theme_url('images/tick.png').'" alt="" title=""/>';
            } else {
                return '<img src="'.osc_current_web_theme_url('images/cross.png').'" alt="" title=""/>';
            }

how to make it
            } else {     
             do not show ?

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom filelds - checkbox. How not to show unselected fields ?
« Reply #2 on: January 02, 2018, 08:32:46 pm »
Code: [Select]
} else if($meta['e_type']=="CHECKBOX") {
            if(osc_field(osc_item_meta(), 's_value', '')==1) {
                return '<img src="'.osc_current_web_theme_url('images/tick.png').'" alt="" title=""/>';
            } else {
                return '';
            }

But this will eliminate only the cross image not the custom field name.

But no need for the above mod.

LIke Teseo said in that post,

in bender/item.php replace

Code: [Select]
                    <?php while ( osc_has_item_meta() ) { ?>
                        <?php if(osc_item_meta_value()!='') { ?>

with

Code: [Select]
                    <?php while ( osc_has_item_meta() ) {

$show_custom = (osc_item_meta_value() == '' || strpos(osc_item_meta_value(), 'cross.png') ? 1);
if (
$show_custom) { ?>
« Last Edit: January 02, 2018, 08:40:24 pm by marius-ciclistu »

c4

  • Newbie
  • *
  • Posts: 25
Re: Custom filelds - checkbox. How not to show unselected fields ?
« Reply #3 on: January 02, 2018, 09:16:31 pm »
Oh yes !!! works like a charm :)

thank you for your help and Teseo for the media partonage over help

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: [SOLVED] Custom filelds - checkbox. How not to show unselected fields ?
« Reply #4 on: January 02, 2018, 09:20:53 pm »
Mark the topic as SOLVED please.
EDIT.
Ah sorry you already did.