function __construct($stats_version, $ebay_profile) { if (!$ebay_profile) { return; } $this->stats_version = $stats_version; $this->id_ebay_profile = (int) $ebay_profile->id; $this->data = array('id' => sha1($this->_getDefaultShopUrl()), 'profile' => $ebay_profile->id, 'ebay_username' => sha1(Configuration::get('EBAY_IDENTIFIER')), 'ebay_site' => $ebay_profile->ebay_site_id, 'is_multishop' => version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive(), 'install_date' => Configuration::get('EBAY_INSTALL_DATE'), 'nb_listings' => EbayProduct::getNbProducts($ebay_profile->id), 'percent_of_catalog' => EbayProduct::getPercentOfCatalog($ebay_profile), 'nb_prestashop_categories' => EbayCategoryConfiguration::getNbPrestashopCategories($ebay_profile->id), 'nb_ebay_categories' => EbayCategoryConfiguration::getNbEbayCategories($ebay_profile->id), 'nb_optional_item_specifics' => EbayCategorySpecific::getNbOptionalItemSpecifics($ebay_profile->id), 'nb_national_shipping_services' => EbayShipping::getNbNationalShippings($ebay_profile->id), 'nb_international_shipping_services' => EbayShipping::getNbInternationalShippings($ebay_profile->id), 'date_add' => date('Y-m-d H:i:s'), 'Configuration' => EbayConfiguration::getAll($ebay_profile->id, array('EBAY_PAYPAL_EMAIL')), 'return_policy' => $ebay_profile->getReturnsPolicyConfiguration()->ebay_returns_description == '' ? 0 : 1, 'ps_version' => _PS_VERSION_); $this->date_add = date('Y-m-d H:i:s'); }
INNER JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON al.`id_attribute` = pac.`id_attribute` AND al.`id_lang` = ' . (int) $id_lang . ' LEFT JOIN ' . ($is_one_five ? '`' . _DB_PREFIX_ . 'stock_available`' : '`' . _DB_PREFIX_ . 'product_attribute`') . ' sa ON sa.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `' . _DB_PREFIX_ . 'ebay_product` ep ON ep.`id_product` = pa.`id_product` AND ep.`id_attribute` = pac.`id_product_attribute` AND ep.`id_ebay_profile` = ' . $id_ebay_profile . ' WHERE pa.`id_product` = ' . $id_product . $ebay->addSqlRestrictionOnLang('sa') . ' ORDER BY a.`position` ASC'; $res = Db::getInstance()->ExecuteS($sql); $final_res = array(); foreach ($res as $row) { if (isset($final_res[$row['id_product_attribute']])) { $final_res[$row['id_product_attribute']]['name'] .= ' ' . Tools::safeOutput($row['name']); } else { $row['name'] = Tools::safeOutput($row['name']); $row['stock'] = Tools::safeOutput($row['stock']); $row['id_product_ref'] = Tools::safeOutput($row['id_product_ref']); if ($row['id_product_ref']) { $row['link'] = EbayProduct::getEbayUrl($row['id_product_ref'], $ebay_request->getDev()); } $final_res[$row['id_product_attribute']] = $row; } } echo Tools::jsonEncode($final_res);
private static function _insertEbayProduct($id_product, $id_ebay_profile, $ebay_item_id, $date, $id_attribute = 0) { EbayProduct::insert(array('id_country' => 8, 'id_product' => (int) $id_product, 'id_attribute' => (int) $id_attribute, 'id_product_ref' => pSQL($ebay_item_id), 'date_add' => pSQL($date), 'date_upd' => pSQL($date), 'id_ebay_profile' => (int) $id_ebay_profile)); //If eBay Product has been inserted then the configuration of eBay is OK Configuration::updateValue('EBAY_CONFIGURATION_OK', true); }
private static function _insertEbayProduct($id_product, $ebay_item_id, $date, $id_attribute = 0) { EbayProduct::insert(array('id_country' => 8, 'id_product' => (int) $id_product, 'id_attribute' => (int) $id_attribute, 'id_product_ref' => pSQL($ebay_item_id), 'date_add' => pSQL($date), 'date_upd' => pSQL($date))); }
public function displayEbayListingsAjax($id_employee = null) { $ebay = new EbayRequest(); $employee = new Employee($id_employee); $this->context->employee = $employee; $link = $this->context->link; $id_lang = $this->context->language->id; $products_ebay_listings = array(); $products = EbayProduct::getProductsWithoutBlacklisted($id_lang, $this->ebay_profile->id, false); $data = array('id_lang' => $id_lang, 'titleTemplate' => $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE')); foreach ($products as $p) { $data['real_id_product'] = (int) $p['id_product']; $data['name'] = $p['name']; $data['manufacturer_name'] = $p['manufacturer_name']; $data['reference'] = $p['reference']; $data['ean13'] = $p['ean13']; $reference_ebay = $p['id_product_ref']; $product = new Product((int) $p['id_product'], true, $id_lang); if ((int) $p['id_attribute'] > 0) { // No Multi Sku case so we do multiple products from a multivariation product $combinaison = $this->_getAttributeCombinationsById($product, (int) $p['id_attribute'], $id_lang); $combinaison = $combinaison[0]; $data['reference'] = $combinaison['reference']; $data['ean13'] = $combinaison['ean13']; $variation_specifics = EbaySynchronizer::_getVariationSpecifics($combinaison['id_product'], $combinaison['id_product_attribute'], $id_lang, $this->ebay_profile->ebay_site_id); foreach ($variation_specifics as $variation_specific) { $data['name'] .= ' ' . $variation_specific; } $products_ebay_listings[] = array('id_product' => $combinaison['id_product'] . '-' . $combinaison['id_product_attribute'], 'quantity' => $combinaison['quantity'], 'prestashop_title' => $data['name'], 'ebay_title' => EbayRequest::prepareTitle($data), 'reference_ebay' => $reference_ebay, 'link' => method_exists($link, 'getAdminLink') ? $link->getAdminLink('AdminProducts') . '&id_product=' . (int) $combinaison['id_product'] . '&updateproduct' : $link->getProductLink((int) $combinaison['id_product']), 'link_ebay' => EbayProduct::getEbayUrl($reference_ebay, $ebay->getDev())); } else { $products_ebay_listings[] = array('id_product' => $data['real_id_product'], 'quantity' => $product->quantity, 'prestashop_title' => $data['name'], 'ebay_title' => EbayRequest::prepareTitle($data), 'reference_ebay' => $reference_ebay, 'link' => method_exists($link, 'getAdminLink') ? $link->getAdminLink('AdminProducts') . '&id_product=' . (int) $data['real_id_product'] . '&updateproduct' : $link->getProductLink((int) $data['real_id_product']), 'link_ebay' => EbayProduct::getEbayUrl($reference_ebay, $ebay->getDev())); } } $this->smarty->assign('products_ebay_listings', $products_ebay_listings); echo $this->display(__FILE__, 'views/templates/hook/ebay_listings_ajax.tpl'); }
private function _relistItems() { if (Configuration::get('EBAY_LISTING_DURATION') != 'GTC' && Configuration::get('EBAY_AUTOMATICALLY_RELIST') == 'on') { //We do relist automatically each day $this->setConfiguration('EBAY_LAST_RELIST', date('Y-m-d')); $ebay = new EbayRequest(); $days = substr(Configuration::get('EBAY_LISTING_DURATION'), 5); foreach (EbayProduct::getProducts($days, 10) as $item) { $new_item_id = $ebay->relistFixedPriceItem($item['itemID']); if (!$new_item_id) { $new_item_id = $item['id_product_ref']; } //Update of the product so that we don't take it in the next 10 products to relist ! EbayProduct::updateByIdProductRef($item['id_product_ref'], array('id_product_ref' => pSQL($new_item_id), 'date_upd' => date('Y-m-d h:i:s'))); } } }
* * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @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_request = new EbayRequest(); $id_product_ref = Tools::getValue('id_product_ref'); if (!Configuration::get('EBAY_SECURITY_TOKEN') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) { return Tools::safeOutput(Tools::getValue('not_logged_str')); } EbayProduct::deleteByIdProductRef($id_product_ref); echo '1';