Advertisement:

Author Topic: [Solved] explode custom fields on item.php  (Read 38912 times)

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Solved] explode custom fields on item.php
« Reply #75 on: March 10, 2016, 04:18:16 pm »
Use this code to get all Custom fields:

Code: [Select]
<?php View::newInstance()->_erase('metafields');
$custom_field_content = array();
            if( 
osc_count_item_meta() >= ) { 
                    while ( 
osc_has_item_meta() ) { 
                        if(
osc_item_meta_value() !="") {
            
$custom_field_name_content[osc_item_meta_slug()] = osc_item_meta_name();
            
$custom_field_value_content[osc_item_meta_slug()] = osc_item_meta_value();
                        }
                    }
?>

<?php echo $custom_field_name_content['sellerphone'] ;?>: <strong><?php echo $custom_field_value_content['sellerphone'] ;?></strong><br>

Now you can repeat it with no problem. Regards
« Last Edit: March 10, 2016, 10:27:13 pm by teseo »

tryserg

  • Newbie
  • *
  • Posts: 24
Re: [Solved] explode custom fields on item.php
« Reply #76 on: March 10, 2016, 09:27:24 pm »
Use this code to get all Custom fields:

Code: [Select]
<?php View::newInstance()->_erase('metafields');
$custom_field_content = array();
            if( 
osc_count_item_meta() >= ) { 
                    while ( 
osc_has_item_meta() ) { 
                        if(
osc_item_meta_value() !="") {
            
$custom_field_name_content[osc_item_meta_slug()] = osc_item_meta_name();
            
$custom_field_value_content[osc_item_meta_slug()] = osc_item_meta_value();
                        }
                    }
?>

<?php echo $custom_field_name_content['sellerphone'] ;?>: <strong><?php echo $custom_field_value_content['sellerphone'] ;?></strong><br>

Now you can repeat it with no problem. Regards
Nice!!!!
Thanks, it's awesome.   8) 8)
Regards.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Solved] explode custom fields on item.php
« Reply #77 on: March 10, 2016, 10:20:25 pm »
You're welcome. :)
Regards
« Last Edit: March 10, 2016, 10:26:56 pm by teseo »

tryserg

  • Newbie
  • *
  • Posts: 24
Re: [Solved] explode custom fields on item.php
« Reply #78 on: April 01, 2016, 11:19:33 am »
You're welcome. :)
Regards
Hi!
Maybe you can help me again?  ::)

Your code don't work in premium listing.  :'( (OsclassWizards)
Code: [Select]
<?php View::newInstance()->_erase('metafields');
$custom_field_content = array();
            if( 
osc_count_item_meta() >= ) { 
                    while ( 
osc_has_item_meta() ) { 
                        if(
osc_item_meta_value() !="") {
            
$custom_field_name_content[osc_item_meta_slug()] = osc_item_meta_name();
            
$custom_field_value_content[osc_item_meta_slug()] = osc_item_meta_value();
                        }
                    }
?>

<?php echo $custom_field_name_content['sellerphone'] ;?>: <strong><?php echo $custom_field_value_content['sellerphone'] ;?></strong><br>
Regards.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Solved] explode custom fields on item.php
« Reply #79 on: April 01, 2016, 05:21:56 pm »
Hi,

No difference in Ad View between premiums and non-premiums. Are you sure you have understand what this procedure is intended for? ???

Regards

tryserg

  • Newbie
  • *
  • Posts: 24
Re: [Solved] explode custom fields on item.php
« Reply #80 on: April 02, 2016, 02:05:38 pm »
Hi,

No difference in Ad View between premiums and non-premiums. Are you sure you have understand what this procedure is intended for? ???

Regards
Not sure  ::)
This code get all custom fields.  ;D

For premium list use this code  8) and it help me.
I change
Code: [Select]
            if( osc_count_item_meta() >= 1 ) {
                    while ( osc_has_item_meta() ) {
to
Code: [Select]
            if( osc_count_premium_meta() >= 1 ) {
                    while ( osc_has_premium_meta() ) {

full code
Code: [Select]
<?php 
$custom_field_content 
= array();
            if( 
osc_count_premium_meta() >= ) { 
                    while ( 
osc_has_premium_meta() ) { 
                        if(
osc_item_meta_value() !="") {
            
$custom_field_name_content[osc_item_meta_slug()] = osc_item_meta_name();
            
$custom_field_value_content[osc_item_meta_slug()] = osc_item_meta_value();
                        }
                    }
?>

<?php echo $custom_field_name_content['year'] ;?>: <strong><?php echo $custom_field_value_content['year'] ;?></strong>

Regards.
« Last Edit: April 02, 2016, 02:13:58 pm by tryserg »

Fernando36

  • Newbie
  • *
  • Posts: 16
Re: [Solved] explode custom fields on item.php
« Reply #81 on: June 27, 2016, 02:04:55 pm »
Hi guys,
I've used Garci de Maria code... and it awesome...
For now...i need to know how can I put a trim for the results.
E.g. Custom valeu is (11) Região de São Paulo, I need to show only number 11.
TKS.
Fernando
See the code:
<?php
            $cf_extra_description = Field::newInstance()->findBySlug('cf_extra_description');

            $dao = new DAO();
            $dao->dao->select('*');
            $dao->dao->from(DB_TABLE_PREFIX.'t_item_meta');
            $dao->dao->where('fk_i_field_id', $cf_extra_description['pk_i_id'] );
            $dao->dao->where('fk_i_item_id', osc_item_id() );
            $result = $dao->dao->get();
            if( $result == false ) {
                return array();
            }
            $custom_data = $result->result();
            $cf_extra_description['s_value'] = $custom_data[0]['s_value'];

            View::newInstance()->_exportVariableToView('metafields', array($cf_extra_description));
        ?>
        <p>
            <strong><?php echo osc_item_meta_name(); ?>:</strong>  <?php echo osc_item_meta_value(); ?>
        </p>

Anvar.in

  • Newbie
  • *
  • Posts: 11
Re: [Solved] explode custom fields on item.php
« Reply #82 on: March 22, 2017, 06:35:26 pm »
I want to change the display view of the custom field in the osclass admin plugin.

Which file i need to edit for this ?

items_search.php

------------------Current custom field search view--------------
<div class="plugin-hooks">
 <fieldset>
<div class="row one_input">
<h6>Fuel</h6>
<select name="meta[5]" id="meta_fuel">
<option value=""></option>
<option value="Pertrol" selected="selected">Pertrol</option>
<option value="Diesel" >Diesel</option>
</select>
</fieldset>
--------------- I want to change like this ----------------------
<div class="col-md-3">
<select name="sRegion" id="sRegion">
<option value="" id="sRegionSelect">Select a Dist</option>
<option value="1" >Alappuza</option>
<option value="2" selected="selected">Calicut</option>
</select>
</div>

Any body help me for this ?