+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: limit the number of free ads at any one time ?

  1. #1
    Guru
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    2,028

    limit the number of free ads at any one time ?

    I understand that in free ads it asks for number of free ads before paying / but this is for total ads and once used it is used, but can i edit the system to allow the number given to represent the number of free ads at any one time not total time.

    for example if I set it to say 10 then it would allow them to have up to 10 free ads at any one time, from there they would need to go paid / or if they wanted to they could delete one of the free ads and then add another free ad, and they could do this forever and a day so long as they never exceeded the free allocations set.
    Getting Started or Starting Over with Your Classified Site? then Get Ready Set Fly V 4.7.1 > quietSecrets.net

  2. #2
    Hi , You have to add some valitacion to add_listing.inc.php around line 645 is this block of code:
    if ( $rlListings -> create( $plan_info, $data, $category_fields ) )
    {
    $listing_id = $rlListings -> id;
    $_SESSION['add_listing']['listing_id'] = $listing_id;

    $rlHook -> load('afterListingCreate');

    /* tmp category controller */
    if ( $_SESSION['add_listing']['tmp_id'] == $_SESSION['add_listing']['tmp_category_id'] )
    {
    $rlDb -> query("UPDATE `". RL_DBPREFIX ."tmp_categories` SET `Account_ID` = '{$account_info['ID']}' WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
    }
    else
    {
    $rlDb -> query("DELETE FROM `". RL_DBPREFIX ."tmp_categories` WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
    }
    }
    I modified this if $plan_info['price'] > 0 I continue normal, if not I query for free listings with days published < 365 on the logued Account['ID']. this is the code modified:

    //chk mod (verify if price > 0)
    if($plan_info['price'] > '0') {
    //end chk mod
    $valid = true;

    if ( $rlListings -> create( $plan_info, $data, $category_fields ) )
    {
    $listing_id = $rlListings -> id;
    $_SESSION['add_listing']['listing_id'] = $listing_id;

    $rlHook -> load('afterListingCreate');

    /* tmp category controller */
    if ( $_SESSION['add_listing']['tmp_id'] == $_SESSION['add_listing']['tmp_category_id'] )
    {
    $rlDb -> query("UPDATE `". RL_DBPREFIX ."tmp_categories` SET `Account_ID` = '{$account_info['ID']}' WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
    }
    else
    {
    $rlDb -> query("DELETE FROM `". RL_DBPREFIX ."tmp_categories` WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
    }
    }

    //chk mod
    } else {

    $listings = $rlDb -> getAll("SELECT `list`.`ID`, DATEDIFF(NOW(), `list`.`Pay_date`) AS `days_published` FROM `mpt_listings` AS `list` INNER JOIN `mpt_listing_plans` AS `plan` ON `list`.`Plan_ID` = `plan`.`ID` WHERE `list`.`Account_ID` = '".$account_info['ID']."' AND `plan`.`Price` = '0' AND (DATEDIFF(NOW(), `list`.`Pay_date`) <= '365') AND `list`.`Status` = 'Active' ");
    //var_dump($listings);

    if(empty($listings)) {
    $valid = true;
    if ( $rlListings -> create( $plan_info, $data, $category_fields ) )
    {
    $listing_id = $rlListings -> id;
    $_SESSION['add_listing']['listing_id'] = $listing_id;

    $rlHook -> load('afterListingCreate');

    /* tmp category controller */
    if ( $_SESSION['add_listing']['tmp_id'] == $_SESSION['add_listing']['tmp_category_id'] )
    {
    $rlDb -> query("UPDATE `". RL_DBPREFIX ."tmp_categories` SET `Account_ID` = '{$account_info['ID']}' WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
    }
    else
    {
    $rlDb -> query("DELETE FROM `". RL_DBPREFIX ."tmp_categories` WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
    }
    }
    } else {
    $valid = false;
    $errors[] = $lang['free_plan_validation'];
    $rlSmarty -> assign_by_ref('errors', $errors);
    }
    }
    //end chk mod
    }

    //chk mod (validation)
    if($valid) {
    //end chk mod
    /* redirect to related controller */
    $redirect = SEO_BASE;
    $redirect .= $config['mod_rewrite'] ? $page_info['Path'] .'/'. $category['Path'] .'/'. $next_step['path'] .'.html' : '?page='. $page_info['Path'] .'&id='. $category['ID'] .'&step=' .$next_step['path'];
    $reefless -> redirect( null, $redirect );
    //chk mod (validation)
    }
    //end chk mod
    Hi hope this could help you.

  3. #3
    Guru
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    2,028
    really appreciated, thank you
    Getting Started or Starting Over with Your Classified Site? then Get Ready Set Fly V 4.7.1 > quietSecrets.net

  4. #4
    Senior Member
    Join Date
    May 2013
    Posts
    185
    This is exactly what I am looking for but I am not very technical. Could you please explain it simpler?

  5. #5
    Guru
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    2,028
    Quote Originally Posted by Kemoid Wilson View Post
    This is exactly what I am looking for but I am not very technical. Could you please explain it simpler?
    Kemoid, for this I have just applied a limit to the number of free ads that people can have and restricted this to 52 ( in my case or an average of one free listing / upgrade a week ) and i have set up a yearly listing plan and will create a new listing plan for 52 free ads each year as a way to work around this.

    There is a small error in the system where it claims hack detected and I have written in fr some support on this. http://www.flynax.com/forum/showthre...=hack+detected
    Getting Started or Starting Over with Your Classified Site? then Get Ready Set Fly V 4.7.1 > quietSecrets.net

  6. #6
    Senior Member
    Join Date
    May 2013
    Posts
    185
    Did you fix the hack error? If yes can you please explain in details which files to edit on my server to get this to work.

  7. #7
    Guru
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    2,028
    Quote Originally Posted by Kemoid Wilson View Post
    Did you fix the hack error? If yes can you please explain in details which files to edit on my server to get this to work.
    No not at this stage I have lodged a ticket and am awaiting reply from them.
    Getting Started or Starting Over with Your Classified Site? then Get Ready Set Fly V 4.7.1 > quietSecrets.net

  8. #8
    Senior Member
    Join Date
    May 2013
    Posts
    185
    Did you get this problem fix?

  9. #9
    Guru
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    2,028
    We are still working on it and I will report back here once it has been done.
    Getting Started or Starting Over with Your Classified Site? then Get Ready Set Fly V 4.7.1 > quietSecrets.net

  10. #10
    Guru
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    2,028
    http://www.screenr.com/5USH

    For those with a hack problem try looking at this, from what i can see if you have edited the number of free updates and downsized it like i have done from 90 to 52 the number shown in the Plan Using section of your admin panel is higher than the current allocated allowed free listings.

    for example I had a number of 55 as the number remaining > higher than the now allocated 52, so this ran an error / caused the hack detected error, now even if I set it to 52 it will show an error as one must already exist, so the number must be below your setting to avoid the error.

    See video attached.

+ Reply to Thread