PhotoPost Photo Gallery Sales PhotoPost Sales Toll Free Phone Number
Mon-Fri 9am-4pm EST
  PhotoPost Photo Sharing Photo Gallery    Visualize community tm
| | | | | | | | |

Go Back   PhotoPost Community > PhotoPost Support > PhotoPost Classifieds Support > Classifieds How do I...?

Classifieds How do I...? Wondering how to do something in Classifieds?

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old April 19th, 2011, 09:28 PM   #1 (permalink)
Member
Verified Customer
 
Join Date: Jun 2005
Posts: 197
Ads Don't Expire?

I have all my ads set to expire in 30 days, what is the process that is suppose to take place? Do they auto delete? How can I have it so that expired ads do not show?

You can see in this link that one ad should be gone.

U-Car - Local Race Chat Classifieds

Thanks
RaceJunkie is offline   Reply With Quote
Old April 19th, 2011, 09:42 PM   #2 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
Cron Job: sendnotice.php

As long as you run the cron things should expire and I see you have done that now
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old May 28th, 2011, 01:25 PM   #3 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
I'm having this same issue.

If I run sendnotice.php the stats table doesn't update.
values are set for lastupdate and crontupdate, they just don't update when i run sendnotice.php

Also, if I try to run cron.php I get:
Notice: Undefined variable: Globals in /www/sites/www.domain.com/files/html/classifieds/cron.php on line 24 Notice: Undefined variable: Globals in /www/sites/www.domain.com/files/html/classifieds/cron.php on line 28 Fatal error: Call to undefined function ppmysql_query() in /www/sites/www.domain.com/files/html/classifieds/cron.php on line 29
h2ojunkie is offline   Reply With Quote
Old May 28th, 2011, 02:06 PM   #4 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
You can not run cron.php in a browser window thats not how its written. That is an inline footer cron which can be turned on.

If you run sendnotice.php expired ads will expire. That has nothing to do with the stats table since obviously nothing has been sold.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old May 30th, 2011, 02:57 PM   #5 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
Quote:
Originally Posted by Chuck S View Post
You can not run cron.php in a browser window thats not how its written. That is an inline footer cron which can be turned on.

If you run sendnotice.php expired ads will expire. That has nothing to do with the stats table since obviously nothing has been sold.
What do I need to do to test where the problem is?
h2ojunkie is offline   Reply With Quote
Old May 30th, 2011, 05:16 PM   #6 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
I am not really sure you have a problem. You have two totally separate posts here both of which I have answered. As long as you setup your server cron task ads will expire. stats are only updated when an ad is actually sold or auction ends never just on a standard expiration of an ad.

So based on my answers what is your issue?
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 2nd, 2011, 08:35 AM   #7 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
The issue I'm having is running the admin based Cron Script (instead of setting up a cron job) the system is sending out expiration emails continuously to users.

I haven't tested using a normal cron job to see if I have the same problem.

This started when I upgraded to the 4.X series. Previous to that I ran a normal cronjob. When I seen the option to run the cron script instead, the system began sending out the same email repeatedly.
h2ojunkie is offline   Reply With Quote
Old June 2nd, 2011, 09:55 AM   #8 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
Try running your upgrade script and selecting the last couple upgrades sounds to me like you missed an upgrade. One of the upgrades specifically altered the stats table which holds the last time the cron was done. Your probally missing your stats table insert. You can also manually check the stats table using phpmyadmin and make sure an insert exists with id 1.

Like I have said in other threads on this issue that is what I have found.

The code is very explicit in the file

Code:
Content visible to verified customers only.
If the time difference between when the script is ran and the lastupdate field in the stats table is greater than a day then an email is sent. If your getting continuous emails then your stats table has an issue.

I just tried looking at your site but your classifieds is broken.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 3rd, 2011, 07:54 PM   #9 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
Weird. I'm not sure why the classifieds were broke for you. I haven't had any reports of problems with them. The site was down yesterday for an hour or so, but that was in the afternoon.

I did check my stats table, and I do have a record with ID of 1

I'll turn the cron script back on again in admin and see if it was somehow just a weird fluke.

Is there any possible way that on a high traffic site, the cron script could be triggered by multiple users viewing the classifieds before the stats table has a chance to update?
h2ojunkie is offline   Reply With Quote
Old June 3rd, 2011, 07:57 PM   #10 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
Yeah I am simply saying if your lastupdate field is a valid number for when it was last checked and updates and it is more than one day from the time right now the last time you ran it an email can not be sent. Thats an absolute as I posted the code above. Its a simple if clause that only sends a renewal reminder once a day.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 4th, 2011, 08:43 PM   #11 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
I turned the cronscript back on and monitored it.

I started getting the 3 day ad expiration email roughly every 30 minutes.

During this time I monitored the stats table. Both the last update field and the cronupdate field were both updating each time the cronscript ran.

So I'm not sure what to tell you. It's clearly updating record ID 1 in the stats table, but I'm also clearly getting an email roughly every 30 minutes.
h2ojunkie is offline   Reply With Quote
Old June 5th, 2011, 07:23 AM   #12 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
You can send me ftp snd admin access to look at your file and try and debug your issue but the code I clearly posted above right from the sendnotice.php file. An email can only sent once a day.

Code:
Content visible to verified customers only.
This is what is known as an absolute. We are dealing with basic math here. $today say lets use an example is 1307280000 now say the cron ran 15mins ago and your stats table has the unixtimestamp value of 1307279100 so if we do the math indicated the $timediff variable is 900 therefore the if clause is not valid and the email portion which is inside is never runs. It can only run when the time difference is greater than a day which is what I said earlier.

If you are getting constant emails you must have an issue with the stats table or your server and the time.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 5th, 2011, 10:26 AM   #13 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
See here is something I would do and you can do it if you want and tell me the results

You see the code above. Right above the if clause at the bottom of sendnotice.php insert a line like this

Code:
Content visible to verified customers only.
Save those changes and run sendnotice.php. Post here the resulted printed line and we can decipher the math together.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 6th, 2011, 03:38 AM   #14 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
Here you go. I haven't had the cron running since the last time I posted in this thread on the 4th. So the Last Upload time is about when I disabled the cronscript.

There were several pages of results, so I just grabbed a random assortment of a few of them and truncated the email addresses for user privacy.

If you need more than that, I can upload an attachment of the full list.

From what I can see, the time stamps are correct.

I only know the basics in PHP. I'm not seeing any script warnings or errors when I run sendnotice.php but is there any chance this problem could be related to the version of PHP I'm running (PHP Version 5.3.3-7+squeeze1).

However, I do get this warning on occasion from the advanced search:

Warning: trim() expects parameter 1 to be string, array given in /www/sites/mysite/files/html/classifieds/pp-inc.php on line 41

I only mention the warning because pp-inc.php is also included in sendnotice.php

Here are the results of the print statement you asked for:
Code:
Content visible to verified customers only.
Then I ran the script a few minutes later and i get this:
Code:
Content visible to verified customers only.
So the "if" statement is evaluating correctly and only allowing it to proceeded sending the notices once every 24 hours, so the problem has to be later in the script, or more likely the problem is in cron.php and how that evaluates to see if it's been 24 hours since the last updates were sent out.

This is what I have in my sendnotice.php

This is where my beginner PHP skills get fuzzy. I can see select statement is only selecting ads that will expire in less than 3 days. But I don't understand what part of the code that follows is forcing the script to only email them once per day, instead of every time the script runs.

Code:
Content visible to verified customers only.
The cron.php cronscript appears to be running roughly every 30 minutes (give or take depending on when someone loads a page to trigger it.

What I don't understand is where in the script does it tell it NOT to send an email to someone that it just sent the email to 30 minutes ago.

Here is what I have for cron.php:
Code:
Content visible to verified customers only.
However, in admin settings, $Globals['crontime'] is set to 1440, which should be 24 hours in minutes per the instructions
"Number of minutes to run cron task?"

Could that be the entire cause of the problem right there? By any chance is it a typo where it says to set "number of minutes" and in reality that should be set to 86400 in second to limit that section of cron.php to run only once per 24 hours?

I didn't want to change the setting, as I'm sure that same setting is used elsewhere for auctions and other things that require running more often than once per day.

Maybe just the IF portion of the part of the cron.php script that sends the 3 day notices needs to be modified to convert the minutes to seconds with something like:

Original if statement with crontime in minutes
Code:
Content visible to verified customers only.
Modified to convert the crontime value to seconds
Code:
Content visible to verified customers only.
Thereby forcing the cron to only send the 3 day emails once per day?

Am I on the right track?


Thanks for the help debugging this. I'm sure it will turn out to be something quite silly once we find it.
h2ojunkie is offline   Reply With Quote
Old June 6th, 2011, 07:54 AM   #15 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
You do not need to modify anything in the cron.php file

The cron statement in admin should be in seconds not minutes and you simply put 86399 if you want it to send email once a day.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Old June 7th, 2011, 12:04 PM   #16 (permalink)
Member
Verified Customer
 
Join Date: Jan 2005
Posts: 46
OK, sounds good.

I would suggest updating the language file for admincp to say seconds instead of minutes.

That will avoid having to go through this with someone else next time.

Thanks for the help.
h2ojunkie is offline   Reply With Quote
Old June 7th, 2011, 12:26 PM   #17 (permalink)
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 68,069
Actually its alot easier if crontime simply uses this

Code:
Content visible to verified customers only.
The only place really I have to use crontime variable is in the printfooter function to know when to include cron.php so you can run it every 2 seconds doesnt matter what is in admin as long as the line in cron.php is as posted above emails would only be sent once a day.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I expire ads? Amedeus Classifieds How do I...? 12 December 9th, 2007 05:52 PM
ads never expire rcsmith01 Classifieds How do I...? 1 June 25th, 2007 07:58 PM
Ads don't expire... PanamaRed Classifieds Bug Reports 10 May 16th, 2007 03:09 PM
Ads will not expire? CrimsonGT Classifieds How do I...? 3 September 18th, 2006 08:40 AM
How do ads expire? kraftworkz Before You Buy 1 October 30th, 2004 08:08 PM


All times are GMT -5. The time now is 07:08 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0