Loading


Advertisement:

Poll

How to change "latest listings" to "last modified listings"  

Latest Listings
1 (50%)
Modified listings
1 (50%)

Total Members Voted: 1

Author Topic: [SOLVED]How to change "latest listings" to "last modified listings"    (Read 272 times)

keiichi

  • Newbie
  • *
  • Posts: 4
Hello everyone

Is it possible to change "the latest listings" to "the last modified listings" on the front page ?

I guess the newly listed ads are using the published date but I would like it to show ads based on the last modified date instead.

I am using modern "Wizestate".

Thanks.

PS: I set a poll avobe on this topic and cannot delete it...sorry....
« Last Edit: September 20, 2017, 04:07:50 am by keiichi »

_Carlison

  • Full Member
  • ***
  • Posts: 114
Re: How to change "latest listings" to "last modified listings"  
« Reply #1 on: September 14, 2017, 02:02:26 pm »
i just give you idea for modified that, please try below code :
Find latest Listing on main.php then

1st change
Quote
  <?php if( osc_count_latest_items() == 0) { ?>
to
Quote
<?php if( osc_item_mod_date() == 0) { ?>

2nd Change

Quote
<?php if( osc_count_latest_items() == osc_max_latest_items() ) { ?>
to
Quote
<?php if( osc_item_mod_date() == osc_max_latest_items() ) { ?>


keiichi

  • Newbie
  • *
  • Posts: 4
Re: How to change "latest listings" to "last modified listings"  
« Reply #2 on: September 15, 2017, 03:52:16 am »
Thank you so much for your quick reply!!!

I changed them, but the error message "There aren't listings available at this moment" appeared...

Quote
<div class="latest_ads">
    <?php if( osc_item_mod_date() == 0) { ?>
    <p class="empty">
      <?php _e("There aren't listings available at this moment", OSCLASSWIZARDS_THEME_FOLDER); ?>
    </p>
    <?php } else { ?>
    <?php
    View::newInstance()->_exportVariableToView("listType", 'latestItems');
   osc_current_web_theme_path('loop-grid.php');
    ?>
    <?php if( osc_item_mod_date() == osc_max_latest_items() ) { ?>
    <p class="see_more_link"><a href="<?php echo osc_search_show_all_url() ; ?>"> <strong>
      <?php _e('See all listings', OSCLASSWIZARDS_THEME_FOLDER) ; ?>
      &raquo;</strong></a> </p>
    <?php } ?>
    <?php } ?>
  </div>
 

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1222
  • #Kurt_Cobain { margin-bottom: -6.5ft; }
Re: How to change "latest listings" to "last modified listings"  
« Reply #3 on: September 15, 2017, 04:31:21 am »
@keiichi
i've looked through the code and can't find any hooks or filter for this purpose, so i think you can't do this without any plugin. but maybe _CONEJO or Teseo have an idea or anyone else.



@_Carlison
do you really know what you are talking about? i don't know what do you want to achieve with your unqualified answers here, but please don't confuse the users here anymore.

to
Quote
<?php if( osc_item_mod_date() == 0) { ?>
Why should be the item modification date be zero?


to
Quote
<?php if( osc_item_mod_date() == osc_max_latest_items() ) { ?>
Why do you try to compare the single item modification date against the number of max latest listings?
« Last Edit: September 15, 2017, 04:33:40 am by Liath »

_Carlison

  • Full Member
  • ***
  • Posts: 114
Re: How to change "latest listings" to "last modified listings"  
« Reply #4 on: September 15, 2017, 09:42:14 am »
@liath

I m  not confusing others.. i just told them to try this..  by the way i m not achieving anything i just tried to help other users.. and atleast i m trying to help other one.. not like your this message : https://forums.osclass.org/general-help/upload-many-listings-with-at-once/msg155370/#msg155370
you just post unqualified message and try to confuse other and also after that post it will affected on Osclass site. coz if users will see that this can be criminal offense then how they will post listings from other sites and if they will not post any listing on their site then they cant get more listings..

teseo

  • Hero Member
  • *****
  • Posts: 5812
Re: How to change "latest listings" to "last modified listings"  
« Reply #5 on: September 15, 2017, 04:26:51 pm »
Hi,

I guess what you really want is to consider edited ads as freshly published, not to put any modified ad at the top regardless of when it was modified? ???

Regards

_Carlison

  • Full Member
  • ***
  • Posts: 114
Re: How to change "latest listings" to "last modified listings"  
« Reply #6 on: September 15, 2017, 06:18:45 pm »
@keiichi,
after using my code, please edit any ad then you can check your site. coz i am using osclasswizard theme and that code used in this theme. when i edit then it display modified listing instead latest listing.

and Mr Liath i think you are "BIG DEVELOPER"  so i dont know your language . and i have not compare anything , if you read my message then it mention replace that code not compare. and you can check any theme include bender then there are also mention below code :
Quote
<?php if( osc_count_latest_items() == osc_max_latest_items() ) { ?>
for latest listing in main.php and i just change latest to modify so MR LIATH Firstly read carefully then post anything otherwise not.


Aficionado

  • issues
  • Hero Member
  • *
  • Posts: 5103
  • Hardliner
Re: How to change "latest listings" to "last modified listings"  
« Reply #7 on: September 15, 2017, 06:53:21 pm »

and Mr Liath i think you are "BIG DEVELOPER"  so i dont know your language . and i have not compare anything , .......
 so MR LIATH Firstly read carefully then post anything otherwise not.

To be honest i also have trouble to understand your replies, here and on other topics. Not sure why i have this problem, if it is a problem of mine or you just complicate things when you reply. I thing the second.

And pls, try not to insult people in this community. Liath or any other dev doesn't need your approval or bad criticism.

 ;)

_Carlison

  • Full Member
  • ***
  • Posts: 114
Re: How to change "latest listings" to "last modified listings"  
« Reply #8 on: September 15, 2017, 07:01:00 pm »
Sorry Mr Aficionado i am not criticism of any developer but if my replies feel that so i am sorry Once again.

 just suggest here to my points only.


but this topic is not for that , so please give best solution for Mr @keiichi . coz he need your solution
« Last Edit: September 16, 2017, 12:48:32 pm by _Carlison »

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1222
  • #Kurt_Cobain { margin-bottom: -6.5ft; }
Re: How to change "latest listings" to "last modified listings"  
« Reply #9 on: September 15, 2017, 11:21:52 pm »
and Mr Liath i think you are "BIG DEVELOPER"
i'm not a BIG DEVELOPER, but i can read and understand the code... and your suggestion was absolutely nonsens.


you have linked to the other thread, where you offend a criminal action, now you told that keiichi should use your modified code and this is bullshit


if you don't know how to help, DO NOT HELP

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 593
Re: How to change "latest listings" to "last modified listings"  
« Reply #10 on: September 16, 2017, 12:03:45 am »
i just give you idea for modified that, please try below code :
Find latest Listing on main.php then

1st change
Quote
  <?php if( osc_count_latest_items() == 0) { ?>
to
Quote
<?php if( osc_item_mod_date() == 0) { ?>

2nd Change

Quote
<?php if( osc_count_latest_items() == osc_max_latest_items() ) { ?>
to
Quote
<?php if( osc_item_mod_date() == osc_max_latest_items() ) { ?>

Carlison your intention was good, but you don't know yet most of the architecture of osclass so that's why your solution does not work. (neither do I so don't worry ).
You thought that by changing count_latest_items with item_mod_date will do it but it doesn't. So don't be offended by this and have patience.  You can learn from Liath.
When I saw your code I knew something wasn't ok but I waited for the more experienced ones like Liath to write a conclusion:) Patience is the key.

keiichi

  • Newbie
  • *
  • Posts: 4
Re: How to change "latest listings" to "last modified listings"  
« Reply #11 on: September 16, 2017, 06:54:58 am »
Hi everyone,
Thank you for many valuable comments !
I'm really glad !!!
(And...sorry for my late reply. I am not good at English...)

But, I cannot solve my problems yet.

As Liath suggested, there's no choice but to do some plugin?

@teseo
Quote
Hi,
I guess what you really want is to consider edited ads as freshly published, not to put any modified ad at the top regardless of when it was modified? ???
Regards
For example,,,,
Someone updates his ads (The ads was listed in the second page because he posted it a week ago).
After his update, I want the ads list on the top in "latest listings".

Do you have any good idea?

I heard,
there is
Quote
<?php query_posts('orderby=modified'); ?>
tag in Wordpress.
How about Osclass ?
« Last Edit: September 16, 2017, 07:01:23 am by keiichi »

_Carlison

  • Full Member
  • ***
  • Posts: 114
Re: How to change "latest listings" to "last modified listings"  
« Reply #12 on: September 16, 2017, 12:59:31 pm »
i just give you idea for modified that, please try below code :
Find latest Listing on main.php then

1st change
Quote
  <?php if( osc_count_latest_items() == 0) { ?>
to
Quote
<?php if( osc_item_mod_date() == 0) { ?>

2nd Change

Quote
<?php if( osc_count_latest_items() == osc_max_latest_items() ) { ?>
to
Quote
<?php if( osc_item_mod_date() == osc_max_latest_items() ) { ?>

Carlison your intention was good, but you don't know yet most of the architecture of osclass so that's why your solution does not work. (neither do I so don't worry ).
You thought that by changing count_latest_items with item_mod_date will do it but it doesn't. So don't be offended by this and have patience.  You can learn from Liath.
When I saw your code I knew something wasn't ok but I waited for the more experienced ones like Liath to write a conclusion:) Patience is the key.

Yes@ marius-ciclistu i was just did help of that visitor . yes i have not good knowledge about osclass , i am just beginner of Osclass. but if my code is not good so its ok, but they USE "NONSENSE" word . so is it ok in publicly forum ? if they mention this code is not working so this will be helpfull for other visitors on this forum and it will be good sound . but Mr Liath says NONSENSE code. really these type of words will be affected on Osclass Users. they will not trust on Osclass if Osclass Developers will use thats type of word, In my 2-3 forum other developers also use "NONSENSE" word . i have not mentioned any developer name but really its very bad impact of any osclass user.

i hope no one will use thats type of word in future . and i will learn more about osclass then i will suggest or help to any visitors of Osclass

_Carlison

  • Full Member
  • ***
  • Posts: 114
Re: How to change "latest listings" to "last modified listings"  
« Reply #13 on: September 16, 2017, 01:04:22 pm »
and i again says sorry for all others, but really i dont want any arguments , i want just help to everyone. if any one always fight with me then i will never reply on any post .  this is really bad impact of any forum

teseo

  • Hero Member
  • *****
  • Posts: 5812
Re: How to change "latest listings" to "last modified listings"  
« Reply #14 on: September 16, 2017, 01:07:09 pm »
@keiichi, try this procedure (only for Latest Items on home page).

Add this at the very bottom of your theme functions.php:
Notes:
1.- Take care not to leave blank lines after this.
2.- If your theme functions.php doesn't end with ?> skip first line of my code.

Code: [Select]
<?php
function cust_latest_items_modified($conditions) {
    if (
osc_is_home_page()) {
        
$mSearch =  Search::newInstance();
        
$query_elements = (array) json_decode($mSearch->toJson());
        
        if (
$query_elements['order_column'] == 'dt_pub_date' && $query_elements['order_direction'] == 'DESC') {
            
$mSearch->order(sprintf("IF(%st_item.dt_mod_date > %st_item.dt_pub_date, %st_item.dt_mod_date, %st_item.dt_pub_date)"DB_TABLE_PREFIXDB_TABLE_PREFIXDB_TABLE_PREFIXDB_TABLE_PREFIX), 'DESC');
        }
    }

    return 
$conditions;
}

osc_add_filter('sql_search_conditions''cust_latest_items_modified'1);
?>


Regards