Advertisement:

Author Topic: How to add RENEW / REFRESH / REPOST feature to OSCLASS  (Read 20674 times)

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #30 on: January 25, 2014, 03:39:24 pm »
Mmmmzzz maybe these changes interfer with their current work on 3.4 ?
But still, you could do the pull and get it lined up for next version so I don't see why devs aren't responding. Even more so since this is actually a functionality people really miss and want. The implementation is pretty simple and straightforward, imo perfect as a first means to automate the process of expiration.

@OsClass devs, please at least a response here?  ::)


Thanks byteGator!

vektor

  • Newbie
  • *
  • Posts: 2
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #31 on: January 27, 2014, 01:21:40 pm »
I get the messag "The listing can't be renewed"

serjuc11111

  • Hero Member
  • *****
  • Posts: 814
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #32 on: January 27, 2014, 04:48:55 pm »
I get the messag "The listing can't be renewed"
your listing is inactiv or not pass X days to the last repulish!

vektor

  • Newbie
  • *
  • Posts: 2
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #33 on: January 29, 2014, 10:04:39 am »
I get the messag "The listing can't be renewed"
your listing is inactiv or not pass X days to the last repulish!
this function date_diff for php 5.3, how to change for php 5.2?

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #34 on: January 29, 2014, 10:38:43 am »
Hi, Google showed me this as a possible alternative for php5.2 there will probably be other alternatives as well:

http://php.net/manual/fr/datetime.diff.php

Code:
Code: [Select]
<?php 
function date_diff($date1$date2) { 
     
$current $date1
     
$datetime2 date_create($date2); 
     
$count 0
     while(
date_create($current) < $datetime2){ 
         
$current gmdate("Y-m-d"strtotime("+1 day"strtotime($current))); 
         
$count++; 
     } 
     return 
$count
 } 

 echo (
date_diff('2010-3-9''2011-4-10')." days <br \>"); 
?>

EDIT: You can put the function in your Functions.php (theme folder). Make sure you do not copy the 'echo' line since that is only in there to show the result. You can play around with that code to see if it really works. With any luck you do not have to change anything else because the date_diff is the same name but no guarantees! ;) Make sure when your host has PHP upgraded you are remembered to disable this function again so your site will keep working.


Good luck,
Eric
« Last Edit: January 29, 2014, 12:01:38 pm by SmaRTeY »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #35 on: January 29, 2014, 12:04:03 pm »
@byteGator, would it be a lot of work trying to bundle these changes into a plugin?


Regards,
Eric

naneri

  • Newbie
  • *
  • Posts: 28
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #36 on: February 09, 2014, 11:10:18 am »
Got a mistakte:

Call to undefined function bg_sanitize_title() in C:\xampp\htdocs\osclass\oc-includes\osclass\ItemActions.php on line 87

 :(

Maybe the feature does not work on 3.1?

UPDATE:

have removed the line with bg_sanitize_title() - now it works perfectly. What did the line do?
« Last Edit: February 11, 2014, 08:57:36 am by naneri »

soymarketing

  • Newbie
  • *
  • Posts: 9
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #37 on: March 26, 2014, 10:38:31 am »
Thanks a lot for sharing with us... However, I did this step by step and nothing happened. Anyone know what could I have missed?

serjuc11111

  • Hero Member
  • *****
  • Posts: 814
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #38 on: March 27, 2014, 03:03:45 pm »
what Bytegator says are very simple and very clear!i dont know why somepeople dont try to play a little bit with code.....maybe u have osclass modifyed,like me,like others,try to adjust functions to work for your code!
if u have problem with time "after x days item can be renew" delete that line,check what function works and what not!

bytegator and me have many changes in core osclass .. that means we can't update to another version, and certainly his code / my is not working for you who use standard osclass and you want to do updates for next version!

Is preparing a major update! Have patience!

serjuc11111

  • Hero Member
  • *****
  • Posts: 814
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #39 on: March 27, 2014, 03:13:08 pm »
Thanks a lot for sharing with us... However, I did this step by step and nothing happened. Anyone know what could I have missed?
what do u mean nothing happend?

secret key is generated?
make that changes and try this in browser:
yourdomain.com/index.php?page=item&action=item_renew&id=321

ads with id=321 will be renew!
post back the result or give me acces to your code to make this to work!

tabuausada

  • Jr. Member
  • **
  • Posts: 77
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #40 on: April 18, 2014, 04:23:37 pm »
First of all many thanks for sharing this information!!! It's quite unbelievable that these features are not part of core OSCLASS yet... :(

I'm struggling to implement these ad management features but I'm facing some difficulties.

The first one relates to the fact that despite the ads are renewed I don't receive the message (osc_add_flash_ok_message...) with that information. Instead when I click "renew" I receive a "500 Internal Server Error". When I go back to the website the ad was renewed although... Any clues on what might be causing this problem and what should I do to fix it?     

The second doubt relates on how to properly update the email_warn_expiration to include a "renew" link. I've made following changes: 

im not new on this kind of programming but sometimes we meet some strange problem and ask for a solution, and in that email templates whatever i put,a link,a php code, a href etc.....will be send exactly word by word!
p.s sorry for i  waste your time but this is a forum anyway!if u have a problem with this just "log out" and let the "amateur" to fix their own bugs/problems!


hi serjuc11111,

This is my code at osclass/emails.php. May be this can give you some idea about warn_expiration email

Code: [Select]
    function fn_email_warn_expiration($aItem) {
        $itemId      = $aItem['pk_i_id'];
        $admin_email = osc_contact_email();

        View::newInstance()->_exportVariableToView('item', $aItem);
        $itemURL = osc_item_url();
        $itemURL = '<a href="'.$itemURL.'" >'.$itemURL.'</a>';
        $renew_url = osc_item_renew_url( $aItem['s_secret'], $aItem['pk_i_id'] );
        $renew_url = '<a href="'.$renew_url.'" >'.$renew_url.'</a>';

        $mPages = new Page();
        $aPage = $mPages->findByInternalName('email_warn_expiration');
        $locale = osc_current_user_locale();

        $content = array();
        if(isset($aPage['locale'][$locale]['s_title'])) {
            $content = $aPage['locale'][$locale];
        } else {
            $content = current($aPage['locale']);
        }

        $words   = array();
        $words[] = array(
            '{USER_NAME}',
            '{ITEM_TITLE}',
            '{ITEM_ID}',
            '{ITEM_EXPIRATION_DATE}',
            '{ITEM_URL}',
            '{ITEM_LINK}',
            '{RENEW_LINK}',
            '{SELLER_NAME}',
            '{SELLER_EMAIL}'
        );
        $words[] = array(
            $aItem['s_contact_name'],
            $aItem['s_title'],
            $itemId,
            $aItem['dt_expiration'],
            osc_item_url(),
            $itemURL,
            $renew_url,
            $aItem['s_contact_name'],
            $aItem['s_contact_email']
        );
        $title_email = osc_apply_filter('email_warn_expiration_title_after', osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_warn_expiration_title', $content['s_title'])), $words));
        $body_email = osc_apply_filter('email_warn_expiration_description_after', osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_warn_expiration_description', $content['s_text'])), $words));

        $emailParams = array(
            'from'      => $admin_email,
            'subject'   => $title_email,
            'to'        => $aItem['s_contact_email'],
            'to_name'   => $aItem['s_contact_name'],
            'body'      => $body_email,
            'alt_body'  => $body_email
        );
        osc_sendMail($emailParams);
    }
    osc_add_hook('hook_email_warn_expiration', 'fn_email_warn_expiration');

But I still can't figure out what I should include in the email template. serjuc11111 can you show us the html you considered for the email_warn_expiration? 

The html I'm using is the following (no idea if it will work...):

Code: [Select]
<p>Hello {USER_NAME},</p>
<p>Your ad: <a href="{ITEM_URL}">{ITEM_TITLE}</a> at {WEB_LINK} finishes in {ITEM_EXPIRATION_DATE}.</p>
<p>If you wish you can renew it <a href="{RENEW_LINK}">here</a></p>
<p>Best regards,</p>
<p>{WEB_TITLE}</p>

Please help!!!
« Last Edit: April 18, 2014, 04:42:17 pm by tabuausada »

tabuausada

  • Jr. Member
  • **
  • Posts: 77
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #41 on: April 21, 2014, 01:15:48 am »
Can someone please help especialy regarding my first doubt above?

The renewal occurs after clicking the renew link but I'm sent to an error page instead of receiving the flash message... Everything seems ok with the link in the error page: http://www.example.com/index.php?page=item&action=item_renew&id=14

What may be causing the "500 Internal Server Error"?

Quikb.com

  • Jr. Member
  • **
  • Posts: 69
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #42 on: April 22, 2014, 06:48:56 pm »
1.oc-include/osclass/itemaction.php
2.oc-include/osclass/controller/item.php
3.modern-theme/user-dashboard.php(near edit line)



Sir , Where to put these code exactly at which lines approx. it will be helpful if you write this.

Aficionado

  • Guest
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #43 on: April 22, 2014, 07:30:12 pm »
It is very SAD to see so many people looking for a way to REpost expired ads.

I hate to see people struggle with custom code, crashes and finally osclass errors and instability.

How many people shall ask for it to include it in the CORE of Osclass ? WHAT DOES IT TAKE ? I want to know.

Pitty, Osclas team doesn't listen to people that actually use and promote their application.

« Last Edit: April 22, 2014, 07:31:57 pm by Aficionado »

ZonaEu

  • Full Member
  • ***
  • Posts: 137
Re: How to add RENEW / REFRESH / REPOST feature to OSCLASS
« Reply #44 on: April 22, 2014, 08:18:05 pm »
This feature is essential and is sorely missed in the OSCLASS!
I'm with many difficulties with renewal of ads!
Many of my users have complained because the system does not have the option to renew.
Some of them are gone for the competition.
Please ... an update from osclass with this function implemented.