Renewal question

Discussion in 'Technical Support' started by hel68c, Mar 22, 2009.

Thread Status:
Not open for further replies.
  1. hel68c Customer

    How does this script manage sending out the Email X number of days before the ad expires?

    how the system know when to send the signal to execute this script?
  2. Eric Barnes Guest

    It uses the file includes/cron.php which determines when emails should be sent and when listings should be deleted.

    It knows by using the current date and subtracting x number of days to get ones that need to be emailed.
  3. hel68c Customer

    As I understand in the script cron.php, it compares the expiration date of the ads less the number of days to expire with today date and sends an e-mail

    It executes this script once a day.

    So the customer receives a single email once for renewal.

    Is this the way it works?

    I ask this information because I work with two languages on my site and I wonder how I have to tell him to send an email in a specific language.
  4. Eric Barnes Guest

    Yes. It runs once a day and if it emails them then it updates the listing table and marks that listing that it has been sent.

    I am not sure how you could determine which language it was written in. Maybe use the category.
  5. hel68c Customer

    I noticed that the renewal notification is not reset.

    The field notified remain to Y.

    Do you have any advise?
  6. hel68c Customer

    I'm looking at the code and I noticed that the function that puts notified to 'N' is the function updateNotification.

    PHP:
        function updateNotification($orderid)
        {
            global 
    $db;
            
    $sSQL="UPDATE ".PREFIX."listings SET notified='N' WHERE orderID=".$orderid;
            
    $db->query($sSQL);
    echo 
    "update notification & orderid= ".$orderid;        
    I placed an echo to look at the $orderid variable and it return 773.

    This is the last order number that I did. This number does not appear in the listings of the ad. The number that appear in the field orderID in listing Table is 237 (the first order number)

    So the function can't update the listings.
  7. Eric Barnes Guest

    In your signature it shows as v4.0.8 so I would recommend downloading v4.0.9 and then replacing these template files:
    user/userbrowselistings.tpl
    renew/ - every file in this folder.
  8. hel68c Customer

    I replace the new 4.09 step1.tpl step2.tpl and userbrowselisting.tpl with the old version 4.08 and samething, the notified field can't be reset to 'N'
  9. John Snyder Staff

    Did you upgrade to 4.0.9 or just copy over those template files?
  10. hel68c Customer

    I just copy the files.

    I made too many changes to the files to copy all 4.09.
  11. John Snyder Staff

    Here is the code (4.0.9 as I don't have 4.0.8 to compare too) that sets the notification to 'Y':

    includes/cron.php
    PHP:

    $content
    ="renewal.tpl";
    $msg=$Mailer->sendMail($to$content$vars);
    if(
    $msg==TRUE)
    {
        
    $sSQL="UPDATE ".PREFIX."listings SET notified='Y' WHERE id=".$id." AND owner='".$owner."'";
        
    $db->query($sSQL);
    }
    else
    {
        
    $cronlog .= $msg."<br />";
    }
    If the email is sent the notified is then updated.

    As far as deciding on their language, you could use an extra field. Make it something like Notify me about renewal in: select box: language 1 language 2

    Then query for it in the code above and change the renewal.tpl to another language version. I think it is difficult to use 2 languages because whatever is chosen as the default will already be loaded and the use of constants make it impossible to overwrite them by the other language file.
  12. hel68c Customer

    Hi juven14,

    The code is the same.

    The problem is not set the notified to Y is set to N.

    I am not sure if I understood the process. If an ad has to be renewed, the cron.php set the field notified in the tables listing to 'Y'. If the ad is renewed, the module userrenew.php set the field notified to 'N'.

    I think my problem come from userrenew.php. But not sure.
  13. Eric Barnes Guest

    Yes your thinking is correct. When the system sends the renewal email it sets the listing to Y because the renewal has been sent.

    Then once they go to renew it updates the listing table back N because the expiration is set again.

    Also the order number remains the same from the original order. That is why it is used to update the correct listing.
  14. hel68c Customer

    I made a new fresh installation with version 4.09 and the fields notified does not change either.
  15. hel68c Customer

    I do not know if I have a server problem, but I made a new fresh installation with the new version 4.12 and the fields notified does not change either.

    Do you have the same problem?
  16. Lhotch curmudgeon

    Whats triggering cron.php?
  17. hel68c Customer

    What do you mean on my site or in general?
  18. John Snyder Staff

    Maybe this bug slipped back into the system?
    http://www.68classifieds.com/forums/project.php?issueid=99

    In Orders.php do you have this method?

    PHP:

    /**
        * Update the notification field so renewals are sent again. {@link http://www.68classifieds.com/forums/project.php?issueid=99 Issue #99} 
        *
        * @param     int $orderid The order id.
        */
        
    function updateNotification($orderid)
        {
            global 
    $db;
            
    $sSQL="UPDATE ".PREFIX."listings SET notified='N' WHERE orderID=".$orderid;
            
    $db->query($sSQL);
        }
    Also, what is the order status in the admin panel after it has been renewed? Completed, Pending Payment, etc.
  19. hel68c Customer

    Yes it's the same code.

    The status is Completed Pending approval,
  20. John Snyder Staff

    What is the value after you approve it? "N" or "Y"
Thread Status:
Not open for further replies.

Share This Page