// Merge -> revision 8720

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8722 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-22 15:45:10 +00:00
parent 69db63f26c
commit 4f2a090e24
87 changed files with 1591 additions and 724 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>ebay</name>
<displayName><![CDATA[eBay]]></displayName>
<version><![CDATA[1.2.4]]></version>
<version><![CDATA[1.2.5]]></version>
<description><![CDATA[Open your shop on the eBay market place !]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab>
+11 -2
View File
@@ -57,7 +57,7 @@ class eBayRequest
private $compatibilityLevel;
private $debug = true;
/******************************************************************/
/** Constructor And Request Methods *******************************/
@@ -125,6 +125,14 @@ class eBayRequest
// Close the connection
curl_close($connection);
// Debug
if ($this->debug == true)
{
if (!file_exists(dirname(__FILE__).'/log/request.php'))
file_put_contents(dirname(__FILE__).'/log/request.php', "<?php\n\n", FILE_APPEND | LOCK_EX);
file_put_contents(dirname(__FILE__).'/log/request.php', date('d/m/Y H:i:s')."\n\n".$request."\n\n".$response."\n\n-------------------\n\n", FILE_APPEND | LOCK_EX);
}
// Return the response
return $response;
}
@@ -889,6 +897,7 @@ class eBayRequest
// Generate Variations Set
$requestXml .= ' <VariationSpecificsSet>'."\n";
foreach ($datas['variationsList'] as $group => $v)
if (isset($group) && !empty($group))
{
$requestXml .= ' <NameValueList>'."\n";
$requestXml .= ' <Name>'.$group.'</Name>'."\n";
@@ -1049,7 +1058,7 @@ class eBayRequest
$requestXml .= ' <CreateTimeFrom>'.$CreateTimeFrom.'</CreateTimeFrom>'."\n";
$requestXml .= ' <CreateTimeTo>'.$CreateTimeTo.'</CreateTimeTo>'."\n";
$requestXml .= ' <OrderRole>Seller</OrderRole>'."\n";
$requestXml .= ' <OrderStatus>Completed</OrderStatus>'."\n";
//$requestXml .= ' <OrderStatus>Completed</OrderStatus>'."\n";
$requestXml .= ' <Pagination>'."\n";
$requestXml .= ' <EntriesPerPage>100</EntriesPerPage>'."\n";
$requestXml .= ' <PageNumber>'.$page.'</PageNumber>'."\n";
+108 -14
View File
@@ -59,7 +59,7 @@ class Ebay extends Module
{
$this->name = 'ebay';
$this->tab = 'market_place';
$this->version = '1.2.4';
$this->version = '1.2.5';
$this->author = 'PrestaShop';
parent::__construct ();
$this->displayName = $this->l('eBay');
@@ -329,7 +329,7 @@ class Ebay extends Module
// init Var
$dateNew = date('Y-m-d').'T'.date('H:i:s').'.000Z';
if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-45 minutes')).'T'.date('H:i:s', strtotime('-45 minutes')).'.000Z')
if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-30 minutes')).'T'.date('H:i:s', strtotime('-30 minutes')).'.000Z')
{
// Lock
Configuration::updateValue('EBAY_ORDER_LAST_UPDATE', $dateNew);
@@ -351,7 +351,9 @@ class Ebay extends Module
}
if ($orderList)
foreach ($orderList as $order)
{
foreach ($orderList as $korder => $order)
{
if ($order['status'] == 'Complete' && $order['amount'] > 0.1 && isset($order['product_list']) && count($order['product_list']))
{
if (!Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `'._DB_PREFIX_.'ebay_order` WHERE `id_order_ref` = \''.pSQL($order['id_order_ref']).'\''))
@@ -473,10 +475,23 @@ class Ebay extends Module
// Register the ebay order ref
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_order', array('id_order_ref' => pSQL($order['id_order_ref']), 'id_order' => (int)$id_order), 'INSERT');
}
else
$orderList[$korder]['errors'][] = $this->l('Could not add product to cart (maybe your stock quantity is 0)');
}
else
$orderList[$korder]['errors'][] = $this->l('Could not found products in database');
}
else
$orderList[$korder]['errors'][] = $this->l('Invalid e-mail');
}
else
$orderList[$korder]['errors'][] = $this->l('Order already imported');
}
else
$orderList[$korder]['errors'][] = $this->l('Status not complete or amount less than 0.1 or no product matching');
}
file_put_contents(dirname(__FILE__).'/log/orders.php', "<?php\n\n".'$dateLastImport = '."'".date('d/m/Y H:i:s')."';\n\n".'$orderList = '.var_export($orderList, true).";\n\n");
}
}
}
@@ -488,7 +503,12 @@ class Ebay extends Module
// Alias
public function hookupdateproduct($params) { $this->hookaddproduct($params); }
public function hookupdateProductAttribute($params) { $this->hookaddproduct($params); }
public function hookupdateProductAttribute($params)
{
$id_product = Db::getInstance()->getValue('SELECT `id_product` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` = '.(int)$params['id_product_attribute']);
$params['product'] = new Product($id_product);
$this->hookaddproduct($params);
}
public function hookdeleteproduct($params) { $this->hookaddproduct($params); }
public function hookheader($params) { $this->hookbackOfficeTop($params); }
public function hookbackOfficeFooter($params) { $this->hookbackOfficeTop($params); }
@@ -548,7 +568,7 @@ class Ebay extends Module
// Displaying Information from Prestashop
$stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 2)));
$stream_context = @stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 2)));
$prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&registered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
if (!Validate::isCleanHtml($prestashopContent))
$prestashopContent = '';
@@ -710,14 +730,16 @@ class Ebay extends Module
<li id="menuTab2" class="menuTabButton">2. '.$this->l('Categories settings').'</li>
<li id="menuTab3" class="menuTabButton">3. '.$this->l('Template manager').'</li>
<li id="menuTab4" class="menuTabButton">4. '.$this->l('eBay Sync').'</li>
<li id="menuTab5" class="menuTabButton">5. '.$this->l('Help').'</li>
<li id="menuTab5" class="menuTabButton">5. '.$this->l('Orders history').'</li>
<li id="menuTab6" class="menuTabButton">6. '.$this->l('Help').'</li>
</ul>
<div id="tabList">
<div id="menuTab1Sheet" class="tabItem selected">'.$this->_displayFormParameters().'</div>
<div id="menuTab2Sheet" class="tabItem">'.$this->_displayFormCategory().'</div>
<div id="menuTab3Sheet" class="tabItem">'.$this->_displayFormTemplateManager().'</div>
<div id="menuTab4Sheet" class="tabItem">'.$this->_displayFormEbaySync().'</div>
<div id="menuTab5Sheet" class="tabItem">'.$this->_displayHelp().'</div>
<div id="menuTab5Sheet" class="tabItem">'.$this->_displayOrdersHistory().'</div>
<div id="menuTab6Sheet" class="tabItem">'.$this->_displayHelp().'</div>
</div>
<br clear="left" />
<br />
@@ -882,6 +904,12 @@ class Ebay extends Module
if (!Configuration::get('EBAY_PAYPAL_EMAIL'))
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
// Load categories only if necessary
if (Db::getInstance()->getValue('SELECT COUNT(`id_ebay_category_configuration`) FROM `'._DB_PREFIX_.'ebay_category_configuration`') > 4 && Tools::getValue('section') != 'category')
return '<p align="center"><b>'.$this->l('Your categories have already been configured.').'</b></p>
<form action="index.php?tab='.$_GET['tab'].'&configure='.$_GET['configure'].'&token='.$_GET['token'].'&tab_module='.$_GET['tab_module'].'&module_name='.$_GET['module_name'].'&id_tab=2&section=category" method="post" class="form">
<p align="center"><input class="button" name="submitSave" type="submit" value="'.$this->l('See Categories').'" /></p></form>';
// Display eBay Categories
if (!Configuration::get('EBAY_CATEGORY_LOADED'))
{
@@ -1358,7 +1386,7 @@ class Ebay extends Module
// Empty error result
Configuration::updateValue('EBAY_SYNC_LAST_PRODUCT', 0);
@unlink('../modules/ebay/ajax/_ebaySyncError.log.php');
@unlink(dirname(__FILE__).'/log/syncError.php');
if ($_POST['ebay_sync_mode'] == 'A')
{
@@ -1450,10 +1478,10 @@ class Ebay extends Module
else
{
echo 'OK|'.$this->displayConfirmation($this->l('Settings updated').' ('.$this->l('Option').' '.Configuration::get('EBAY_SYNC_MODE').' : '.($nbProductsTotal - $nbProductsLess).' / '.$nbProductsTotal.' '.$this->l('product(s) sync with eBay').')');
if (file_exists('_ebaySyncError.log.php'))
if (file_exists(dirname(__FILE__).'/log/syncError.php'))
{
global $tab_error;
include('_ebaySyncError.log.php');
include(dirname(__FILE__).'/log/syncError.php');
foreach ($tab_error as $error)
{
$productsDetails = '<br /><u>'.$this->l('Product(s) concerned').' :</u>';
@@ -1462,7 +1490,7 @@ class Ebay extends Module
echo $this->displayError($error['msg'].'<br />'.$productsDetails);
}
echo '<style>#content .alert { text-align: left; width: 875px; }</style>';
@unlink('_ebaySyncError.log.php');
@unlink(dirname(__FILE__).'/log/syncError.php');
}
}
}
@@ -1479,10 +1507,10 @@ class Ebay extends Module
$categoryDefaultCache = array();
// Get errors back
if (file_exists('_ebaySyncError.log.php'))
if (file_exists(dirname(__FILE__).'/log/syncError.php'))
{
global $tab_error;
include('_ebaySyncError.log.php');
include(dirname(__FILE__).'/log/syncError.php');
}
// Up the time limit
@@ -1816,10 +1844,76 @@ class Ebay extends Module
}
if ($count_error > 0)
file_put_contents('_ebaySyncError.log.php', '<?php $tab_error = '.var_export($tab_error, true).'; ?>');
file_put_contents(dirname(__FILE__).'/log/syncError.php', '<?php $tab_error = '.var_export($tab_error, true).'; ?>');
}
/******************************************************************/
/** Orders History Methods *******************************************/
/******************************************************************/
private function _displayOrdersHistory()
{
// Check if the module is configured
if (!Configuration::get('EBAY_PAYPAL_EMAIL'))
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
$dateLastImport = '-';
if (file_exists(dirname(__FILE__).'/log/orders.php'))
include(dirname(__FILE__).'/log/orders.php');
$html = '<h2>'.$this->l('Last orders Importation').' :</h2><p><b>'.$dateLastImport.'</b></p><br /><br />
<h2>'.$this->l('Orders History').' :</h2>';
if (isset($orderList) && count($orderList) > 0)
foreach ($orderList as $order)
{
$html .= '<style>
.orderImportTd1 {border-right:1px solid #000}
.orderImportTd2 {border-right:1px solid #000;border-top:1px solid #000}
.orderImportTd3 {border-top:1px solid #000}
</style>
<p>
<b>'.$this->l('Order Ref eBay').' :</b> '.$order['id_order_ref'].'<br />
<b>'.$this->l('Id Order Seller').' :</b> '.$order['id_order_seller'].'<br />
<b>'.$this->l('Amount').' :</b> '.$order['amount'].'<br />
<b>'.$this->l('Status').' :</b> '.$order['status'].'<br />
<b>'.$this->l('Date').' :</b> '.$order['date'].'<br />
<b>'.$this->l('E-mail').' :</b> '.$order['email'].'<br />
<b>'.$this->l('Products').' :</b><br />';
if (isset($order['product_list']) && count($order['product_list']) > 0)
{
$html .= '<table border="0" cellpadding="4" cellspacing="0"><tr>
<td class="orderImportTd1"><b>'.$this->l('Id Product').'</b></td>
<td class="orderImportTd1"><b>'.$this->l('Id Product Attribute').'</b></td>
<td class="orderImportTd1"><b>'.$this->l('Quantity').'</b></td><td><b>'.$this->l('Price').'</b></td></tr>';
foreach ($order['product_list'] as $product)
$html .= '<tr><td class="orderImportTd2">'.$product['id_product'].'</td>
<td class="orderImportTd2">'.$product['id_product'].'</td>
<td class="orderImportTd2">'.$product['quantity'].'</td>
<td class="orderImportTd3">'.$product['price'].'</td></tr>';
$html .= '</table>';
}
if (isset($order['errors']) && count($order['errors']) > 0)
{
$html .= '<b>'.$this->l('Status Import').' :</b> KO<br />';
$html .= '<b>'.$this->l('Failure details').' :</b><br />';
foreach ($order['errors'] as $error)
$html .= $error.'t<br />';
}
else
$html .= '<b>'.$this->l('Status Import').' :</b> OK';
$html .= '</p><br />';
}
return $html;
}
/******************************************************************/
/** Help Config Methods *******************************************/
/******************************************************************/
+23
View File
@@ -9,6 +9,11 @@ $_MODULE['<{ebay}prestashop>ebay_8acabcc788c316f92b7850c76265b49b'] = 'Vous deve
$_MODULE['<{ebay}prestashop>ebay_d591cbc447d01e5a6165096ebfdf804e'] = 'Vous devez activer l\'extension cURL sur votre serveur si vous désirez utiliser ce module.';
$_MODULE['<{ebay}prestashop>ebay_1b18bd5d9d85f4f667614345ee20e3b2'] = 'Vous devez activer l\'option allow_url_fopen sur votre serveur si vous désirez utiliser ce module.';
$_MODULE['<{ebay}prestashop>ebay_8e64bc164aee46723ed2d70273c6f8ab'] = 'Vous devez enregistrer le module sur eBay';
$_MODULE['<{ebay}prestashop>ebay_5f8d9c30e0606a91c5d7b6e1bf1217ac'] = 'N\'a pas pu ajouté les produits au panier (peut être votre stock est il à 0)';
$_MODULE['<{ebay}prestashop>ebay_25fff46a6fe5b9512e2f4054f4ff6060'] = 'N\'a pas pu trouvé les produits dans votre catalogue';
$_MODULE['<{ebay}prestashop>ebay_eaa0d1591e6369a298dcd6cb1a8eba8a'] = 'E-mail invalide';
$_MODULE['<{ebay}prestashop>ebay_a11a07346e4343b393b7a6d29924043e'] = 'Commande déjà importé';
$_MODULE['<{ebay}prestashop>ebay_2e7adc61fa0cedcf1d442feafbaea1de'] = 'Le statut n\'est pas à \"Complete\" ou le montant de la commande est inférieur à 0.1 ou aucun produit n\'a pu être trouvé dans votre catalogue';
$_MODULE['<{ebay}prestashop>ebay_98f54d8bba6523829eeb8fd7ab9a2088'] = 'Continuer quand même ?';
$_MODULE['<{ebay}prestashop>ebay_2e4f4d8b849fb72905addc231d160e8b'] = 'Status du module eBay';
$_MODULE['<{ebay}prestashop>ebay_85f9d92e0551772437b934b7222d63cb'] = 'Le module eBay est fonctionnel.';
@@ -25,6 +30,7 @@ $_MODULE['<{ebay}prestashop>ebay_3225a10b07f1580f10dee4abc3779e6c'] = 'Paramètr
$_MODULE['<{ebay}prestashop>ebay_dc2f736ed903b4f6f72a36b763cd7717'] = 'Configuration des catégories';
$_MODULE['<{ebay}prestashop>ebay_0f5f872ba4c6575319e6beee6ebcc481'] = 'Template de la fiche produit';
$_MODULE['<{ebay}prestashop>ebay_47ba6504eb5b1e3a95ea3dbd960904db'] = 'Mise en ligne des produits';
$_MODULE['<{ebay}prestashop>ebay_1a6f6b88447d4c3a86da93913a1b844d'] = 'Historique des commandes';
$_MODULE['<{ebay}prestashop>ebay_6a26f548831e6a8c26bfbbd9f6ec61e0'] = 'Aide';
$_MODULE['<{ebay}prestashop>ebay_e5beb503fe9553f0ed5be3c324fc9cb7'] = 'Pour exporter vos produits sur eBay, vous devez créer un compte pro sur eBay (voir la partie Aide) et configurer le module eBay-Prestashop.';
$_MODULE['<{ebay}prestashop>ebay_230b8b5e65ef7731d72a42b1ddb0293f'] = 'Identifiant eBay';
@@ -49,6 +55,8 @@ $_MODULE['<{ebay}prestashop>ebay_458d329d5eb1caf63615141fb51e8329'] = 'Votre cod
$_MODULE['<{ebay}prestashop>ebay_c888438d14855d7d96a2724ee9c306bd'] = 'Configuration mise à jour';
$_MODULE['<{ebay}prestashop>ebay_b9284bff13acffdd879ef4ac7fca5234'] = 'Configuration non mise à jour.';
$_MODULE['<{ebay}prestashop>ebay_67e19ffdaa0a11e69349810403a9727e'] = 'Vous devez configurer l\'onglet \"Paramètres\" avant d\'utiliser cet onglet.';
$_MODULE['<{ebay}prestashop>ebay_0706a152f5e26f0cbce3de5269c54f30'] = 'Vos catégories ont déjà été configurés';
$_MODULE['<{ebay}prestashop>ebay_2b827fb3fb7f3fb4304b286764b18f1e'] = 'Voir les catégories';
$_MODULE['<{ebay}prestashop>ebay_1fe6b0032a7882ef20d08a5386441e33'] = 'Pour mettre en ligne vos produits sur eBay, vous devez associer chacune des catégories de votre boutique à une catégorie eBay. Vous pouvez également définir une variation du prix sur eBay.';
$_MODULE['<{ebay}prestashop>ebay_1bffdb0b10182ea51f7baa97ee2d19a8'] = 'Vous pouvez utiliser le bouton ci-dessous pour associer automatiquement les catégories qui n\'ont pas encore d\'association avec des catégories suggérées par eBay.';
$_MODULE['<{ebay}prestashop>ebay_36be9eda23888bf12f74d6cd9d46ba1d'] = 'Suggérer des catégories';
@@ -81,3 +89,18 @@ $_MODULE['<{ebay}prestashop>ebay_caab0e2c2f3ae0d242b0b36f22d9acc5'] = 'Vous alle
$_MODULE['<{ebay}prestashop>ebay_70b240eb3db5174e1c9520cabe2ae781'] = 'produits sur eBay. Voulez-vous confirmer ?';
$_MODULE['<{ebay}prestashop>ebay_547c708291fe196592dd1e4db7b206a5'] = 'produit(s) mis en ligne sur eBay';
$_MODULE['<{ebay}prestashop>ebay_1761efb946aa43c14af989665dae691a'] = 'Produit(s) concerné(s)';
$_MODULE['<{ebay}prestashop>ebay_04a338309915f11c8b8052a1c1ff7d84'] = 'Dernière importation des commandes';
$_MODULE['<{ebay}prestashop>ebay_45ad2eef89200b7037c5062688740213'] = 'Historiques des commandes';
$_MODULE['<{ebay}prestashop>ebay_1b5f52a88052dce1423a8c0cb19d6ee9'] = 'Référence commande eBay';
$_MODULE['<{ebay}prestashop>ebay_af63fd747d7a33367a4399d0c21c30d3'] = 'Référence commande vendeur';
$_MODULE['<{ebay}prestashop>ebay_b2f40690858b404ed10e62bdf422c704'] = 'Montant';
$_MODULE['<{ebay}prestashop>ebay_ec53a8c4f07baed5d8825072c89799be'] = 'Statut';
$_MODULE['<{ebay}prestashop>ebay_44749712dbec183e983dcd78a7736c41'] = 'Date';
$_MODULE['<{ebay}prestashop>ebay_1e884e3078d9978e216a027ecd57fb34'] = 'E-mail';
$_MODULE['<{ebay}prestashop>ebay_068f80c7519d0528fb08e82137a72131'] = 'Produits';
$_MODULE['<{ebay}prestashop>ebay_2bff0c18dad806b7e121a0013c7f08a6'] = 'Identifiant produit';
$_MODULE['<{ebay}prestashop>ebay_b86883a8dc6c44cb39371e3b7aea594f'] = 'Identifiant attribut produit';
$_MODULE['<{ebay}prestashop>ebay_694e8d1f2ee056f98ee488bdc4982d73'] = 'Quantité';
$_MODULE['<{ebay}prestashop>ebay_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix';
$_MODULE['<{ebay}prestashop>ebay_eacb7a77450c68e3936ff0475c010cdb'] = 'Status de l\'import';
$_MODULE['<{ebay}prestashop>ebay_59fc75ecf1ce372c9ed534d5e545ff88'] = 'Détails de l\'échec de l\'import';
+2
View File
@@ -0,0 +1,2 @@
Order deny,allow
Deny from all
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6594 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;