help editing defaults_comparison.php (display meta_key from post_meta)

  • Maik
    Maik
    Newbie 4 points
    April 13, 2015 at 8:17 pm

    Hi folks,

    I’m not a real expert in php and I wanted to ask for help.
    I imported ~2000 products and I’m trying to add a price option to my comparison table.

    I tried several things but I do not have the appropriate php knowlege to do so.

    [code title=”example”]
    // NOW DISPLAY TABLE

    $DATA = $CORE->multisort( $dataArray , array(‘price’) );
    if(count($DATA) > 1){ $row = 1; }else{ $row = 0; }
    foreach($DATA as $data){

    $STRING .= ‘<tr class=”row’.$row.'”>’;

    $price = hook_price($data[‘price’]);
    if($data[‘price’] == “” || $data[‘price’] == 0){ $price = $CORE->_e(array(‘button’,’19’)); }

    $STRING .= ‘<td>

    <div class=”media”>
    <div class=”pull-left”>
    ‘.$data[‘image’].’
    <!– ‘.$data[‘ID’].’ –>
    </div>
    <div class=”media-body hidden-xs”>

    <h4 class=”media-heading”>’.$data[‘title’].'</h4>’.preg_replace(‘/\[gallery[^>]+\]/i’, “”, substr(strip_tags($data[‘desc’]),0,130)).’

    </div>
    </div>

    </td><td style=”text-align:center;”>

    <div class=”price”>’.$price.’ ‘.$data[‘store’].'</div>
    <div class=”price_monthly”></div>

    ‘.$CORE->_e(array(‘checkout’,’51’)).’

    </td>

    </tr>’;
    $row ++;

    } // END TABLE
    [/code]

    Attachments:
    You must be logged in to view attached files.
  • Mark Fail
    Mark Fail
    Super Guru 13,013 points
    April 14, 2015 at 5:54 am

    put this where you want to be added

    [code title=””]get_post_meta($data[‘ID’],’price_monthly’,true)
    [/code]

  • Maik
    Maik
    Newbie 4 points
    April 25, 2015 at 8:59 am

    thx mark…
    I’ve added your example and

    [code title=””]$dataArray[$i][‘price_monthly’] = $price_monthly;[/code]
    [code title=””] $dataArray[$i][‘price_monthly’] = $db_product[‘price_monthly’];[/code]
    [code title=””]<div class=”price_monthly”>’.$data[‘price_monthly’].'</div>[/code]
    [code title=””]$dataArray[$i][‘price_monthly’] = get_post_meta($post->ID,’price_monthly’,true);[/code]

  • Inayat
    Inayat
    Newbie 30 points
    June 6, 2015 at 4:57 pm

    Salaam Malik

    Can i have your email add if you dont mind
    i need your help for my website http://www.pricereview.co.za
    i want to import products and want to update something in comparison table ..

Viewing 4 posts - 1 through 4 (of 4 total)

New Business Themes for WordPress 2020

Start your new website today!

View Business Themes