[+] 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
+57 -37
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -37,7 +37,7 @@ class AdminCustomers extends AdminTab
$this->delete = true;
$this->deleted = true;
$this->requiredDatabase = true;
$this->_select = '(YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5)<RIGHT(`birthday`, 5)) as age, (
SELECT c.date_add FROM '._DB_PREFIX_.'guest g
LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
@@ -45,10 +45,27 @@ class AdminCustomers extends AdminTab
ORDER BY c.date_add DESC
LIMIT 1
) as connect';
$genders = array(1 => $this->l('M'), 2 => $this->l('F'), 9 => $this->l('?'));
$genders_icon = array('default' => 'unknown.gif');
$genders = array(0 => $this->l('?'));
foreach (Gender::getGenders() as $gender)
{
$genders_icon[$gender['id_gender']] = '../genders/'.$gender['id_gender'].'.jpg';
$genders[$gender['id_gender']] = $gender['name'];
}
$this->fieldsDisplay = array(
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'),
'id_gender' => array(
'title' => $this->l('Gender'),
'width' => 30,
'align' => 'center',
'icon' => $genders_icon,
'orderby' => false,
'type' => 'select',
'select' => $genders,
'filter_key' => 'a!id_gender',
),
'lastname' => array('title' => $this->l('Last Name'), 'width' => 80),
'firstname' => array('title' => $this->l('First name'), 'width' => 60),
'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19),
@@ -74,7 +91,7 @@ class AdminCustomers extends AdminTab
parent::__construct();
}
public function postProcess()
{
if (Tools::isSubmit('submitDel'.$this->table) OR Tools::isSubmit('delete'.$this->table))
@@ -102,11 +119,11 @@ class AdminCustomers extends AdminTab
</form>
<div class="clear">&nbsp;</div>';
}
if (Tools::getValue('submitAdd'.$this->table))
{
$groupList = Tools::getValue('groupBox');
/* Checking fields validity */
$this->validateRules();
if (!sizeof($this->_errors))
@@ -122,7 +139,7 @@ class AdminCustomers extends AdminTab
if (Validate::isLoadedObject($object))
{
$customer_email = strval(Tools::getValue('email'));
// check if e-mail already used
if ($customer_email != $object->email)
{
@@ -131,13 +148,13 @@ class AdminCustomers extends AdminTab
if ($customer->id)
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
}
if (!is_array($groupList) OR sizeof($groupList) == 0)
$this->_errors[] = Tools::displayError('Customer must be in at least one group.');
else
if (!in_array(Tools::getValue('id_default_group'), $groupList))
$this->_errors[] = Tools::displayError('Default customer group must be selected in group box.');
// Updating customer's group
if (!sizeof($this->_errors))
{
@@ -248,7 +265,7 @@ class AdminCustomers extends AdminTab
$update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
if (!$update)
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}elseif (Tools::isSubmit('changeOptinVal') AND Tools::getValue('id_customer'))
{
@@ -261,7 +278,7 @@ class AdminCustomers extends AdminTab
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}
return parent::postProcess();
}
@@ -288,10 +305,12 @@ class AdminCustomers extends AdminTab
else
$countBetterCustomers = '-';
$gender = new Gender($customer->id_gender);
echo '
<fieldset style="width:400px;float: left"><div style="float: right"><a href="'.self::$currentIndex.'&addcustomer&id_customer='.$customer->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a></div>
<span style="font-weight: bold; font-size: 14px;">'.$customer->firstname.' '.$customer->lastname.'</span>
<img src="../img/admin/'.($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')).'.gif" style="margin-bottom: 5px" /><br />
<img src="'.$gender->getImage().'" style="margin-bottom: 5px" /><br />
<a href="mailto:'.$customer->email.'" style="text-decoration: underline; color: blue">'.$customer->email.'</a><br /><br />
'.$this->l('ID:').' '.sprintf('%06d', $customer->id).'<br />
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, $this->context->language->id, true).'<br />
@@ -331,7 +350,7 @@ class AdminCustomers extends AdminTab
echo '
</fieldset>
<div class="clear">&nbsp;</div>';
echo '<fieldset style="height:190px"><legend><img src="../img/admin/cms.gif" /> '.$this->l('Add a private note').'</legend>
<p>'.$this->l('This note will be displayed to all the employees but not to the customer.').'</p>
<form action="ajax.php" method="post" onsubmit="saveCustomerNote();return false;" id="customer_note">
@@ -361,8 +380,8 @@ class AdminCustomers extends AdminTab
});
}
</script>';
echo '<h2>'.$this->l('Messages').' ('.sizeof($messages).')</h2>';
if (sizeof($messages))
{
@@ -476,7 +495,7 @@ class AdminCustomers extends AdminTab
}
else
echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has not placed any orders yet');
if ($products AND sizeof($products))
{
echo '<div class="clear">&nbsp;</div>
@@ -572,7 +591,7 @@ class AdminCustomers extends AdminTab
else
echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has no discount vouchers').'.';
echo '<div class="clear">&nbsp;</div>';
echo '<div style="float:left">
<h2>'.$this->l('Carts').' ('.sizeof($carts).')</h2>';
if ($carts AND sizeof($carts))
@@ -608,14 +627,14 @@ class AdminCustomers extends AdminTab
else
echo $this->l('No cart available').'.';
echo '</div>';
$sql = 'SELECT DISTINCT id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
FROM '._DB_PREFIX_.'cart_product cp
FROM '._DB_PREFIX_.'cart_product cp
JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart)
WHERE c.id_customer = '.(int)$customer->id.'
WHERE c.id_customer = '.(int)$customer->id.'
AND cp.id_product NOT IN (
SELECT product_id
FROM '._DB_PREFIX_.'orders o
SELECT product_id
FROM '._DB_PREFIX_.'orders o
JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order)
WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.'
)';
@@ -638,12 +657,12 @@ class AdminCustomers extends AdminTab
}
echo '</table></div>';
}
echo '<div class="clear">&nbsp;</div>';
/* Last connections */
$connections = $customer->getLastConnections();
if (sizeof($connections))
if (sizeof($connections))
{
echo '<h2>'.$this->l('Last connections').'</h2>
<table cellspacing="0" cellpadding="0" class="table">
@@ -665,7 +684,7 @@ class AdminCustomers extends AdminTab
echo '</table><div class="clear">&nbsp;</div>';
}
if (sizeof($referrers))
if (sizeof($referrers))
{
echo '<h2>'.$this->l('Referrers').'</h2>
<table cellspacing="0" cellpadding="0" class="table">
@@ -688,26 +707,27 @@ class AdminCustomers extends AdminTab
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$birthday = explode('-', $this->getFieldValue($obj, 'birthday'));
$customer_groups = Tools::getValue('groupBox', $obj->getGroups());
$groups = Group::getGroups($this->_defaultFormLanguage, true);
echo '
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" autocomplete="off">
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
<fieldset><legend><img src="../img/admin/tab-customers.gif" />'.$this->l('Customer').'</legend>
<label>'.$this->l('Gender:').' </label>
<div class="margin-form">
<input type="radio" size="33" name="id_gender" id="gender_1" value="1" '.($this->getFieldValue($obj, 'id_gender') == 1 ? 'checked="checked" ' : '').'/>
<label class="t" for="gender_1"> '.$this->l('Male').'</label>
<input type="radio" size="33" name="id_gender" id="gender_2" value="2" '.($this->getFieldValue($obj, 'id_gender') == 2 ? 'checked="checked" ' : '').'/>
<label class="t" for="gender_2"> '.$this->l('Female').'</label>
<input type="radio" size="33" name="id_gender" id="gender_3" value="9" '.(($this->getFieldValue($obj, 'id_gender') == 9 OR !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/>
<label class="t" for="gender_3"> '.$this->l('Unknown').'</label>
<div class="margin-form">';
foreach (Gender::getGenders() as $gender)
{
echo '<input type="radio" size="33" name="id_gender" id="gender_'.$gender['id_gender'].'" value="'.$gender['id_gender'].'" '.($this->getFieldValue($obj, 'id_gender') == $gender['id_gender'] ? 'checked="checked" ' : '').'/>';
echo '<label class="t" for="gender_'.$gender['id_gender'].'"> '.$gender['name'].'</label> &nbsp; ';
}
echo ' <input type="radio" size="33" name="id_gender" id="gender_unknown" value="0" '.(($this->getFieldValue($obj, 'id_gender') == 9 || !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/>
<label class="t" for="gender_unknown"> '.$this->l('Unknown').'</label>
</div>
<label>'.$this->l('Last name:').' </label>
<div class="margin-form">
@@ -854,7 +874,7 @@ class AdminCustomers extends AdminTab
{
return parent::getList(Context::getContext()->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
}
public function beforeDelete($object)
{
return $object->isUsed();
+109
View File
@@ -0,0 +1,109 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminGenders extends AdminTab
{
public function __construct()
{
$this->table = 'gender';
$this->className = 'Gender';
$this->lang = true;
$this->edit = true;
$this->delete = true;
$this->fieldImageSettings = array('name' => 'image', 'dir' => 'genders');
$this->fieldsDisplay = array(
'id_gender' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 150, 'filter_key' => 'b!name'),
'type' => array(
'title' => $this->l('Type'),
'width' => 100,
'orderby' => false,
'type' => 'select',
'select' => array(0 => $this->l('Male'), 1 => $this->l('Female')),
'filter_key' => 'a!type',
'callback' => 'displayGenderType',
'callback_object' => $this,
),
'image' => array('title' => $this->l('Image'), 'align' => 'center', 'image' => 'genders', 'orderby' => false, 'search' => false),
);
parent::__construct();
}
public function displayGenderType($value, $tr)
{
return $this->fieldsDisplay['type']['select'][$value];
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
echo '
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
<fieldset><legend><img src="../img/admin/tab-genders.gif" />'.$this->l('Gender').'</legend>
<label>'.$this->l('Name:').' </label>
<div class="margin-form">';
foreach ($this->_languages as $language)
echo '
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"{}_$%:<span class="hint-pointer">&nbsp;</span></span>
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
echo '</div><div class="clear">&nbsp;</div>';
echo '<label>'.$this->l('Type:').' </label>
<div class="margin-form">
<input type="radio" name="type" id="type_male" value="0" '.($this->getFieldValue($obj, 'type') == 0 ? 'checked="checked" ' : '').'/>
<label class="t" for="type_male"> '.$this->l('Male').'</label>
<input type="radio" name="type" id="type_female" value="1" '.($this->getFieldValue($obj, 'type') == 1 ? 'checked="checked" ' : '').'/>
<label class="t" for="type_female"> '.$this->l('Female').'</label>
</div>
<div class="clear"></div>';
echo '<label>'.$this->l('Image:').' </label>
<div class="margin-form">';
echo ' <input type="file" name="image" /> ';
if ($obj->getImage())
echo '<img src="'.$obj->getImage().'" />';
echo '</div>
<div class="clear"></div>';
echo '<div class="margin-form">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
</div>
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
</fieldset>
</form><br />';
}
}
+22 -23
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -35,12 +35,12 @@ class AdminGroups extends AdminTab
$this->edit = true;
$this->view = true;
$this->delete = true;
$this->_select = '
(SELECT COUNT(jcg.`id_customer`)
FROM `'._DB_PREFIX_.'customer_group` jcg
LEFT JOIN `'._DB_PREFIX_.'customer` jc ON (jc.`id_customer` = jcg.`id_customer`)
WHERE jc.`deleted` != 1
FROM `'._DB_PREFIX_.'customer_group` jcg
LEFT JOIN `'._DB_PREFIX_.'customer` jc ON (jc.`id_customer` = jcg.`id_customer`)
WHERE jc.`deleted` != 1
AND jcg.`id_group` = a.`id_group`) AS nb
';
$this->_listSkipDelete = array(1);
@@ -58,7 +58,7 @@ class AdminGroups extends AdminTab
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, $this->context->language->id) : array();
@@ -93,7 +93,7 @@ class AdminGroups extends AdminTab
<div class="margin-form">';
if ($groupReductions)
{
echo '
<table>
<tr>
@@ -168,11 +168,11 @@ class AdminGroups extends AdminTab
public function viewgroup()
{
$this->context = Context::getContext();
$this->context = Context::getContext();
self::$currentIndex = 'index.php?tab=AdminGroups';
if (!($obj = $this->loadObject(true)))
return;
echo '
<fieldset style="width: 400px">
<div style="float: right"><a href="'.self::$currentIndex.'&updategroup&id_group='.$obj->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a></div>
@@ -197,50 +197,50 @@ class AdminGroups extends AdminTab
if ($nbCustomers = $obj->getCustomers(true))
{
echo '<h2>'.$this->l('Customer members of this group').' ('.$nbCustomers.')</h2>';
// Pagination Begin
$customersPerPage = (Tools::getValue('customerPerPage') ? (int)Tools::getValue('customerPerPage') : 50);
$customersPerPage = (Tools::getValue('customerPerPage') ? (int)Tools::getValue('customerPerPage') : 50);
$totalPages = ceil($nbCustomers / $customersPerPage);
$perPageOptions = array(20, 50, 100, 300);
$customerPageIndex = (Tools::getValue('customerPageIndex') && Tools::getValue('customerPageIndex') <= $totalPages ? (int)Tools::getValue('customerPageIndex') : 1);
$from = (Tools::getValue('customerPageIndex') ? ((int)$customerPageIndex - 1) * ((int)$customersPerPage) : 0);
$customers = $obj->getCustomers(false, $from, $customersPerPage);
echo '<table><tr>
<form method="post" action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'">
<td style="vertical-align: bottom;"><span style="float: left; height:30px">';
if ($customerPageIndex > 1)
{
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value=1" src="../img/admin/list-prev2.gif">&nbsp';
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.($customerPageIndex-1).'" src="../img/admin/list-prev.gif">&nbsp';
}
echo 'Page <b><select onChange="submit()" name="customerPageIndex" id="customerPageIndex">';
for ($i=1; $i <= $totalPages; $i++)
echo '<option value="'.$i.'"'.((int)$customerPageIndex === $i ? 'selected="selected"' : '').'>'.$i.'</option>';
echo '</select></b> / '.$totalPages;
if ($customerPageIndex < $totalPages)
{
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.((int)$customerPageIndex+1).'" src="../img/admin/list-next.gif">';
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.$totalPages.'" src="../img/admin/list-next2.gif">';
}
echo ' | Display
<select onchange="document.getElementById(\'customerPageIndex\').value=1; submit();" name="customerPerPage">';
foreach ($perPageOptions as $option)
echo '<option value="'.$option.'"'.((int)$customersPerPage == $option ? 'selected="selected"' : '').'>'.$option.'</option>';
echo ' </select> / '.$nbCustomers.' result(s)
echo ' </select> / '.$nbCustomers.' result(s)
</span><span class="clear"></span></td>
</form>
</tr>
</table>
<div class="clear"></div>';
// Pagination End
echo '<table cellspacing="0" cellpadding="0" class="table widthfull">
<tr>';
foreach ($this->fieldsDisplay AS $field)
@@ -248,14 +248,13 @@ class AdminGroups extends AdminTab
echo '
</tr>';
$irow = 0;
foreach ($customers AS $k => $customer)
{
$imgGender = $customer['id_gender'] == 1 ? '<img src="../img/admin/male.gif" alt="'.$this->l('Male').'" />' : ($customer['id_gender'] == 2 ? '<img src="../img/admin/female.gif" alt="'.$this->l('Female').'" />' : '');
echo '
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
<td>'.$customer['id_customer'].'</td>
<td class="center">'.$imgGender.'</td>
<td class="center"><img src="'.Gender::getStaticImage($customer['id_gender']).'" /></td>
<td>'.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).'</td>
<td>'.stripslashes($customer['email']).'<a href="mailto:'.stripslashes($customer['email']).'"> <img src="../img/admin/email_edit.gif" alt="'.$this->l('Write to this customer').'" /></a></td>
<td>'.Tools::displayDate($customer['birthday'], $this->context->language->id).'</td>
+22 -22
View File
@@ -82,7 +82,7 @@ class AdminImport extends AdminTab
case $this->entities[$this->l('Combinations')]:
self::$required_fields = array('id_product', 'options');
$this->available_fields = array(
'no' => array('label' => $this->l('Ignore this column')),
'no' => array('label' => $this->l('Ignore this column')),
'id_product' => array('label' => $this->l('Product ID').'*'),
'options' => array('label' => $this->l('Options (Group:Value)').'*'),
'reference' => array('label' => $this->l('Reference')),
@@ -95,7 +95,7 @@ class AdminImport extends AdminTab
'quantity' => array('label' => $this->l('Quantity')),
'weight' => array('label' => $this->l('Weight')),
'default_on' => array('label' => $this->l('Default')),
'image_position' => array('label' => $this->l('Image position'),
'image_position' => array('label' => $this->l('Image position'),
'help' => $this->l('Position of the product image to use for this combination. If you use this field, leave image URL empty.')),
'image_url' => array('label' => $this->l('Image URL')),
);
@@ -180,7 +180,7 @@ class AdminImport extends AdminTab
'online_only' => array('label' => $this->l('Only available online')),
'condition' => array('label' => $this->l('Condition')),
'shop' => array(
'label' => $this->l('ID / Name of shop'),
'label' => $this->l('ID / Name of shop'),
'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'),
),
);
@@ -210,7 +210,7 @@ class AdminImport extends AdminTab
'no' => array('label' => $this->l('Ignore this column')),
'id' => array('label' => $this->l('ID')),
'active' => array('label' => $this->l('Active (0/1)')),
'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 9)')),
'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 0)')),
'email' => array('label' => $this->l('E-mail *')),
'passwd' => array('label' => $this->l('Password *')),
'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')),
@@ -219,7 +219,7 @@ class AdminImport extends AdminTab
'newsletter' => array('label' => $this->l('Newsletter (0/1)')),
'optin' => array('label' => $this->l('Opt in (0/1)')),
'id_shop' => array(
'label' => $this->l('ID / Name of shop'),
'label' => $this->l('ID / Name of shop'),
'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'),
),
);
@@ -282,11 +282,11 @@ class AdminImport extends AdminTab
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
'meta_description' => array('label' => $this->l('Meta-description')),
'shop' => array(
'label' => $this->l('ID / Name of group shop'),
'label' => $this->l('ID / Name of group shop'),
'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'),
),
);
self::$default_values = array(
'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')),
);
@@ -446,11 +446,11 @@ class AdminImport extends AdminTab
/**
* copyImg copy an image located in $url and save it in a path
* according to $entity->$id_entity .
* according to $entity->$id_entity .
* $id_image is used if we need to add a watermark
*
*
* @param int $id_entity id of product or category (set in entity)
* @param int $id_image (default null) id of the image if watermark enabled.
* @param int $id_image (default null) id of the image if watermark enabled.
* @param string $url path or url to use
* @param string entity 'products' or 'categories'
* @return void
@@ -798,7 +798,7 @@ class AdminImport extends AdminTab
}
$product->associateTo($shops);
}
// SpecificPrice (only the basic reduction feature is supported by the import)
if ((isset($info['reduction_price']) AND $info['reduction_price'] > 0) OR (isset($info['reduction_percent']) AND $info['reduction_percent'] > 0))
{
@@ -863,7 +863,7 @@ class AdminImport extends AdminTab
$product->deleteImages();
elseif (isset($product->image) AND is_array($product->image) AND sizeof($product->image))
$product->deleteImages();
if (isset($product->image) AND is_array($product->image) and sizeof($product->image))
{
$productHasImages = (bool)Image::getImages($this->context->language->id, (int)($product->id));
@@ -926,10 +926,10 @@ class AdminImport extends AdminTab
$info = array_map('trim', $info);
self::setDefaultValues($info);
$product = new Product((int)($info['id_product']), false, $defaultLanguage);
$id_image = null;
if (isset($info['image_url']) && $info['image_url'])
{
$productHasImages = (bool)Image::getImages($this->context->language->id, $product->id);
@@ -1035,7 +1035,7 @@ class AdminImport extends AdminTab
if (($fieldError = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
{
$customer->id_group_shop = Shop::getGroupFromShop($customer->id_shop);
if ($customer->id AND $customer->customerIdExists($customer->id))
$res = $customer->update();
if (!$res)
@@ -1125,7 +1125,7 @@ class AdminImport extends AdminTab
}
if(isset($address->customer_email) and !empty($address->customer_email))
{
{
if( Validate::isEmail($address->customer_email))
{
$customer = Customer::customerExists($address->customer_email, true);
@@ -1211,7 +1211,7 @@ class AdminImport extends AdminTab
$res = $manufacturer->update();
if (!$res)
$res = $manufacturer->add();
if ($res)
{
// Associate supplier to group shop
@@ -1450,7 +1450,7 @@ class AdminImport extends AdminTab
$("label[for=match_ref],#match_ref").show();
}
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",
{
getAvailableFields:1,
entity: $("#entity").val()},
@@ -1478,7 +1478,7 @@ class AdminImport extends AdminTab
$array[$key] = utf8_encode($value);
else
$array = utf8_encode($array);
return $array;
}
@@ -1561,7 +1561,7 @@ class AdminImport extends AdminTab
public function displayCSV()
{
$importMatchs = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'import_match');
echo '
<script src="'._PS_JS_DIR_.'adminImport.js"></script>
<script type="text/javascript">
@@ -1579,7 +1579,7 @@ class AdminImport extends AdminTab
</select>
<a class="button" id="loadImportMatchs" href="#">'.$this->l('Load').'</a>
<a class="button" id="deleteImportMatchs" href="#">'.$this->l('Delete').'</a>';
echo '</div></div><h3>'.$this->l('Please set the value type of each column').'</h3>
<div id="error_duplicate_type" class="warning warn" style="display:none;">
<h3>'.$this->l('Columns cannot have the same value type').'</h3>
@@ -1744,7 +1744,7 @@ class AdminImport extends AdminTab
$this->_errors[] = Tools::displayError('No file was uploaded');
break;
break;
}
}
}
elseif (!file_exists($_FILES['file']['tmp_name']) OR !@move_uploaded_file($_FILES['file']['tmp_name'], dirname(__FILE__).'/../import/'.$_FILES['file']['name'].'.'.date('Ymdhis')))
$this->_errors[] = $this->l('an error occurred while uploading and copying file');
+15 -16
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -32,7 +32,7 @@ class AdminSearch extends AdminTab
{
if (!ip2long(trim($query)))
return;
$this->_list['customers'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT DISTINCT c.*
FROM `'._DB_PREFIX_.'customer` c
@@ -40,7 +40,7 @@ class AdminSearch extends AdminTab
LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.id_guest = co.id_guest
WHERE co.`ip_address` = \''.ip2long(trim($query)).'\'');
}
/**
* Search a specific string in the products and categories
*
@@ -48,7 +48,7 @@ class AdminSearch extends AdminTab
*/
public function searchCatalog($query)
{
$this->context = Context::getContext();
$this->context = Context::getContext();
$this->_list['products'] = Product::searchByName($this->context->language->id, $query);
if (!empty($this->_list['products']))
for ($i = 0; $i < count($this->_list['products']); $i++)
@@ -69,17 +69,17 @@ class AdminSearch extends AdminTab
function postProcess()
{
$this->context = Context::getContext();
$this->context = Context::getContext();
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
/* Handle empty search field */
if (empty($query))
$this->_errors[] = Tools::displayError('Please fill in search form first.');
else
{
echo '<h2>'.$this->l('Search results').'</h2>';
if (!$searchType and strlen($query) > 1)
{
global $_LANGADM;
@@ -101,7 +101,7 @@ class AdminSearch extends AdminTab
$matchingResults[$tabs[$key]] = array();
$matchingResults[$tabs[$key]][] = array('tab' => $key, 'value' => $value);
}
if (count($matchingResults))
{
arsort($matchingResults);
@@ -122,8 +122,8 @@ class AdminSearch extends AdminTab
echo '</table><div class="clear">&nbsp;</div>';
}
}
/* Product research */
if (!$searchType OR $searchType == 1)
{
@@ -184,7 +184,7 @@ class AdminSearch extends AdminTab
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
$this->_errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
/* Invoices */
if ($searchType == 4)
{
@@ -200,7 +200,7 @@ class AdminSearch extends AdminTab
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$this->context->employee->id));
$this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
/* IP */
// 6 - but it is included in the customer block
}
@@ -211,7 +211,7 @@ class AdminSearch extends AdminTab
self::$currentIndex = 'index.php';
$query = trim(Tools::getValue('bo_query'));
$nbCategories = $nbProducts = $nbCustomers = 0;
/* Display categories if any has been matching */
if (isset($this->_list['categories']) AND $nbCategories = sizeof($this->_list['categories']))
{
@@ -270,11 +270,10 @@ class AdminSearch extends AdminTab
$irow = 0;
foreach ($this->_list['customers'] AS $k => $customer)
{
$imgGender = $customer['id_gender'] == 1 ? '<img src="../img/admin/male.gif" alt="'.$this->l('Male').'" />' : ($customer['id_gender'] == 2 ? '<img src="../img/admin/female.gif" alt="'.$this->l('Female').'" />' : '');
echo '
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
<td>'.$customer['id_customer'].'</td>
<td class="center">'.$imgGender.'</td>
<td class="center"><img src="'.Gender::getStaticImage($customer['id_gender']).'" /></td>
<td>'.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).'</td>
<td>'.stripslashes($customer['email']).'<a href="mailto:'.stripslashes($customer['email']).'"> <img src="../img/admin/email_edit.gif" alt="'.$this->l('Write to this customer').'" /></a></td>
<td>'.Tools::displayDate($customer['birthday'], $this->context->language->id).'</td>
@@ -294,7 +293,7 @@ class AdminSearch extends AdminTab
echo '</table>
<div class="clear">&nbsp;</div>';
}
/* Display error if nothing has been matching */
if (!$nbCategories AND !$nbProducts AND !$nbCustomers)
echo '<h3>'.$this->l('Nothing found for').' "'.Tools::htmlentitiesUTF8($query).'"</h3>';
+2
View File
@@ -96,6 +96,8 @@
'FileUploader' => '',
'FrontControllerCore' => 'classes/FrontController.php',
'FrontController' => 'override/classes/FrontController.php',
'GenderCore' => 'classes/Gender.php',
'Gender' => '',
'GroupCore' => 'classes/Group.php',
'Group' => 'override/classes/Group.php',
'GroupReductionCore' => 'classes/GroupReduction.php',
+60 -60
View File
@@ -92,12 +92,12 @@ abstract class AdminTabCore
/** @var array Fields to display in list */
public $fieldsDisplay = array();
public $optionTitle = null;
/** @var string shop | group_shop */
public $shopLinkType;
/** @var bool */
public $shopShareDatas = false;
@@ -125,7 +125,7 @@ abstract class AdminTabCore
/** @var string Order way (ASC, DESC) determined by arrows in list header */
protected $_orderWay;
/** @var integer Max image size for upload
/** @var integer Max image size for upload
* As of 1.5 it is recommended to not set a limit to max image size
**/
protected $maxImageSize;
@@ -144,27 +144,27 @@ abstract class AdminTabCore
/** @var string specificConfirmDelete */
public $specificConfirmDelete = NULL;
public static $currentIndex;
public $smarty;
protected $identifiersDnd = array('id_product' => 'id_product', 'id_category' => 'id_category_to_move','id_cms_category' => 'id_cms_category_to_move', 'id_cms' => 'id_cms');
/** @var bool Redirect or not ater a creation */
protected $_redirect = true;
/** @var bool If false, don't add form tags in options forms */
protected $formOptions = true;
public $_fieldsOptions = array();
/**
* @since 1.5.0
* @var array
*/
public $optionsList = array();
/**
* @since 1.5.0
* @var Context
@@ -196,7 +196,7 @@ abstract class AdminTabCore
public function __construct()
{
$this->context = Context::getContext();
$this->id = Tab::getCurrentTabId();
$this->_conf = array(
1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
@@ -255,8 +255,8 @@ abstract class AdminTabCore
}
/**
* ajaxDisplay is the default ajax return sytem
*
* ajaxDisplay is the default ajax return sytem
*
* @return void
*/
public function displayAjax()
@@ -531,8 +531,8 @@ abstract class AdminTabCore
}
/**
* ajaxPreProcess is a method called in ajax-tab.php before displayConf().
*
* ajaxPreProcess is a method called in ajax-tab.php before displayConf().
*
* @return void
*/
public function ajaxPreProcess()
@@ -541,7 +541,7 @@ abstract class AdminTabCore
/**
* ajaxProcess is the default handle method for request with ajax-tab.php
*
*
* @return void
*/
public function ajaxProcess()
@@ -557,7 +557,7 @@ abstract class AdminTabCore
return false;
// set token
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
// Sub included tab postProcessing
$this->includeSubTab('postProcess', array('status', 'submitAdd1', 'submitDel', 'delete', 'submitFilter', 'submitReset'));
@@ -892,7 +892,7 @@ abstract class AdminTabCore
$type = 'group_shop';
else
return ;
$assos = array();
foreach ($_POST AS $k => $row)
{
@@ -923,7 +923,7 @@ abstract class AdminTabCore
foreach ($this->optionsList as $category => $categoryData)
{
$fields = $categoryData['fields'];
/* Check required fields */
foreach ($fields AS $field => $values)
if (isset($values['required']) AND $values['required'] && !isset($_POST['configUseDefault'][$field]))
@@ -935,7 +935,7 @@ abstract class AdminTabCore
}
elseif (($value = Tools::getValue($field)) == false AND (string)$value != '0')
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
/* Check fields validity */
foreach ($fields AS $field => $values)
if (isset($values['type']) AND $values['type'] == 'textLang')
@@ -948,7 +948,7 @@ abstract class AdminTabCore
elseif (Tools::getValue($field) AND isset($values['validation']))
if (!Validate::$values['validation'](Tools::getValue($field)))
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is invalid.');
/* Default value if null */
foreach ($fields AS $field => $values)
if (!Tools::getValue($field) AND isset($values['default']))
@@ -960,7 +960,7 @@ abstract class AdminTabCore
{
if (isset($options['visibility']) && $options['visibility'] > Context::getContext()->shop->getContextType())
continue;
if (Shop::isMultiShopActivated() && isset($_POST['configUseDefault'][$key]))
{
Configuration::deleteFromContext($key);
@@ -986,7 +986,7 @@ abstract class AdminTabCore
}
}
Configuration::updateValue($key, $list);
}
}
else
{
$val = (isset($options['cast']) ? $options['cast'](Tools::getValue($key)) : Tools::getValue($key));
@@ -1001,14 +1001,14 @@ abstract class AdminTabCore
}
}
}
if (count($this->_errors) <= 0)
Tools::redirectAdmin(self::$currentIndex.'&conf=6&token='.$token);
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
/**
* Can be overriden
*/
@@ -1027,10 +1027,10 @@ abstract class AdminTabCore
{
$this->_errors[] = Tools::displayError($field['title'].' : Incorrect value');
return false;
}
}
}
}
}
return true;
}
@@ -1044,7 +1044,7 @@ abstract class AdminTabCore
else
return false;
// Check image validity
$max_size = isset($this->maxImageSize) ? $this->maxImageSize : 0;
if ($error = checkImage($_FILES[$name], Tools::getMaxUploadSize($max_size)))
@@ -1279,7 +1279,7 @@ abstract class AdminTabCore
/* SQL table : orders, but class name is Order */
$sqlTable = $this->table == 'order' ? 'orders' : $this->table;
// Add SQL shop restriction
$selectShop = $joinShop = $whereShop = '';
if ($this->shopLinkType)
@@ -1313,7 +1313,7 @@ abstract class AdminTabCore
$this->_group = 'GROUP BY a.'.pSQL($this->identifier);
else if (!preg_match('#(\s|,)\s*a\.`?'.pSQL($this->identifier).'`?(\s|,|$)#', $this->_group))
$this->_group .= ', a.'.pSQL($this->identifier);
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_'.$filterKey).'`? *sa#', $this->_join))
$filterShop = 'JOIN `'._DB_PREFIX_.$this->table.'_'.$filterKey.'` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filterKey.' IN ('.implode(', ', $idenfierShop).'))';
}
@@ -1383,7 +1383,7 @@ abstract class AdminTabCore
echo '<form method="post" action="'.self::$currentIndex;
if(Tools::getIsset($this->identifier))
echo '&'.$this->identifier.'='.(int)(Tools::getValue($this->identifier));
echo '&token='.$token;
echo '&token='.$token;
if (Tools::getIsset($this->table.'Orderby'))
echo '&'.$this->table.'Orderby='.urlencode($this->_orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->_orderWay));
echo '#'.$this->table.'" class="form">
@@ -1656,13 +1656,13 @@ abstract class AdminTabCore
// item_id is the product id in a product image context, else it is the image id.
$item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
// If it's a product image
if (isset($tr['id_image']))
if (isset($tr['id_image']))
{
$image = new Image((int)$tr['id_image']);
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$image->getExistingImgPath().'.'.$this->imageType;
}else
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)($tr['id_image']) : '').'.'.$this->imageType;
echo cacheImage($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
}
elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default'])))
@@ -1684,7 +1684,7 @@ abstract class AdminTabCore
else
$echo = $tr[$key];
echo isset($params['callback']) ? call_user_func_array(array($this->className, $params['callback']), array($echo, $tr)) : $echo;
echo isset($params['callback']) ? call_user_func_array(array((isset($params['callback_object'])) ? $params['callback_object'] : $this->className, $params['callback']), array($echo, $tr)) : $echo;
}
else
echo '--';
@@ -1692,7 +1692,7 @@ abstract class AdminTabCore
echo (isset($params['suffix']) ? $params['suffix'] : '').
'</td>';
}
if ($this->shopLinkType)
{
$name = (Tools::strlen($tr['shop_name']) > 15) ? Tools::substr($tr['shop_name'], 0, 15).'...' : $tr['shop_name'];
@@ -1716,7 +1716,7 @@ abstract class AdminTabCore
}
}
}
protected function displayAddButton()
{
echo '<br /><a href="'.self::$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add new').'</a><br /><br />';
@@ -1826,7 +1826,7 @@ abstract class AdminTabCore
$legend = '<img src="'.(!empty($tab['module']) && file_exists($_SERVER['DOCUMENT_ROOT']._MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif') ? _MODULE_DIR_.$tab['module'].'/' : '../img/t/').$tab['class_name'].'.gif" /> ';
$legend .= ((isset($categoryData['title'])) ? $categoryData['title'] : $this->l('Options'));
echo '<legend>'.$legend.'</legend>';
// Category fields
if (!isset($categoryData['fields']))
continue;
@@ -1841,10 +1841,10 @@ abstract class AdminTabCore
$value = Tools::getValue($key, Configuration::get($key));
if (!Validate::isCleanHtml($value))
$value = Configuration::get($key);
if (isset($field['defaultValue']) && !$value)
$value = $field['defaultValue'];
// Check if var is invisible (can't edit it in current shop context), or disable (use default value for multishop)
$isDisabled = $isInvisible = false;
if (Shop::isMultiShopActivated())
@@ -1889,14 +1889,14 @@ abstract class AdminTabCore
<input type="checkbox" name="configUseDefault['.$key.']" value="1" '.(($isDisabled) ? 'checked="checked"' : '').' onclick="checkMultishopDefaultValue(this, \''.$key.'\')" /> '.$this->l('Use default value').'
</label>
</div>';
// Field description
//echo (isset($field['desc']) ? '<p class="preference_description">'.((isset($field['thumb']) AND $field['thumb'] AND $field['thumb']['pos'] == 'after') ? '<img src="'.$field['thumb']['file'].'" alt="'.$field['title'].'" title="'.$field['title'].'" style="float:left;" />' : '' ).$field['desc'].'</p>' : '');
echo (isset($field['desc']) ? '<p class="preference_description">'.$field['desc'].'</p>' : '');
// Is this field invisible in current shop context ?
echo ($isInvisible) ? '<p class="multishop_warning">'.$this->l('You can\'t change the value of this configuration field in this shop context').'</p>' : '';
echo '</div></div>';
}
@@ -1905,7 +1905,7 @@ abstract class AdminTabCore
echo '</div>';
if ($required)
echo '<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>';
echo '</fieldset><br />';
$this->displayBottomOptionCategory($category, $categoryData);
}
@@ -1936,7 +1936,7 @@ abstract class AdminTabCore
echo '<option value="'.(isset($option['cast']) ? $option['cast']($option[$field['identifier']]) : $option[$field['identifier']]).'"'.(($value == $option[$field['identifier']]) ? ' selected="selected"' : '').'>'.$option['name'].'</option>';
echo '</select>';
}
/**
* Type = bool
*/
@@ -1950,7 +1950,7 @@ abstract class AdminTabCore
echo '<input type="radio" name="'.$key.'" id="'.$key.'_off" value="0" '.(!$value ? ' checked="checked" ' : '').(isset($field['js']['off']) ? $field['js']['off'] : '').' />';
echo '<label class="t" for="'.$key.'_off"> '.$this->l('No').'</label>';
}
/**
* Type = radio
*/
@@ -1960,7 +1960,7 @@ abstract class AdminTabCore
echo '<input type="radio" name="'.$key.'" id="'.$key.$k.'_on" value="'.(int)$v.'"'.(($k == $value) ? ' checked="checked"' : '').(isset($field['js'][$k]) ? ' '.$field['js'][$k] : '').' /><label class="t" for="'.$key.$k.'_on"> '.$v.'</label><br />';
echo '<br />';
}
/**
* Type = text
*/
@@ -1968,7 +1968,7 @@ abstract class AdminTabCore
{
echo '<input type="'.$field['type'].'"'.(isset($field['id']) ? ' id="'.$field['id'].'"' : '').' size="'.(isset($field['size']) ? (int)$field['size'] : 5).'" name="'.$key.'" value="'.htmlentities($value, ENT_COMPAT, 'UTF-8').'" />'.(isset($field['next']) ? '&nbsp;'.(string)$field['next'] : '');
}
/**
* Type = password
*/
@@ -1976,7 +1976,7 @@ abstract class AdminTabCore
{
$this->displayOptionTypeText($key, $field, '');
}
/**
* Type = textarea
*/
@@ -1984,7 +1984,7 @@ abstract class AdminTabCore
{
echo '<textarea name='.$key.' cols="'.$field['cols'].'" rows="'.$field['rows'].'">'.htmlentities($value, ENT_COMPAT, 'UTF-8').'</textarea>';
}
/**
* Type = file
*/
@@ -1994,7 +1994,7 @@ abstract class AdminTabCore
echo '<img src="'.$field['thumb']['file'].'" alt="'.$field['title'].'" title="'.$field['title'].'" /><br />';
echo '<input type="file" name="'.$key.'" />';
}
/**
* Type = image
*/
@@ -2034,7 +2034,7 @@ abstract class AdminTabCore
echo '</tr>';
echo '</table>';
}
/**
* Type = textLang
*/
@@ -2050,7 +2050,7 @@ abstract class AdminTabCore
}
$this->displayFlags($languages, $this->context->language->id, $key, $key);
}
/**
* Type = TextareaLang
*/
@@ -2067,7 +2067,7 @@ abstract class AdminTabCore
$this->displayFlags($languages, $this->context->language->id, $key, $key);
echo '<br style="clear:both">';
}
/**
* Type = selectLang
*/
@@ -2085,7 +2085,7 @@ abstract class AdminTabCore
}
$this->displayFlags($languages, $this->context->language->id, $key, $key);
}
/**
* Type = price
*/
@@ -2095,7 +2095,7 @@ abstract class AdminTabCore
$this->displayOptionTypeText($key, $field, $value);
echo $this->context->currency->getSign('right').' '.$this->l('(tax excl.)');
}
/**
* Type = disabled
*/
@@ -2296,7 +2296,7 @@ abstract class AdminTabCore
return $this->fieldsDisplay[$filter];
return false;
}
protected function warnDomainName()
{
if ($_SERVER['HTTP_HOST'] != Configuration::get('PS_SHOP_DOMAIN') AND $_SERVER['HTTP_HOST'] != Configuration::get('PS_SHOP_DOMAIN_SSL'))
@@ -2305,7 +2305,7 @@ abstract class AdminTabCore
<a href="index.php?tab=AdminMeta&token='.Tools::getAdminTokenLite('AdminMeta').'#SEO%20%26%20URLs">'.
$this->l('Click here if you want to modify the main shop domain name').'</a>');
}
protected function displayAssoShop($type = 'shop')
{
if (!Shop::isMultiShopActivated() || (!$this->_object && $this->context->shop->getContextType() != Shop::CONTEXT_ALL))
@@ -2364,7 +2364,7 @@ abstract class AdminTabCore
});
$('.input_group_shop[value='+id_group+']').attr('checked', groupChecked);
}
function check_all_shop()
{
var allChecked = true;
@@ -2411,7 +2411,7 @@ EOF;
/**
* Get current URL
*
*
* @param array $remove List of keys to remove from URL
* @return string
*/
@@ -2420,7 +2420,7 @@ EOF;
$url = $_SERVER['REQUEST_URI'];
if (!$remove)
return $url;
if (!is_array($remove))
$remove = array($remove);
+31 -31
View File
@@ -28,11 +28,11 @@
class CustomerCore extends ObjectModel
{
public $id;
public $id_shop;
public $id_group_shop;
/** @var string Secure key */
public $secure_key;
@@ -40,7 +40,7 @@ class CustomerCore extends ObjectModel
public $note;
/** @var integer Gender ID */
public $id_gender = 9;
public $id_gender = 0;
/** @var integer Default group ID */
public $id_default_group = _PS_DEFAULT_CUSTOMER_GROUP_;
@@ -80,7 +80,7 @@ class CustomerCore extends ObjectModel
/** @var boolean Status */
public $is_guest = 0;
/** @var boolean True if carrier has been deleted (staying in database as deleted) */
public $deleted = 0;
@@ -93,20 +93,20 @@ class CustomerCore extends ObjectModel
public $years;
public $days;
public $months;
/** @var int customer id_country as determined by geolocation */
public $geoloc_id_country;
/** @var int customer id_state as determined by geolocation */
public $geoloc_id_state;
/** @var string customer postcode as determined by geolocation */
public $geoloc_postcode;
/** @var boolean is the customer logged in */
public $logged = 0;
/** @var int id_guest meaning the guest table, not the guest customer */
public $id_guest;
protected $tables = array ('customer');
protected $fieldsRequired = array('lastname', 'passwd', 'firstname', 'email');
@@ -137,7 +137,7 @@ class CustomerCore extends ObjectModel
$this->validateFields();
if (isset($this->id))
$fields['id_customer'] = (int)($this->id);
$fields['id_shop'] = (int)$this->id_shop;
$fields['id_group_shop'] = (int)$this->id_group_shop;
$fields['secure_key'] = pSQL($this->secure_key);
@@ -211,7 +211,7 @@ class CustomerCore extends ObjectModel
{
if (!$shop)
$shop = Context::getContext()->shop;
$sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname`
FROM `'._DB_PREFIX_.'customer`
WHERE 1 '.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
@@ -286,10 +286,10 @@ class CustomerCore extends ObjectModel
{
if (!Validate::isEmail($email))
die (Tools::displayError());
if (!$shop)
$shop = Context::getContext()->shop;
$sql = 'SELECT `id_customer`
FROM `'._DB_PREFIX_.'customer`
WHERE `email` = \''.pSQL($email).'\'
@@ -322,7 +322,7 @@ class CustomerCore extends ObjectModel
}
return self::$_customerHasAddress[$id_customer];
}
public static function resetAddressCache($id_customer)
{
if (array_key_exists($id_customer, self::$_customerHasAddress))
@@ -389,7 +389,7 @@ class CustomerCore extends ObjectModel
{
if (!$shop)
$shop = Context::getContext()->shop;
$sql = 'SELECT *
FROM `'._DB_PREFIX_.'customer`
WHERE (
@@ -407,7 +407,7 @@ class CustomerCore extends ObjectModel
* @return array Stats
*/
public function getStats()
{
{
$result = Db::getInstance()->getRow('
SELECT COUNT(`id_order`) AS nb_orders, SUM(`total_paid` / o.`conversion_rate`) AS total_orders
FROM `'._DB_PREFIX_.'orders` o
@@ -483,7 +483,7 @@ class CustomerCore extends ObjectModel
{
if (!Group::isFeatureActive())
return array(1);
$groups = array();
$result = Db::getInstance()->ExecuteS('
SELECT cg.`id_group`
@@ -533,7 +533,7 @@ class CustomerCore extends ObjectModel
$ids = Address::getCountryAndState($id_address);
return (int)($ids['id_country'] ? $ids['id_country'] : Configuration::get('PS_COUNTRY_DEFAULT'));
}
public function toggleStatus()
{
parent::toggleStatus();
@@ -550,7 +550,7 @@ class CustomerCore extends ObjectModel
{
return (bool)$this->is_guest;
}
public function transformToCustomer($id_lang, $password = NULL)
{
if (!$this->isGuest())
@@ -559,7 +559,7 @@ class CustomerCore extends ObjectModel
$password = Tools::passwdGen();
if (!Validate::isPasswd($password))
return false;
$this->is_guest = 0;
$this->passwd = Tools::encrypt($password);
if ($this->update())
@@ -570,13 +570,13 @@ class CustomerCore extends ObjectModel
'{email}' => $this->email,
'{passwd}' => $password
);
Mail::Send((int)$id_lang, 'guest_to_customer', Mail::l('Your guest account has been transformed to customer account'), $vars, $this->email, $this->firstname.' '.$this->lastname);
return true;
}
return false;
}
public static function printNewsIcon($id_customer, $tr)
{
$customer = new Customer($tr['id_customer']);
@@ -586,7 +586,7 @@ class CustomerCore extends ObjectModel
($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />').
'</a>';
}
public static function printOptinIcon($id_customer, $tr)
{
$customer = new Customer($tr['id_customer']);
@@ -596,7 +596,7 @@ class CustomerCore extends ObjectModel
($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />').
'</a>';
}
public function setWsPasswd($passwd)
{
if ($this->id != 0)
@@ -608,28 +608,28 @@ class CustomerCore extends ObjectModel
$this->passwd = Tools::encrypt($passwd);
return true;
}
/**
* Check customer informations and return customer validity
*
* @since 1.5.0
* @param boolean $withGuest
* @param boolean $withGuest
* @return boolean customer validity
*/
public function isLogged($withGuest = false)
{
if (!$withGuest AND $this->is_guest == 1)
return false;
/* Customer is valid only if it can be load and if object password is the same as database one */
if ($this->logged == 1 AND $this->id AND Validate::isUnsignedId($this->id) AND self::checkPassword($this->id, $this->passwd))
return true;
return false;
}
/**
* Logout
*
*
* @since 1.5.0
*/
public function logout()
@@ -642,7 +642,7 @@ class CustomerCore extends ObjectModel
/**
* Soft logout, delete everything links to the customer
* but leave there affiliate's informations
*
*
* @since 1.5.0
*/
public function mylogout()
@@ -650,5 +650,5 @@ class CustomerCore extends ObjectModel
if (isset(Context::getContext()->cookie))
Context::getContext()->cookie->mylogout();
$this->logged = 0;
}
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* @since 1.5.0
*/
class GenderCore extends ObjectModel
{
public $id_gender;
public $name;
public $type;
protected $fieldsRequired = array('type');
protected $fieldsSize = array();
protected $fieldsValidate = array();
protected $fieldsRequiredLang = array('name');
protected $fieldsSizeLang = array('name' => 20);
protected $fieldsValidateLang = array('name' => 'isString');
protected $table = 'gender';
protected $identifier = 'id_gender';
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id, $id_lang, $id_shop);
$this->image_dir = _PS_GENDERS_DIR_;
}
public function getFields()
{
$this->validateFields();
$fields['id_gender'] = (int)$this->id_gender;
$fields['type'] = (int)$this->type;
return $fields;
}
/**
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
$this->validateFieldsLang();
return $this->getTranslationsFields(array(
'name',
));
}
public function getGenders($id_lang = null)
{
if (is_null($id_lang))
$id_lang = Context::getContext()->language->id;
$sql = 'SELECT g.id_gender, gl.name
FROM '._DB_PREFIX_.'gender g
LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON g.id_gender = gl.id_gender AND gl.id_lang = '.(int)$id_lang;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
}
public function getStaticImage($id, $useUnknown = false)
{
if (!file_exists(_PS_GENDERS_DIR_.$id.'.jpg'))
return ($useUnknown) ? _PS_ADMIN_IMG_.'unknown.gif' : false;
return _THEME_GENDERS_DIR_.$id.'.jpg';
}
public function getImage($useUnknown = false)
{
return Gender::getStaticImage($this->id, $useUnknown);
}
}
+25 -25
View File
@@ -32,11 +32,11 @@ abstract class ObjectModelCore
/** @var integer lang id */
protected $id_lang = NULL;
protected $id_shop = NULL;
private $getShopFromContext = true;
/** @var string SQL Table name */
protected $table = NULL;
@@ -63,7 +63,7 @@ abstract class ObjectModelCore
/** @var array Multilingual fields validity functions for admin panel forms */
protected $fieldsValidateLang = array();
protected $langMultiShop = false;
/** @var array tables */
@@ -76,7 +76,7 @@ abstract class ObjectModelCore
/** @var string path to image directory. Used for image deletion. */
protected $image_dir = NULL;
/** @var string file type of image files. Used for image deletion. */
protected $image_format = 'jpg';
@@ -153,7 +153,7 @@ abstract class ObjectModelCore
foreach ($result AS $key => $value)
if (key_exists($key, $this))
$this->{$key} = stripslashes($value);
if (!$id_lang AND method_exists($this, 'getTranslationsFieldsChild'))
{
$sql = 'SELECT * FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang`
@@ -248,7 +248,7 @@ abstract class ObjectModelCore
$result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table.'_lang', $field, 'INSERT');
}
}
if (!Shop::isMultishopActivated())
{
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
@@ -285,7 +285,7 @@ abstract class ObjectModelCore
if (!$result)
return false;
// Database update for multilingual fields related to the object
// Database update for multilingual fields related to the object
if (method_exists($this, 'getTranslationsFieldsChild'))
{
$fields = $this->getTranslationsFieldsChild();
@@ -417,7 +417,7 @@ abstract class ObjectModelCore
return $fields;
}
protected function makeTranslationFields(&$fields, &$fieldsArray, $id_language)
{
$fields[$id_language]['id_lang'] = $id_language;
@@ -433,13 +433,13 @@ abstract class ObjectModelCore
$fieldName = $k;
$html = (isset($field['html'])) ? $field['html'] : false;
}
/* Check fields validity */
if (!Validate::isTableOrIdentifier($fieldName))
die(Tools::displayError());
/* Copy the field, or the default language field if it's both required and empty */
if ((!$this->id_lang AND isset($this->{$fieldName}[$id_language]) AND !empty($this->{$fieldName}[$id_language]))
if ((!$this->id_lang AND isset($this->{$fieldName}[$id_language]) AND !empty($this->{$fieldName}[$id_language]))
OR ($this->id_lang AND isset($this->$fieldName) AND !empty($this->$fieldName)))
$fields[$id_language][$fieldName] = $this->id_lang ? pSQL($this->$fieldName, $html) : pSQL($this->{$fieldName}[$id_language], $html);
elseif (in_array($fieldName, $this->fieldsRequiredLang))
@@ -715,7 +715,7 @@ abstract class ObjectModelCore
public function getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
{
$assoc = Shop::getAssoTables();
if (array_key_exists($this->table ,$assoc))
{
$multi_shop_join = ' LEFT JOIN `'._DB_PREFIX_.$this->table.'_'.$assoc[$this->table]['type'].'` AS multi_shop_'.$this->table.' ON (main.'.$this->identifier.' = '.'multi_shop_'.$this->table.'.'.$this->identifier.')';
@@ -778,7 +778,7 @@ abstract class ObjectModelCore
{
if (is_null($id_shop))
$id_shop = Context::getContext()->shop->getID();
$sql = 'SELECT id_shop
FROM `'.pSQL(_DB_PREFIX_.$this->table).'_shop`
WHERE `'.$this->identifier.'` = '.(int)$this->id.'
@@ -788,9 +788,9 @@ abstract class ObjectModelCore
/**
* This function associate an item to its context
*
* @param int|array $id_shops
* @param string $type
*
* @param int|array $id_shops
* @param string $type
* @return boolean
*/
public function associateTo($id_shops, $type = 'shop')
@@ -800,13 +800,13 @@ abstract class ObjectModelCore
$sql = '';
if (!is_array($id_shops))
$id_shops = array($id_shops);
foreach ($id_shops as $id_shop)
{
if (($type == 'shop' && !$this->isAssociatedToShop($id_shop)) || ($type == 'group_shop' && !$this->isAssociatedToGroupShop($id_shop)))
$sql .= '('.(int)$this->id.','.(int)$id_shop.'),';
}
if (!empty($sql))
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.$this->table.'_'.$type.'` (`'.$this->identifier.'`, `id_'.$type.'`) VALUES '.rtrim($sql,','));
return true;
@@ -823,7 +823,7 @@ abstract class ObjectModelCore
{
if (is_null($id_group_shop))
$id_group_shop = Context::getContext()->shop->getGroupID();
$sql = 'SELECT id_group_shop
FROM `'.pSQL(_DB_PREFIX_.$this->table).'_group_shop`
WHERE `'.$this->identifier.'`='.(int)$this->id.' AND id_group_shop='.(int)$id_group_shop;
@@ -849,7 +849,7 @@ abstract class ObjectModelCore
$ids[] = $row['id_shop'];
return $this->associateTo($ids);
}
return false;
}
@@ -871,20 +871,20 @@ abstract class ObjectModelCore
/* Deleting object images and thumbnails (cache) */
if ($this->image_dir)
{
if (file_exists($this->image_dir.$this->id.'.'.$this->image_format)
if (file_exists($this->image_dir.$this->id.'.'.$this->image_format)
&& !unlink($this->image_dir.$this->id.'.'.$this->image_format))
return false;
}
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_'.$this->id.'.'.$this->image_format)
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_'.$this->id.'.'.$this->image_format)
&& !unlink(_PS_TMP_IMG_DIR_.$this->table.'_'.$this->id.'.'.$this->image_format))
return false;
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_mini_'.$this->id.'.'.$this->image_format)
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_mini_'.$this->id.'.'.$this->image_format)
&& !unlink(_PS_TMP_IMG_DIR_.$this->table.'_mini_'.$this->id.'.'.$this->image_format))
return false;
$types = ImageType::getImagesTypes();
foreach ($types AS $image_type)
if (file_exists($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format)
if (file_exists($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format)
&& !unlink($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format))
return false;
return true;
+2
View File
@@ -56,6 +56,7 @@ define('_THEME_SHIP_DIR_', _PS_IMG_.'s/');
define('_THEME_STORE_DIR_', _PS_IMG_.'st/');
define('_THEME_LANG_DIR_', _PS_IMG_.'l/');
define('_THEME_COL_DIR_', _PS_IMG_.'co/');
define('_THEME_GENDERS_DIR_', _PS_IMG_.'genders/');
define('_SUPP_DIR_', _PS_IMG_.'su/');
define('_PS_PROD_IMG_', 'img/p/');
@@ -92,6 +93,7 @@ define('_PS_UPLOAD_DIR_', _PS_ROOT_DIR_.'/upload/');
define('_PS_TOOL_DIR_', _PS_ROOT_DIR_.'/tools/');
define('_PS_GEOIP_DIR_', _PS_TOOL_DIR_.'geoip/');
define('_PS_SWIFT_DIR_', _PS_TOOL_DIR_.'swift/');
define('_PS_GENDERS_DIR_', _PS_IMG_DIR_.'genders/');
define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/');
define('_PS_TAASC_PATH_', _PS_TOOL_DIR_.'taasc/');
define('_PS_PEAR_XML_PARSER_PATH_', _PS_TOOL_DIR_.'pear_xml_parser/');
+7 -5
View File
@@ -323,6 +323,8 @@ class AuthControllerCore extends FrontController
));
}
$this->context->smarty->assign('genders', Gender::getGenders());
/* Generate years, months and days */
if (isset($_POST['years']) AND is_numeric($_POST['years']))
$selectedYears = (int)($_POST['years']);
@@ -364,13 +366,13 @@ class AuthControllerCore extends FrontController
if (!empty($back))
{
$this->context->smarty->assign('back', Tools::safeOutput($back));
if (strpos($back, 'order.php') !== false)
if (strpos($back, 'order') !== false)
{
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES'))
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
else
$countries = Country::getCountries($this->context->language->id, true);
$this->context->smarty->assign(array(
'inOrderProcess' => true,
'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
@@ -394,16 +396,16 @@ class AuthControllerCore extends FrontController
$addressItems = array();
$addressFormat = AddressFormat::getOrderedAddressFields(Configuration::get('PS_COUNTRY_DEFAULT'), false, true);
$requireFormFieldsList = AddressFormat::$requireFormFieldsList;
foreach ($addressFormat as $addressline)
foreach (explode(' ', $addressline) as $addressItem)
$addressItems[] = trim($addressItem);
// Add missing require fields for a new user susbscription form
foreach($requireFormFieldsList as $fieldName)
if (!in_array($fieldName, $addressItems))
$addressItems[] = trim($fieldName);
foreach (array('inv', 'dlv') as $addressType)
$this->context->smarty->assign(array($addressType.'_adr_fields' => $addressFormat, $addressType.'_all_fields' => $addressItems));
}
+8 -7
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,11 +31,11 @@ class IdentityControllerCore extends FrontController
public $php_self = 'identity';
public $authRedirection = 'identity';
public $ssl = true;
public function preProcess()
{
parent::preProcess();
$customer = $this->context->customer;
if (sizeof($_POST))
@@ -102,18 +102,19 @@ class IdentityControllerCore extends FrontController
'sl_month' => $birthday[1],
'days' => Tools::dateDays(),
'sl_day' => $birthday[2],
'errors' => $this->errors
'errors' => $this->errors,
'genders' => Gender::getGenders(),
));
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
}
public function setMedia()
{
parent::setMedia();
$this->addCSS(_THEME_CSS_DIR_.'identity.css');
}
public function displayContent()
{
parent::displayContent();
+28 -27
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,14 +31,14 @@ class OrderOpcControllerCore extends ParentOrderController
{
public $php_self = 'order-opc';
public $isLogged;
public function preProcess()
{
parent::preProcess();
if ($this->nbProducts)
$this->context->smarty->assign('virtual_cart', false);
$this->isLogged = (bool)($this->context->customer->id AND Customer::customerIdExistsStatic((int)($this->context->cookie->id_customer)));
if ($this->context->cart->nbProducts())
{
if (Tools::isSubmit('ajax'))
@@ -100,7 +100,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->customer->newsletter = (int)Tools::isSubmit('newsletter');
$this->context->customer->optin = (int)Tools::isSubmit('optin');
$return = array(
'hasError' => !empty($this->errors),
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'id_customer' => (int)$this->context->customer->id,
'token' => Tools::getToken(false)
@@ -173,7 +173,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->cart->id_address_invoice = Tools::isSubmit('same') ? $this->context->cart->id_address_delivery : (int)(Tools::getValue('id_address_invoice'));
if (!$this->context->cart->update())
$this->errors[] = Tools::displayError('An error occurred while updating your cart.');
if (!sizeof($this->errors))
{
if ($this->context->customer->id)
@@ -209,11 +209,11 @@ class OrderOpcControllerCore extends ParentOrderController
elseif (Tools::isSubmit('ajax'))
exit;
}
public function setMedia()
{
parent::setMedia();
// Adding CSS style sheet
$this->addCSS(_THEME_CSS_DIR_.'order-opc.css');
// Adding JS files
@@ -221,7 +221,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->addJS(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js');
$this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js');
}
public function process()
{
// SHOPPING CART
@@ -235,7 +235,7 @@ class OrderOpcControllerCore extends ParentOrderController
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
else
$countries = Country::getCountries($this->context->language->id, true);
$this->context->smarty->assign(array(
'isLogged' => $this->isLogged,
'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0,
@@ -244,7 +244,8 @@ class OrderOpcControllerCore extends ParentOrderController
'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
'errorCarrier' => Tools::displayError('You must choose a carrier before', false),
'errorTOS' => Tools::displayError('You must accept terms of service before', false),
'isPaymentStep' => (bool)(isset($_GET['isPaymentStep']) AND $_GET['isPaymentStep'])
'isPaymentStep' => (bool)(isset($_GET['isPaymentStep']) AND $_GET['isPaymentStep']),
'genders' => Gender::getGenders(),
));
/* Call a hook to display more information on form */
self::$smarty->assign(array(
@@ -259,11 +260,11 @@ class OrderOpcControllerCore extends ParentOrderController
'months' => $months,
'days' => $days,
));
/* Load guest informations */
if ($this->isLogged AND $this->context->cookie->is_guest)
$this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
if ($this->isLogged)
$this->_assignAddress(); // ADDRESS
// CARRIER
@@ -271,30 +272,30 @@ class OrderOpcControllerCore extends ParentOrderController
// PAYMENT
$this->_assignPayment();
Tools::safePostVars();
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
}
public function displayHeader()
{
if (Tools::getValue('ajax') != 'true')
parent::displayHeader();
}
public function displayContent()
{
parent::displayContent();
$this->_processAddressFormat();
$this->context->smarty->display(_PS_THEME_DIR_.'order-opc.tpl');
}
public function displayFooter()
{
if (Tools::getValue('ajax') != 'true')
parent::displayFooter();
}
protected function _getGuestInformations()
{
$customer = $this->context->customer;
@@ -331,7 +332,7 @@ class OrderOpcControllerCore extends ParentOrderController
'sl_day' => $birthday[2]
);
}
protected function _assignCarrier()
{
if (!$this->isLogged)
@@ -348,7 +349,7 @@ class OrderOpcControllerCore extends ParentOrderController
else
parent::_assignCarrier();
}
protected function _assignPayment()
{
$this->context->smarty->assign(array(
@@ -356,7 +357,7 @@ class OrderOpcControllerCore extends ParentOrderController
'HOOK_PAYMENT' => $this->_getPaymentMethods()
));
}
protected function _getPaymentMethods()
{
if (!$this->isLogged)
@@ -381,29 +382,29 @@ class OrderOpcControllerCore extends ParentOrderController
return '<p class="warning">'.Tools::displayError('Error: no currency has been selected').'</p>';
if (!$this->context->cookie->checkedTOS AND Configuration::get('PS_CONDITIONS'))
return '<p class="warning">'.Tools::displayError('Please accept Terms of Service').'</p>';
/* If some products have disappear */
if (!$this->context->cart->checkQuantities())
return '<p class="warning">'.Tools::displayError('An item in your cart is no longer available, you cannot proceed with your order.').'</p>';
/* Check minimal amount */
$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
' '.Tools::displayError('is required in order to validate your order.').'</p>';
/* Bypass payment step if total is 0 */
if ($this->context->cart->getOrderTotal() <= 0)
return '<p class="center"><input type="button" class="exclusive_large" name="confirmOrder" id="confirmOrder" value="'.Tools::displayError('I confirm my order').'" onclick="confirmFreeOrder();" /></p>';
$return = Module::hookExecPayment();
if (!$return)
return '<p class="warning">'.Tools::displayError('No payment method is available').'</p>';
return $return;
}
protected function _getCarrierList()
{
$address_delivery = new Address($this->context->cart->id_address_delivery);
Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

+14
View File
@@ -670,6 +670,20 @@ CREATE TABLE `PREFIX_feature_value_lang` (
PRIMARY KEY (`id_feature_value`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_gender` (
`id_gender` int(11) NOT NULL AUTO_INCREMENT,
`type` tinyint(1) NOT NULL,
PRIMARY KEY (`id_gender`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_gender_lang` (
`id_gender` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(20) NOT NULL,
PRIMARY KEY (`id_gender`,`id_lang`),
KEY `id_gender` (`id_gender`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_group` (
`id_group` int(10) unsigned NOT NULL auto_increment,
`reduction` decimal(17,2) NOT NULL default '0.00',
+1 -4
View File
@@ -940,7 +940,6 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(2, 89, 0, 0, 0, 0),
(2, 90, 0, 0, 0, 0),
(2, 91, 0, 0, 0, 0),
(2, 92, 0, 0, 0, 0),
(3, 1, 1, 1, 1, 1),
(3, 2, 0, 0, 0, 0),
(3, 3, 0, 0, 0, 0),
@@ -1023,7 +1022,6 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(3, 89, 0, 0, 0, 0),
(3, 90, 0, 0, 0, 0),
(3, 91, 0, 0, 0, 0),
(3, 92, 0, 0, 0, 0),
(4, 1, 1, 1, 1, 1),
(4, 2, 1, 1, 1, 1),
(4, 3, 1, 1, 1, 1),
@@ -1105,8 +1103,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(4, 88, 1, 1, 1, 1),
(4, 89, 0, 0, 0, 0),
(4, 90, 0, 0, 0, 0),
(4, 91, 0, 0, 0, 0),
(4, 92, 0, 0, 0, 0);
(4, 91, 0, 0, 0, 0);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module);
+7 -7
View File
@@ -160,7 +160,7 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
(80, 'PS_ORDER_PROCESS_TYPE', 0, NOW(), NOW()),
(81, 'PS_SPECIFIC_PRICE_PRIORITIES', 'id_shop;id_currency;id_country;id_group', NOW(), NOW()),
(82, 'PS_TAX_DISPLAY', 0, NOW(), NOW()),
(83, 'PS_SMARTY_FORCE_COMPILE', 0, NOW(), NOW()),
(83, 'PS_SMARTY_FORCE_COMPILE', 1, NOW(), NOW()),
(84, 'PS_DISTANCE_UNIT', 'km', NOW(), NOW()),
(85, 'PS_STORES_DISPLAY_CMS', 1, NOW(), NOW()),
(86, 'PS_STORES_DISPLAY_FOOTER', 1, NOW(), NOW()),
@@ -827,7 +827,7 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
(70, 'AdminPerformance', 8, 11),(71, 'AdminCustomerThreads', 29, 4),(72, 'AdminWebservice', 9, 12),(73, 'AdminStockMvt', 1, 9),
(80, 'AdminAddonsCatalog', 7, 1),(81, 'AdminAddonsMyAccount', 7, 2),(83, 'AdminThemes', 7, 3),(84, 'AdminGeolocation', 8, 12),
(85, 'AdminTaxRulesGroup', 4, 3),(86, 'AdminLogs', 9, 13), (87,'AdminHome',-1,0),
(88,'AdminShop', 0, 11), (89,'AdminGroupShop', 90, 1),(90, 'AdminShopUrl', 90, 2);
(88,'AdminShop', 0, 11), (89,'AdminGroupShop', 88, 1),(90, 'AdminShopUrl', 88, 2),(91, 'AdminGenders', 2, 4);
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM PREFIX_tab);
@@ -844,7 +844,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 61, 'Search Engines'),(1, 62, 'Referrers'),(1, 63, 'Groups'),(1, 64, 'Generators'),(1, 65, 'Shopping Carts'),(1, 66, 'Tags'),(1, 67, 'Search'),
(1, 68, 'Attachments'),(1, 69, 'Configuration Information'),(1, 70, 'Performance'),(1, 71, 'Customer Service'),(1, 72, 'Webservice'),(1, 73, 'Stock Movements'),
(1, 80, 'Modules & Themes Catalog'),(1, 81, 'My Account'),(1, 82, 'Stores'),(1, 83, 'Themes'),(1, 84, 'Geolocation'),(1, 85, 'Tax Rules'),(1, 86, 'Log'),
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls');
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
@@ -859,7 +859,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 62, 'Sites affluents'),(2, 63, 'Groupes'),(2, 64, 'Générateurs'),(2, 65, 'Paniers'),(2, 66, 'Tags'),(2, 67, 'Recherche'),
(2, 68, 'Documents joints'),(2, 69, 'Informations'),(2, 70, 'Performances'),(2, 71, 'SAV'),(2, 72, 'Service web'),(2, 73, 'Mouvements de Stock'),
(2, 80, 'Catalogue de modules et thèmes'),(2, 81, 'Mon compte'),(2, 82, 'Magasins'),(2, 83, 'Thèmes'),(2, 84, 'Géolocalisation'),(2, 85, 'Règles de taxes'),(2, 86, 'Log'),
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique');
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
@@ -873,7 +873,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 55, 'Albaranes de entrega'),(3, 56, 'SEO & URLs'),(3, 57, 'CMS'),(3, 58, 'Mapeo de la imagen'),(3, 59, 'Mensajes del cliente'),(3, 60, 'Rastreo'),
(3, 61, 'Motores de búsqueda'),(3, 62, 'Referido'),(3, 63, 'Grupos'),(3, 64, 'Generadores'),(3, 65, 'Carritos'),(3, 66, 'Etiquetas'),(3, 67, 'Búsqueda'),(3, 68, 'Adjuntos'),
(3, 69, 'Informaciones'),(3, 70, 'Rendimiento'),(3, 72, 'Web service'),(3, 71, 'Servicio al cliente'),(3, 73, 'Movimiento de Stock'), (3, 82, 'Tiendas'),(3, 83, 'Temas'),(3, 84, 'Geolocalización'),(3, 85, 'Reglas de Impuestos'),(3, 86, 'Log'),
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls');
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
@@ -888,7 +888,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 61, 'Suchmaschinen'),(4, 62, 'Referrer'),(4, 63, 'Gruppen'),(4, 64, 'Generatoren'),(4, 65, 'Warenkörbe'),(4, 66, 'Tags'),(4, 67, 'Suche'),
(4, 68, 'Anhänge'),(4, 69, 'Konfigurationsinformationen'),(4, 70, 'Leistung'),(4, 71, 'Kundenservice'),(4, 72, 'Webservice'),(4, 73, 'Lagerbewegungen'),
(4, 80, 'Module und Themenkatalog'),(4, 81, 'Mein Konto'),(4, 82, 'Shops'),(4, 83, 'Themen'),(4, 84, 'Geotargeting'),(4, 85, 'Steuerregeln'),(4, 86, 'Log'),
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls');
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
@@ -903,7 +903,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 61, 'Motori di ricerca'),(5, 62, 'Referenti'),(5, 63, 'Gruppi'),(5, 64, 'Generatori'),(5, 65, 'Carrelli shopping'),(5, 66, 'Tag'),(5, 67, 'Cerca'),
(5, 68, 'Allegati'),(5, 69, 'Informazioni di configurazione'),(5, 70, 'Performance'),(5, 71, 'Servizio clienti'),(5, 72, 'Webservice'),(5, 73, 'Movimenti magazzino'),
(5, 80, 'Moduli & Temi catalogo'),(5, 81, 'Il mio Account'),(5, 82, 'Negozi'),(5, 83, 'Temi'),(5, 84, 'Geolocalizzazione'),(5, 85, 'Regimi fiscali'),(5, 86, 'Log'),
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls');
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders');
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
(SELECT `id_tab`, id_lang, (SELECT tl.`name`
+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`
+7
View File
@@ -0,0 +1,7 @@
<?php
class Gender extends GenderCore
{
}
+12 -12
View File
@@ -1,5 +1,5 @@
{*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -146,12 +146,12 @@ $(function(){ldelim}
</p>
<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.'}</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.'}</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">
<p class="required text">
<label for="firstname">{l s='First name'}</label>
<input type="text" class="text" id="firstname" name="firstname" onblur="$('#customer_firstname').val($(this).val());" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{/if}">
<input type="hidden" class="text" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{/if}">
@@ -296,8 +296,8 @@ $(function(){ldelim}
<sup>*</sup>
</p>
</fieldset>
<p class="cart_navigation required submit">
<span><sup>*</sup>{l s='Required field'}</span>
<p class="cart_navigation required submit">
<span><sup>*</sup>{l s='Required field'}</span>
<input type="submit" class="button" name="submitGuestAccount" id="submitGuestAccount" style="float:right" value="{l s='Continue'}">
</p>
</form>
@@ -309,10 +309,10 @@ $(function(){ldelim}
<h3>{l s='Your personal information'}</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.'}</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.'}</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'}</label>
+5 -5
View File
@@ -1,5 +1,5 @@
{*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -43,10 +43,10 @@
<fieldset>
<p class="radio">
<span>{l s='Title'}</span>
<input type="radio" id="id_gender1" name="id_gender" value="1" {if $smarty.post.id_gender == 1 OR !$smarty.post.id_gender}checked="checked"{/if} />
<label for="id_gender1">{l s='Mr.'}</label>
<input type="radio" id="id_gender2" name="id_gender" value="2" {if $smarty.post.id_gender == 2}checked="checked"{/if} />
<label for="id_gender2">{l s='Ms.'}</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="firstname">{l s='First name'}</label>
+4 -4
View File
@@ -140,10 +140,10 @@
</p>
<p class="radio required">
<span>{l s='Title'}</span>
<input type="radio" name="id_gender" id="id_gender1" value="1" {if isset($guestInformations) && $guestInformations.id_gender == 1}checked="checked"{/if} />
<label for="id_gender1" class="top">{l s='Mr.'}</label>
<input type="radio" name="id_gender" id="id_gender2" value="2" {if isset($guestInformations) && $guestInformations.id_gender == 2}checked="checked"{/if} />
<label for="id_gender2" class="top">{l s='Ms.'}</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="firstname">{l s='First name'}</label>