public function previewListing($id) { // init model $ibm = new ItemBuilderModel(); $account_id = WPLE_ListingQueryHelper::getAccountID($id); $account = WPLE_eBayAccount::getAccount($account_id); $this->initEC($account_id); $item = $ibm->buildItem($id, $this->EC->session, false, true); // if ( ! $ibm->checkItem($item) ) return $ibm->result; $ibm->checkItem($item); // $preview_html = $ibm->getFinalHTML( $id, $item, true ); $preview_html = $item->Description; // echo $preview_html; // set condition name $item->ConditionName = $this->getConditionDisplayName($item->getConditionID()); $aData = array('item' => $item, 'site_id' => $account ? $account->site_id : false, 'check_result' => $ibm->result, 'preview_html' => $preview_html); header('Content-Type: text/html; charset=utf-8'); $this->display('listings_preview', $aData); exit; }
function verifyAddItem($id, $session) { // skip this item if item status not allowed $allowed_statuses = array('prepared', 'verified'); if (!$this->itemHasAllowedStatus($id, $allowed_statuses)) { return $this->result; } // build item $ibm = new ItemBuilderModel(); $item = $ibm->buildItem($id, $session); if (!$ibm->checkItem($item)) { return $ibm->result; } // eBay Motors (beta) if ($item->Site == 'eBayMotors') { $session->setSiteId(100); } // preparation - set up new ServiceProxy with given session $this->initServiceProxy($session); // switch to FixedPriceItem if product has variations $listing_item = self::getItem($id); // $useFixedPriceItem = ( ProductWrapper::hasVariations( $listing_item['post_id'] ) ) ? true : false; // $useFixedPriceItem = ( 'FixedPriceItem' == $listing_item['auction_type'] ) ? true : false; WPLE()->logger->info("Verifying #{$id}: " . $item->Title); if (self::listingUsesFixedPriceItem($listing_item)) { $req = new VerifyAddFixedPriceItemRequestType(); $req->setItem($item); WPLE()->logger->debug("Request: " . print_r($req, 1)); $res = $this->_cs->VerifyAddFixedPriceItem($req); } else { $req = new VerifyAddItemRequestType(); $req->setItem($item); WPLE()->logger->debug("Request: " . print_r($req, 1)); $res = $this->_cs->VerifyAddItem($req); } // handle response and check if successful if ($this->handleResponse($res)) { // save listing fees to db $listingFee = self::getListingFeeFromResponse($res); // $data['ebay_id'] = $res->ItemID; $data['fees'] = $listingFee; $data['status'] = 'verified'; self::updateListing($id, $data); WPLE()->logger->info("Item #{$id} verified with ebay, getAck(): " . $res->getAck()); } // call successful self::processErrorsAndWarnings($id, $this->result); return $this->result; }