public function importTemplatesForCategory($category_name, $site_code) { WPLA()->logger->info("importTemplatesForCategory( {$category_name} , {$site_code} )"); $file_index = WPLA_FeedTemplateIndex::get_file_index(); $this->imported_count = 0; if (!isset($file_index[$site_code])) { return; } $site = $file_index[$site_code]; // echo "<pre>";print_r($category_name);echo"</pre>"; // echo "<pre>";print_r($site);echo"</pre>"; $this->market = WPLA_AmazonMarket::getMarketByCountyCode($site_code); $this->site_id = $this->market->id; $this->site_code = $site_code; if (!isset($site['categories'][$category_name])) { return; } $category = $site['categories'][$category_name]; // echo "<pre>";print_r($category);echo"</pre>"; // $template_files = $category['templates']; // $btguides_files = $category['btguides']; // echo "<pre>";print_r($template_files);echo"</pre>"; // echo "<pre>";print_r($btguides_files);echo"</pre>"; WPLA()->logger->info("importing files for {$this->site_id} / {$this->site_code}"); $this->importTemplates($category['templates'], $site_code); $this->importBrowseTreeGuides($category['btguides'], $site_code); // remove data files $this->cleanupTempFiles(); return $this->imported_count; }
public function displayEditAccountsPage() { // get account $account_id = $_REQUEST['amazon_account']; $account = new WPLA_AmazonAccount($account_id); if (!$account) { die('wrong account'); } $account->allowed_markets = maybe_unserialize($account->allowed_markets); $active_tab = 'accounts'; $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'account' => $account, 'amazon_markets' => WPLA_AmazonMarket::getAll(), 'default_account' => get_option('wpla_default_account_id'), 'settings_url' => 'admin.php?page=' . self::ParentMenuId . '-settings', 'form_action' => 'admin.php?page=' . self::ParentMenuId . '-settings' . '&tab=' . $active_tab); $this->display('account_edit_page', $aData); }
static function getUrlForItemObj($item) { $item = (array) $item; $listing_url = 'http://www.amazon.com/dp/' . $item['asin'] . '/'; // default to US if ($item['account_id']) { $account = WPLA_AmazonAccount::getAccount($item['account_id']); $market = $account ? WPLA_AmazonMarket::getMarket($account->market_id) : false; $listing_url = $market ? 'http://www.' . $market->url . '/dp/' . $item['asin'] . '/' : $listing_url; } return $listing_url; }
</div> </div> <!-- #postbox-container-1 --> <!-- #postbox-container-2 --> <div id="postbox-container-2" class="postbox-container"> <div class="meta-box-sortables ui-sortable"> <?php foreach ($wpl_file_index as $site_code => $amazon_site) { ?> <?php $site = WPLA_AmazonMarket::getMarketByCountyCode($site_code); $site_id = $site->id; ?> <div class="postbox wpla_categories" id="CategoriesBox-<?php echo $site_code; ?> "> <h3 class="hndle"><span><?php echo $amazon_site['site']; ?> </span></h3> <div class="inside"> <!-- <h4>Categories</h4> --> <ul>
public function ajax_get_amazon_categories_tree() { $path = $_POST["dir"]; // example: /0/20081/37903/ - /0/ means root $parent_node_id = basename($path); $categories = $this->getChildrenOfCategory($parent_node_id); // echo "<pre>";print_r($categories);echo"</pre>";#die(); // $categories = apply_filters( 'wpla_get_amazon_categories_node', $categories, $parent_node_id, $path ); $show_node_ids = get_option('wpla_show_browse_node_ids'); if (count($categories) > 0) { echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">" . "\n"; // first show all folders foreach ($categories as $cat) { if ($cat['leaf'] == '0') { $node_id = $cat['node_id']; $node_label = $cat['node_name']; $node_slug = $_POST['dir'] . $cat['node_id']; $keyword = $cat['keyword']; if ($path == '/0/') { $node_label .= ' (' . WPLA_AmazonMarket::getMarketCode($cat['site_id']) . ')'; } elseif ($show_node_ids) { $node_label .= ' (' . $cat['node_id'] . ')'; if ($keyword) { $node_label .= ' (' . $keyword . ')'; } } echo '<li class="directory collapsed"><a href="#" id="wpla_node_id_' . $node_id . '" rel="' . $node_slug . '/" data-keyword="' . $keyword . '" >' . $node_label . '</a></li>' . "\n"; } } // then show all leaf nodes foreach ($categories as $cat) { if ($cat['leaf'] == '1') { $node_id = $cat['node_id']; $node_label = $cat['node_name']; // $node_slug = $_POST['dir'] . $cat['keyword']; $node_slug = $cat['node_id'] ? $_POST['dir'] . $cat['node_id'] : $_POST['dir'] . $cat['keyword']; $keyword = $cat['keyword']; if ($show_node_ids) { $node_label .= ' (' . $cat['node_id'] . ')'; if ($keyword) { $node_label .= ' (' . $keyword . ')'; } } echo '<li class="file ext_txt"><a href="#" id="wpla_node_id_' . $node_id . '" rel="' . $node_slug . '" data-keyword="' . $keyword . '" >' . $node_label . '</a></li>' . "\n"; } } echo "</ul>"; } exit; }
public function getOrderUrl($order_id, $marketplace_id = NULL) { $domain = WPLA_AmazonMarket::getUrl($marketplace_id); return 'https://sellercentral.' . $domain . '/gp/orders-v2/details/?orderID=' . $order_id; }
function getMarket() { return WPLA_AmazonMarket::getMarket($this->market_id); }