コード例 #1
0
 function postProcess()
 {
     // Reset Image if they have modification on the size
     if ($this->ebay_profile->getConfiguration('EBAY_PICTURE_SIZE_DEFAULT') != (int) Tools::getValue('sizedefault') || $this->ebay_profile->getConfiguration('EBAY_PICTURE_SIZE_SMALL') != (int) Tools::getValue('sizesmall') || $this->ebay_profile->getConfiguration('EBAY_PICTURE_SIZE_BIG') != (int) Tools::getValue('sizebig')) {
         EbayProductImage::removeAllProductImage();
     }
     // Saving new configurations
     $picture_per_listing = (int) Tools::getValue('picture_per_listing');
     if ($picture_per_listing < 0) {
         $picture_per_listing = 0;
     }
     if ($this->ebay_profile->setConfiguration('EBAY_PICTURE_SIZE_DEFAULT', (int) Tools::getValue('sizedefault')) && $this->ebay_profile->setConfiguration('EBAY_PICTURE_SIZE_SMALL', (int) Tools::getValue('sizesmall')) && $this->ebay_profile->setConfiguration('EBAY_PICTURE_SIZE_BIG', (int) Tools::getValue('sizebig')) && $this->ebay_profile->setConfiguration('EBAY_PICTURE_PER_LISTING', $picture_per_listing) && $this->ebay->setConfiguration('EBAY_API_LOGS', Tools::getValue('api_logs') ? 1 : 0) && $this->ebay->setConfiguration('EBAY_ACTIVATE_LOGS', Tools::getValue('activate_logs') ? 1 : 0) && Configuration::updateValue('EBAY_SYNC_PRODUCTS_BY_CRON', 'cron' === Tools::getValue('sync_products_mode')) && Configuration::updateValue('EBAY_SYNC_ORDERS_BY_CRON', 'cron' === Tools::getValue('sync_orders_mode')) && Configuration::updateValue('EBAY_SEND_STATS', Tools::getValue('stats') ? 1 : 0, false, 0, 0) && Configuration::updateValue('EBAY_ORDERS_DAYS_BACKWARD', (int) Tools::getValue('orders_days_backward'), false, 0, 0) && Configuration::updateValue('EBAY_LOGS_DAYS', (int) Tools::getValue('logs_conservation_duration'), false, 0, 0)) {
         if (Tools::getValue('activate_logs') == 0) {
             if (file_exists(dirname(__FILE__) . '/../../log/request.txt')) {
                 unlink(dirname(__FILE__) . '/../../log/request.txt');
             }
         }
         return $this->ebay->displayConfirmation($this->ebay->l('Settings updated'));
     } else {
         return $this->ebay->displayError($this->ebay->l('Settings failed'));
     }
 }
コード例 #2
0
 * 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 dirname(__FILE__) . '/../../../config/config.inc.php';
if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) {
    die('ERROR: Invalid Token');
}
include dirname(__FILE__) . '/../classes/EbayProductImage.php';
if (Tools::getValue('action') == 'delete-all') {
    if (EbayProductImage::removeAllProductImage() === true) {
        echo 'success';
    } else {
        echo 'error';
    }
} else {
    die('ERROR: Invalid arguments');
}
コード例 #3
0
ファイル: EbaySynchronizer.php プロジェクト: poonc/ebay
 public static function _getPictures($product, $ebay_profile, $id_lang, $context, $variations)
 {
     $pictures = array();
     $pictures_medium = array();
     $pictures_large = array();
     $nb_pictures = 1 + (int) $ebay_profile->getConfiguration('EBAY_PICTURE_PER_LISTING');
     $large = new ImageType((int) $ebay_profile->getConfiguration('EBAY_PICTURE_SIZE_BIG'));
     $small = new ImageType((int) $ebay_profile->getConfiguration('EBAY_PICTURE_SIZE_SMALL'));
     $default = new ImageType((int) $ebay_profile->getConfiguration('EBAY_PICTURE_SIZE_DEFAULT'));
     foreach (EbaySynchronizer::orderImages($product->getImages($id_lang)) as $image) {
         $pictures_default = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, $default->name);
         if (count($pictures) == 0 && $nb_pictures == 1 || self::_hasVariationProducts($variations)) {
             // no extra picture, we don't upload the image
             $pictures[] = $pictures_default;
         } elseif (count($pictures) < $nb_pictures) {
             // we upload every image if there are extra pictures
             $pictures[] = EbayProductImage::getEbayUrl($pictures_default, $product->name . '_' . (count($pictures) + 1));
         }
         $pictures_medium[] = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, $small->name);
         $pictures_large[] = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, $large->name);
     }
     return array('general' => $pictures, 'medium' => $pictures_medium, 'large' => $pictures_large);
 }
コード例 #4
0
 private static function _getPictures($product, $id_lang, $context, $products_configuration)
 {
     $pictures = array();
     $pictures_medium = array();
     $pictures_large = array();
     $nb_pictures = 1 + (isset($products_configuration[$product->id]['extra_images']) ? $products_configuration[$product->id]['extra_images'] : 0);
     foreach (EbaySynchronizer::orderImages($product->getImages($id_lang)) as $image) {
         $large_pict = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, 'large');
         if (count($pictures) == 0 && $nb_pictures == 1) {
             // no extra picture, we don't upload the image
             $pictures[] = $large_pict;
         } elseif (count($pictures) < $nb_pictures) {
             // we upload every image if there are extra pictures
             $pictures[] = EbayProductImage::getEbayUrl($large_pict, $product->name . '_' . (count($pictures) + 1));
         }
         $pictures_medium[] = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, 'medium');
         $pictures_large[] = $large_pict;
     }
     return array('general' => $pictures, 'medium' => $pictures_medium, 'large' => $pictures_large);
 }
コード例 #5
0
 private static function _getPictures($product, $id_lang, $context, $products_configuration)
 {
     $pictures = array();
     $pictures_medium = array();
     $pictures_large = array();
     $nb_pictures = 1 + (isset($products_configuration[$product->id]['extra_images']) ? $products_configuration[$product->id]['extra_images'] : 0);
     $large = new ImageType((int) Configuration::get('EBAY_PICTURE_SIZE_BIG'));
     $small = new ImageType((int) Configuration::get('EBAY_PICTURE_SIZE_SMALL'));
     $default = new ImageType((int) Configuration::get('EBAY_PICTURE_SIZE_DEFAULT'));
     foreach (EbaySynchronizer::orderImages($product->getImages($id_lang)) as $image) {
         $pictures_default = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, $default->name);
         if (count($pictures) == 0 && $nb_pictures == 1) {
             // no extra picture, we don't upload the image
             $pictures[] = $pictures_default;
         } elseif (count($pictures) < $nb_pictures) {
             // we upload every image if there are extra pictures
             $pictures[] = EbayProductImage::getEbayUrl($pictures_default, $product->name . '_' . (count($pictures) + 1));
         }
         $pictures_medium[] = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, $small->name);
         $pictures_large[] = EbaySynchronizer::_getPictureLink($product->id, $image['id_image'], $context->link, $large->name);
     }
     return array('general' => $pictures, 'medium' => $pictures_medium, 'large' => $pictures_large);
 }