// Merge -> revision 7979
This commit is contained in:
@@ -439,7 +439,7 @@ class BlockLayered extends Module
|
||||
$.ajax(
|
||||
{
|
||||
type: \'GET\',
|
||||
url: '.__PS_BASE_URI__.' + \'modules/blocklayered/blocklayered-ajax-back.php\',
|
||||
url: \''.__PS_BASE_URI__.'\' + \'modules/blocklayered/blocklayered-ajax-back.php\',
|
||||
data: (all ? \'\' : $(\'input[name="categoryBox[]"]\').serialize()+\'&\')+(id_layered_filter ? \'id_layered_filter=\'+parseInt(id_layered_filter)+\'\' : \'\'),
|
||||
success: function(result)
|
||||
{
|
||||
|
||||
@@ -935,7 +935,7 @@ class eBayRequest
|
||||
|
||||
|
||||
|
||||
function getOrders($CreateTimeFrom, $CreateTimeTo)
|
||||
function getOrders($CreateTimeFrom, $CreateTimeTo, $page)
|
||||
{
|
||||
// Check data
|
||||
if (!$CreateTimeFrom || !$CreateTimeTo)
|
||||
@@ -953,6 +953,11 @@ class eBayRequest
|
||||
$requestXml .= ' <CreateTimeFrom>'.$CreateTimeFrom.'</CreateTimeFrom>'."\n";
|
||||
$requestXml .= ' <CreateTimeTo>'.$CreateTimeTo.'</CreateTimeTo>'."\n";
|
||||
$requestXml .= ' <OrderRole>Seller</OrderRole>'."\n";
|
||||
$requestXml .= ' <OrderStatus>Completed</OrderStatus>'."\n";
|
||||
$requestXml .= ' <Pagination>'."\n";
|
||||
$requestXml .= ' <EntriesPerPage>100</EntriesPerPage>'."\n";
|
||||
$requestXml .= ' <PageNumber>'.$page.'</PageNumber>'."\n";
|
||||
$requestXml .= ' </Pagination>'."\n";
|
||||
$requestXml .= ' <RequesterCredentials>'."\n";
|
||||
$requestXml .= ' <eBayAuthToken>'.Configuration::get('EBAY_API_TOKEN').'</eBayAuthToken>'."\n";
|
||||
$requestXml .= ' </RequesterCredentials>'."\n";
|
||||
@@ -992,19 +997,25 @@ class eBayRequest
|
||||
$transaction = $order->TransactionArray->Transaction[$i];
|
||||
|
||||
$id_product = 0;
|
||||
$id_attribute = 0;
|
||||
$id_product_attribute = 0;
|
||||
$quantity = (string)$transaction->QuantityPurchased;
|
||||
if (isset($transaction->item->SKU))
|
||||
{
|
||||
$tmp = explode('-', (string)$transaction->item->SKU);
|
||||
if (isset($tmp[1]))
|
||||
$id_product = $tmp[1];
|
||||
}
|
||||
if (isset($transaction->Variation->SKU))
|
||||
{
|
||||
$tmp = explode('-', (string)$transaction->Variation->SKU);
|
||||
if (isset($tmp[1]))
|
||||
$id_product = $tmp[1];
|
||||
if (isset($tmp[2]))
|
||||
$id_product_attribute = $tmp[2];
|
||||
}
|
||||
|
||||
$id_product = (int)Db::getInstance()->getValue('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.(int)$id_product);
|
||||
$id_product_attribute = (int)Db::getInstance()->getValue('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)$id_product.' AND `id_product_attribute` = '.(int)$id_product_attribute);
|
||||
if ($id_product > 0)
|
||||
$itemList[] = array('id_product' => $id_product, 'id_product_attribute' => $id_product_attribute, 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice);
|
||||
else
|
||||
@@ -1025,7 +1036,7 @@ class eBayRequest
|
||||
SELECT `id_product` FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `reference` = \''.pSQL($reference).'\'');
|
||||
if ((int)$id_product > 0)
|
||||
$itemList[] = array('id_product' => $id_product, 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice);
|
||||
$itemList[] = array('id_product' => $id_product, 'id_product_attribute' => 0, 'quantity' => $quantity, 'price' => (string)$transaction->TransactionPrice);
|
||||
else
|
||||
{
|
||||
$row = Db::getInstance()->getValue('
|
||||
@@ -1057,7 +1068,7 @@ class eBayRequest
|
||||
'shippingServiceCost' => (string)$order->ShippingServiceSelected->ShippingServiceCost,
|
||||
'email' => (string)$order->TransactionArray->Transaction[0]->Buyer->Email,
|
||||
'product_list' => $itemList,
|
||||
'object' => $order
|
||||
//'object' => $order
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+21
-3
@@ -318,7 +318,19 @@ class Ebay extends Module
|
||||
if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-45 minutes')).'T'.date('H:i:s', strtotime('-45 minutes')).'.000Z')
|
||||
{
|
||||
$ebay = new eBayRequest();
|
||||
$orderList = $ebay->getOrders(date('Y-m-d', strtotime('-30 days')).'T'.date('H:i:s', strtotime('-30 days')).'.000Z', $dateNew);
|
||||
|
||||
$page = 1;
|
||||
$orderList = array();
|
||||
$orderCount = 0;
|
||||
$orderCountTmp = 100;
|
||||
while ($orderCountTmp == 100 && $page < 10)
|
||||
{
|
||||
$orderListTmp = $ebay->getOrders(date('Y-m-d', strtotime('-30 days')).'T'.date('H:i:s', strtotime('-30 days')).'.000Z', $dateNew, $page);
|
||||
$orderCountTmp = count($orderListTmp);
|
||||
$orderList = array_merge((array)$orderList, (array)$orderListTmp);
|
||||
$orderCount += $orderCountTmp;
|
||||
$page++;
|
||||
}
|
||||
|
||||
if ($orderList)
|
||||
foreach ($orderList as $order)
|
||||
@@ -377,12 +389,13 @@ class Ebay extends Module
|
||||
{
|
||||
if ((int)$product['id_product'] < 1 || !Db::getInstance()->getValue('SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.(int)$product['id_product']))
|
||||
$flag = 0;
|
||||
if (isset($product['id_product_attribute']) && !Db::getInstance()->getValue('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)$product['id_product'].' AND `id_product_attribute` = '.(int)$product['id_product_attribute']))
|
||||
if (isset($product['id_product_attribute']) && $product['id_product_attribute'] > 0 && !Db::getInstance()->getValue('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)$product['id_product'].' AND `id_product_attribute` = '.(int)$product['id_product_attribute']))
|
||||
$flag = 0;
|
||||
}
|
||||
|
||||
if ($flag == 1)
|
||||
{
|
||||
$cartNbProducts = 0;
|
||||
$cartAdd = new Cart();
|
||||
$cartAdd->id_customer = $id_customer;
|
||||
$cartAdd->id_address_invoice = $id_address;
|
||||
@@ -392,9 +405,13 @@ class Ebay extends Module
|
||||
$cartAdd->id_currency = Currency::getIdByIsoCode('EUR');
|
||||
$cartAdd->add();
|
||||
foreach ($order['product_list'] as $product)
|
||||
$cartAdd->updateQty((int)($product['quantity']), (int)($product['id_product']), (isset($product['id_product_attribute']) ? $product['id_product_attribute'] : NULL));
|
||||
if ($cartAdd->updateQty((int)($product['quantity']), (int)($product['id_product']), ((isset($product['id_product_attribute']) && $product['id_product_attribute'] > 0) ? $product['id_product_attribute'] : NULL)))
|
||||
$cartNbProducts++;
|
||||
$cartAdd->update();
|
||||
|
||||
// Check number of products in the cart
|
||||
if ($cartNbProducts > 0)
|
||||
{
|
||||
// Fix on sending e-mail
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'customer', array('email' => 'NOSEND-EBAY'), 'UPDATE', '`id_customer` = '.(int)$id_customer);
|
||||
$customerClear = new Customer();
|
||||
@@ -427,6 +444,7 @@ class Ebay extends Module
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Configuration::updateValue('EBAY_ORDER_LAST_UPDATE', $dateNew);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>paypal</name>
|
||||
<displayName><![CDATA[PayPal]]></displayName>
|
||||
<version><![CDATA[2.6]]></version>
|
||||
<version><![CDATA[2.7]]></version>
|
||||
<description><![CDATA[Accepts payments by credit cards (CB, Visa, MasterCard, Amex, Aurore, Cofinoga, 4 stars) with PayPal.]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[payments_gateways]]></tab>
|
||||
|
||||
+10
-18
@@ -39,7 +39,7 @@ class PayPal extends PaymentModule
|
||||
{
|
||||
$this->name = 'paypal';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '2.6';
|
||||
$this->version = '2.7';
|
||||
|
||||
$this->currencies = true;
|
||||
$this->currencies_mode = 'radio';
|
||||
@@ -57,17 +57,20 @@ class PayPal extends PaymentModule
|
||||
if (file_exists(_PS_ROOT_DIR_.'/modules/paypalapi/paypalapi.php') AND $this->active)
|
||||
$this->warning = $this->l('All features of Paypal API module are be include in the new Paypal module. In order to don\'t have any conflict, please don\'t use and remove PayPalAPI module.');
|
||||
|
||||
$stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
|
||||
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower($this->context->language->iso_code).'&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);
|
||||
/* For 1.4.3 and less compatibility */
|
||||
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
|
||||
if (!Configuration::get('PS_OS_PAYMENT'))
|
||||
foreach ($updateConfig as $u)
|
||||
if (!Configuration::get($u) && defined('_'.$u.'_'))
|
||||
Configuration::updateValue($u, constant('_'.$u.'_'));
|
||||
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK')
|
||||
/* Check preactivation warning */
|
||||
if (Configuration::get('PS_PREACTIVATION_PAYPAL_WARNING'))
|
||||
{
|
||||
if (!empty($this->warning))
|
||||
$this->warning .= ', ';
|
||||
$this->warning .= $content[1];
|
||||
$this->warning .= Configuration::get('PS_PREACTIVATION_PAYPAL_WARNING');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function install()
|
||||
@@ -91,11 +94,6 @@ class PayPal extends PaymentModule
|
||||
return $this->_checkAndUpdateFromOldVersion(true);
|
||||
}
|
||||
|
||||
/* For 1.4.3 and less compatibility */
|
||||
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
|
||||
foreach ($updateConfig as $u)
|
||||
if (!Configuration::get($u) && defined('_'.$u.'_'))
|
||||
Configuration::updateValue($u, constant('_'.$u.'_'));
|
||||
|
||||
/* Set database */
|
||||
if (!Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'paypal_order` (
|
||||
@@ -1202,12 +1200,6 @@ class PayPal extends PaymentModule
|
||||
$this->registerHook('cancelProduct');
|
||||
$this->registerHook('adminOrder');
|
||||
|
||||
/* For 1.4.3 and less compatibility */
|
||||
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
|
||||
foreach ($updateConfig as $u)
|
||||
if (!Configuration::get($u) && defined('_'.$u.'_'))
|
||||
Configuration::updateValue($u, constant('_'.$u.'_'));
|
||||
|
||||
/* Create OrderState */
|
||||
if (!Configuration::get('PAYPAL_OS_AUTHORIZATION'))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user