Advertisement:

Author Topic: (SOLVED) Put 'Make premium' in the same line of 'Edit', 'Delete','Activate'  (Read 982 times)

Mundianuncios.net

  • Newbie
  • *
  • Posts: 14
Hellooo :)

I've working with the user panel and I don't want a lot of confusing functions on the left side for my users. That's the reason why I'm putting all together.

Look at that image:



I've achieved to add the "Destacar" (make premium) function at the same line of the item, using the following code:

Code: [Select]
while(osc_has_items())
{
$_delete = '<a class="delete"
onclick="javascript:return confirm(\'' . osc_esc_js(__('This action can not be undone. Are you sure you want to continue?', 'minimalist')) . '\')"
href="' . osc_item_delete_url() . '" >' . __('Delete', 'minimalist') . '</a>';

echo '<tr class="' . ($_row++ % 2 == 0 ? 'even' : 'odd') . '">
<td><a href="' . osc_item_url() . '">' . osc_item_title() . '</a></td>
<td>' . osc_format_date(osc_item_pub_date()) . '</td>
' . (osc_price_enabled_at_items() ? '<td>' . osc_format_price(osc_item_price()) . '</td>' : '') . '
<td class="options">
<strong><a href="' . osc_item_edit_url() . '">' . __("Editar", 'minimalist') . '</a></strong> |
' . $_delete . '
' . (osc_item_is_inactive() ? ' | <a href="' . osc_item_activate_url() . '" >' . __('Activate', 'minimalist') . '</a>' : '') . '
' . (osc_item_is_premium(osc_item_id()) ? ' | <a href="' . osc_route_url('payment-premium', array('itemId' => osc_item_id())) . '" >' . __("Destacar", 'payment') . '</a>' : '') . '
</td>
</tr>';
}

The important part is
Code: [Select]
' . (osc_item_is_premium(osc_item_id()) ? ' | <a href="' . osc_route_url('payment-premium', array('itemId' => osc_item_id())) . '" >' . __("Destacar", 'payment') . '</a>' : '') . '
I've created the "osc_item_is_premium(osc_item_id())" because I don't know what to put in there. The matter is that it works. The problem comes when you make premium one ad. That ad doesn't tells "Already premium!" instead of "Make Premium".

The code of the original plugin is this:

Code: [Select]
                            <?php if(ModelPayment::newInstance()->premiumFeeIsPaid(osc_item_id())) { ?>
                                <strong><?php _e('Already premium!''payment'); ?></strong>
                            <?php } else { ?>
                                <strong><a href="<?php echo osc_route_url('payment-premium', array('itemId' => osc_item_id())); ?>"><?php _e("Destacar"'payment'); ?></a></strong>
                            <?php }; ?>

How can I translate that format in the other format? How can I show the user if the ad is already premium?

Thank you very much :)
« Last Edit: June 11, 2014, 08:07:44 pm by Mundianuncios.net »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Put 'Make premium' in the same line of 'Edit', 'Delete','Activate'
« Reply #1 on: June 11, 2014, 08:01:02 pm »
Hi,

I think replacing this line would do the trick:

Code: [Select]
' . (osc_item_is_premium(osc_item_id()) ? ' | <a href="' . osc_route_url('payment-premium', array('itemId' => osc_item_id())) . '" >' . __("Destacar", 'payment') . '</a>' : '') . '
with

' . (!osc_item_is_premium(osc_item_id()) ? ' | <a href="' . osc_route_url('payment-premium', array('itemId' => osc_item_id())) . '" >' . __("Destacar", 'payment') . '</a>' : ' | ' . _e('Already premium!', 'payment')) . '

Regards

Mundianuncios.net

  • Newbie
  • *
  • Posts: 14
Re: Put 'Make premium' in the same line of 'Edit', 'Delete','Activate'
« Reply #2 on: June 11, 2014, 08:07:13 pm »
While I was waiting I've tried that one and it works:

Code: [Select]
' . (osc_item_is_premium(osc_item_id()) ? '| Destacado' : ' | <a href="' . osc_route_url('payment-premium', array('itemId' => osc_item_id())) . '" >' . __("Destacar", 'payment') . '</a>') . '
Thanks for your answer, teseo! ;)