private function updateListing($type, $key, $items, $userSid) { $listingSid = $items['custom_info'][$key]['listing_id']; $listingInfo = SJB_ListingManager::getListingInfoBySID($listingSid); $products = array('name' => $items['custom_item'][$key], 'type' => $type, 'listingSid' => $listingSid); if ($listingInfo) { if ($type == 'featuredListing') { if (!$listingInfo['featured']) { SJB_ListingManager::makeFeaturedBySID($listingSid); } else { $products['error'] = 'LISTING_ALREADY_FEATURED'; } } else { if ($type == 'priorityListing') { if (!$listingInfo['priority']) { SJB_ListingManager::makePriorityBySID($listingSid); } else { $products['error'] = 'LISTING_ALREADY_PRIORITY'; } } else { if ($type == 'activateListing') { if (!$listingInfo['active']) { SJB_ListingManager::activateListingBySID($listingSid); } else { $products['error'] = 'LISTING_ALREADY_ACTIVE'; } } } } } else { $products['error'] = 'INVALID_LISTING_ID'; } SJB_ShoppingCart::deleteCustomItemFromCart($userSid, $items['custom_item'][$key]); return $products; }