*

rooman

  • ****
  • 231 posts
How can I get specific ads with the advertising ID number?
« on: July 15, 2022, 05:24:34 PM »
Hello
How can I get specific ads with the advertising ID number?
Here you can fetch ads within a specific city
Code: [Select]
<?php osc_query_item("region_name=Madrid");
if( 
osc_count_custom_items() == 0) { ?>
I want a specific advertisement with the ID number

Thanks
« Last Edit: July 15, 2022, 05:27:20 PM by rooman »

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #1 on: July 15, 2022, 05:30:55 PM »
I found the solution
for the benefit

Code: [Select]
osc_query_item("id=145");

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #2 on: July 15, 2022, 06:12:07 PM »
there is a problem
I want to fetch more than one ad with a specific number of ID
I did that but it is not responding
Code: [Select]
osc_query_item("id=145,146,250,266");

*

MB Themes

Re: How can I get specific ads with the advertising ID number?
« Reply #3 on: July 18, 2022, 07:46:32 AM »
I would try:
Code: [Select]
osc_query_item("id in (145,146,250,266)");

If does not work, its probably not supported.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #4 on: July 18, 2022, 05:28:00 PM »
I would try:
Code: [Select]
osc_query_item("id in (145,146,250,266)");

If does not work, its probably not supported.
Unfortunately it doesn't work
Is there a solution for that? :(
« Last Edit: July 18, 2022, 07:03:48 PM by rooman »

*

MB Themes

Re: How can I get specific ads with the advertising ID number?
« Reply #5 on: July 19, 2022, 08:59:18 AM »
No using osc_query_item, you can try Search model instead for more options and custom conditions.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #6 on: July 19, 2022, 09:40:08 AM »
No using osc_query_item, you can try Search model instead for more options and custom conditions.

Thank you general search problem
I have a custom page I want to fetch specific ads
Fixed for this page
Is there another way or by function :(
Thank you

*

MB Themes

Re: How can I get specific ads with the advertising ID number?
« Reply #7 on: July 19, 2022, 09:42:33 AM »
Yes, search model.

Sample:
Code: [Select]
  $randSearch = Search::newInstance();
  $randSearch->dao->select(DB_TABLE_PREFIX.'t_item.* ');
  $randSearch->dao->from( DB_TABLE_PREFIX.'t_item use index (PRIMARY)' );
  $randSearch->dao->orderBy(DB_TABLE_PREFIX.'t_item.dt_pub_date DESC');
  $rs = $randSearch->dao->get();

  if($rs === false){
    return array();
  }

  if( $rs->numRows() == 0 ) {
    return array();
  }

  $items = $rs->result();
  $items = Item::newInstance()->extendData($items);
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #8 on: July 19, 2022, 09:50:08 AM »
General search problem
I wish there was more explanation
 :'(

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #9 on: July 19, 2022, 11:22:05 AM »
Has any of you seen this problem?
please help :( :( :(

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #10 on: July 20, 2022, 10:35:11 AM »
please help :(

*

MB Themes

Re: How can I get specific ads with the advertising ID number?
« Reply #11 on: July 20, 2022, 11:02:16 AM »
Yes, search model.

Sample:
Code: [Select]
  $randSearch = Search::newInstance();
  $randSearch->dao->select(DB_TABLE_PREFIX.'t_item.* ');
  $randSearch->dao->from( DB_TABLE_PREFIX.'t_item use index (PRIMARY)' );
  $randSearch->dao->orderBy(DB_TABLE_PREFIX.'t_item.dt_pub_date DESC');
  $rs = $randSearch->dao->get();

  if($rs === false){
    return array();
  }

  if( $rs->numRows() == 0 ) {
    return array();
  }

  $items = $rs->result();
  $items = Item::newInstance()->extendData($items);

Completely ignored.
Go to that class and identify all supported methods.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I get specific ads with the advertising ID number?
« Reply #12 on: July 21, 2022, 01:38:14 PM »
Yes, search model.

Sample:
Code: [Select]
  $randSearch = Search::newInstance();
  $randSearch->dao->select(DB_TABLE_PREFIX.'t_item.* ');
  $randSearch->dao->from( DB_TABLE_PREFIX.'t_item use index (PRIMARY)' );
  $randSearch->dao->orderBy(DB_TABLE_PREFIX.'t_item.dt_pub_date DESC');
  $rs = $randSearch->dao->get();

  if($rs === false){
    return array();
  }

  if( $rs->numRows() == 0 ) {
    return array();
  }

  $items = $rs->result();
  $items = Item::newInstance()->extendData($items);

Completely ignored.
Go to that class and identify all supported methods.
Sorry, I have poor coding experience
Can you help me, thank you

*

MB Themes

Re: How can I get specific ads with the advertising ID number?
« Reply #13 on: July 21, 2022, 04:06:36 PM »
You have almost complete code there that require just to change one line with your condition.
If you are not able to utilize that, you should hire developer.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots