Support Forums - Classified Ads Script Osclass

General osclass questions => General discussion => Topic started by: dsf on May 06, 2021, 09:18:38 AM

Title: Renew feature
Post by: dsf on May 06, 2021, 09:18:38 AM
Hello.

Last weekend i upgraded from 3.9 to 4.4, all went well. Great update, i must say.

I have one issue. It seems that no renew email is send out. To test this, i created a demo account, made a short period category and waited. Until today, i got no email. While the ad expires on 9th and i have set it to email 7 days before, i got nothing.

CRON runs great, no issues there.
 
Is there a way to LOG each renew email send or some info about the renew function when run? Or debug this somehow?

Thanks
Title: Re: Renew feature
Post by: MB Themes on May 06, 2021, 02:00:59 PM
Are you using built-in osclass solution? Do you have mail template created?
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 03:46:32 PM
Hello.

Just got the email to renew!!.

Still i can't find a way to renew it.

Yes i use the build in function. NO i have nothing created. If there any guide on what i must do?

Many thanks !
Title: Re: Renew feature
Post by: MB Themes on May 06, 2021, 03:58:57 PM
@dsf
Basically you must have email template created I think. If you check installation files.
Code: [Select]
INSERT INTO /*TABLE_PREFIX*/t_pages (pk_i_id, s_internal_name, b_indelible, dt_pub_date) VALUES (22, 'email_warn_expiration', 1, NOW() );
INSERT INTO /*TABLE_PREFIX*/t_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (22, 'en_US', '{WEB_TITLE} - Your ad is about to expire', '<p>Hi {USER_NAME},</p><p>Your listing <a href="{ITEM_URL}">{ITEM_TITLE}</a> is about to expire at {WEB_LINK}.');

/*TABLE_PREFIX*/ Should be changed to your prefix (in config.php) and run on database.
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 04:03:49 PM
What i have is:


email_warn_expiration    {WEB_TITLE} - Your ad is about to expire


If you mean that, yes i have it. But HOW do i renew?
Title: Re: Renew feature
Post by: MB Themes on May 06, 2021, 04:14:39 PM
@dsf
In user account, check sigma theme for reference
Code: [Select]
            <?php if(osc_item_can_renew()) { ?>
              <a href="<?php echo osc_item_renew_url();?>" ><?php _e('Renew''sigma'); ?></a>
            <?php ?>
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 04:22:04 PM
ok, does the link in MY ACCOUNT appears AFTER the expiration date or when the email is send to the user?

I mean if the email is sent 2 days before the expiration, when that link is appearing?

Or it is there ALWAYS? because right now i seen no such option with Sigma.
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 04:36:41 PM
Ok, i see this is an issue with OsclassWizards theme i use. With Sigma it shows ok.

I will see if i can modify our theme, to work with this, following Sigma example. I'm not a coder, but i think i can do that.

If not, we will see ..

many thanks
Title: Re: Renew feature
Post by: MB Themes on May 06, 2021, 04:36:55 PM
@dsf
Listing can be renewed once it is expired.
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 06:36:50 PM
I was able to resolve this by looking at the Sigma example you told me to.

MANY thanks, appreciated.
Title: Re: Renew feature
Post by: MB Themes on May 06, 2021, 06:45:57 PM
No problem, do you mean adding link to user items right?
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 07:05:24 PM
No problem, do you mean adding link to user items right?

Yes. adding a Renew, next to Edit Item and Delete.

I was able to modify my theme, accordingly to Sigma code. With a little change since the files are named differently.
Title: Re: Renew feature
Post by: MB Themes on May 06, 2021, 07:12:55 PM
Cool, thanks for details  :)
Title: Re: Renew feature
Post by: dsf on May 06, 2021, 07:14:27 PM
If anyone is interested and uses OsclassWizard theme, here is how to ADD Renew:

Add to loop-user-list.php file the following code, around line 190 (approximatelly since i have many changes done myself to the code):

Code: [Select]

<?php if(osc_item_can_renew()) { ?>
<span>|</span>
<a href="<?php echo osc_item_renew_url();?>" ><?php _e('Renew'OSCLASSWIZARDS_THEME_FOLDER); ?></a>
<?php ?>

Also do this to the loop-user-grid.php.
Title: Re: Renew feature
Post by: dsf on May 08, 2021, 04:55:44 PM
Hello.

I was informed by some users that the Renew option leads to a 404 page. I was able to verify this, while Edit and Delete work very well.

Then i switched from my Theme to the default of yours. And same thing happened.

ANY ideas why a 404 is appearing? In my stage test it worked right. And the "link" of Renew looks right.

ANY ideas or hints would help on what to look for.

Many thanks
Title: Re: Renew feature
Post by: MB Themes on May 09, 2021, 11:47:46 AM
@dsf
If you upgraded, you must go to permalinks settings in oc-admin and simply re-save them.
Make sure that all links looks good.
Title: Re: Renew feature
Post by: dsf on May 09, 2021, 12:11:50 PM
@dsf
If you upgraded, you must go to permalinks settings in oc-admin and simply re-save them.
Make sure that all links looks good.

Well i did and also Delete and Edit permalinks show and work ok, so it is not a permalinks issue.

Renew and PHP 8 was a major reason i upgraded (because of short ads duration i use, 7-30 days), i will try to figure this out ...
Title: Re: Renew feature
Post by: MB Themes on May 09, 2021, 02:30:31 PM
@dsf
If you see 404, it is not going to be related to PHP
Title: Re: Renew feature
Post by: dsf on May 09, 2021, 02:34:56 PM
@dsf
If you see 404, it is not going to be related to PHP

Got it, thanks.

It is not easy to test the Renew feature (as you already know). I will have to wait at least a day (or two) to see and test.

If i find something related to 4.4 i will update.


Title: Re: Renew feature
Post by: MB Themes on May 09, 2021, 02:36:58 PM
@dsf
As I mentioned before, permalinks should be re-saved. Everything will look ok there, but once you press save button, it is going to generate something like string/key osclass used for links decoding.
Title: Re: Renew feature
Post by: dsf on May 09, 2021, 03:34:36 PM
@dsf
As I mentioned before, permalinks should be re-saved. Everything will look ok there, but once you press save button, it is going to generate something like string/key osclass used for links decoding.


My mistake. Indeed it works after saving permalinks.

Sorry for the trouble.
Title: Re: Renew feature
Post by: MB Themes on May 09, 2021, 06:41:57 PM
Cool
Title: Re: Renew feature
Post by: dsf on May 10, 2021, 08:07:38 PM
Am asking much but is there any way for the Admin to Renew an expired ad?

I mean when you have Delete, Deactivate, Mark as etc etc, can i somehow put also Renew in there?

Thanks
Title: Re: Renew feature
Post by: MB Themes on May 11, 2021, 08:32:02 PM
Not for now, will consider thst.
Title: Re: Renew feature
Post by: dsf on May 11, 2021, 09:06:49 PM
Not for now, will consider thst.

Thank you !
Title: Re: Renew feature
Post by: dsf on May 23, 2021, 01:28:12 AM
It seems that the Renew doesn't work well. Not always at least. I have tried to find out under what circumstances it doesn't (replicate it) but failed. Sometimes it works, some not.

And it is NOT an issue with email, since Cpanel track delivery doesn't show ANY failed emails. The emails are just NOT sent. Neither a CRON issue.

Please take the time to check this when you can.

Thanks
Title: Re: Renew feature
Post by: MB Themes on May 25, 2021, 07:47:43 AM
@dsf
So only emails are not being sent?
Title: Re: Renew feature
Post by: dsf on May 25, 2021, 10:44:56 AM
@dsf
So only emails are not being sent?

Yes but sometimes. Not always and i'm unable to locate the source of the issue.
Title: Re: Renew feature
Post by: MB Themes on May 25, 2021, 11:00:18 AM
@dsf
What is name of email template?
Title: Re: Renew feature
Post by: dsf on May 25, 2021, 11:02:53 AM
@dsf
What is name of email template?


email_warn_expiration
Title: Re: Renew feature
Post by: MB Themes on May 25, 2021, 11:36:21 AM
@dsf
Found this code in cron, not sure if it is ok to be in hourly cron
Code: [Select]
    if(is_numeric(osc_warn_expiration()) && osc_warn_expiration()>0) {
      $items = Item::newInstance()->findByHourExpiration(24*osc_warn_expiration());
      foreach($items as $item) {
        osc_run_hook('hook_email_warn_expiration', $item);
      }
    }
Title: Re: Renew feature
Post by: dsf on May 25, 2021, 11:45:46 AM
You mean the Hourly calculations can sometimes be off? Is that what you mean? It should be Daily?
Title: Re: Renew feature
Post by: MB Themes on May 26, 2021, 02:42:44 PM
@dsf
I never studied this part of code and how it works, maybe will look on it in 4.5
Title: Re: Renew feature
Post by: dsf on June 01, 2021, 07:03:32 PM
Does anybody know if the Admin account gets an email when an ad is Renewed?