* * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include_once dirname(__FILE__) . '/../../../config/config.inc.php'; include_once dirname(__FILE__) . '/../../../init.php'; include_once dirname(__FILE__) . '/../ebay.php'; $ebay = new Ebay(); $ebay_profile = new EbayProfile((int) Tools::getValue('profile')); if (!Configuration::get('EBAY_SECURITY_TOKEN') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) { return Tools::safeOutput(Tools::getValue('not_logged_str')); } $categories = Category::getCategories(Tools::getValue('id_lang')); $category_list = $ebay->getChildCategories($categories, version_compare(_PS_VERSION_, '1.5', '>') ? 1 : 0, array(), '', Tools::getValue('s')); $offset = 20; $page = (int) Tools::getValue('p', 0); if ($page < 2) { $page = 1; } $limit = $offset * ($page - 1); $nb_categories = count($category_list); $category_list = array_slice($category_list, $limit, $offset); $ebay_category_list = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'ebay_category` WHERE `id_category_ref` = `id_category_ref_parent` AND `id_country` = ' . (int) $ebay_profile->ebay_site_id); if (version_compare(_PS_VERSION_, '1.5', '>')) { $rq_products = ' SELECT COUNT(DISTINCT(p.`id_product`)) AS nbProducts,
if (array_key_exists($key, $array)) { $new = array(); foreach ($array as $k => $value) { $new[$k] = $value; if ($k === $key) { $new[$new_key] = $new_value; } } return $new; } return false; } $ebay = new Ebay(); $ebay_profile = new EbayProfile((int) Tools::getValue('profile')); if (!Configuration::get('EBAY_SECURITY_TOKEN') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) { return Tools::safeOutput(Tools::getValue('not_logged_str')); } $category_list = $ebay->getChildCategories(Category::getCategories(Tools::getValue('id_lang')), version_compare(_PS_VERSION_, '1.5', '>') ? 1 : 0); $offset = 20; $page = (int) Tools::getValue('p', 0); if ($page < 2) { $page = 1; } $limit = $offset * ($page - 1); $category_list = array_slice($category_list, $limit, $offset); $ebay_store_category_list = EbayStoreCategory::getCategoriesWithConfiguration($ebay_profile->id); $smarty = Context::getContext()->smarty; /* Smarty datas */ $template_vars = array('tabHelp' => '&id_tab=7', '_path' => $ebay->getPath(), 'categoryList' => $category_list, 'eBayStoreCategoryList' => $ebay_store_category_list, 'request_uri' => $_SERVER['REQUEST_URI'], 'noCatFound' => Tools::getValue('ch_no_cat_str'), 'p' => $page); $smarty->assign($template_vars); echo $ebay->display(realpath(dirname(__FILE__) . '/../'), '/views/templates/hook/table_store_categories.tpl');
AND ep.`id_ebay_product` = ( SELECT MIN(ep2.`id_ebay_product`) FROM `' . _DB_PREFIX_ . 'ebay_product` ep2 WHERE ep2.`id_product` = ep.`id_product` AND ep2.`id_ebay_profile` = ep.`id_ebay_profile` )' . ' WHERE 1' . $ebay->addSqlRestrictionOnLang('pl') . $ebay->addSqlRestrictionOnLang('cl') . $ebay->addSqlRestrictionOnLang('s'); if ($search) { $query .= ' AND pl.`name` LIKE \'%' . $search . '%\''; } //$query .= ' GROUP BY s.`id_product`'; $queryCount = preg_replace('/SELECT ([a-zA-Z.,` ]+) FROM /', 'SELECT COUNT(*) FROM ', $query); $nbProducts = Db::getInstance()->getValue($queryCount); $res = Db::getInstance()->executeS($query . ' ORDER BY p.`id_product` ASC LIMIT ' . $offset . ', ' . $limit); // categories $category_list = $ebay->getChildCategories(Category::getCategories($ebay_profile->id_lang, false), version_compare(_PS_VERSION_, '1.5', '>') ? 1 : 0); // eBay categories $ebay_categories = EbayCategoryConfiguration::getEbayCategories($ebay_profile->id); $content = Context::getContext(); $employee = new Employee((int) Tools::getValue('id_employee')); $context->employee = $employee; foreach ($res as &$row) { if ($row['EbayProductRef']) { $row['link'] = EbayProduct::getEbayUrl($row['EbayProductRef'], $ebay_request->getDev()); } foreach ($category_list as $cat) { if ($cat['id_category'] == $row['id_category']) { $row['category_full_name'] = $cat['name']; $row['is_category_active'] = $cat['active']; break; }