Advertisement:

Author Topic: Help Required adding Payment Paid button to Edit Listing page  (Read 866 times)

Travelfrog

  • Jr. Member
  • **
  • Posts: 80
Help Required adding Payment Paid button to Edit Listing page
« on: February 06, 2013, 06:23:15 pm »
I understand that to make an ad free in a category with fees, you need to change 0 to 1 in payment_publish table.

This is similar to make premium option button.

I have added the button thus in oc_content/items.php

Code: [Select]
                                        if( $item['b_premium'] ) {
                                            $actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&amp;action=status_paid&amp;id=' . $item['pk_i_id'] . '&amp;value=0">' . __('Mark as unpaid') .'</a>' ;
                                        } else {
                                            $actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&amp;action=status_paid&amp;id=' . $item['pk_i_id'] . '&amp;value=1">' . __('Mark as paid') .'</a>' ;
                                        }

I have added case status_paid in oc_content/items.php

Code: [Select]
                case 'status_paid':  //status premium
                                        $id = Params::getParam('id') ;
                                        $value = Params::getParam('value') ;

                                        if (!$id)
                                            return false;

                                        $id = (int) $id;

                                        if (!is_numeric($id))
                                            return false;

                                        if (!in_array($value, array(0, 1)))
                                            return false;

                                        $mItems = new ItemActions(true);
                                       
                                        if ($mItems->premium($id, $value==1?true:false) ) {
                                            osc_add_flash_ok_message( _m('Changes have been applied'), 'admin');
                                        } else {
                                            osc_add_flash_error_message( _m('An error has occurred'), 'admin');
                                        }
                                       
                                        $this->redirectTo( $_SERVER['HTTP_REFERER'] );
                break;


Obviously this at the moment just replicates the premium button. What I want is for the button to change the value in the payments_publish table b_paid column.

What do I need to do to achieve this?

Travelfrog

  • Jr. Member
  • **
  • Posts: 80
Re: Help Required adding Payment Paid button to Edit Listing page
« Reply #1 on: February 07, 2013, 07:04:30 pm »
can anyone help?

Travelfrog

  • Jr. Member
  • **
  • Posts: 80
Re: Help Required adding Payment Paid button to Edit Listing page
« Reply #2 on: February 08, 2013, 06:15:02 pm »
Can anyone help with this?