Announcement

Collapse
No announcement yet.

How to modify tld_price.php to show * on D+H domains?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to modify tld_price.php to show * on D+H domains?

    Currently, the Domains + Hosting table (controlled by file tld_price.php) only puts an " * " beside any "promo" domains you are offering but not beside any "Domain+hosting" priced domains (which are technically promos but are not apparently labeled as that on the API (or whatever)).

    I want the table to show an " * " beside these domains+hosting prices but I can't figure it out. Been at it for over 2 hours. I can get it to do everything else BUT that lol.

    If anyone know what to modify, add or change, I'm all ears. Here's the code...

    Code:
    <?php
    if(!function_exists('__rp_price')){
    /**
     * Local helper - print the formated price by a given period
     * @param string $p The period
     * @return void
     */
        function __rp_price($price, $p){
            if (isset($price['prices'][$p][$price['store_currency']]) && $price['prices'][$p][$price['store_currency']] == '0.00')
                return __rp('FREE', 'FREE');
            //else echo isset($price['prices'][$p])?sprintf($price['currency_symbol'], $price['prices'][$p][$price['store_currency']]):"-";
            else {
                $has_promo_price = '';
                if (!empty($price['prices_register'])) {
                    $pricesArr = $price['prices_register'];
                    if (preg_match('/12$/', $p)) {
                        $has_promo_price = '*';
                    }
                } else {
                    $pricesArr = $price['prices'];
                }
                return isset($pricesArr[$p]) ? sprintf("{$price['currency_symbol']}{$has_promo_price}", $pricesArr[$p][$price['store_currency']]) : "-";
            }
        }
    }
    $show_promo_msg = false;
    ?>
    <div class="long-domain-table">
    <table class="rp-tld-price">
        <thead>
            <tr>
                <th class="rp-tld-col-first"><?php _erp('tldp_tld', 'TLD')?></th>
                <th><?php printf(__rp('tldp_year', '%d year'), 1)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 2)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 3)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 4)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 5)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 6)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 7)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 8)?></th>
                <th><?php printf(__rp('tldp_years', '%d years'), 9)?></th>
                <th class="rp-tld-col-last"><?php printf(__rp('tldp_years', '%d years'), 10)?></th>
            </tr>
        </thead>
        <tbody>
        <?php $cnt=0; foreach ($prices as $tld => $price): if($id_protect == 1 and !$tlds[$tld]['id_protect']) continue; $p = 0; $cnt++;?>
        <tr class="<?php if($cnt%2) echo 'rp-tld-row-odd'; else echo 'rp-tld-row-even'; if (array_key_exists($tld, $GLOBALS['rp_info']['domain_prices'])) echo ' rp-tld-promotional';?>">
        <td class="rp-tld-col-first"><?php if(get_option('rp_domain_names_'.$tld)) echo '<a href="'.get_permalink(get_option('rp_domain_names_'.$tld)).'">.'.$tld.'</a>'; else echo '.'.$tld; ?></td>
        <?php foreach(range(1,10) as $i):?>
    <?php
    $_price = __rp_price($price, 'period_'.($p+=12));
    if (!$show_promo_msg && preg_match('/\*/', $_price))
        $show_promo_msg = true;
    ?>
        <td<?php if ($i == 10) echo ' class="rp-tld-col-last"'?>><?php echo $_price; ?></td>
        <?php endforeach;?>
        </tr>
      
        <?php endforeach;?>
      
        </tbody>
    </table>
    <? if ($show_promo_msg) { ?>
    <small>* Price is valid for 1-year registrations only. </small>
    <? } ?>
    </div>
    Last edited by vrepub; 21-03-2016, 03:27 PM.

  • #2
    Here's a pic for some clarification for those that might find it helpful...



    I'm not offering the free domain. Instead I'm offering the special domains+hosting pricing on the 17 domains that allow it.

    I want the prices of the domains in the red circle to have a " * " next to the prices just as the promo domains below them do.

    Comment

    Working...
    X