Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 11778
Latest: robgratt
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 40981
Total Topics: 7173
Most Online Today: 63
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 32
Total: 32

Author Topic: Simple Portal Block - Classifieds  (Read 28437 times)

0 Members and 1 Guest are viewing this topic.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15464
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #45 on: October 13, 2016, 09:11:23 am »
I need the error code full to help.../screenshot
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline grim

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #46 on: October 13, 2016, 09:13:18 am »
not getting any error
just the one i told you about

Offline grim

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #47 on: October 13, 2016, 09:14:31 am »
An Error Has Occurred!
Database error in block code. Please check the code.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15464
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #48 on: October 13, 2016, 09:14:59 am »
You might have to ask simple portal then i can't help without more information.
I need the error from the SMF error log.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline grim

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #49 on: October 13, 2016, 09:17:52 am »
there is none from the log

Offline shadav

  • Ad Seller Pro Customer
  • Newbie
  • *****
  • Posts: 8
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #50 on: August 14, 2020, 10:37:02 pm »
[edit] ignore me, please delete....blonde moment
« Last Edit: August 14, 2020, 11:14:29 pm by shadav »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15464
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #51 on: August 16, 2020, 09:56:48 am »
Glad you have it working!
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Shades

  • SMF Gallery Pro Customer
  • Newbie
  • *****
  • Posts: 24
  • Community Suite Customer
    • View Profile
    • Bikerhound.com
Re: Simple Portal Block - Classifieds
« Reply #52 on: May 06, 2021, 12:24:32 pm »
Block does not show the "time left" although the item has about 3 hours remaining.

Using this code on SMF 2.0.18 with simple portal 2.3.7
Code: [Select]
ClassifiedsBlock(1,1, 'random','vertical');



function ClassifiedsBlock($rows = 4, $listings = 4, $type = 'recent', $category = 0,  $format = 'vertical',  $startHtml = '', $endHtml = '')
{
 global  $smcFunc, $scripturl, $txt, $modSettings, $boardurl, $user_info, $context, $sourcedir, $boarddir;

 $rows = (int) $rows;
 $listings = (int) $listings;
 $category  = (int) $category;
 

 

 
 
 // Html Header
 echo $startHtml;
 
 
 // Load the language files
 if (loadlanguage('classifieds') == false)
 loadLanguage('classifieds', 'english');
 
 $g_manage = allowedTo('smfclassifieds_manage');
 
 $groupsdata = implode($user_info['groups'],',');
 
 if (empty($modSettings['class_url']))
 $modSettings['class_url'] = $boardurl . '/classifieds/';

 if (empty($modSettings['class_path']))
 $modSettings['class_path'] = $boarddir . '/classifieds/';
 
 $maxrowlevel = $rows;
 echo '<table cellspacing="0" cellpadding="5" border="0" align="center" width="100%">
 
 ';
 // Check what type it is
 $query = ' ';
 switch($type)
 {
 case 'recent':
 $query = "SELECT i.ID_LISTING, i.commenttotal,
 i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
 i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
 FROM {db_prefix}class_listing as i
 LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
 LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
 LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
 WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY i.ID_LISTING DESC LIMIT $listings";
 break;

 case 'viewed':
 $query = "SELECT i.ID_LISTING, i.commenttotal,
 i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
 i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
 FROM {db_prefix}class_listing as i
 LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
 LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
 LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
 WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY  i.views DESC LIMIT $listings";
 break;
             
  case 'random':
 $query = "SELECT i.ID_LISTING, i.commenttotal,
 i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
 i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
 FROM {db_prefix}class_listing as i
 LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
 LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
 LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
 WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY  RAND() DESC LIMIT $listings";
 break;
             

 case 'mostcomments':
 $query = "SELECT i.ID_LISTING, i.commenttotal,
 i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
 i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
 FROM {db_prefix}class_listing as i
 LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
 LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
 LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
 WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY i.commenttotal DESC LIMIT $listings";
 break;

 case 'featured':
 $query = "SELECT i.ID_LISTING, i.commenttotal,
 i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
 i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
 FROM {db_prefix}class_listing as i
 LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
 LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
 LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
 WHERE i.removed = 0 AND i.approved = 1 AND i.featuredlisting = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY i.ID_LISTING DESC LIMIT $listings";
 break;
 
 
 }
 // Execute the SQL query
 $dbresult = $smcFunc['db_query']('', $query);
 $rowlevel = 0;
 while($row = $smcFunc['db_fetch_assoc']($dbresult))
 {
 if ($rowlevel == 0)
 echo '<tr class="windowbg2">';

 echo '<td align="center"><a href="', $scripturl, '?action=classifieds;sa=view;id=', $row['ID_LISTING'], '">', $row['title'], '</a><br />';
 
 if (!empty($row['primaryID_PICTURE']) && $modSettings['class_catlist_showimage'])
 {
 
 if (empty($row['remotefilename']))
 echo '<a href="', $scripturl, '?action=classifieds;sa=view;id=', $row['ID_LISTING'], '"><img src="', $modSettings['class_url'], $row['thumbfilename'], '" alt="" /></a><br />';
 else
 echo '<a href="', $scripturl, '?action=classifieds;sa=view;id=', $row['ID_LISTING'], '"><img src="', $row['remotefilename'], '" alt="" /></a><br />';
 
 }
 
 echo '<span class="smalltext">';
 
 
 if (!empty($modSettings['class_catlist_currentprice']) && $row['noprice'] == 0)
 echo $txt['class_text_price'] . SMFEzformatprice($row['currentbid'],$row['currency']) . '<br />';


 if (!empty($modSettings['class_catlist_listingdate']))
            {
                if (!empty($modSettings['class_set_date_format_mdy']))
                    echo $txt['class_text_date'] .  date($modSettings['class_set_date_format_mdy'],$row['datelisted']), ' ', date($modSettings['class_set_date_format_hia'],$row['datelisted']) . '<br />';
                else
                    echo $txt['class_text_date'] . date("m/d/Y",$row['datelisted']) . ' ' . date("h:i a",$row['datelisted'])  . '<br />';
         
            }
 
 
 
 
 if ($modSettings['class_catlist_timeleft'])
 {
 echo  $txt['class_txt_time_left'] ;
 
 echo  ($row['expiredate'] == 0 ? $txt['class_expire_never'] :  SMFezblockclass_cattimeleft( date("Y",$row['expiredate']), date("m",$row['expiredate']), date("d",$row['expiredate']), date("H",$row['expiredate']), date("i",$row['expiredate']),date("s",$row['expiredate'])) ) , '<br />';
 
 }
 
 
 
 if (!empty($modSettings['class_catlist_numofbids']) && $row['noprice'] == 0 && $row['is_auction'] == 1)
 echo $txt['class_text_totalbids'] . ' ' . $row['totalbids'] . '<br />';
 
 
 if (!empty($modSettings['class_catlist_comments']))
 echo $txt['class_text_comments'] . ' (<a href="' . $scripturl . '?action=classifieds;sa=view;id=' . $row['ID_LISTING'] . '">' . $row['commenttotal'] . '</a>)<br />';
 
 if ($g_manage)
 {
 if ($row['is_auction'] == 0)
 echo '&nbsp;<a href="' . $scripturl . '?action=classifieds;sa=editlisting;id=' . $row['ID_LISTING'] . '">' . $txt['class_text_edit'] . '</a>';
 else
 echo '&nbsp;<a href="' . $scripturl . '?action=classifieds;sa=editauction;id=' . $row['ID_LISTING'] . '">' . $txt['class_text_edit'] . '</a>';
 
 
 echo '&nbsp;<a href="' . $scripturl . '?action=classifieds;sa=deletelisting;id=' . $row['ID_LISTING'] . '">' . $txt['class_text_delete'] . '</a>';
 
 }
 
 echo '</span></td>';


 if($rowlevel < ($maxrowlevel-1))
 $rowlevel++;
 else
 {
 echo '</tr>';
 $rowlevel = 0;
 }
 }
 if($rowlevel !=0)
 {
 echo '</tr>';
 }

 echo '
       </table><br />';
 // Free the Mysql Resoruces
 $smcFunc['db_free_result']($dbresult);
 
 // Html Footer
 echo $endHtml;
 
}
function SMFEzformatprice($price,$currency)
{
 if ($currency == 'USD')
 return  '$' .  number_format($price, 2, '.', '');
 else if ($currency == 'GBP')
 return  '' .  number_format($price, 2, '.', '');
 elseif ($currency == 'CAD')
 return  '$' .  number_format($price, 2, '.', '');
 elseif ($currency == 'AUD')
 return  '$' .  number_format($price, 2, '.', '');
 elseif ($currency == 'ZAR')
 return  'R ' .  number_format($price, 2, '-', '');
 else
 return $price . ' ' . $currency;
 
}


function SMFezblockclass_cattimeleft($year, $month, $day, $hour, $minute, $seconds)
{
 global $txt;
  // make a unix timestamp for the given date
  $the_countdown_date = mktime($hour, $minute, $seconds, $month, $day, $year, -1);

  // get current unix timestamp
  $today = forum_time(false);
 

  $difference = $the_countdown_date - $today;
  if ($difference < 0) $difference = 0;

  $days_left = floor($difference/60/60/24);
  $hours_left = floor(($difference - $days_left*60*60*24)/60/60);
  $minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
  $seconds_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60 - $minutes_left*60));


 
  if ($days_left == 0 && $hours_left == 0 &&  $minutes_left < 5  && ($minutes_left != 0 && $seconds_left  !=0))
  {
  echo '<font color="#FF0000">';
  }
 
  echo '<span class="smalltext">';
 
  if ($days_left > 0)
  {
  echo $days_left . 'd ' . $hours_left  . 'h ' . $minutes_left . 'm';
  }
  else
  {
  if ($hours_left > 0)
  echo $hours_left  . 'h ' . $minutes_left . 'm';
  else
  {
 
  if ($minutes_left > 0)
  echo $minutes_left . 'm ' . $seconds_left . 's';
  else
  {
  if ($seconds_left > 0)
  echo  $seconds_left . 's';
 
  }
 
 
  }
   
  }
 

  echo '</span>';
 
  if ($days_left == 0 && $hours_left == 0 &&  $minutes_left < 5  && ($minutes_left != 0 && $seconds_left  !=0))
  {
  echo '</font>';
  }
}

Live on right hand side at https://bikerhound.com/

SMF Classifieds 5.1.4a
« Last Edit: May 06, 2021, 12:29:00 pm by Shades »

BikerHound.com
Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
9020 Views
Last post May 11, 2007, 02:18:33 pm
by asklife
0 Replies
2836 Views
Last post May 04, 2008, 08:57:46 am
by newguyatthis
0 Replies
3797 Views
Last post November 30, 2009, 04:30:30 am
by Mr.Pyscho
1 Replies
4504 Views
Last post September 11, 2011, 10:31:11 am
by SMFHacks
16 Replies
6470 Views
Last post December 30, 2014, 02:53:45 pm
by dan4ever

+- Recent Topics

Where are original uploaded files stored? by robgratt
June 20, 2021, 12:41:48 pm

Errors for nonexistent members by Krash
June 14, 2021, 09:51:47 pm

Error message: cannot access upload path by SMFHacks
June 08, 2021, 10:06:22 am

How to change order of the Classifieds board by SMFHacks
May 31, 2021, 09:57:36 am

Standard version of Downloads mod value missing by SMFHacks
May 25, 2021, 11:32:48 pm

Privacy Link by SMFHacks
May 14, 2021, 11:11:51 am

Gallery font by SMFHacks
May 13, 2021, 09:58:02 am

Mod Using Google App Script by T7i
May 09, 2021, 08:19:03 pm

Guest has high bid? by Shades
May 06, 2021, 01:36:08 pm

Simple Portal Block - Classifieds by Shades
May 06, 2021, 12:24:32 pm

Powered by EzPortal