// Merge -> revision 8342
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8344 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -34,7 +34,7 @@ class authorizeAIM extends PaymentModule
|
||||
{
|
||||
$this->name = 'authorizeaim';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '1.2';
|
||||
$this->version = '1.2.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->limited_countries = array('us');
|
||||
$this->need_instance = 0;
|
||||
@@ -140,7 +140,7 @@ class authorizeAIM extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
if (Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED'))
|
||||
if (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off'))
|
||||
{
|
||||
$invoiceAddress = new Address((int)$params['cart']->id_address_invoice);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>authorizeaim</name>
|
||||
<displayName><![CDATA[Authorize.net AIM (Advanced Integration Method)]]></displayName>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<version><![CDATA[1.2.1]]></version>
|
||||
<description><![CDATA[Receive payment with Authorize.net]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[payments_gateways]]></tab>
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
*/
|
||||
|
||||
/* Getting cookie or logout */
|
||||
/*include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');*/
|
||||
include(dirname(__FILE__).'/blocklayered.php');
|
||||
|
||||
/* Clean categoryBox before use */
|
||||
if (isset($_GET['categoryBox']) AND is_array($_GET['categoryBox']))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');
|
||||
|
||||
if (substr(Tools::encrypt('blocklayered/index'),0,10) != Tools::getValue('token') || !Module::isInstalled('blocklayered'))
|
||||
die;
|
||||
|
||||
if(Tools::getValue('full'))
|
||||
echo BlockLayered::fullindexProcess((int)Tools::getValue('cursor'), (int)Tools::getValue('ajax'), true);
|
||||
else
|
||||
echo BlockLayered::indexProcess((int)Tools::getValue('cursor'), (int)Tools::getValue('ajax'));
|
||||
@@ -104,7 +104,7 @@ class DateOfDelivery extends Module
|
||||
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($params['cart']->getProducts() as $product)
|
||||
if ($product['quantity'] <= 0 OR ($product['quantity_attribute'] <= 0 AND $product['id_product_attribute']))
|
||||
if ($product['stock_quantity'] <= 0 OR ($product['quantity_attribute'] <= 0 AND $product['id_product_attribute']))
|
||||
$oos = true;
|
||||
|
||||
$datesDelivery = array();
|
||||
|
||||
@@ -4,6 +4,7 @@ $configPath = '../../../config/config.inc.php';
|
||||
if (file_exists($configPath))
|
||||
{
|
||||
include('../../../config/config.inc.php');
|
||||
include('../../../init.php');
|
||||
include('../../../modules/ebay/ebay.php');
|
||||
if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN'))
|
||||
die('ERROR : Invalid Token');
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
<module>
|
||||
<name>ebay</name>
|
||||
<displayName><![CDATA[eBay]]></displayName>
|
||||
<<<<<<< .working
|
||||
<version><![CDATA[1.2.1]]></version>
|
||||
=======
|
||||
<version><![CDATA[1.2.3]]></version>
|
||||
>>>>>>> .merge-right.r8342
|
||||
<description><![CDATA[Open your shop on the eBay market place !]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[market_place]]></tab>
|
||||
|
||||
@@ -59,7 +59,7 @@ class Ebay extends Module
|
||||
{
|
||||
$this->name = 'ebay';
|
||||
$this->tab = 'market_place';
|
||||
$this->version = '1.2.2';
|
||||
$this->version = '1.2.3';
|
||||
$this->author = 'PrestaShop';
|
||||
parent::__construct ();
|
||||
$this->displayName = $this->l('eBay');
|
||||
@@ -1292,6 +1292,8 @@ class Ebay extends Module
|
||||
}
|
||||
}
|
||||
$html .= '</tbody></table>';
|
||||
if (Tools::getValue('section') == 'sync')
|
||||
$html .= '<script>$(document).ready(function() { eBaySync(); });</script>';
|
||||
|
||||
if (Configuration::get('EBAY_SYNC_MODE') == 'B')
|
||||
{
|
||||
@@ -1299,10 +1301,7 @@ class Ebay extends Module
|
||||
$(document).ready(function() {
|
||||
$("#catSync").show("slow");
|
||||
$("#ebay_sync_mode2").attr("checked", true);
|
||||
';
|
||||
if (Tools::getValue('section') == 'sync')
|
||||
$html .= 'eBaySync();';
|
||||
$html .= '});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>ekomi</name>
|
||||
<displayName><![CDATA[eKomi]]></displayName>
|
||||
<version><![CDATA[1]]></version>
|
||||
<version><![CDATA[1.1]]></version>
|
||||
<description><![CDATA[Adds an eKomi block]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[advertising_marketing]]></tab>
|
||||
|
||||
@@ -37,7 +37,7 @@ class Ekomi extends Module
|
||||
{
|
||||
$this->name = 'ekomi';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = 1.0;
|
||||
$this->version = 1.1;
|
||||
$this->need_instance = 0;
|
||||
|
||||
parent::__construct();
|
||||
@@ -83,9 +83,9 @@ class Ekomi extends Module
|
||||
<br class="clear"/><br />
|
||||
<label>Display block</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_on" value="1" />
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_on" value="1" '.(Configuration::get('PS_EKOMI_DISPLAY') == 1 ? 'checked="checked"' : '').' />
|
||||
<label class="t" for="ekomi_display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_off" value="0" checked="checked" />
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_off" value="0" '.(Configuration::get('PS_EKOMI_DISPLAY') == 0 ? 'checked="checked"' : '').' />
|
||||
<label class="t" for="ekomi_display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p class="clear">'.$this->l('Show or don\'t show the block (orders will be sent to eKomi whether you choose to hide or display the block).').'</p>
|
||||
</div>
|
||||
|
||||
@@ -307,7 +307,6 @@ class importerosc extends ImportModule
|
||||
{
|
||||
$combination['association'] = array('product_attribute_combination' => array($combination['options_values_id'] => $combination['id_product_attribute']));
|
||||
unset($combination['options_values_price']);
|
||||
unset($combination['options_values_id']);
|
||||
}
|
||||
return $this->autoFormat($combinations, $identifier);
|
||||
}
|
||||
@@ -454,6 +453,34 @@ class importerosc extends ImportModule
|
||||
|
||||
}
|
||||
|
||||
public function displayConfigConnector()
|
||||
{
|
||||
$content = '<label>'.$this->l('Server').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="server" id="server" value="">
|
||||
<p>'.$this->l('(eg : mysql.mydomain.com)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('User').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="user" id="user" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Password').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="password" name="password" id="password" value="">
|
||||
<p>'.$this->l('(password can be empty)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Database').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="database" id="database" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Database prefix').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="prefix" id="prefix" value="">
|
||||
<p>'.$this->l('(The prefix is optional. If all of your database tables start with "pref_", your prefix is "pref_")').'</p>
|
||||
</div>';
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -275,7 +275,6 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE');
|
||||
$this->_fields['list']['Expe_Langage']['value'] = Configuration::get('MR_LANGUAGE');
|
||||
var_dump(Configuration::get('MR_LANGUAGE'));
|
||||
$this->_fields['list']['Expe_Ad1']['value'] = Configuration::get('PS_MR_SHOP_NAME');
|
||||
$this->_fields['list']['Expe_Ad3']['value'] = Configuration::get('PS_SHOP_ADDR1');
|
||||
// Deleted, cause to many failed for the process
|
||||
|
||||
@@ -32,10 +32,17 @@ class MRTools
|
||||
{
|
||||
static public function replaceAccentedCharacters($string)
|
||||
{
|
||||
if (function_exists('iconv'))
|
||||
{
|
||||
$currentLocale = setlocale(LC_ALL, NULL);
|
||||
setlocale(LC_ALL, 'en_US.UTF8');
|
||||
$cleanedString = iconv('UTF-8','ASCII//TRANSLIT', $string);
|
||||
setLocale(LC_ALL, $currentLocale);
|
||||
}
|
||||
else
|
||||
$cleanedString = strtr($string,
|
||||
'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ',
|
||||
'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
|
||||
return $cleanedString;
|
||||
}
|
||||
|
||||
@@ -48,8 +55,9 @@ class MRTools
|
||||
FROM `'._DB_PREFIX_.'country`
|
||||
WHERE `id_country` = '.(int)$id_country);
|
||||
|
||||
// Skip the cheking format if doesn't exist
|
||||
if (!$zipcodeFormat)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
$regxMask = str_replace(
|
||||
array('N', 'C', 'L'),
|
||||
@@ -64,4 +72,4 @@ class MRTools
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -277,11 +277,12 @@ tr.PS_MRSelectedCarrier > td
|
||||
|
||||
.PS_MRFloatRelayPointSelected a.PS_MRSelectRelayPointButton
|
||||
{
|
||||
font-size: 10px;
|
||||
float:right;
|
||||
display: block;
|
||||
width: 60px;
|
||||
height: 20px;
|
||||
padding: 6px 20px 0px 25px;
|
||||
padding: 7px 20px 0px 25px;
|
||||
text-decoration: none;
|
||||
margin-top: 8px;
|
||||
color:#333333;
|
||||
@@ -313,4 +314,15 @@ div.PS_MRGmapStyle
|
||||
div#PS_MRPersonalizedFields
|
||||
{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after
|
||||
{
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
overflow: hidden
|
||||
}
|
||||
.clearfix:after {clear: both}
|
||||
.clearfix {zoom: 1}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>paypal</name>
|
||||
<displayName><![CDATA[PayPal]]></displayName>
|
||||
<version><![CDATA[2.8]]></version>
|
||||
<version><![CDATA[2.8.1]]></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>
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<input type="hidden" name="paymentaction" value="{$paymentaction}" />
|
||||
{if $header != NULL}
|
||||
<input type="hidden" name="cpp_header_image" value="{$header}" />
|
||||
<input type="hidden" name="logoImage" value="{$header}" />
|
||||
{/if}
|
||||
<input type="hidden" name="template" value="{$template}" />
|
||||
<input type="hidden" name="rm" value="2" />
|
||||
|
||||
@@ -40,7 +40,7 @@ class PayPal extends PaymentModule
|
||||
{
|
||||
$this->name = 'paypal';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '2.8';
|
||||
$this->version = '2.8.1';
|
||||
|
||||
$this->currencies = true;
|
||||
$this->currencies_mode = 'radio';
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if count($categoryProducts) > 0}
|
||||
{if count($categoryProducts) > 0 && $categoryProducts !== false}
|
||||
<h2 class="productscategory_h2">{$categoryProducts|@count} {l s='other products in the same category:' mod='productscategory'}</h2>
|
||||
<div id="{if count($categoryProducts) > 5}productscategory{else}productscategory_noscroll{/if}">
|
||||
{if count($categoryProducts) > 5}<a id="productscategory_scroll_left" title="{l s='Previous' mod='productscategory'}" href="javascript:{ldelim}{rdelim}">{l s='Previous' mod='productscategory'}</a>{/if}
|
||||
|
||||
@@ -20,6 +20,10 @@ $database = Tools::getValue('database');
|
||||
$prefix = Tools::getValue('prefix');
|
||||
$save = Tools::getValue('save');
|
||||
|
||||
$url = Tools::getValue('url');
|
||||
$loginws = Tools::getValue('loginws');
|
||||
$apikey = Tools::getValue('apikey');
|
||||
|
||||
if (Tools::isSubmit('checkAndSaveConfig'))
|
||||
{
|
||||
//cleans the database if an import has already been done
|
||||
@@ -69,6 +73,35 @@ if (Tools::isSubmit('getData') || Tools::isSubmit('syncLang') || Tools::isSubmit
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('getDataWS') || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrencyWS'))
|
||||
{
|
||||
if (Tools::isSubmit('syncLangWS'))
|
||||
$save = true;
|
||||
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
|
||||
try
|
||||
{
|
||||
$importModule = new $moduleName();
|
||||
$importModule->connect($url,$loginws,$apikey);
|
||||
|
||||
if (!method_exists($importModule, $getMethod))
|
||||
die('{"hasError" : true, "error" : ["not_exist"], "datas" : []}');
|
||||
else
|
||||
{
|
||||
$return = call_user_func_array(array($importModule, $getMethod), array($limit, $nbr_import));
|
||||
$shopImporter = new shopImporter();
|
||||
$shopImporter->generiqueImport($className, $return, (bool)$save);
|
||||
}
|
||||
die('{"hasError" : false, "error" : []}');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('truncatTable'))
|
||||
{
|
||||
@@ -114,6 +147,43 @@ if (Tools::isSubmit('displaySpecificOptions'))
|
||||
die(Tools::displayError('Link to database cannot be established.'));
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('displaySpecificOptionsWsdl'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$importModule = new $moduleName();
|
||||
|
||||
try
|
||||
{
|
||||
if (method_exists($importModule, 'displaySpecificOptions'))
|
||||
die($importModule->displaySpecificOptions());
|
||||
else
|
||||
die('not_exist');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('connexionWs'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
try
|
||||
{
|
||||
|
||||
$importModule = new $moduleName();
|
||||
$importModule->connect($url,$loginws,$apikey);
|
||||
die('{"hasError" : false, "error" : []}');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('validateSpecificOptions'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
@@ -126,5 +196,16 @@ if (Tools::isSubmit('validateSpecificOptions'))
|
||||
die($importModule->validateSpecificOptions());
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('displayConfigConnector'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$importModule = new $moduleName();
|
||||
if (!method_exists($importModule, 'displayConfigConnector'))
|
||||
die('{"hasError" : true, "error" : ["not_exist"]}');
|
||||
else
|
||||
die($importModule->displayConfigConnector());
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -6,6 +6,9 @@ var shopImporter = {
|
||||
password: $('#password').val(),
|
||||
database: $('#database').val(),
|
||||
prefix: $('#prefix').val(),
|
||||
url: $('#url').val(),
|
||||
loginws: $('#loginws').val(),
|
||||
apikey: $('#apikey').val(),
|
||||
specificOptions : '',
|
||||
imagesOptions : '',
|
||||
output : 1,
|
||||
@@ -22,6 +25,37 @@ var shopImporter = {
|
||||
srcDelete : '../modules/shopimporter/img/delete.gif',
|
||||
|
||||
|
||||
syncLangWS : function (onComplete)
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'ajax=true&syncLangWS&getMethod=getLangagues&token='+this.token+'&className=Language&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&nbr_import='+this.nbr_import ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#steps').html('<div id="lang_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">'+jsonData.error+'</div>');
|
||||
$('#lang_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="technical_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">TECHNICAL ERROR<br><br>Details: '+XMLHttpRequest.responseText+'</div>');
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncLang : function (onComplete)
|
||||
{
|
||||
$.ajax({
|
||||
@@ -51,6 +85,36 @@ var shopImporter = {
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncCurrencyWS : function (onComplete)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'ajax=true&token='+this.token+'&syncCurrencyWS&getMethod=getCurrencies&className=Currency&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&nbr_import='+this.nbr_import ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#steps').html('<div id="currency_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">'+jsonData.error+'</div>');
|
||||
$('#currency_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="technical_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">TECHNICAL ERROR<br><br>Details: '+XMLHttpRequest.responseText+'</div>');
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncCurrency : function (onComplete)
|
||||
{
|
||||
@@ -81,6 +145,78 @@ var shopImporter = {
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
checkAndSaveConfigWSDL : function (onComplete)
|
||||
{
|
||||
$('#checkAndSaveConfig').fadeOut('slow');
|
||||
$('#steps').html($('#steps').html()+'<div id="database_feedback" style="display:none;" class="conf"><img src="'+shopImporter.srcConf+'">'+wsOk+'</div>');
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="submit" name="next" id="next" class="button" value="'+testImport+'">');
|
||||
$('#next').fadeIn('slow', function () {
|
||||
$('#next').unbind('click').click(function(){
|
||||
$('#next').fadeOut('fast', function() {
|
||||
shopImporter.nbrMethod = conf.length;
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
$('#database_feedback').fadeIn('slow');
|
||||
|
||||
},
|
||||
checkAndSaveConfigWS : function (save)
|
||||
{
|
||||
|
||||
//sync languages and currency
|
||||
this.syncLangWS(function(isOk) {
|
||||
if (isOk)
|
||||
{
|
||||
shopImporter.syncCurrencyWS(function(isOk) {
|
||||
if (isOk)
|
||||
{
|
||||
|
||||
if ($('#technical_error_feedback').length)
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
|
||||
|
||||
$('#checkAndSaveConfig').fadeOut('slow');
|
||||
$('#steps').html($('#steps').html()+'<div id="database_feedback" style="display:none;" class="conf"><img src="'+shopImporter.srcConf+'">'+databaseOk+'</div>');
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="submit" name="next" id="next" class="button" value="'+testImport+'">');
|
||||
$('#database_feedback').fadeIn('slow', function() {
|
||||
if (save)
|
||||
{
|
||||
shopImporter.idMethod = 0;
|
||||
shopImporter.limit = 0;
|
||||
shopImporter.nbrMethod = conf.length;
|
||||
$('.truncateTable:checked').each(function (){
|
||||
shopImporter.truncatTable(this.id, 'add');
|
||||
});
|
||||
|
||||
if($('#truncat_feedback').length != 0)
|
||||
$('#truncat_feedback').removeClass('import').addClass('conf');
|
||||
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#next').fadeIn('slow', function () {
|
||||
$('#next').unbind('click').click(function(){
|
||||
$('#next').fadeOut('fast', function() {
|
||||
shopImporter.nbrMethod = conf.length;
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
checkAndSaveConfig : function (save)
|
||||
{
|
||||
@@ -158,6 +294,123 @@ var shopImporter = {
|
||||
|
||||
},
|
||||
|
||||
getDatasWS : function (methodName)
|
||||
{
|
||||
//check if method have to be call
|
||||
if (shopImporter.idMethod >= shopImporter.nbrMethod)
|
||||
shopImporter.displayEnd(false);
|
||||
else if ($('input[name='+methodName[0]+']:radio:checked').val() == 0)
|
||||
{
|
||||
shopImporter.idMethod ++;
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
return;
|
||||
}
|
||||
if (typeof(methodName) != 'undefined')
|
||||
{
|
||||
|
||||
$('#steps').html($('#steps').html()+'<div id="ok_feedback_'+methodName[0]+'" style="display:none;" class="import"><img src="'+this.srcImport+'">'+methodName[1]+'<span id="display_error_'+methodName[0]+'" style="display:none"><span><div id="feedback_'+methodName[0]+'_errors_list"></div></div>');
|
||||
$('#ok_feedback_'+methodName[0]).css('display', '');
|
||||
|
||||
$('#checkAndSaveConfig').fadeIn('slow');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: true,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
//data: 'ajax=true&token='+this.token+'&getData&className='+methodName[2]+'&getMethod='+methodName[0]+'&moduleName='+this.moduleName+'&server='+this.server+'&user='+this.user+'&password='+this.password+'&database='+this.database+'&prefix='+prefix+'&limit='+this.limit+'&nbr_import='+this.nbr_import+'&save='+this.save+'&errors='+this.errors+'&hasErrors='+this.hasErrors+this.specificOptions+this.imagesOptions ,
|
||||
|
||||
|
||||
data: 'ajax=true&token='+this.token+'&getDataWS&className='+methodName[2]+'&getMethod='+methodName[0]+'&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&limit='+this.limit+'&nbr_import='+this.nbr_import+'&save='+this.save+'&errors='+this.errors+'&hasErrors='+this.hasErrors+this.specificOptions+this.imagesOptions ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
var jsonError;
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
jsonError = '';
|
||||
if (jsonData.error == 'not_exist')
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('conf').addClass(function() {
|
||||
$('#ok_feedback_'+methodName[0]).html('<img src="'+shopImporter.srcWarn+'">'+methodName[1]+' '+notExist);
|
||||
return 'warn';
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0;i<jsonData.error.length;i++)
|
||||
jsonError = jsonError+'<li>Id : '+jsonData.error[i]+'</li>';
|
||||
|
||||
if ($('#display_error_'+methodName[0]+'_link').length == 0)
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).html($('#ok_feedback_'+methodName[0]).html()+'<span id="display_error_'+methodName[0]+'" style="float:right;"><a id="display_error_'+methodName[0]+'_link" class="display_error_link" rel="'+methodName[0]+'" href="#" onclick="enableShowErrors(\''+methodName[0]+'\'); return false;">'+showErrors+'(<span id="nbr_errors_'+methodName[0]+'">'+jsonData.error.length+'</span>)'+'</a></span><div style="display:none;" id="feedback_'+methodName[0]+'_errors_list"><ul>'+jsonError+'</ul></div>');
|
||||
}
|
||||
else
|
||||
{
|
||||
var nbrErrors = $('#nbr_errors_'+methodName[0]).html();
|
||||
var newNbrError = parseInt(jsonData.error.length) + parseInt(nbrErrors);
|
||||
$('#nbr_errors_'+methodName[0]).html(newNbrError);
|
||||
$('#feedback_'+methodName[0]+'_errors_list > ul').html($('#feedback_'+methodName[0]+'_errors_list > ul').html() + jsonError);
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonData.datas.length != parseInt(shopImporter.nbr_import))
|
||||
{
|
||||
if ($('#display_error_'+methodName[0]+'_link').length != 0)
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() {
|
||||
$('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError);
|
||||
return 'error';
|
||||
});
|
||||
shopImporter.idMethod ++;
|
||||
shopImporter.limit = 0;
|
||||
}
|
||||
else
|
||||
shopImporter.limit += parseInt(shopImporter.nbr_import);
|
||||
if ((shopImporter.idMethod < shopImporter.nbrMethod))
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
else
|
||||
shopImporter.displayEnd(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (jsonData.datas.length != parseInt(shopImporter.nbr_import))
|
||||
{
|
||||
if ($('#display_error_'+methodName[0]+'_link').length != 0)
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() {
|
||||
$('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError);
|
||||
return 'error';
|
||||
});
|
||||
}else
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('import').addClass('conf');
|
||||
$('#ok_feedback_'+methodName[0]+'>img:first').attr('src', shopImporter.srcConf);
|
||||
}
|
||||
shopImporter.idMethod ++;
|
||||
shopImporter.limit = 0;
|
||||
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shopImporter.idMethod < shopImporter.nbrMethod)
|
||||
{
|
||||
shopImporter.limit += parseInt(shopImporter.nbr_import);
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
}
|
||||
else
|
||||
shopImporter.displayEnd(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="technical_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">TECHNICAL ERROR<br><br>Details: '+XMLHttpRequest.responseText+'</div>');
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
$('#checkAndSaveConfig').fadeIn('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getDatas : function (methodName)
|
||||
{
|
||||
//check if method have to be call
|
||||
@@ -336,13 +589,17 @@ var shopImporter = {
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="submit" name="submitImport" id="submitImport" class="button" value="'+runImport+'">');
|
||||
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="button" name="submitImport" id="submitImport" class="button" value="'+runImport+'">');
|
||||
$('#submitImport').fadeIn('slow', function() {
|
||||
$(this).unbind('click').click(function() {
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
onAfter:function(){
|
||||
$('#steps').html('');
|
||||
shopImporter.save = 1;
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
shopImporter.checkAndSaveConfigWS(shopImporter.save);
|
||||
else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
shopImporter.checkAndSaveConfig(shopImporter.save);
|
||||
}
|
||||
});
|
||||
@@ -388,6 +645,7 @@ function displaySpecificOptions(moduleName, server, user, password, database, pr
|
||||
{
|
||||
$('#specificOptionsContent').html(htmlData);
|
||||
$('#specificOptions').show();
|
||||
$('#importOptions').show();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
@@ -396,6 +654,69 @@ function displaySpecificOptions(moduleName, server, user, password, database, pr
|
||||
}
|
||||
});
|
||||
}
|
||||
function initConnexion (moduleName, url, loginws, apikey, token)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'ajax=true&token='+token+'&connexionWs&moduleName='+moduleName+'&url='+ url+'&loginws='+loginws+'&apikey='+apikey ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
var jsonError = '';
|
||||
$('#connectionInformation').removeAttr('style');
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#connectionInformation').attr("style","width: 400px;background-color: #FAE2E3;border: 1px solid #EC9B9B");
|
||||
for (i=0;i<jsonData.error.length;i++)
|
||||
jsonError = jsonError+'<li>'+jsonData.error[i]+'</li>';
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('<ul>'+jsonError+'</ul>');
|
||||
$('#connectionInformation').show();
|
||||
}else
|
||||
{
|
||||
|
||||
$('#connectionInformation').attr("style","width: 400px;background-color: #DFFAD3;border: 1px solid #72CB67");
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('<ul>Connection successful</ul>');
|
||||
$('#connectionInformation').show();
|
||||
$('#importOptions').show();
|
||||
displaySpecificOptionsWsdl(moduleName, token);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function displaySpecificOptionsWsdl(moduleName,token)
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "html",
|
||||
data: 'ajax=true&token='+token+'&displaySpecificOptionsWsdl&moduleName='+moduleName ,
|
||||
success: function(htmlData)
|
||||
{
|
||||
$('#specificOptionsContent').html(htmlData);
|
||||
$('#specificOptions').show();
|
||||
$('#displayOptions').hide();
|
||||
$('#importOptions').show();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
function validateSpecificOptions(moduleName, specificOptions)
|
||||
{
|
||||
$.ajax({
|
||||
@@ -428,9 +749,51 @@ function validateSpecificOptions(moduleName, specificOptions)
|
||||
return true;
|
||||
}
|
||||
|
||||
//init configuration connector (database or webservice)
|
||||
function initConfigConnector()
|
||||
{
|
||||
if($('#choose_module_name').attr('value'))
|
||||
{
|
||||
$('#db_config').hide();
|
||||
$('#importOptions').hide();
|
||||
$('#steps').html('');
|
||||
|
||||
if ($('#import_module_name').attr('value') != 0)
|
||||
{
|
||||
$('#displayOptions').show();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "html",
|
||||
|
||||
data: 'ajax=true&token='+globalAjaxShopImporterToken+'&displayConfigConnector&moduleName='+$('#import_module_name').val() ,
|
||||
success: function(html)
|
||||
{
|
||||
$('#config_connector').html(html);
|
||||
$('#config_connector').show();
|
||||
$('#db_config').slideDown('slow');
|
||||
$('#displayOptions').show();
|
||||
$('#checkAndSaveConfig').show();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#db_config').slideUp('slow');
|
||||
$('#checkAndSaveConfig').show();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#displayOptions').hide();
|
||||
$('#db_input input').each(function () {
|
||||
$(this).keyup(function () {
|
||||
$('#steps').fadeOut(200, function () {
|
||||
@@ -454,26 +817,31 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
$('#choose_module_name').unbind('click').click(function(){
|
||||
$('#db_config').hide();
|
||||
$('#importOptions').hide();
|
||||
$('#steps').html('');
|
||||
if ($('#import_module_name').attr('value') != 0)
|
||||
{
|
||||
$('#db_config').slideDown('slow');
|
||||
$('#displayOptions').show();
|
||||
$('#checkAndSaveConfig').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#db_config').slideUp('slow');
|
||||
$('#checkAndSaveConfig').show();
|
||||
}
|
||||
return false;
|
||||
initConfigConnector();
|
||||
});
|
||||
|
||||
$('#displayOptions').unbind('click').click(function(){
|
||||
$(this).fadeOut('slow');
|
||||
$('#importOptions').slideDown('slow');
|
||||
$('#displayOptions').show();
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
{
|
||||
if($('#loginws').val() == '' || $('#apikey').val() == '' || $('#url').val() == '')
|
||||
{
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('Url wsdl, User name,API key are required fields');
|
||||
$('#connectionInformation').show();
|
||||
return false;
|
||||
}else{
|
||||
$('#connectionInformation').hide();
|
||||
|
||||
|
||||
}
|
||||
token = globalAjaxShopImporterToken;
|
||||
initConnexion($('#import_module_name').val(), $('#url').val(), $('#loginws').val(), $('#apikey').val(), token);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
{
|
||||
moduleName = $('#import_module_name').val();
|
||||
server = $('#server').val();
|
||||
user = $('#user').val();
|
||||
@@ -482,6 +850,10 @@ $(document).ready(function(){
|
||||
prefix = $('#prefix').val();
|
||||
token = globalAjaxShopImporterToken;
|
||||
displaySpecificOptions(moduleName, server, user, password, database, prefix, token);
|
||||
}
|
||||
$(this).fadeOut('slow');
|
||||
$('#importOptions').slideDown('slow');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -499,6 +871,8 @@ $(document).ready(function(){
|
||||
moduleName = $('#import_module_name').val();
|
||||
if (validateSpecificOptions(moduleName, shopImporter.specificOptions) == true)
|
||||
{
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
{
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
onAfter:function(){
|
||||
shopImporter.specificOptions = '';
|
||||
@@ -509,7 +883,33 @@ $(document).ready(function(){
|
||||
shopImporter.limit = 0;
|
||||
shopImporter.nbr_import = parseInt($('#nbr_import').val());
|
||||
shopImporter.save = 0;
|
||||
|
||||
shopImporter.moduleName = $('#import_module_name').val();
|
||||
shopImporter.url = $('#url').val();
|
||||
shopImporter.loginws = $('#loginws').val();
|
||||
shopImporter.apikey = $('#apikey').val();
|
||||
|
||||
shopImporter.token = globalAjaxShopImporterToken;
|
||||
shopImporter.hasErrors = $('input[name=hasErrors]:radio:checked').val();
|
||||
|
||||
shopImporter.checkAndSaveConfigWS(shopImporter.save);
|
||||
shopImporter.checkAndSaveConfigWSDL();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
{
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
onAfter:function(){
|
||||
shopImporter.specificOptions = '';
|
||||
$('#specificOptionsContent :input').each(function (){
|
||||
shopImporter.specificOptions = shopImporter.specificOptions+'&'+$(this).attr('name')+'='+$(this).attr('value');
|
||||
});
|
||||
shopImporter.idMethod = 0;
|
||||
shopImporter.limit = 0;
|
||||
shopImporter.nbr_import = parseInt($('#nbr_import').val());
|
||||
shopImporter.save = 0;
|
||||
shopImporter.moduleName = $('#import_module_name').val();
|
||||
shopImporter.server = $('#server').val();
|
||||
shopImporter.user = $('#user').val();
|
||||
shopImporter.password = $('#password').val();
|
||||
@@ -522,6 +922,7 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ class shopimporter extends ImportModule
|
||||
'table' => 'product',
|
||||
'identifier' => 'id_product',
|
||||
'alterTable' => array('id_product' => 'int(10)'),
|
||||
'foreign_key' => array('id_category'),
|
||||
'foreign_key' => array('id_category', 'id_manufacturer'),
|
||||
'delete' => true,
|
||||
'association' => array(
|
||||
array(
|
||||
@@ -306,6 +306,7 @@ class shopimporter extends ImportModule
|
||||
|
||||
$html .= ' var notExist = "'.$this->l('is not available in this module').'";
|
||||
var databaseOk = "'.$this->l('Connection to the database OK').'";
|
||||
var wsOk = "'.$this->l('Connection to the web service OK').'";
|
||||
var showErrors = "'.$this->l('Show errors').'";
|
||||
var testImport = "'.$this->l('Test import process').'";
|
||||
var runImport = "'.$this->l('Run Import').'";
|
||||
@@ -343,33 +344,9 @@ class shopimporter extends ImportModule
|
||||
else
|
||||
$html .= '<div class="warn" ><img src="../img/admin/warn2.png">'.$this->l('No import module installed').'</div>';
|
||||
$html .= '
|
||||
<div id="db_config" style="display:none;width:420px;padding-right:20px">
|
||||
<div id="db_input">
|
||||
<label>'.$this->l('Server').' : </label>
|
||||
<div style="display:none;" class="error" id="connectionInformation"></div>
|
||||
<div id="config_connector"></div>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="server" id="server" value="">
|
||||
<p>'.$this->l('(eg : mysql.mydomain.com)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('User').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="user" id="user" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Password').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="password" name="password" id="password" value="">
|
||||
<p>'.$this->l('(password can be empty)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Database').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="database" id="database" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Database prefix').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="prefix" id="prefix" value="">
|
||||
<p>'.$this->l('(The prefix is optional. If all of your database tables start with "pref_", your prefix is "pref_")').'</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" name="displayOptions" id="displayOptions" class="button" value="'.$this->l('Next Step').'">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -469,7 +446,7 @@ class shopimporter extends ImportModule
|
||||
$importModule->prefix = Tools::getValue('prefix');
|
||||
$defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = $importModule->getLangagues(0);
|
||||
if (Tools::isSubmit('syncLang'))
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
$defaultIdLand = $importModule->getDefaultIdLang();
|
||||
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
|
||||
@@ -478,7 +455,7 @@ class shopimporter extends ImportModule
|
||||
'.$importModule->displayName.' : '.$defaultLanguageImport->name.'<br>'.$this->l('Please change default language in your configuration');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncCurrency'))
|
||||
if (Tools::isSubmit('syncCurrency') OR Tools::isSubmit('syncCurrencyWS'))
|
||||
{
|
||||
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
|
||||
$currencies = $importModule->getCurrencies(0);
|
||||
@@ -522,12 +499,15 @@ class shopimporter extends ImportModule
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
if ($save OR Tools::isSubmit('syncLang'))
|
||||
//die('');
|
||||
if ($save OR Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
|
||||
//add language if not exist in prestashop
|
||||
if ($className == 'Language')
|
||||
{
|
||||
if (Tools::isSubmit('syncLang'))
|
||||
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
$add = true;
|
||||
else
|
||||
$add = false;
|
||||
@@ -560,7 +540,134 @@ class shopimporter extends ImportModule
|
||||
}
|
||||
die(Tools::jsonEncode($json));
|
||||
}
|
||||
public function generiqueImportWS($className, $fields, $save = false)
|
||||
{
|
||||
|
||||
$return = '';
|
||||
$json = array();
|
||||
$errors = array();
|
||||
$json['hasError'] = false;
|
||||
$json['datas'] = array_values($fields);
|
||||
$languages = array();
|
||||
$defaultLanguage = '';
|
||||
$table = $this->supportedImports[strtolower($className)]['table'];
|
||||
|
||||
$object = new $className();
|
||||
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
|
||||
|
||||
if ((sizeof($rules['requiredLang']) OR sizeof($rules['sizeLang']) OR sizeof($rules['validateLang']) OR Tools::isSubmit('syncLangWS') OR Tools::isSubmit('syncCurrency')))
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$importModule = new $moduleName();
|
||||
/* $importModule->server = Tools::getValue('server');
|
||||
$importModule->user = Tools::getValue('user');
|
||||
$importModule->passwd = Tools::getValue('password');
|
||||
$importModule->database = Tools::getValue('database');
|
||||
$importModule->prefix = Tools::getValue('prefix');
|
||||
*/
|
||||
|
||||
$defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
|
||||
$languages = $importModule->getLangagues();
|
||||
|
||||
if (Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
$defaultIdLand = $importModule->getDefaultIdLang();
|
||||
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
|
||||
if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code)
|
||||
$errors[] = $this->l('Default language doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultLanguage->name.' ≠
|
||||
'.$importModule->displayName.' : '.$defaultLanguageImport->name.'<br>'.$this->l('Please change default language in your configuration');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncCurrency'))
|
||||
{
|
||||
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
|
||||
$currencies = $importModule->getCurrencies();
|
||||
if (!empty($currencies[$defaultIdCurrency]['iso_code']))
|
||||
$defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code']));
|
||||
else
|
||||
$defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num']));
|
||||
|
||||
$defaultCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code)
|
||||
$errors[] = $this->l('Default currency doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultCurrency->name.' ≠ '.$importModule->displayName.' : '.$defaultCurrencyImport->name.'<br>'.$this->l('Please change default currency in your configuration');
|
||||
}
|
||||
if (!empty($errors))
|
||||
die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}');
|
||||
}
|
||||
else
|
||||
die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}');
|
||||
}
|
||||
|
||||
foreach($fields as $key => $field)
|
||||
{
|
||||
$id = $this->supportedImports[strtolower($className)]['identifier'];
|
||||
//remove wrong fields (ex : id_toto in Customer)
|
||||
foreach($field as $name => $value)
|
||||
if (!array_key_exists($name, get_object_vars($object)) AND ($name != $id) AND ($name != 'association') AND ($name != 'images') AND (strtolower($className) != 'cart'))
|
||||
unset($field[$name]);
|
||||
$return = $this->validateRules($rules, $field, $className, $languages, $defaultLanguage);
|
||||
$fields[$key] = $field;
|
||||
if (!empty($return))
|
||||
{
|
||||
//skip mode
|
||||
if (Tools::getValue('hasErrors') == 1)
|
||||
unset($fields[$key]);
|
||||
|
||||
$errors[] = $return;
|
||||
array_unshift($errors[sizeof($errors)-1], $field[$id]);
|
||||
}
|
||||
}
|
||||
if (sizeof($errors) > 0)
|
||||
{
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
if ($save OR Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
//add language if not exist in prestashop
|
||||
if ($className == 'Language')
|
||||
{
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
$add = true;
|
||||
else
|
||||
$add = false;
|
||||
$errors = $this->checkAndAddLang($fields, $add);
|
||||
}
|
||||
elseif ($className == 'Cart')
|
||||
{
|
||||
$this->saveOrders($fields);
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = $this->saveObject($className, $fields);
|
||||
$this->cleanPositions($table);
|
||||
//insert association
|
||||
if (array_key_exists('association', $this->supportedImports[strtolower($className)]))
|
||||
$this->insertAssociation(strtolower($className), $fields);
|
||||
if (!empty($return))
|
||||
{
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $return;
|
||||
}
|
||||
}
|
||||
if ($className == 'Category' AND (sizeof($fields) != (int)Tools::getValue('nbr_import')))
|
||||
$this->updateCat();
|
||||
}
|
||||
if (sizeof($errors) > 0 AND is_array($errors))
|
||||
{
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
die(Tools::jsonEncode($json));
|
||||
}
|
||||
|
||||
private function saveObject($className, $items)
|
||||
{
|
||||
$return = array();
|
||||
@@ -586,7 +693,7 @@ class shopimporter extends ImportModule
|
||||
{
|
||||
|
||||
foreach($matchIdLang as $k => $v)
|
||||
if ($k != $v)
|
||||
if (($k != $v) AND array_key_exists($k, $val))
|
||||
{
|
||||
$item[$key][$v] = $val[$k];
|
||||
unset($item[$key][$k]);
|
||||
@@ -831,7 +938,8 @@ class shopimporter extends ImportModule
|
||||
foreach ($this->supportedImports[$className]['alterTable'] AS $name => $type)
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
if (!array_key_exists($name.'_'.$moduleName, $result))
|
||||
Db::getInstance()->ExecuteS("SHOW COLUMNS FROM `"._DB_PREFIX_.pSQL($from)."` LIKE '".$name.'_'.$moduleName."'");
|
||||
if (!Db::getInstance()->numRows() AND !array_key_exists($name.'_'.$moduleName, $result))
|
||||
$queryTmp .= ' ADD `'.$name.'_'.$moduleName.'` '.$type.' NOT NULL,';
|
||||
}
|
||||
if (!empty($queryTmp))
|
||||
@@ -1006,6 +1114,52 @@ class shopimporter extends ImportModule
|
||||
return $returnErrors;
|
||||
}
|
||||
|
||||
private function validateRulesWS($rules, &$fields, $className, $languages, $defaultLanguage)
|
||||
{
|
||||
$returnErrors = array();
|
||||
$hasErrors = Tools::getValue('hasErrors');
|
||||
/* Checking for required fields */
|
||||
foreach ($rules['required'] AS $field)
|
||||
if (($value = $fields[$field]) == false AND (string)$value != '0')
|
||||
if ($hasErrors == 2)
|
||||
{
|
||||
if (array_key_exists($field, $rules['size']))
|
||||
$size = $rules['size'][$field];
|
||||
else
|
||||
$size = 1;
|
||||
$fields[$field] = $this->generateData($size, $rules['validate'][$field]);
|
||||
}
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
|
||||
/* Checking for maximum fields sizes */
|
||||
foreach ($rules['size'] AS $field => $maxLength)
|
||||
if (array_key_exists($field, $fields) AND $field != 'passwd')
|
||||
if ($fields[$field] !== false AND Tools::strlen($fields[$field]) > $maxLength)
|
||||
if ($hasErrors == 2)
|
||||
$fields[$field] = substr($fields[$field], 0, $maxLength);
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b>'.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
|
||||
/* Checking for fields validity */
|
||||
foreach ($rules['validate'] AS $field => $function)
|
||||
if (array_key_exists($field, $fields))
|
||||
if (($value = $fields[$field]) !== false AND ($field != 'passwd'))
|
||||
if (!Validate::$function($value))
|
||||
if ($hasErrors == 2)
|
||||
{
|
||||
if (array_key_exists($field, $rules['size']))
|
||||
$size = $rules['size'][$field];
|
||||
else
|
||||
$size = 1;
|
||||
$fields[$field] = $this->generateData($size, $rules['validate'][$field]);
|
||||
}
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
|
||||
|
||||
return $returnErrors;
|
||||
}
|
||||
public function checkAndAddLang ($languages, $add = true)
|
||||
{
|
||||
$errors = '';
|
||||
@@ -1077,6 +1231,20 @@ class shopimporter extends ImportModule
|
||||
case 'address' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'address');
|
||||
break;
|
||||
case 'country' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'state');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'country');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'country_lang');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'country');
|
||||
case 'group' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer_group');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'ps_group_lang');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'group');
|
||||
break;
|
||||
case 'combination' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination');
|
||||
break;
|
||||
case 'category' :
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE id_category != 1');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE id_category != 1');
|
||||
@@ -1130,7 +1298,6 @@ class shopimporter extends ImportModule
|
||||
case 'customer' :
|
||||
case 'zone' :
|
||||
case 'state' :
|
||||
case 'group' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.pSQL($table));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ class ThemeInstallator extends Module
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_time_limit(0);
|
||||
ini_set('memory_limit', '2G');
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', '2G');
|
||||
|
||||
$this->name = 'themeinstallator';
|
||||
$this->version = '1.4';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>treepodia</name>
|
||||
<displayName><![CDATA[Treepodia]]></displayName>
|
||||
<version><![CDATA[1.6]]></version>
|
||||
<version><![CDATA[1.6.1]]></version>
|
||||
<description><![CDATA[Cover your entire catalog with product videos in 24 hours.]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
@@ -47,7 +47,7 @@ class Treepodia extends Module
|
||||
{
|
||||
$this->name = 'treepodia';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.6';
|
||||
$this->version = '1.6.1';
|
||||
$this->displayName = 'Treepodia';
|
||||
|
||||
parent::__construct();
|
||||
@@ -86,7 +86,7 @@ class Treepodia extends Module
|
||||
if (!($domain = Configuration::get('PS_SHOP_DOMAIN')))
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$host = ((Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://'.$domain : 'http://'.$domain).__PS_BASE_URI__;
|
||||
$host = ((Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://'.$domain : 'http://'.$domain).__PS_BASE_URI__;
|
||||
|
||||
return $host;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user