Beispiel #1
0
 function column_callname($item)
 {
     //Build row action
     $link = sprintf('<a href="?page=%s&action=%s&log_id=%s&width=820&height=550" class="thickbox">%s</a>', $_REQUEST['page'], 'display_log_entry', $item['id'], $item['callname']);
     if ('GeteBayDetails' == $item['callname']) {
         if (preg_match("/<DetailName>(.*)<\\/DetailName>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - ' . strip_tags($match);
         }
     }
     if ('GetOrders' == $item['callname'] || 'GetSellerTransactions' == $item['callname']) {
         if (preg_match("/<PageNumber>(.*)<\\/PageNumber>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - Page ' . strip_tags($match);
         }
         if (preg_match("/<TotalNumberOfPages>(.*)<\\/TotalNumberOfPages>/", $item['response'], $matches)) {
             $link .= ' of ' . strip_tags($matches[1]);
         }
         if (preg_match("/<ModTimeFrom>(.*)<\\/ModTimeFrom>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= '<br>Since: ' . strip_tags($match);
         }
         if (preg_match("/<NumberOfDays>(.*)<\\/NumberOfDays>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= '<br>Days: ' . strip_tags($match);
         }
     }
     if ('GetMyeBaySelling' == $item['callname']) {
         if (preg_match("/<SoldList>(.*)<\\/SoldList>/", $item['request'], $matches)) {
             $link .= ' SoldList ';
         }
         if (preg_match("/<UnsoldList>(.*)<\\/UnsoldList>/", $item['request'], $matches)) {
             $link .= ' UnsoldList ';
         }
         if (preg_match("/<ActiveList>(.*)<\\/ActiveList>/", $item['request'], $matches)) {
             $link .= ' ActiveList ';
         }
         if (preg_match("/<DurationInDays>(.*)<\\/DurationInDays>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' (' . strip_tags($match) . ' days) ';
         }
         if (preg_match("/<PageNumber>(.*)<\\/PageNumber>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - Page ' . strip_tags($match);
         }
     }
     if ('CompleteSale' == $item['callname']) {
         if (preg_match("/<OrderID>(.*)<\\/OrderID>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - ' . strip_tags($match);
         }
     }
     if ('GetCategories' == $item['callname']) {
         if (preg_match("/<CategoryParent>(.*)<\\/CategoryParent>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - ' . strip_tags($match);
         }
     }
     if ('GetNotificationPreferences' == $item['callname']) {
         if (preg_match("/<PreferenceLevel>(.*)<\\/PreferenceLevel>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - ' . strip_tags($match);
         }
     }
     if ('SetNotificationPreferences' == $item['callname']) {
         if (preg_match("/<EventType>(.*)<\\/EventType>/", $item['request'], $matches)) {
             $link .= ' - ' . 'User Events';
         }
     }
     if ('GetMyMessages' == $item['callname']) {
         if (preg_match("/<MessageID>(.*)<\\/MessageID>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' - ' . strip_tags($match);
         }
         if (preg_match("/<DetailLevel>(.*)<\\/DetailLevel>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $link .= ' <span style="color:silver">' . strip_tags($match) . '</span>';
         }
     }
     if (in_array($item['callname'], array('GetCategorySpecifics', 'GetCategoryFeatures'))) {
         if (preg_match("/<CategoryID>(.*)<\\/CategoryID>/", $item['request'], $matches)) {
             $match = str_replace('<![CDATA[', '', $matches[1]);
             $match = str_replace(']]>', '', $match);
             $category_id = strip_tags($match);
             $link .= ' - ' . $category_id;
             $link .= '<br><span style="color: silver; font-size: small;">';
             $link .= EbayCategoriesModel::getFullEbayCategoryName($category_id, $item['site_id']);
             $link .= '</span>';
         }
     }
     if (in_array($item['callname'], array('wplister_revise_inventory_status', 'wplister_revise_item'))) {
         if (is_numeric($item['request'])) {
             $link .= ' - ID: ' . $item['request'];
         }
     }
     // if ( preg_match("/<ShortMessage>(.*)<\/ShortMessage>/", $item['response'], $matches) ) {
     //     $ShortMessage = $matches[1];
     //     if ( $item['success'] == 'Warning' ) {
     //         $link .= '<br><span style="color:darkorange">Warning: '.$ShortMessage.'</span>';
     //     } else {
     //         $link .= '<br><span style="color:#B00">Error: '.$ShortMessage.'</span>';
     //     }
     // }
     $link .= $this->displayErrors($item['errors']);
     $link .= $this->displayExtraMessage($item);
     return $link;
 }
Beispiel #2
0
 function printTree($tree, $depth = 0, $result = array())
 {
     $categories_map_ebay = self::getOption('categories_map_ebay');
     $categories_map_store = self::getOption('categories_map_store');
     if ($this->account_id) {
         $categories_map_ebay = maybe_unserialize(WPLE()->accounts[$this->account_id]->categories_map_ebay);
         $categories_map_store = maybe_unserialize(WPLE()->accounts[$this->account_id]->categories_map_store);
     }
     if ($tree != 0 && count($tree) > 0) {
         foreach ($tree as $node) {
             // indent category name accourding to depth
             $node->name = str_repeat('&ndash; ', $depth) . $node->name;
             // echo $node->name;
             // get ebay category and (full) name
             $ebay_category_id = @$categories_map_ebay[$node->term_id];
             $store_category_id = @$categories_map_store[$node->term_id];
             // add item to results - excluding children
             $tmpnode = array('term_id' => $node->term_id, 'parent' => $node->parent, 'category' => $node->name, 'ebay_category_id' => $ebay_category_id, 'ebay_category_name' => EbayCategoriesModel::getFullEbayCategoryName($ebay_category_id, $this->site_id), 'store_category_id' => $store_category_id, 'store_category_name' => EbayCategoriesModel::getFullStoreCategoryName($store_category_id, $this->account_id), 'description' => $node->description);
             $result[] = $tmpnode;
             $result = $this->printTree($node->children, $depth + 1, $result);
         }
     }
     return $result;
 }
Beispiel #3
0
							</tr>
							<tr>
								<td colspan="4" height="10"></td>
							</tr>

							<tr>
								<th class="vi-is1-lbl">
									eBay Category:
								</th>
								<td colspan="3" class="vi-is1-clr">
									<?php 
if ($wpl_item->PrimaryCategory->CategoryID) {
    echo EbayCategoriesModel::getFullEbayCategoryName($wpl_item->PrimaryCategory->CategoryID, $wpl_site_id);
}
if ($wpl_item->SecondaryCategory->CategoryID) {
    echo '<br>' . EbayCategoriesModel::getFullEbayCategoryName($wpl_item->SecondaryCategory->CategoryID, $wpl_site_id);
}
?>
								</td>
							</tr>
							<tr>
								<td colspan="4" height="10"></td>
							</tr>

							<?php 
if ($wpl_item->Storefront->StoreCategoryID) {
    ?>
							<tr>
								<th class="vi-is1-lbl">
									Store Category:
								</th>
Beispiel #4
0
	a.link_select_category {
		float: right;
		padding-top: 3px;
		text-decoration: none;
	}
	a.link_remove_category {
		padding-left: 3px;
		text-decoration: none;
	}
	
</style>

					<?php 
// fetch full category names
$item_details['ebay_category_1_name'] = EbayCategoriesModel::getFullEbayCategoryName($item_details['ebay_category_1_id'], $wpl_site_id);
$item_details['ebay_category_2_name'] = EbayCategoriesModel::getFullEbayCategoryName($item_details['ebay_category_2_id'], $wpl_site_id);
$item_details['store_category_1_name'] = EbayCategoriesModel::getFullStoreCategoryName($item_details['store_category_1_id'], $wpl_account_id);
$item_details['store_category_2_name'] = EbayCategoriesModel::getFullStoreCategoryName($item_details['store_category_2_id'], $wpl_account_id);
?>

					<div class="postbox" id="EbayCategorySelectionBox">
						<h3><span><?php 
echo __('eBay categories', 'wplister');
?>
</span></h3>
						<div class="inside">

							<div style="position:relative; margin: 0 5px;">
								<label for="wpl-text-ebay_category_1_name" class="text_label">
									<?php 
echo __('Primary eBay category', 'wplister');
 function showItemSpecifics()
 {
     global $post;
     // get data
     $wpl_available_attributes = ProductWrapper::getAttributeTaxonomies();
     $wpl_default_ebay_category_id = get_post_meta($post->ID, '_ebay_category_1_id', true);
     // $specifics contains all available item specifics for the selected category
     // $item_specifics contains values set for this particular product / profile
     // $specifics                 = get_post_meta( $post->ID, '_ebay_category_specifics', true );
     $specifics = array();
     $item_specifics = get_post_meta($post->ID, '_ebay_item_specifics', true);
     // get listing object
     $listing = $this->get_current_ebay_item();
     $wpl_account_id = $listing && $listing->account_id ? $listing->account_id : get_option('wplister_default_account_id');
     $wpl_site_id = $listing ? $listing->site_id : get_option('wplister_ebay_site_id');
     // $profile_id  = $listing && $listing->profile_id ? $listing->profile_id : false;
     $post_id = $post->ID;
     // // if primary category is set on product level, update stored category specifics if required
     // // (fixes empty item specifics box on imported products)
     // if ( $wpl_default_ebay_category_id && ! $specifics ) {
     // 	$specifics = $this->get_updated_item_specifics_for_product_and_category( $post_id, $wpl_default_ebay_category_id, $wpl_account_id );
     // }
     // if no primary category selected on product level, check profile for primary category
     $profile = $this->get_current_listing_profile();
     if (!$wpl_default_ebay_category_id) {
         if ($profile && $profile['details']['ebay_category_1_id']) {
             $wpl_default_ebay_category_id = $profile['details']['ebay_category_1_id'];
             // $specifics = maybe_unserialize( $profile['category_specifics'] );
         }
     }
     // if there is still no primary eBay category, look up the product's category in the category map
     if (!$wpl_default_ebay_category_id) {
         // get ebay categories map
         $categories_map_ebay = get_option('wplister_categories_map_ebay');
         if (isset(WPLE()->accounts[$wpl_account_id])) {
             $account = WPLE()->accounts[$wpl_account_id];
             $categories_map_ebay = maybe_unserialize($account->categories_map_ebay);
         }
         // fetch products local category terms
         $terms = wp_get_post_terms($post_id, ProductWrapper::getTaxonomy());
         // WPLE()->logger->info('terms: '.print_r($terms,1));
         // echo "<pre>";print_r($terms);echo"</pre>";#die();
         // echo "<pre>";print_r($categories_map_ebay);echo"</pre>";#die();
         $ebay_category_id = false;
         foreach ($terms as $term) {
             // look up ebay category
             if (isset($categories_map_ebay[$term->term_id])) {
                 $ebay_category_id = $categories_map_ebay[$term->term_id];
                 $ebay_category_id = apply_filters('wplister_apply_ebay_category_map', $ebay_category_id, $post_id);
             }
             // check ebay category
             if (intval($ebay_category_id) > 0) {
                 $wpl_default_ebay_category_id = $ebay_category_id;
                 // $specifics = $this->get_updated_item_specifics_for_product_and_category( $post_id, $ebay_category_id, $wpl_account_id );
                 break;
             }
         }
         // each term
     }
     // if still no ebay category
     // load specifics if we have a category
     if ($wpl_default_ebay_category_id) {
         $specifics = EbayCategoriesModel::getItemSpecificsForCategory($wpl_default_ebay_category_id, false, $wpl_account_id);
         // $specifics = array( $wpl_default_ebay_category_id => $specifics );
     }
     // echo "<pre>";print_r($wpl_default_ebay_category_id);echo"</pre>";#die();
     // echo "<pre>";print_r($profile);echo"</pre>";#die();
     // echo "<pre>";print_r($specifics);echo"</pre>";#die();
     // echo "<pre>";print_r($item_specifics);echo"</pre>";#die();
     // add attribute for SKU
     // $attrib = new stdClass();
     // $attrib->name = '_sku';
     // $attrib->label = 'SKU';
     // $wpl_available_attributes[] = $attrib;
     // process custom attributes
     $wpl_custom_attributes = array();
     $custom_attributes = apply_filters('wplister_custom_attributes', array());
     if (is_array($custom_attributes)) {
         foreach ($custom_attributes as $attrib) {
             $new_attribute = new stdClass();
             $new_attribute->name = $attrib['id'];
             $new_attribute->label = $attrib['label'];
             $wpl_custom_attributes[] = $new_attribute;
         }
     }
     echo '<div class="ebay_item_specifics_wrapper">';
     echo '<h2>' . __('Item Specifics', 'wplister') . '</h2>';
     include WPLISTER_PATH . '/views/profile/edit_item_specifics.php';
     // let the user know which category the available item specifics are based on
     if ($profile && $profile['details']['ebay_category_1_id']) {
         $profile_link = '<a href="admin.php?page=wplister-profiles&action=edit&profile=' . $profile['profile_id'] . '" target="_blank">' . $profile['profile_name'] . '</a>';
         echo '<small>These options are based on the selected profile <b>' . $profile_link . '</b> and its primary eBay category <b>' . $profile['details']['ebay_category_1_name'] . '</b>.</small>';
     } elseif ($wpl_default_ebay_category_id && isset($categories_map_ebay)) {
         $category_path = EbayCategoriesModel::getFullEbayCategoryName($wpl_default_ebay_category_id, $wpl_site_id);
         echo '<small>Item specifics are based on the eBay category <b>' . $category_path . '</b> according to your category settings.</small>';
     }
     echo '</div>';
 }