예제 #1
0
    function wplister_product_submitbox_misc_actions()
    {
        global $post;
        global $woocommerce;
        if ($post->post_type != 'product') {
            return;
        }
        // if product has been imported from ebay...
        $this->wplister_product_submitbox_imported_status();
        // check listing status
        // $listingsModel = new ListingsModel();
        // $status = WPLE_ListingQueryHelper::getStatusFromPostID( $post->ID );
        // if ( ! in_array($status, array('published','changed','ended','sold','prepared','verified') ) ) return;
        // get first item
        // $listings = WPLE_ListingQueryHelper::getAllListingsFromPostID( $post->ID );
        // if ( sizeof($listings) == 0 ) return;
        // $item = $listings[0];
        // get all listings for product ID - including check for split variations
        $listings = WPLE_ListingQueryHelper::getAllListingsFromPostOrParentID($post->ID);
        if (empty($listings)) {
            return;
        }
        // use different template if there are multiple results
        if (sizeof($listings) > 1) {
            return $this->wplister_product_submitbox_for_multiple_items($listings);
        }
        // get status of first listing
        $item = $listings[0];
        $status = $listings[0]->status;
        // show locked indicator
        if (@$item->locked) {
            $tip_msg = 'This listing is currently locked.<br>Only inventory changes and prices will be updated, other changes will be ignored.<br><br>(Except for variable products where not all variations have a unique SKU, or when new variations are added. In these cases, the item will be revised in full.)';
            $img_url = WPLISTER_URL . '/img/lock-1.png';
            $locktip = '<img src="' . $img_url . '" style="height:11px; padding:0;" class="tips" data-tip="' . $tip_msg . '"/>&nbsp;';
        }
        ?>
		
		<style type="text/css">
			#wpl_ebay_revise_on_update,
			#wpl_ebay_relist_on_update {
				width: auto;
				/*margin-left: 1em;*/
				float: right;
			}
			.wpl_ebay_revise_on_update_field { margin:0; }
			.wpl_ebay_relist_on_update_field { margin:0; }
		</style>

		<div class="misc-pub-section" id="wplister-submit-options">

			<input type="hidden" name="wpl_ebay_listing_id" value="<?php 
        echo $item->id;
        ?>
" />

			<?php 
        _e('eBay listing is', 'wplister');
        ?>
			<b><?php 
        echo $item->status;
        ?>
</b>

			<?php 
        if (isset($locktip)) {
            echo $locktip;
        }
        ?>

			<?php 
        if (isset($item->ViewItemURL) && $item->ViewItemURL) {
            ?>
				<a href="<?php 
            echo $item->ViewItemURL;
            ?>
" target="_blank" style="float:right;">
					<?php 
            echo __('View on eBay', 'wplister');
            ?>
				</a>
			<?php 
        } elseif ($item->status == 'prepared') {
            ?>
				<a href="admin.php?page=wplister&amp;action=verify&amp;auction=<?php 
            echo $item->id;
            ?>
" style="float:right;">
					<?php 
            echo __('Verify', 'wplister');
            ?>
				</a>
			<?php 
        } elseif ($item->status == 'verified') {
            ?>
				<a href="admin.php?page=wplister&amp;action=publish2e&amp;auction=<?php 
            echo $item->id;
            ?>
" style="float:right;">
					<?php 
            echo __('Publish', 'wplister');
            ?>
				</a>
			<?php 
        }
        ?>

			<br>

			<?php 
        // show revise checkbox for published listings
        if (in_array($status, array('published', 'changed'))) {
            $this->wplister_product_submitbox_revise_checkbox($item);
        }
        ?>

			<?php 
        // show relist checkbox for ended listings
        if (in_array($status, array('ended', 'sold'))) {
            $this->wplister_product_submitbox_relist_checkbox($item);
        }
        ?>

			<?php 
        /* if ( in_array($status, array('ended','sold') ) ) : ?>
        				<a href="admin.php?page=wplister&amp;action=relist&amp;auction=<?php echo $item->id ?>" 
        					onclick="return confirm('Are you sure you want to relist this product on eBay?');" style="float:right;">
        					<?php echo __('Relist', 'wplister') ?>
        				</a>
        			<?php endif; */
        ?>

		</div>
		<?php 
    }