*

Tango

  • ****
  • 214 posts
Listing Status Plugin PHP Notices
« on: November 27, 2021, 04:27:14 PM »
Hello,

I'm using an old MB Themes plugin called Listing Status v1.1 and I'm having some issues as it follows.

This function:
Code: [Select]
function ListingStatusStyle() {
  $status = ModelStatus::newInstance()->getStatusByItemId( osc_item_id() );
  $name = ModelStatus::newInstance()->getStatusName($status['item_status']);
  return '<div class="status-' . $name . '" style="background-color:red; color:#fff;font-size:22px;text-align:center;border-radius:50px;">' . $name['status_name'] . '</div>';
}

Returns the following notices:
Code: [Select]
PHP Notice: Undefined index: item_status in \oc-content\plugins\listing_status\index.php on line 33
PHP Notice: Array to string conversion in \oc-content\plugins\listing_status\index.php on line 34
PHP Notice: Undefined index: status_name in \merc\oc-content\plugins\listing_status\index.php on line 34

And this code:
Code: [Select]
if( $detail['item_status']*1 == $s['status_id']*1 ) {
    echo 'selected="selected"';
  }
  echo ' value="' . $s['status_id'] . '">' . $s['status_name'] . '</option>';
}

Returns the following notice:
Code: [Select]
PHP Notice: Undefined index: item_status in \oc-content\plugins\listing_status\item_edit.php on line 16
Any ideas on how to fix them?
Thanks!

*

MB Themes

Re: Listing Status Plugin PHP Notices
« Reply #1 on: November 28, 2021, 08:54:56 PM »
@Tango
Do not have that plugin yet (or cannot find it), you can fix notices by adding symbol @ in front of variable.
$detail['item_status']  ----> @$detail['item_status']

It is simplest way  8)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Tango

  • ****
  • 214 posts
Re: Listing Status Plugin PHP Notices
« Reply #2 on: November 28, 2021, 09:08:56 PM »
Thanks, I've attached the plugin.

It's a nice one, as it allows you to set customs statuses for listings, like: Sold, Out of Stock, Reserved, Unavailable etc.
Maybe you can update it and post it on the OsclassPoint Marketplace. :D

*

MB Themes

Re: Listing Status Plugin PHP Notices
« Reply #3 on: November 29, 2021, 10:29:19 AM »
Thanks will check it out & update when time permits ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots