Advertisement:

Author Topic: Expired Listing  (Read 2922 times)

Abhi

  • Jr. Member
  • **
  • Posts: 78
  • Love what you do :)
Expired Listing
« on: May 06, 2015, 01:26:16 pm »
Hi My Idea is to create a clone of manage listing and show only the ads which are expired so it would be easy for admin so it would be easy to manage for admin to block or delete the ad
My page URL is  page=items&action=items_expired  this and it is right now showing same page as manage listing i want ItemsDataTable() function to be modified and show only expired ads  please any help would be very much help for me

Aficionado

  • Guest
Re: Expired Listing
« Reply #1 on: May 06, 2015, 03:31:43 pm »
Hi My Idea is to create a clone of manage listing and show only the ads which are expired so it would be easy for admin so it would be easy to manage for admin to block or delete the ad
My page URL is  page=items&action=items_expired  this and it is right now showing same page as manage listing i want ItemsDataTable() function to be modified and show only expired ads  please any help would be very much help for me

Not sure what you trying to say. Expired ads are already blocked and a plugin to clear expired ads or renew them, is already available. Search for  "Renew Ads plugin".


Abhi

  • Jr. Member
  • **
  • Posts: 78
  • Love what you do :)
Re: Expired Listing
« Reply #2 on: May 23, 2015, 09:08:21 am »
actually i wanted a screen in admin to show all expired ads like how we show all ads in manage listing so was looking for that type of solution thanks

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Expired Listing
« Reply #3 on: May 23, 2015, 03:13:37 pm »
I think the filter in Admin should be used for this ie. add a filter to show only expired items and voila.....

Regards,
Eric

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Expired Listing
« Reply #4 on: May 23, 2015, 05:26:48 pm »
I remember I wanted this myself as well in Admin overview so I decided to look into this.

To enable filtering on 'Expired' items you need to change two core files!
If you're interested you can make the following CORE changes (remember this thread in case your core files get overwritten with next update):

File1: /oc-admin/themes/modern/items/index.php
Paste the following code on line 280 right after the "form-row" of "b_spam" html:
Code: [Select]
<!-- By SmaRTeY - 23-05-2015: Added option for filtering expired items in Admin -->
<div class="form-row">
        <div class="form-label">
               <?php _e('Expired'); ?>
        </div>
        <div class="form-controls">
               <select id="b_expired" name="b_expired">
                     <option value="" <?php echo ( (Params::getParam('b_expired') == '') ? 'selected="selected"' '' )?>><?php _e('Choose an option'); ?></option>
                     <option value="1" <?php echo ( (Params::getParam('b_expired') == '1') ? 'selected="selected"' '' )?>><?php _e('ON'); ?></option>
                     <option value="0" <?php echo ( (Params::getParam('b_expired') == '0') ? 'selected="selected"' '' )?>><?php _e('OFF'); ?></option>
               </select>
        </div>
</div>

File2: /oc-includes/osclass/classes/datatables/ItemsDataTable.php
On line 465 you should see the end "}" of the b_spam routine, after this code paste the following code to create the filter:
Code: [Select]
//By SmaRTeY - 23-05-2015 Adding filter for expired items in Admin
if($k == 'b_expired' && $v != '') {
      $this->mSearch->addItemConditions(DB_TABLE_PREFIX.'t_item.dt_expiration < now()');
      $this->withFilters = true;
}

Make sure this added code is pasted between the 'b_spam' and the 'user' routines.

Okay, with these changes save both files, make sure your cache is empty and enjoy your new filter in Admin on Expired Items  ;)


Regards,
Eric

cartagena68

  • issues
  • Hero Member
  • *
  • Posts: 1198
Re: Expired Listing
« Reply #5 on: May 23, 2015, 05:48:32 pm »
HI,
you can click on  "expiration date" to sort the ads

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Expired Listing
« Reply #6 on: May 23, 2015, 05:54:03 pm »
Correct but it's not the same as filtering so you don't see the nr. of expired items in one go  8)

(I agree almost similar effect but I like filter better, should be added in core imo since it is such a simple useful addition and the 'hard work' is already done) ;)

Helpto

  • Newbie
  • *
  • Posts: 45
Re: Expired Listing
« Reply #7 on: May 24, 2015, 02:23:58 am »
Thank you @SmaRTeY

It is working fine


Regards

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Expired Listing
« Reply #8 on: May 24, 2015, 04:27:37 pm »
You're welcome Helpto, thanks for the appreciation  ;)