[+] Project: it's possible to create new genders, "Miss" gender is now added

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8578 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-14 15:15:51 +00:00
parent 62a578b314
commit 03eaee9bf4
35 changed files with 777 additions and 526 deletions
+21 -21
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -256,7 +256,7 @@ class Ebay extends Module
include(dirname(__FILE__).'/sql-upgrade-1-2.php');
foreach ($sql as $s)
if (!Db::getInstance()->Execute($s))
return false;
return false;
Configuration::updateValue('EBAY_VERSION', $this->version);
}
}
@@ -374,7 +374,7 @@ class Ebay extends Module
if ($id_customer < 1)
{
$customer = new Customer();
$customer->id_gender = 9;
$customer->id_gender = 0;
$customer->id_default_group = 1;
$customer->secure_key = md5(uniqid(rand(), true));
$customer->email = $order['email'];
@@ -387,7 +387,7 @@ class Ebay extends Module
$customer->add();
$id_customer = $customer->id;
}
// Search if address exists
$id_address = (int)Db::getInstance()->getValue('SELECT `id_address` FROM `'._DB_PREFIX_.'address` WHERE `id_customer` = '.(int)$id_customer.' AND `alias` = \'eBay\'');
if ($id_address > 0)
@@ -421,7 +421,7 @@ class Ebay extends Module
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;
@@ -437,7 +437,7 @@ class Ebay extends Module
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)
{
@@ -446,18 +446,18 @@ class Ebay extends Module
$customerClear = new Customer();
if (method_exists($customerClear, 'clearCache'))
$customerClear->clearCache(true);
// Validate order
$paiement = new eBayPayment();
$paiement->validateOrder(intval($cartAdd->id), Configuration::get('PS_OS_PAYMENT'), floatval($cartAdd->getOrderTotal(true, 3)), 'eBay '.$order['payment_method'].' '.$order['id_order_seller'], NULL, array(), intval($cartAdd->id_currency));
$id_order = $paiement->currentOrder;
// Fix on date
Db::getInstance()->autoExecute(_DB_PREFIX_.'orders', array('date_add' => pSQL($order['date_add'])), 'UPDATE', '`id_order` = '.(int)$id_order);
// Fix on sending e-mail
Db::getInstance()->autoExecute(_DB_PREFIX_.'customer', array('email' => pSQL($order['email'])), 'UPDATE', '`id_customer` = '.(int)$id_customer);
// Update price (because of possibility of price impact)
$updateOrder = array(
'total_paid' => floatval($order['amount']),
@@ -614,7 +614,7 @@ class Ebay extends Module
{
$ebay = new eBayRequest();
if (!empty($this->context->cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged')
if (!empty($this->context->cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged')
{
if (isset($_POST['eBayUsername']))
{
@@ -778,7 +778,7 @@ class Ebay extends Module
<select name="ebay_shipping_carrier_id">';
foreach ($this->_shippingMethod as $id => $val)
$html .= '<option value="'.$id.'" '.(Tools::getValue('ebay_shipping_carrier_id', Configuration::get('EBAY_SHIPPING_CARRIER_ID')) == $id ? 'selected="selected"' : '').'>'.$val['description'].'</option>';
$html .= ' </select>
$html .= ' </select>
<p>'.$this->l('Shipping cost configuration for your products on eBay').'</p>
</div>
<label>'.$this->l('Shipping cost').' : </label>
@@ -854,7 +854,7 @@ class Ebay extends Module
/******************************************************************/
/** Category Form Config Methods **********************************/
/******************************************************************/
private function _getChildCategories($categories, $id, $path = array(), $pathAdd = '')
{
$categoryTmp = array();
@@ -904,7 +904,7 @@ class Ebay extends Module
// Display header
$html = '<p><b>'.$this->l('To export your products on eBay, you have to associate each one of your shop categories to an eBay category. You can also define an impact of your price on eBay.').'</b></p><br />
<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&action=suggestCategories" method="post" class="form" id="configForm2SuggestedCategories">
<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&action=suggestCategories" method="post" class="form" id="configForm2SuggestedCategories">
<p><b>'.$this->l('You can use the button below to associate automatically the categories which have no association for the moment with an eBay suggested category.').'</b>
<input class="button" name="submitSave" type="submit" value="'.$this->l('Suggest Categories').'" />
</p><br />
@@ -1117,7 +1117,7 @@ class Ebay extends Module
});
</script>
' : '
<script type="text/javascript">
<script type="text/javascript">
var iso = \''.$isoTinyMCE.'\';
var pathCSS = \''._THEME_CSS_DIR_.'\';
var ad = \''.$ad.'\';
@@ -1258,7 +1258,7 @@ class Ebay extends Module
});
}
</script>
<div id="resultSync" style="text-align: center; font-weight: bold; font-size: 14px;"></div>
<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=4&section=sync" method="post" class="form" id="configForm4">
@@ -1390,7 +1390,7 @@ class Ebay extends Module
WHERE `quantity` > 0 AND `active` = 1
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)');
// Retrieve products list for eBay (which have matched categories)
// Retrieve products list for eBay (which have matched categories)
$productsList = Db::getInstance()->ExecuteS('
SELECT `id_product` FROM `'._DB_PREFIX_.'product`
WHERE `quantity` > 0 AND `active` = 1
@@ -1400,7 +1400,7 @@ class Ebay extends Module
ORDER BY `id_product`
LIMIT 1');
// How Many Product Less ?
// How Many Product Less ?
$nbProductsLess = Db::getInstance()->getValue('
SELECT COUNT(`id_product`) FROM `'._DB_PREFIX_.'product`
WHERE `quantity` > 0 AND `active` = 1
@@ -1417,7 +1417,7 @@ class Ebay extends Module
WHERE `quantity` > 0 AND `active` = 1
AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)');
// Retrieve products list for eBay (which have matched categories)
// Retrieve products list for eBay (which have matched categories)
$productsList = Db::getInstance()->ExecuteS('
SELECT `id_product` FROM `'._DB_PREFIX_.'product`
WHERE `quantity` > 0 AND `active` = 1
@@ -1427,7 +1427,7 @@ class Ebay extends Module
ORDER BY `id_product`
LIMIT 1');
// How Many Product Less ?
// How Many Product Less ?
$nbProductsLess = Db::getInstance()->getValue('
SELECT COUNT(`id_product`) FROM `'._DB_PREFIX_.'product`
WHERE `quantity` > 0 AND `active` = 1
@@ -1735,7 +1735,7 @@ class Ebay extends Module
}
}
}
}
}
else
{
// No variations case
@@ -1897,7 +1897,7 @@ class Ebay extends Module
<h3 id="EbayHelpPart2-1">1) Onglet « Paramètres »</h3>
<p>Cette section est à configurer lors de la première utilisation du module. <br />Vous devez définir votre <strong>compte PayPal</strong> comme <strong>moyen de paiement de produits sur eBay</strong> en renseignant l’email que vous utilisez pour votre compte PayPal. <br />Si vous n’en avez pas, vous devez <a href="https://www.paypal.com/fr/cgi-bin/webscr?cmd=_flow&amp;SESSION=85gB6zaK7zA5l_Y0UnNe_eJTaw1Al_e4hmrEfOLhrEiojJMJZGG-Cw9amIq&amp;dispatch=5885d80a13c0db1f8e263663d3faee8d5863a909c4bb5aeebb52c6e1151bdaa9" target="_blank"><u>souscrire à un compte PayPal Business</u></a>.<br />Vous devez définir le <strong>moyen et les frais de livraison</strong> qui seront appliqués à vos produits sur eBay.</p>
<h3 id="EbayHelpPart2-2">2) Onglet « Configuration des catégories »</h3>
<p>Avant de publier vos produits sur eBay, vous devez associer les catégories de produits de votre boutique Prestashop avec celles d’eBay. Vous pouvez également choisir de vendre les produits de votre boutique Prestashop à un prix différent sur eBay. Cet impact sur le prix est défini en %.</p>
<p><u>NB :</u> Certaines catégories bénéficient du nouveau format d’annonce multi-versions.</p>
+31 -29
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -27,7 +27,7 @@
if (!defined('_PS_VERSION_'))
exit;
if ((basename(__FILE__) == 'fianetfraud.php'))
require_once(dirname(__FILE__).'/fianet/fianet.php');
@@ -65,7 +65,7 @@ class Fianetfraud extends Module
4 => 'Transporteur (La Poste, Colissimo, UPS, DHL... ou tout transporteur privé)',
5 => 'Emission dun billet électronique, téléchargements'
);
private $_payement_type = array(
1 => 'carte',
2 => 'cheque',
@@ -157,9 +157,9 @@ class Fianetfraud extends Module
}
private function _postProcess()
{
{
$error = false;
Configuration::updateValue('SAC_PRODUCTION', ((Tools::getValue('fianetfraud_production') == 1 ) ? 1 : 0));
Configuration::updateValue('SAC_LOGIN', Tools::getValue('fianetfraud_login'));
Configuration::updateValue('SAC_PASSWORD', Tools::getValue('fianetfraud_password'));
@@ -167,20 +167,20 @@ class Fianetfraud extends Module
Configuration::updateValue('SAC_DEFAULT_PRODUCT_TYPE', Tools::getValue('fianetfraud_product_type'));
Configuration::updateValue('SAC_DEFAULT_CARRIER_TYPE', Tools::getValue('fianetfraud_default_carrier'));
Configuration::updateValue('SAC_MINIMAL_ORDER', Tools::getValue('fianetfraud_minimal_order'));
if (isset($_POST['payementBox']))
{
Configuration::updateValue('SAC_PAYMENT_MODULE', implode(',', $_POST['payementBox']));
foreach ($_POST['payementBox'] as $payment)
foreach ($_POST['payementBox'] as $payment)
Configuration::updateValue('SAC_PAYMENT_TYPE_'.$payment,Tools::getValue($payment));
}
$categories = Category::getSimpleCategories($this->context->language->id);
foreach ($categories AS $category)
Configuration::updateValue('SAC_CATEGORY_TYPE_'.$category['id_category'],Tools::getValue('cat_'.$category['id_category']));
$carriers = Carrier::getCarriers($this->context->language->id);
foreach ($carriers as $carrier)
foreach ($carriers as $carrier)
{
if (isset($_POST['carrier_'.$carrier['id_carrier']]))
Configuration::updateValue('SAC_CARRIER_TYPE_'.$carrier['id_carrier'], $_POST['carrier_'.$carrier['id_carrier']]);
@@ -190,7 +190,7 @@ class Fianetfraud extends Module
$this->_html .= '<div class="alert error">'.$this->l('Invalid carrier code').'</div>';
}
}
if (!$error)
{
$dataSync = ((($site_id = Configuration::get('SAC_SITEID')) AND Configuration::get('SAC_PRODUCTION'))
@@ -199,7 +199,7 @@ class Fianetfraud extends Module
);
$this->_html .= '<div class="conf confirm">'.$this->l('Settings are updated').$dataSync.'</div>';
}
}
public function getContent()
@@ -289,7 +289,7 @@ class Fianetfraud extends Module
$this->_html .= '</select>
</div>
</fieldset><div class="clear">&nbsp;</div>';
/* Get all modules then select only payment ones*/
$modules = Module::getModulesOnDisk();
$modules_is_fianet = explode(',', Configuration::get('SAC_PAYMENT_MODULE'));
@@ -303,12 +303,12 @@ class Fianetfraud extends Module
$countries = DB::getInstance()->ExecuteS('SELECT id_country FROM '._DB_PREFIX_.'module_country WHERE id_module = '.(int)($module->id));
foreach ($countries as $country)
$module->country[] = $country['id_country'];
$module->currency = array();
$currencies = DB::getInstance()->ExecuteS('SELECT id_currency FROM '._DB_PREFIX_.'module_currency WHERE id_module = '.(int)($module->id));
foreach ($currencies as $currency)
$module->currency[] = $currency['id_currency'];
$module->group = array();
$groups = DB::getInstance()->ExecuteS('SELECT id_group FROM '._DB_PREFIX_.'module_group WHERE id_module = '.(int)($module->id));
foreach ($groups as $group)
@@ -327,7 +327,7 @@ class Fianetfraud extends Module
<label>'.$this->l('Payment Detail').'</label>
<div class="margin-form">
<table cellspacing="0" cellpadding="0" class="table" ><thead><tr>
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'payementBox[]\', this.checked)" /></th>
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'payementBox[]\', this.checked)" /></th>
<th>'.$this->l('Payment Module').'</th><th>'.$this->l('Payment Type').'</th></tr></thead><tbody>';
foreach ($this->paymentModules as $module)
@@ -336,10 +336,10 @@ class Fianetfraud extends Module
$this->_html .= '<td><img src="'.__PS_BASE_URI__.'modules/'.$module->name.'/logo.gif" alt="'.$module->name.'" title="'.$module->displayName.'" />'.stripslashes($module->displayName).'</td><td><select name="'.substr($module->name,0,15).'">';
$this->_html .= '<option value="0">'.$this->l('-- Choose --').'</option>';
foreach ($this->_payement_type as $type)
$this->_html .= '<option '.((Configuration::get('SAC_PAYMENT_TYPE_'.substr($module->name,0,15)) == $type) ? 'selected="true"' : '').'>'.$type.'</option>';
$this->_html .= '<option '.((Configuration::get('SAC_PAYMENT_TYPE_'.substr($module->name,0,15)) == $type) ? 'selected="true"' : '').'>'.$type.'</option>';
$this->_html .= '</select></tr>';
}
$this->_html .= '</tbody></table></margin></fieldset><br class="clear" /><br />
<center><input type="submit" name="submitSettings" value="'.$this->l('Save').'" class="button" /></center>
</form>
@@ -409,10 +409,10 @@ class Fianetfraud extends Module
{
if ($params['order']->total_paid <= 0)
return;
if (!$this->needCheck($params['order']->module, $params['order']->total_paid))
return false;
$address_delivery = new Address((int)($params['order']->id_address_delivery));
$address_invoice = new Address((int)($params['order']->id_address_invoice));
$customer = new Customer((int)($params['order']->id_customer));
@@ -423,7 +423,8 @@ class Fianetfraud extends Module
else
$orderFianet->billing_user->set_quality_professional();
$orderFianet->billing_user->titre = (($customer->id_gender == 1) ? $this->l('Mr.') : (($customer->id_gender == 2 ) ? $this->l('Mrs') : $this->l('Mr.')));
$gender = new Gender($customer->id_gender);
$orderFianet->billing_user->titre = $gender->name;
$orderFianet->billing_user->nom = utf8_decode($address_invoice->lastname);
$orderFianet->billing_user->prenom = utf8_decode($address_invoice->firstname);
$orderFianet->billing_user->societe = utf8_decode($address_invoice->company);
@@ -455,14 +456,15 @@ class Fianetfraud extends Module
{
$orderFianet->delivery_user = new fianet_delivery_user_xml();
$orderFianet->delivery_adress = new fianet_delivery_adress_xml();
if ($address_delivery->company == '')
$orderFianet->delivery_user->set_quality_nonprofessional();
else
$orderFianet->delivery_user->set_quality_professional();
$orderFianet->delivery_user->titre = (($customer->id_gender == 1) ? $this->l('Mr.') : (($customer->id_gender == 2) ? $this->l('Mrs') : $this->l('Unknown')));
$orderFianet->delivery_user->titre = $gender->name;
$orderFianet->delivery_user->nom = utf8_decode($address_delivery->lastname);
$orderFianet->delivery_user->prenom = utf8_decode($address_delivery->firstname);
$orderFianet->delivery_user->societe = utf8_decode($address_delivery->company);
@@ -471,7 +473,7 @@ class Fianetfraud extends Module
$orderFianet->delivery_user->telmobile = utf8_decode($address_delivery->phone_mobile);
$orderFianet->delivery_user->telfax = '';
$orderFianet->delivery_user->email = $customer->email;
$orderFianet->delivery_adress->rue1 = utf8_decode($address_delivery->address1);
$orderFianet->delivery_adress->rue2 = utf8_decode($address_delivery->address2);
$orderFianet->delivery_adress->cpostal = utf8_decode($address_delivery->postcode);
@@ -479,7 +481,7 @@ class Fianetfraud extends Module
$country = new Country((int)($address_delivery->id_country));
$orderFianet->delivery_adress->pays = utf8_decode($country->name[$id_lang]);
}
$orderFianet->info_commande->refid = ($params['order']->id);
$orderFianet->info_commande->montant = $params['order']->total_paid;
$currency = new Currency((int)($params['order']->id_currency));
@@ -495,7 +497,7 @@ class Fianetfraud extends Module
$have_sac_cat = false;
$produit = new fianet_product_xml();
if(Configuration::get('SAC_CATEGORY_TYPE_'.$product['id_category_default']))
{
$produit->type = Configuration::get('SAC_CATEGORY_TYPE_'.$product['id_category_default']);
@@ -521,7 +523,7 @@ class Fianetfraud extends Module
$sender->mode = 'production';
else
$sender->mode = 'test';
$sender->add_order($orderFianet);
$res = $sender->send_orders_stacking();
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'fianet_fraud_orders(id_order, date_add) VALUES('.(int)($params['order']->id).', \''.pSQL(date('Y-m-d H:i:s')).'\')');
+19 -19
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -27,20 +27,20 @@
if (!defined('_PS_VERSION_'))
exit;
class FianetSceau extends Module
{
private $id_order;
function __construct()
{
$this->name = 'fianetsceau';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->limited_countries = array('fr');
parent::__construct();
$this->displayName = $this->l('FIA-NET Seal of Confidence');
$this->description = $this->l('Turn your visitors into buyers by creating confidence in your site.');
if (!Configuration::get('FIANET_SCEAU_PRIVATEKEY'))
@@ -48,7 +48,7 @@ class FianetSceau extends Module
if (!Configuration::get('FIANET_SCEAU_SITEID'))
$this->warning = $this->l('Please enter your site ID.');
}
public function install()
{
return (parent::install() AND
@@ -79,13 +79,13 @@ class FianetSceau extends Module
else
Configuration::updateValue('FIANET_SCEAU_SITEID', Tools::getValue('FIANET_SCEAU_SITEID'));
Configuration::updateValue('FIANET_SCEAU_PRIVATEKEY', Tools::getValue('FIANET_SCEAU_PRIVATEKEY'));
if ((int)Tools::getValue('fia_net_mode'))
$dataSync = (($site_id = Configuration::get('FIANET_SCEAU_SITEID')) ? '<img src="http://www.prestashop.com/modules/fianetsceau.png?site_id='.urlencode($site_id).'" style="float:right" />' : 'toto');
else
$dataSync = '';
return $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); }
public function getContent()
{
$output = '<h2>'.$this->displayName.'</h2>';
@@ -93,7 +93,7 @@ class FianetSceau extends Module
$output .= parent::displayError('You need to enable Curl library to use this module');
else if (Tools::isSubmit('submitFianet'))
$output .= self::getProcess();
$output .= '
<fieldset style="width:80%"><legend>'.$this->displayName.'</legend>
<img src="../modules/'.$this->name.'/logo.jpg" style="float:right;margin:5px 10px 5px 0" />
@@ -131,13 +131,13 @@ class FianetSceau extends Module
<label for="production" style="color:#080;display:block;float:left;text-align:left;width:85px;">'.$this->l('Production').'</label></span>
</div>
<p class="clear">&nbsp;</p>
<input type="submit" name="submitFianet" value="'.$this->l('Update settings').'" class="button" />
<input type="submit" name="submitFianet" value="'.$this->l('Update settings').'" class="button" />
</fieldset>
</form>';
return $output;
}
private function sendXML()
{
$SiteID = Configuration::get('FIANET_SCEAU_SITEID');
@@ -148,15 +148,15 @@ class FianetSceau extends Module
$user = $control->addChild('utilisateur');
$name = $user->addChild('nom', $customer->lastname);
if ($customer->id_gender == 1 OR $customer->id_gender == 2)
if ($customer->id_gender)
$name->addAttribute('titre', 1);
$user->addChild('prenom', $customer->firstname);
$user->addChild('email', $customer->email);
$info = $control->addChild('infocommande');
$info->addChild('siteid', $SiteID);
$info->addChild('refid', (int)$order->id);
$total = round($order->total_paid / $currency->conversion_rate, 2);
$amount = $info->addChild('montant', $total);
$amount->addAttribute('devise', 'EUR');
@@ -173,12 +173,12 @@ class FianetSceau extends Module
SELECT date_add
FROM '._DB_PREFIX_.'orders
WHERE id_order = '.(int)$order->id);
$customer_ip = $info->addChild('ip', $ip);
$customer_ip = $info->addChild('ip', $ip);
$customer_ip->addAttribute('timestamp', $order_date);
$cryptKey = md5(Configuration::get('FIANET_SCEAU_PRIVATEKEY').'_'.(int)$order->id.'+'.$order_date.'='.$customer->email);
$control->addChild('crypt', $cryptKey);
$XMLInfo = $control->asXML();
$CheckSum = md5($XMLInfo);
@@ -196,7 +196,7 @@ class FianetSceau extends Module
return true;
return false;
}
public function hookUpdateOrderStatus($params)
{
$this->id_order = (int)$params['id_order'];
@@ -224,12 +224,12 @@ class FianetSceau extends Module
WHERE a.id = '.(int)$res['id']);
}
}
public function hookLeftColumn($params)
{
return $this->hookRightColumn($params);
}
public function hookRightColumn($params)
{
return '<a href="javascript:;" onclick="varwin=window.open(\'https://www.fia-net.com/certif/certificat.php?key='.Configuration::get('FIANET_SCEAU_SITEID').'&amp;lang='.$this->context->language->iso_code.'\', \'certificat\', \'width=650, height=510\', \'toolbar=no, location=no,directories=no, status=no, menubar=no, scrollbars=no, resizable=yes,dependent=yes\');"><img src="https://www.fia-net.com/img/logos/'.(($this->context->language->id != 2 ) ? 'en/' : '' ).'rouge3bc.gif" title="Voir la fiche marchand sur Fia-net.com" alt="Voir la fiche marchand sur Fia-net.com" /></a>';
+57 -57
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -42,28 +42,28 @@ class importerosc extends ImportModule
parent::__construct ();
$this->displayName = $this->l('Importer osCommerce');
$this->description = $this->l('This module allows you to import from osCommerce to Prestashop.');
$this->description = $this->l('This module allows you to import from osCommerce to Prestashop.');
}
public function install()
{
if (!parent::install() OR !$this->registerHook('beforeAuthentication'))
return false;
return true;
return true;
}
public function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
public function displaySpecificOptions()
{
$langagues = $this->ExecuteS('SELECT * FROM `'.addslashes($this->prefix).'languages`');
$curencies = $this->ExecuteS('SELECT * FROM `'.addslashes($this->prefix).'currencies`');
$html = '<label style="width:220px">'.$this->l('Default osCommerce language').' : </label>
<div class="margin-form">
<select name="defaultOscLang"><option value="0">------</option>';
@@ -81,15 +81,15 @@ class importerosc extends ImportModule
http://<input type="text" name="shop_url">/
<p>'.$this->l('Specify the root URL of your site oscommerce').'</p>
</div>';
return $html;
}
public function validateSpecificOptions()
{
{
$errors = array();
if (Tools::getValue('defaultOscLang') == 0)
$errors[] = $this->l('Please select a default language');
@@ -103,25 +103,25 @@ class importerosc extends ImportModule
die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}');
}
public function getDefaultIdLang ()
{
return Tools::getValue('defaultOscLang');
}
public function getDefaultIdCurrency ()
{
return Tools::getValue('defaultOscCurrency');
}
public function getLangagues($limit = 0, $nrb_import = 100)
{
$identifier = 'id_lang';
$langagues = $this->ExecuteS('SELECT languages_id as id_lang, name as name, code as iso_code, 1 as active FROM `'.addslashes($this->prefix).'languages` LIMIT '.(int)($limit).' , '.(int)$nrb_import);
return $this->autoFormat($langagues, $identifier);
return $this->autoFormat($langagues, $identifier);
}
public function getCurrencies($limit = 0, $nrb_import = 100)
{
$identifier = 'id_currency';
@@ -130,16 +130,16 @@ class importerosc extends ImportModule
CONCAT(`symbol_left`, `symbol_right`) as sign, value as conversion_rate
FROM `'.addslashes($this->prefix).'currencies` LIMIT '.(int)($limit).' , '.(int)$nrb_import
);
return $this->autoFormat($currencies, $identifier);
return $this->autoFormat($currencies, $identifier);
}
public function getZones($limit = 0, $nrb_import = 100)
{
$identifier = 'id_zone';
$zones = $this->ExecuteS('SELECT geo_zone_id as id_zone, geo_zone_name as name, 1 as active FROM `'.addslashes($this->prefix).'geo_zones` LIMIT '.(int)($limit).' , '.(int)$nrb_import);
return $this->autoFormat($zones, $identifier);
return $this->autoFormat($zones, $identifier);
}
public function getCountries($limit = 0, $nrb_import = 100)
{
$multiLangFields = array('name');
@@ -150,9 +150,9 @@ class importerosc extends ImportModule
SELECT countries_id as id_country, countries_name as name, countries_iso_code_2 as iso_code, '.$defaultIdLang.' as id_lang,
1 as id_zone, 0 as id_currency, 1 as contains_states, 1 as need_identification_number, 1 as active, 1 as display_tax_label
FROM `'.addslashes($this->prefix).'countries` as c LIMIT '.(int)($limit).' , '.(int)$nrb_import);
return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields);
return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields);
}
public function getStates($limit = 0, $nrb_import = 100)
{
$identifier = 'id_state';
@@ -164,18 +164,18 @@ class importerosc extends ImportModule
'iso_code' => 999,
'name' => 'osc',
'active' => 0
)
)
);
return $this->autoFormat($states, $identifier);
return $this->autoFormat($states, $identifier);
}
public function getGroups()
{
$idLang = $this->getDefaultIdLang();
return array( 1 => array(
'id_group' => 1,
'price_display_method' => 0,
'name' => array($idLang => $this->l('Default osCommerce Group'))
'name' => array($idLang => $this->l('Default osCommerce Group'))
)
);
}
@@ -198,11 +198,11 @@ class importerosc extends ImportModule
if (isset($customer['id_gender']) && array_key_exists($customer['id_gender'], $genderMatch))
$customer['id_gender'] = $genderMatch[$customer['id_gender']];
else
$customer['id_gender'] = 9;
$customer['id_gender'] = 0;
return $this->autoFormat($customers, $identifier);
}
public function getAddresses($limit = 0, $nrb_import = 100)
{
$identifier = 'id_address';
@@ -218,10 +218,10 @@ class importerosc extends ImportModule
$multiLangFields = array('name', 'link_rewrite');
$keyLanguage = 'id_lang';
$identifier = 'id_category';
$categories = $this->ExecuteS('
SELECT c.categories_id as id_category, c.parent_id as id_parent, 0 as level_depth, cd.language_id as id_lang, cd.categories_name as name , 1 as active, categories_image as images
FROM `'.addslashes($this->prefix).'categories` c
FROM `'.addslashes($this->prefix).'categories` c
LEFT JOIN `'.addslashes($this->prefix).'categories_description` cd ON (c.categories_id = cd.categories_id)
WHERE cd.categories_name IS NOT NULL AND cd.language_id IS NOT NULL
ORDER BY c.categories_id, cd.language_id
@@ -233,7 +233,7 @@ class importerosc extends ImportModule
}
return $this->autoFormat($categories, $identifier, $keyLanguage, $multiLangFields);
}
public function getAttributesGroups($limit = 0, $nrb_import = 100)
{
$multiLangFields = array('name', 'public_name');
@@ -241,11 +241,11 @@ class importerosc extends ImportModule
$identifier = 'id_attribute_group';
$countries = $this->ExecuteS('
SELECT products_options_id as id_attribute_group, products_options_name as name , products_options_name as public_name, language_id as id_lang, 0 as is_color_group
FROM `'.addslashes($this->prefix).'products_options`
FROM `'.addslashes($this->prefix).'products_options`
LIMIT '.(int)($limit).' , '.(int)$nrb_import);
return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields);
return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields);
}
public function getAttributes($limit = 0, $nrb_import = 100)
{
$multiLangFields = array('name');
@@ -258,7 +258,7 @@ class importerosc extends ImportModule
LIMIT '.(int)($limit).' , '.(int)$nrb_import);
return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields);
}
public function getProducts($limit = 0, $nrb_import = 100)
{
$multiLangFields = array('name', 'link_rewrite', 'description');
@@ -270,11 +270,11 @@ class importerosc extends ImportModule
pd.products_description as description, CONCAT(\''.Tools::getProtocol().Tools::getValue('shop_url').'\/images/\',p.`products_image`) as images,
(SELECT ptc.categories_id FROM `'.addslashes($this->prefix).'products_to_categories` ptc WHERE ptc.`products_id` = p.`products_id` LIMIT 1) as id_category_default,
p.`products_date_added` as date_add
FROM `'.addslashes($this->prefix).'products` p
FROM `'.addslashes($this->prefix).'products` p
LEFT JOIN `'.addslashes($this->prefix).'products_description` pd ON (p.products_id = pd.products_id)
WHERE pd.products_name IS NOT NULL AND pd.language_id IS NOT NULL
LIMIT '.(int)($limit).' , '.(int)$nrb_import);
$this->Execute('CREATE TABLE IF NOT EXISTS`products_images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`products_id` int(11) NOT NULL,
@@ -296,7 +296,7 @@ class importerosc extends ImportModule
}
return $this->autoFormat($products, $identifier, $keyLanguage, $multiLangFields);
}
public function getProductsCombination($limit = 0, $nrb_import = 100)
{
$identifier = 'id_product_attribute';
@@ -310,7 +310,7 @@ class importerosc extends ImportModule
}
return $this->autoFormat($combinations, $identifier);
}
public function getManufacturers($limit = 0, $nrb_import = 100)
{
$identifier = 'id_manufacturer';
@@ -319,10 +319,10 @@ class importerosc extends ImportModule
FROM `'.addslashes($this->prefix).'manufacturers` LIMIT '.(int)($limit).' , '.(int)$nrb_import);
foreach($manufacturers as& $manufacturer)
$manufacturer['images'] = array(Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$manufacturer['images']);
return $this->autoFormat($manufacturers, $identifier);
}
public function getOrdersStates($limit = 0, $nrb_import = 100)
{
$multiLangFields = array('name');
@@ -334,7 +334,7 @@ class importerosc extends ImportModule
LIMIT '.(int)($limit).' , '.(int)$nrb_import);//IF(`public_flag` = 0, 1, 0) as hidden
return $this->autoFormat($ordersStates, $identifier, $keyLanguage, $multiLangFields);
}
public function getOrders($limit = 0, $nrb_import = 100)
{
$orders = array();
@@ -344,13 +344,13 @@ class importerosc extends ImportModule
$matchAddresses[$address['id_customer']] = $address['id_address'];
$psCarrierDefault = (int)Configuration::get('PS_CARRIER_DEFAULT');
$psCurrency = Currency::getCurrencies();
foreach($psCurrency as $key => $currency)
{
$psCurrency[$currency['iso_code']] = $currency['id_currency'];
unset($psCurrency[$key]);
}
$orders = $this->ExecuteS('
SELECT orders_id as id_cart, '.$psCarrierDefault.' as id_carrier, 1 as id_lang, currency as id_currency, customers_id as id_customer, payment_method as payment, 1 as valid,
date_purchased as date_add, last_modified as date_upd
@@ -369,22 +369,22 @@ class importerosc extends ImportModule
$orders[$key]['total_discounts'] = 0;
$orders[$key]['total_wrapping'] = 0;
$orders[$key]['cart_products'] = $this->ExecuteS('
SELECT `orders_id` as id_cart, `products_id` as id_product, 0 as id_product_attribute, `products_quantity` as quantity
SELECT `orders_id` as id_cart, `products_id` as id_product, 0 as id_product_attribute, `products_quantity` as quantity
FROM `'.addslashes($this->prefix).'orders_products` WHERE `orders_id` = '.$order['id_cart']);
$orders[$key]['order_products'] = $this->ExecuteS('
SELECT `orders_id` as id_order, `products_id` as product_id, 0 as product_attribute_id, `products_name` as product_name, `products_quantity` as product_quantity,
`final_price` as product_price, 0 as product_weight
FROM `'.addslashes($this->prefix).'orders_products` WHERE `orders_id` = '.$order['id_cart']);
$orders[$key]['order_history'] = $this->ExecuteS('
SELECT `orders_status_history_id` as id_order_history, 0 as id_employee, `orders_id` as id_order, `orders_status_id` as id_order_state, `date_added` as date_add
SELECT `orders_status_history_id` as id_order_history, 0 as id_employee, `orders_id` as id_order, `orders_status_id` as id_order_state, `date_added` as date_add
FROM `'.addslashes($this->prefix).'orders_status_history` WHERE `orders_id` = '.$order['id_cart']);
}
return $orders;
}
private function autoFormat($items, $identifier, $keyLanguage = NULL, $multiLangFields = array())
{
{
$array = array();
foreach ($items AS $item)
if (sizeof($multiLangFields) && is_array($multiLangFields) && isset($array[$item[$identifier]][$multiLangFields[0]]))
@@ -399,7 +399,7 @@ class importerosc extends ImportModule
else
$array[$item[$identifier]][$key] = $value;
return $array;
}
}
public function hookbeforeAuthentication($params)
{
@@ -410,7 +410,7 @@ class importerosc extends ImportModule
FROM `'._DB_PREFIX_ .'customer`
WHERE `active` = 1 AND `email` = \''.pSQL($email).'\'');
if ($result && !empty($result['passwd_'.$this->name]))
{
{
if($this->checkPwd($passwd, $result['passwd_'.pSQL($this->name)]))
{
$ps_passwd = md5(pSQL(_COOKIE_KEY_.$passwd));
@@ -420,9 +420,9 @@ class importerosc extends ImportModule
WHERE `'._DB_PREFIX_.'customer`.`id_customer` ='.(int)$result['id_customer'].' LIMIT 1');
}
}
}
private function checkPwd($passwd, $encrypt_pwd)
{
//checks the type of encryption password
@@ -432,7 +432,7 @@ class importerosc extends ImportModule
$stack = explode(':', $encrypt_pwd);
if (sizeof($stack) != 2)
return false;
if (md5($stack[1] . $passwd) == $stack[0])
return true;
else
@@ -450,7 +450,7 @@ class importerosc extends ImportModule
else
return false;
}
}
public function displayConfigConnector()
+5 -5
View File
@@ -1,5 +1,5 @@
{*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -51,10 +51,10 @@ countries = new Array();
<h3>{l s='Your personal information' mod='paypal'}</h3>
<p class="radio required">
<span>{l s='Title'}</span>
<input type="radio" name="id_gender" id="id_gender1" value="1" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 1}checked="checked"{/if} />
<label for="id_gender1" class="top">{l s='Mr.' mod='paypal'}</label>
<input type="radio" name="id_gender" id="id_gender2" value="2" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 2}checked="checked"{/if} />
<label for="id_gender2" class="top">{l s='Ms.' mod='paypal'}</label>
{foreach from=$genders key=k item=gender}
<input type="radio" name="id_gender" id="id_gender{$gender.id_gender}" value="{$gender.id_gender}" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == $gender.id_gender}checked="checked"{/if} />
<label for="id_gender{$gender.id_gender}" class="top">{$gender.name}</label>
{/foreach}
</p>
<p class="required text">
<label for="customer_firstname">{l s='First name' mod='paypal'}</label>
+6 -5
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -142,7 +142,7 @@ function submitConfirm()
function submitAccount()
{
global $errors;
$context = Context::getContext();
$email = Tools::getValue('email');
if (empty($email) OR !Validate::isEmail($email))
@@ -150,7 +150,7 @@ function submitAccount()
elseif (!Validate::isPasswd(Tools::getValue('passwd')))
$errors[] = Tools::displayError('invalid password');
elseif (Customer::customerExists($email))
$errors[] = Tools::displayError('someone has already registered with this e-mail address');
$errors[] = Tools::displayError('someone has already registered with this e-mail address');
elseif (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) AND !(Tools::getValue('months') == '' AND Tools::getValue('days') == '' AND Tools::getValue('years') == ''))
$errors[] = Tools::displayError('invalid birthday');
else
@@ -179,7 +179,7 @@ function submitAccount()
$errors[] = Tools::displayError('an error occurred while creating your address');
else
{
if (Mail::Send($context->language->id, 'account', Mail::l('Welcome!'),
if (Mail::Send($context->language->id, 'account', Mail::l('Welcome!'),
array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname))
$context->smarty->assign('confirmation', 1);
$context->cookie->id_customer = (int)($customer->id);
@@ -326,7 +326,8 @@ function displayAccount()
'zip' => (Tools::getValue('postcode') ? Tools::htmlentitiesUTF8(strval(Tools::getValue('postcode'))) : (isset($result['SHIPTOZIP']) ? $result['SHIPTOZIP'] : '')),
'payerID' => $payerID,
'ppToken' => strval(Context::getContext()->cookie->paypal_token),
'errors'=> $errors
'errors'=> $errors,
'genders' => Gender::getGenders(),
));
// Display all and exit
+41 -55
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -25,30 +25,30 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class Secuvad_flux
class Secuvad_flux
{
public $encoding = 'utf-8';
public $encoding = 'utf-8';
public $flux_xml;
public $id_order;
public $id_order;
public $imp_time;
public $idsecuvad;
function __construct($idsecuvad, $encoding)
{
{
$this->idsecuvad = $idsecuvad;
$this->encoding = $encoding;
}
public function get_flux_xml_fraud($id_order)
{
$this->id_order = (int)($id_order);
$this->imp_time = date("Y-m-d H:i:s");
$this->flux_xml = '<?xml version="1.0" encoding="'.$this->encoding.'" ?>' . "\n";
$this->flux_xml .= '<impaye><idsecuvad>'.$this->idsecuvad.'</idsecuvad><idtransaction>'.(int)($this->id_order).'</idtransaction><imptimestamp>'.$this->imp_time.'</imptimestamp></impaye>';
return ($this->flux_xml);
}
function get_flux_xml($id_order)
{
$this->id_order = (int)($id_order);
@@ -59,19 +59,19 @@ class Secuvad_flux
$this->flux_xml .= '</bulk_transactions>' . "\n";
return $this->flux_xml;
}
private function get_flux_xml_order()
{
$order = new Order((int)($this->id_order));
{
$order = new Order((int)($this->id_order));
$address_delivery = new Address((int)($order->id_address_delivery));
$address_invoice = new Address((int)($order->id_address_invoice));
$customer = new Customer((int)($order->id_customer));
$currency = new Currency((int)($order->id_currency));
$carrier = new Carrier((int)($order->id_carrier));
$ip = Db::getInstance()->getValue('
SELECT `ip`
FROM `'._DB_PREFIX_.'secuvad_order`
SELECT `ip`
FROM `'._DB_PREFIX_.'secuvad_order`
WHERE `id_secuvad_order` = '.(int)($this->id_order));
if (!$ip)
return false;
@@ -84,53 +84,39 @@ class Secuvad_flux
$card_number = $payment_cc['card_number'];
$card_expiration = $payment_cc['card_expiration'];
}
$carrier = Db::getInstance()->getRow('
SELECT at.`transport_id`, td.`transport_delay_name`
FROM `'._DB_PREFIX_.'secuvad_assoc_transport` at
JOIN `'._DB_PREFIX_.'secuvad_transport_delay` td ON (at.`transport_delay_id` = td.`transport_delay_id`)
SELECT at.`transport_id`, td.`transport_delay_name`
FROM `'._DB_PREFIX_.'secuvad_assoc_transport` at
JOIN `'._DB_PREFIX_.'secuvad_transport_delay` td ON (at.`transport_delay_id` = td.`transport_delay_id`)
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = td.`id_lang`)
WHERE l.`id_lang` = '.(int)Context::getContext()->language->id.'
AND at.`id_carrier` = '.(int)($order->id_carrier));
$transptype = $carrier['transport_id'];
$rapidite = $carrier['transport_delay_name'];
$code_payment = Db::getInstance()->getValue('
SELECT sap.`code`
FROM `'._DB_PREFIX_.'module` m
SELECT sap.`code`
FROM `'._DB_PREFIX_.'module` m
JOIN `'._DB_PREFIX_.'secuvad_assoc_payment` sap ON (m.`id_module` = sap.`id_module`)
WHERE m.`name` = \''.pSQL($order->module).'\'');
$flux_xml = "<transaction>\n";
switch ($customer->id_gender)
{
case 1:
$gender = 'M';
break;
case 2:
$gender = 'Mme';
break;
case 3:
$gender = 'Mlle';
break;
default:
$gender = 'M';
break;
}
$gender = new Gender($customer->id_gender);
if($address_invoice->company == '')
$flux_xml .= '<client mode="facturation" qualite="particulier">'."\n";
else
$flux_xml .= '<client mode="facturation" qualite="entreprise">'."\n";
$flux_xml .= '<nom titre="'.$gender .'">'.$address_invoice->lastname.'</nom>'."\n";
$flux_xml .= '<nom titre="'.$gender->name.'">'.$address_invoice->lastname.'</nom>'."\n";
$flux_xml .= '<prenom>'.$address_invoice->firstname.'</prenom>'."\n";
if($address_invoice->company != '')
if($address_invoice->company != '')
$flux_xml .= '<societe>'.$address_invoice->company.'</societe>'."\n";
$flux_xml .= '<telephoneperso>'.$address_invoice->phone.'</telephoneperso>'."\n";
$flux_xml .= '<portable>'.$address_invoice->phone_mobile.'</portable>'."\n";
$flux_xml .= '<email>'.$customer->email.'</email>'."\n";
$flux_xml .= '</client>';
$flux_xml .= '<adresse mode="facturation">'."\n";
$flux_xml .= '<rue1>'.$address_invoice->address1.'</rue1>'."\n";
$flux_xml .= '<rue2>'.$address_invoice->address2.'</rue2>'."\n";
@@ -138,7 +124,7 @@ class Secuvad_flux
$flux_xml .= '<ville>'.$address_invoice->city.'</ville>'."\n";
$flux_xml .= '<pays>'.$address_invoice->country.'</pays>'."\n";
$flux_xml .= '</adresse>'."\n";
$flux_xml .= '<adresse mode="livraison">'."\n";
$flux_xml .= '<rue1>'.$address_delivery->address1.'</rue1>'."\n";
$flux_xml .= '<rue2>'.$address_delivery->address2.'</rue2>'."\n";
@@ -146,10 +132,10 @@ class Secuvad_flux
$flux_xml .= '<ville>'.$address_delivery->city.'</ville>'."\n";
$flux_xml .= '<pays>'.$address_delivery->country.'</pays>'."\n";
$flux_xml .= '</adresse>'."\n";
$flux_xml .= '<commande>'."\n";
$flux_xml .= '<idsecuvad>'.$this->idsecuvad.'</idsecuvad>'."\n";
$flux_xml .= '<idtransaction>'.(int)($this->id_order).'</idtransaction>'."\n";
$flux_xml .= '<idtransaction>'.(int)($this->id_order).'</idtransaction>'."\n";
$flux_xml .= '<trstimestamp>'.$order->date_add.'</trstimestamp>'."\n";
$flux_xml .= '<montantttc devise="'.$currency->iso_code.'">'.$order->total_paid_real.'</montantttc>'."\n";
$flux_xml .= '<montantlivraison>'.$order->total_shipping.'</montantlivraison>'."\n";
@@ -175,21 +161,21 @@ class Secuvad_flux
if (!empty($card_number))
{
$cc_array = preg_split('/([X0-9]{4})/Ui', strtoupper($card_number), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
if (sizeof($cc_array))
{
$bin_array = array();
foreach ($cc_array as $element)
$bin_array[] = str_replace('X', '', $element);
$card_number = str_replace('X', '', $card_number); // 16 char
$bin = $bin_array[0].'-'.$bin_array[1]; // 6 char
$bin4 = $bin_array[0]; // 4 char
$bin42 = $bin_array[0].'-'.$bin_array[3]; // 6 char
if (strlen($bin42) != 7 AND strlen($bin4) != 4 AND strlen($bin) != 7 AND strlen($card_number) != 16)
return false;
$flux_xml .= '<CB datevalidite="'.$card_expiration.'" '.(strlen($card_number) == 16 ? 'numcb="'.$card_number.'"' : '').' '.(strlen($bin) == 7 ? 'bin="'.$bin.'"' : '').' '.(strlen($bin4) == 4 ? 'bin4="'.$bin4.'"' : '').' '.(strlen($bin42) == 7 ? 'bin42="'.$bin42.'"' : '').'></CB>'."\n";
}
else
@@ -198,13 +184,13 @@ class Secuvad_flux
else
return false;
}
$flux_xml .= '</paiementtype>'."\n";
$flux_xml .= '</paiementtype>'."\n";
$flux_xml .= '</paiement>'."\n";
$flux_xml .= '</transaction>'."\n";
return $flux_xml;
}
private function get_flux_xml_products()
{
$flux_xml = '';
@@ -213,11 +199,11 @@ class Secuvad_flux
foreach($products as $product)
{
$data = Db::getInstance()->getRow('
SELECT sac.`category_id`, pl.`name`
FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac
SELECT sac.`category_id`, pl.`name`
FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac
JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`)
JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').')
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').')
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE pl.`id_product` = '.(int)($product['product_id']).'
ORDER BY c.`level_depth` DESC
@@ -227,7 +213,7 @@ class Secuvad_flux
$flux_xml = '<caddie nbproduit="'.sizeof($products).'">'."\n".$flux_xml.'</caddie>'."\n";
return $flux_xml;
}
}
+30 -34
View File
@@ -144,29 +144,29 @@ class Socolissimo extends CarrierModule
//add carrier in back office
if(!$this->createSoColissimoCarrier($this->_config))
return false;
return true;
}
public function uninstall()
{
$so_id = (int)Configuration::get('SOCOLISSIMO_CARRIER_ID');
if (!parent::uninstall()
if (!parent::uninstall()
OR !Db::getInstance()->Execute('DROP TABLE IF EXISTS`'._DB_PREFIX_.'socolissimo_delivery_info`')
OR !$this->unregisterHook('extraCarrier')
OR !$this->unregisterHook('payment')
OR !$this->unregisterHook('extraCarrier')
OR !$this->unregisterHook('payment')
OR !$this->unregisterHook('AdminOrder')
OR !$this->unregisterHook('newOrder')
OR !$this->unregisterHook('newOrder')
OR !$this->unregisterHook('updateCarrier')
OR !Configuration::deleteByName('SOCOLISSIMO_ID')
OR !Configuration::deleteByName('SOCOLISSIMO_KEY')
OR !Configuration::deleteByName('SOCOLISSIMO_ID')
OR !Configuration::deleteByName('SOCOLISSIMO_KEY')
OR !Configuration::deleteByName('SOCOLISSIMO_URL')
OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST')
OR !Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME')
OR !Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID')
OR !Configuration::deleteByName('SOCOLISSIMO_SUP')
OR !Configuration::deleteByName('SOCOLISSIMO_SUP_URL')
OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST')
OR !Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME')
OR !Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID')
OR !Configuration::deleteByName('SOCOLISSIMO_SUP')
OR !Configuration::deleteByName('SOCOLISSIMO_SUP_URL')
OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST_TAX'))
return false;
@@ -194,7 +194,7 @@ class Socolissimo extends CarrierModule
$this->_html .= '<h2>' . $this->l('So Colissimo').'</h2>';
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
$this->_html .= '<div class="alert error"><img src="'._PS_IMG_.'admin/forbbiden.gif" alt="nok" />&nbsp;'.$this->l('So Colissimo isn\'t compliant with One Page Checkout feature, in order to use this module, please activate the standard order process (Preferences > "Order process type")').'</div>';
if (!empty($_POST) AND Tools::isSubmit('submitSave'))
{
$this->_postValidation();
@@ -231,7 +231,7 @@ class Socolissimo extends CarrierModule
<div class="margin-form">
<p style="width:500px">'.$this->l('To open your SoColissimo account, please contact "La Poste" at this phone number: 3634 (French phone number).').'</p>
</div>
<label>'.$this->l('ID So').' : </label>
<div class="margin-form">
<input type="text" name="id_user" value="'.Tools::getValue('id_user', Configuration::get('SOCOLISSIMO_ID')).'" />
@@ -243,14 +243,14 @@ class Socolissimo extends CarrierModule
<input type="text" name="key" value="'.Tools::getValue('key', Configuration::get('SOCOLISSIMO_KEY')).'" />
<p>'.$this->l('Secure key for back office SoColissimo.').'</p>
</div>
<label>'.$this->l('Preparation time').' : </label>
<div class="margin-form">
<input type="text" size="5" name="dypreparationtime" value="'.(int)(Tools::getValue('dypreparationtime',Configuration::get('SOCOLISSIMO_PREPARATION_TIME'))).'" /> '.$this->l('Day(s)').'
<p>' . $this->l('Average time of preparation of materials.') . ' <br><span style="color:red">'
.$this->l('Average time must be the same in Coliposte back office.').'</span></p>
</div>
<label>'.$this->l('Overcost').' : </label>
<div class="margin-form">
<input size="11" type="text" size="5" name="overcost" onkeyup="this.value = this.value.replace(/,/g, \'.\');"
@@ -327,10 +327,10 @@ class Socolissimo extends CarrierModule
private function _postProcess()
{
if (Configuration::updateValue('SOCOLISSIMO_ID', Tools::getValue('id_user'))
AND Configuration::updateValue('SOCOLISSIMO_KEY', Tools::getValue('key'))
AND Configuration::updateValue('SOCOLISSIMO_URL', pSQL(Tools::getValue('url_so')))
AND Configuration::updateValue('SOCOLISSIMO_PREPARATION_TIME', (int)(Tools::getValue('dypreparationtime')))
if (Configuration::updateValue('SOCOLISSIMO_ID', Tools::getValue('id_user'))
AND Configuration::updateValue('SOCOLISSIMO_KEY', Tools::getValue('key'))
AND Configuration::updateValue('SOCOLISSIMO_URL', pSQL(Tools::getValue('url_so')))
AND Configuration::updateValue('SOCOLISSIMO_PREPARATION_TIME', (int)(Tools::getValue('dypreparationtime')))
AND Configuration::updateValue('SOCOLISSIMO_OVERCOST', (float)(Tools::getValue('overcost')))
AND Configuration::updateValue('SOCOLISSIMO_SUP_URL', Tools::getValue('url_sup'))
AND Configuration::updateValue('SOCOLISSIMO_OVERCOST_TAX', Tools::getValue('id_tax_rules_group'))
@@ -352,11 +352,7 @@ class Socolissimo extends CarrierModule
public function hookExtraCarrier($params)
{
$customer = new Customer($params['address']->id_customer);
$gender = array('1'=>'MR','2'=>'MME');
if (in_array((int)($customer->id_gender),array(1,2)))
$cecivility = $gender[(int)($customer->id_gender)];
else
$cecivility = 'MR';
$gender = new Gender($customer->id_gender);
$carrierSo = new Carrier((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')));
if (isset($carrierSo) AND $carrierSo->active)
@@ -371,7 +367,7 @@ class Socolissimo extends CarrierModule
'ORDERID' => $orderId,
'CENAME' => substr($this->lower($params['address']->lastname),0, 34),
'TRCLIENTNUMBER' => $this->upper((int)($params['address']->id_customer)),
'CECIVILITY' => $cecivility,
'CECIVILITY' => $gender->name,
'CEFIRSTNAME' => substr($this->lower($params['address']->firstname),0,29),
'CECOMPANYNAME' => substr($this->upper($params['address']->company),0,38),
'CEEMAIL' => $params['cookie']->email,
@@ -387,7 +383,7 @@ class Socolissimo extends CarrierModule
'DYPREPARATIONTIME' => (int)(Configuration::Get('SOCOLISSIMO_PREPARATION_TIME')),
'TRRETURNURLKO' => htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'),
'TRRETURNURLOK' => htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'));
$serialsInput = '';
foreach($inputs as $key => $val)
$serialsInput .= '&'.$key.'='.$val;
@@ -406,10 +402,10 @@ class Socolissimo extends CarrierModule
$this->context->smarty->assign('already_select_delivery', true);
else
$this->context->smarty->assign('already_select_delivery', false);
if (($country->iso_code == 'FR') AND (Configuration::Get('SOCOLISSIMO_ID') != NULL)
if (($country->iso_code == 'FR') AND (Configuration::Get('SOCOLISSIMO_ID') != NULL)
AND (Configuration::get('SOCOLISSIMO_KEY') != NULL) AND $this->checkAvailibility()
AND $this->checkSoCarrierAvailable((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')))
AND $this->checkSoCarrierAvailable((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')))
AND in_array((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')),$ids))
{
return $this->display(__FILE__, 'socolissimo_carrier.tpl');
@@ -745,7 +741,7 @@ class Socolissimo extends CarrierModule
}
return true;
}
public function getOrderShippingCost($params,$shipping_cost)
{
$deliveryInfo = $this->getDeliveryInfos($this->context->cart->id, $this->context->cart->id_customer);
@@ -753,8 +749,8 @@ class Socolissimo extends CarrierModule
if ($deliveryInfo['delivery_mode'] == 'RDV')
$shipping_cost += (float)(Configuration::get('SOCOLISSIMO_OVERCOST'));
return $shipping_cost;
}
}
public function getOrderShippingCostExternal($params){}
}
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -69,9 +69,9 @@ class StatsPersonalInfos extends ModuleGraph
$this->csvExport(array('type' => 'pie', 'option' => 'currency'));
elseif (Tools::getValue('exportType') =='language')
$this->csvExport(array('type' => 'pie', 'option' => 'language'));
$this->_html .= '
<center><p><img src="../img/admin/down.gif" />'.$this->l('Gender distribution allows you to determine the percentage of men and women among your customers.').'</p>
'.$this->engine(array('type' => 'pie', 'option' => 'gender')).'<br /></center>
<p><a href="'.$_SERVER['REQUEST_URI'].'&export=1&exportType=gender"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>
@@ -124,27 +124,43 @@ class StatsPersonalInfos extends ModuleGraph
{
case 'gender':
$this->_titles['main'] = $this->l('Gender distribution');
$sql = 'SELECT `id_gender`, COUNT(`id_customer`) AS total
FROM `'._DB_PREFIX_.'customer`
$genders = array(
0 => $this->l('Male'),
1 => $this->l('Female'),
2 => $this->l('Unknown'),
);
$sql = 'SELECT g.type, c.id_gender, COUNT(c.id_customer) AS total
FROM '._DB_PREFIX_.'customer c
LEFT JOIN '._DB_PREFIX_.'gender g ON c.id_gender = g.id_gender
WHERE 1
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
GROUP BY `id_gender`';
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER, 'c').'
GROUP BY c.id_gender';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
$gender = array(1 => $this->l('Male'), 2 => $this->l('Female'), 9 => $this->l('Unknown'), 0 => $this->l('Unknown'));
$gendersResults = array();
foreach ($result as $row)
{
$this->_values[] = $row['total'];
$this->_legend[] = $gender[$row['id_gender']];
$type = (is_null($row['type'])) ? 2 : $row['type'];
if (!isset($gendersResults[$type]))
$gendersResults[$type] = 0;
$gendersResults[$type] += $row['total'];
}
foreach ($gendersResults as $type => $total)
{
$this->_values[] = $total;
$this->_legend[] = $genders[$type];
}
break;
case 'age':
$this->_titles['main'] = $this->l('Age ranges');
// 0 - 18 years
$sql = 'SELECT COUNT(`id_customer`) as total
FROM `'._DB_PREFIX_.'customer`
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 18
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 18
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
AND `birthday` IS NOT NULL';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
@@ -153,7 +169,7 @@ class StatsPersonalInfos extends ModuleGraph
$this->_values[] = $result['total'];
$this->_legend[] = $this->l('0-18 years old');
}
// 18 - 24 years
$sql = 'SELECT COUNT(`id_customer`) as total
FROM `'._DB_PREFIX_.'customer`
@@ -195,7 +211,7 @@ class StatsPersonalInfos extends ModuleGraph
$this->_values[] = $result['total'];
$this->_legend[] = $this->l('35-49 years old');
}
// 50 - 59 years
$sql = 'SELECT COUNT(`id_customer`) as total
FROM `'._DB_PREFIX_.'customer`
@@ -209,7 +225,7 @@ class StatsPersonalInfos extends ModuleGraph
$this->_values[] = $result['total'];
$this->_legend[] = $this->l('50-59 years old');
}
// More than 60 years
$sql = 'SELECT COUNT(`id_customer`) as total
FROM `'._DB_PREFIX_.'customer`
@@ -222,7 +238,7 @@ class StatsPersonalInfos extends ModuleGraph
$this->_values[] = $result['total'];
$this->_legend[] = $this->l('60 years old and more');
}
// Total unknown
$sql = 'SELECT COUNT(`id_customer`) as total
FROM `'._DB_PREFIX_.'customer`