예제 #1
0
 public function add_ebay_item()
 {
     $requestType = $this->input->post('requestType');
     $Currency = $this->input->post('Currency');
     $ListingType = $this->input->post('ListingType');
     $eBayID = $this->input->post('eBayID');
     $Site = $this->input->post('Site');
     $Title = $this->input->post('Title');
     $description = $this->input->post('itemDescription');
     $description = wrap_description($description);
     $CategoryId = $this->input->post('CategoryId');
     $CustomerLabel = $this->input->post('CustomerLabel');
     $Quantity = $this->input->post('Quantity');
     $StartPrice = $this->input->post('StartPrice');
     $ExternalGalleryImageFile = $this->input->post('ExternalGalleryImageFile');
     $ListingDuration = $this->input->post('ListingDuration');
     $Country = $this->input->post('Country');
     $Location = $this->input->post('Location');
     $PayPalEmailAddress = $this->input->post('PayPalEmailAddress');
     $ShippingType = $this->input->post('ShippingType');
     $ShippingService0 = $this->input->post('ShippingService0');
     $free0 = $this->input->post('free0');
     $ShippingServiceCost0 = $this->input->post('ShippingServiceCost0');
     $ShippingServiceAdditionalCost0 = $this->input->post('ShippingServiceAdditionalCost0');
     $ShippingSurcharge0 = $this->input->post('ShippingSurcharge0');
     $DispatchTimeMax = $this->input->post('DispatchTimeMax');
     $GetItFast = $this->input->post('GetItFast');
     $iShippingService0 = $this->input->post('iShippingService0');
     $ifree0 = $this->input->post('ifree0');
     $iShippingServiceCost0 = $this->input->post('iShippingServiceCost0');
     $iShippingServiceAdditionalCost0 = $this->input->post('iShippingServiceAdditionalCost0');
     $ShippingService1 = $this->input->post('ShippingService1');
     $ShippingServiceCost1 = $this->input->post('ShippingServiceCost1');
     $ShippingServiceAdditionalCost1 = $this->input->post('ShippingServiceAdditionalCost1');
     $ShippingSurcharge1 = $this->input->post('ShippingSurcharge1');
     $ShippingService2 = $this->input->post('ShippingService2');
     $ShippingServiceCost2 = $this->input->post('ShippingServiceCost2');
     $ShippingServiceAdditionalCost2 = $this->input->post('ShippingServiceAdditionalCost2');
     $ShippingSurcharge2 = $this->input->post('ShippingSurcharge2');
     $iShippingService1 = $this->input->post('iShippingService1');
     $iShippingServiceCost1 = $this->input->post('iShippingServiceCost1');
     $iShippingServiceAdditionalCost1 = $this->input->post('iShippingServiceAdditionalCost1');
     $iShippingService2 = $this->input->post('iShippingService2');
     $iShippingServiceCost2 = $this->input->post('iShippingServiceCost2');
     $iShippingServiceAdditionalCost2 = $this->input->post('iShippingServiceAdditionalCost2');
     $ReturnPolicy = $this->input->post('ReturnPolicy');
     $BestOfferEnabled = $this->input->post('BestOfferEnabled');
     $iShipToLocation0 = $this->input->post('iShipToLocation0');
     if (isset($iShipToLocation0[0])) {
         $iShipToLocation0 = $iShipToLocation0[0];
     }
     $storeCategoryID = $this->input->post('StoreCategoryID');
     $itemInfo = array('site' => $Site, 'currency' => $Currency, 'description' => $description, 'title' => $Title, 'startPrice' => $StartPrice, 'quantity' => $Quantity, 'pictureUrl' => $ExternalGalleryImageFile, 'categoryID' => $CategoryId, 'customerLabel' => $CustomerLabel, 'listType' => $ListingType, 'bestOfferEnabled' => false, 'listingDuration' => $ListingDuration, 'country' => $Country, 'location' => $Location, 'payPalEmailAddress' => $PayPalEmailAddress, 'shippingType' => $ShippingType, 'shippingService0' => $ShippingService0, 'shippingServiceCost0' => $ShippingServiceCost0, 'ishippingService0' => $iShippingService0, 'ishippingServiceCost0' => $iShippingServiceCost0, 'iShipToLocation0' => $iShipToLocation0, 'dispatchTimeMax' => $DispatchTimeMax, 'returnPolicy' => $ReturnPolicy);
     $this->ebay_config['siteToUseID'] = get_site_id($Site);
     if (!empty($storeCategoryID)) {
         $itemInfo['storeCategoryID'] = $storeCategoryID;
     }
     if ($free0 == 1) {
         $itemInfo['free0'] = true;
     }
     if (isset($ShippingServiceAdditionalCost0)) {
         $itemInfo['shippingServiceAdditionalCost0'] = $ShippingServiceAdditionalCost0;
     }
     if (isset($ShippingSurcharge0) && $ShippingSurcharge0 > 0) {
         $itemInfo['shippingSurcharge0'] = $ShippingSurcharge0;
     }
     if ($GetItFast == 1) {
         $itemInfo['getItFast'] = $GetItFast;
     }
     if ($ifree0 == 1) {
         $itemInfo['ifree0'] = true;
     }
     if (isset($iShippingServiceAdditionalCost0)) {
         $itemInfo['ishippingServiceAdditionalCost0'] = $iShippingServiceAdditionalCost0;
     }
     if ($ShippingService1 != 'NotSelected') {
         $itemInfo['shippingService1'] = $ShippingService1;
         $itemInfo['shippingServiceCost1'] = $ShippingServiceCost1;
         if (isset($ShippingServiceAdditionalCost1)) {
             $itemInfo['shippingServiceAdditionalCost1'] = $ShippingServiceAdditionalCost1;
         }
         if (isset($ShippingSurcharge1) && $ShippingSurcharge1 > 0) {
             $itemInfo['shippingSurcharge1'] = $ShippingSurcharge1;
         }
     }
     if ($ShippingService2 != 'NotSelected') {
         $itemInfo['shippingService2'] = $ShippingService2;
         $itemInfo['shippingServiceCost2'] = $ShippingServiceCost2;
         if (isset($ShippingServiceAdditionalCost2)) {
             $itemInfo['shippingServiceAdditionalCost2'] = $ShippingServiceAdditionalCost2;
         }
         if (isset($ShippingSurcharge2) && $ShippingSurcharge2 > 0) {
             $itemInfo['shippingSurcharge2'] = $ShippingSurcharge2;
         }
     }
     if ($iShippingService1 != 'InternationalNotSelected') {
         $itemInfo['ishippingService1'] = $iShippingService1;
         $itemInfo['ishippingServiceCost1'] = $this->input->post('iShippingServiceCost1');
         if (isset($iShippingServiceAdditionalCost1)) {
             $itemInfo['ishippingServiceAdditionalCost1'] = $iShippingServiceAdditionalCost1;
         }
         $iShipToLocation1 = $this->input->post('iShipToLocation1');
         if (isset($iShipToLocation1[0])) {
             $itemInfo['ishipToLocation1'] = $iShipToLocation1[0];
         }
     }
     if ($iShippingService2 != 'InternationalNotSelected') {
         $itemInfo['ishippingService2'] = $iShippingService2;
         $itemInfo['ishippingServiceCost2'] = $iShippingServiceCost2;
         if (isset($iShippingServiceAdditionalCost2)) {
             $itemInfo['ishippingServiceAdditionalCost2'] = $iShippingServiceAdditionalCost2;
         }
         $iShipToLocation2 = $this->input->post('iShipToLocation2');
         if (isset($iShipToLocation2[0])) {
             $itemInfo['ishipToLocation2'] = $iShipToLocation2[0];
         }
     }
     if ($ReturnPolicy == 1) {
         $return_within = $this->input->post('return_within');
         $return_refund_as = $this->input->post('return_refund_as');
         $return_actor = $this->input->post('return_actor');
         $return_details = $this->input->post('return_details');
         $itemInfo['return_within'] = $return_within;
         $itemInfo['return_refund_as'] = $return_refund_as;
         $itemInfo['return_actor'] = $return_actor;
         if (!empty($return_details)) {
             $itemInfo['return_details'] = $return_details;
         }
     }
     $usescheduler = $this->input->post('usescheduler');
     if ($usescheduler == 1) {
         $schedule_hour = $this->input->post('schedule_hour');
         $schedule_minute = $this->input->post('schedule_minute');
         $auctionDate = $this->input->post('auctionDate');
         $schedule_date = date('d', strtotime($auctionDate));
         $schedule_month = date('m', strtotime($auctionDate));
         $schedule_year = date('Y', strtotime($auctionDate));
         $itemInfo['schedule_time'] = get_gmt(array('year' => $schedule_year, 'month' => $schedule_month, 'date' => $schedule_date, 'hour' => $schedule_hour, 'minute' => $schedule_minute));
     }
     $itemSpecificsJSON = $this->input->post('itemSpecifics');
     $itemSpecifics = json_decode($itemSpecificsJSON, true);
     if (count($itemSpecifics)) {
         $itemInfo['itemSpecifics'] = $itemSpecifics;
     }
     if ($ListingType == 'FixedPriceItem') {
         if ($BestOfferEnabled) {
             $itemInfo['bestOfferEnabled'] = true;
             $MinimumBestOfferPrice = $this->input->post('MinimumBestOfferPrice');
             if (isset($MinimumBestOfferPrice) && $MinimumBestOfferPrice > 0) {
                 $itemInfo['minimumBestOfferPrice'] = $MinimumBestOfferPrice;
             }
             $BestOfferAutoAcceptPrice = $this->input->post('BestOfferAutoAcceptPrice');
             if (isset($BestOfferAutoAcceptPrice) && $BestOfferAutoAcceptPrice > 0) {
                 $itemInfo['bestOfferAutoAcceptPrice'] = $BestOfferAutoAcceptPrice;
             }
         }
         $this->ebay_config['callName'] = $requestType;
         $this->load->library('ebayapi/EbaySession', $this->ebay_config);
         if ($requestType == 'AddItem') {
             $requestType = $requestType . 'Request';
             $xml = add_item($this->appToken, $itemInfo, $requestType);
             $resp = $this->xmlRequest($this->ebaysession, $xml);
             if ($resp->Ack != 'Failure') {
                 echo 'Success';
             } else {
                 $err_num = count($resp->Errors);
                 echo $resp->Errors[$err_num - 1]->LongMessage;
             }
         } else {
             if ($requestType == 'VerifyAddItem') {
                 $requestType = $requestType . 'Request';
                 $xml = add_item($this->appToken, $itemInfo, $requestType);
                 $resp = $this->xmlRequest($this->ebaysession, $xml);
                 if ($resp->Ack == 'Success' || $resp->Ack == 'Warning') {
                     $toReturn['Ack'] = 'Success';
                     $toReturn['Fees'] = countFees($resp);
                 } else {
                     $toReturn['Ack'] = 'Failure';
                     $err_num = count($resp->Errors);
                     $toReturn['Message'] = sprintf('%s', $resp->Errors[$err_num - 1]->LongMessage);
                 }
                 echo json_encode($toReturn);
             }
         }
     } else {
         if ($ListingType == 'Chinese') {
             $ReservePrice = $this->input->post('ReservePrice');
             if (isset($ReservePrice) && $ReservePrice > 0) {
                 $itemInfo['reservePrice'] = $ReservePrice;
             }
             $BuyItNowPrice = $this->input->post('BuyItNowPrice');
             if (isset($BuyItNowPrice) && $BuyItNowPrice > 0) {
                 $itemInfo['buyItNowPrice'] = $BuyItNowPrice;
             }
             $this->ebay_config['callName'] = $requestType;
             $this->load->library('ebayapi/EbaySession', $this->ebay_config);
             if ($requestType == 'AddItem') {
                 $requestType = $requestType . 'Request';
                 $xml = add_item($this->appToken, $itemInfo, $requestType);
                 $resp = $this->xmlRequest($this->ebaysession, $xml);
                 if ($resp->Ack != 'Failure') {
                     echo 'Success';
                 } else {
                     $err_num = count($resp->Errors);
                     echo $resp->Errors[$err_num - 1]->LongMessage;
                 }
             } else {
                 if ($requestType == 'VerifyAddItem') {
                     $requestType = $requestType . 'Request';
                     $xml = add_item($this->appToken, $itemInfo, $requestType);
                     $resp = $this->xmlRequest($this->ebaysession, $xml);
                     if ($resp->Ack == 'Success' || $resp->Ack == 'Warning') {
                         $toReturn['Ack'] = 'Success';
                         $toReturn['Fees'] = countFees($resp);
                     } else {
                         $toReturn['Ack'] = 'Failure';
                         $err_num = count($resp->Errors);
                         $toReturn['Message'] = sprintf('%s', $resp->Errors[$err_num - 1]->LongMessage);
                     }
                     echo json_encode($toReturn);
                 }
             }
         } else {
             if ($ListingType == 'MultiSKU') {
                 $variations = get_variations($_POST);
                 if (count($variations) > 0) {
                     $itemInfo['variations'] = $variations;
                 }
                 if ($requestType == 'AddItem') {
                     $this->ebay_config['callName'] = 'AddFixedPriceItem';
                     $this->load->library('ebayapi/EbaySession', $this->ebay_config);
                     $requestType = 'AddFixedPriceItemRequest';
                     $xml = add_multi_sku_item($this->appToken, $itemInfo, $requestType);
                     $resp = $this->xmlRequest($this->ebaysession, $xml);
                     if ($resp->Ack != 'Failure') {
                         echo 'Success';
                     } else {
                         $err_num = count($resp->Errors);
                         echo $resp->Errors[$err_num - 1]->LongMessage;
                     }
                 } else {
                     if ($requestType == 'VerifyAddItem') {
                         $this->ebay_config['callName'] = 'VerifyAddFixedPriceItem';
                         $this->load->library('ebayapi/EbaySession', $this->ebay_config);
                         $requestType = 'VerifyAddFixedPriceItemRequest';
                         $xml = add_multi_sku_item($this->appToken, $itemInfo, $requestType);
                         $resp = $this->xmlRequest($this->ebaysession, $xml);
                         if ($resp->Ack == 'Success' || $resp->Ack == 'Warning') {
                             $toReturn['Ack'] = 'Success';
                             $toReturn['Fees'] = countFees($resp);
                         } else {
                             $toReturn['Ack'] = 'Failure';
                             $err_num = count($resp->Errors);
                             $toReturn['Message'] = sprintf('%s', $resp->Errors[$err_num - 1]->LongMessage);
                         }
                         echo json_encode($toReturn);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
$url = fix_url($url);
echo $url;
?>
" alt="Card Image Goes Here"><br>
                Fair Trade Price:<br>
                <div id="price_area">...Loading...<script>
                    $(document).ready(function () {
                        get_price()
                    });
                    </script></div>
                <div id="price_area_foil">...Loading...<script>

                    </script></div>
                Variations<br>
                <?php 
$variations = get_variations($card['card_name'], $set['set_id']);
//var_dump($variations);
foreach ($variations as $variation) {
    if ($variation['variation_number'] == $card['variation_number']) {
        echo ' ' . $variation['variation_number'] . ' ';
    } else {
        echo '<a href=".?action=details&amp;cardname=' . $card['card_name'] . '&amp;setid=' . $card['set_id'] . '&amp;variation=' . $variation['variation_number'] . '">' . $variation['variation_number'] . '</a> ';
    }
}
?>
            </td>
            <td class="middlecolumn">

                <?php 
if (isset($_SESSION['user_id'])) {
    ?>