// Merge -> revision 9435

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9438 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-10-19 08:14:42 +00:00
parent 43958d54e7
commit 42564ca3d0
35 changed files with 853 additions and 572 deletions
+7 -2
View File
@@ -35,8 +35,13 @@ $errors = array();
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$iso = strtolower(Language::getIsoById((int)$id_lang));
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
if (isset($_POST['Submit']))
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$errors[] = Tools::displayError('This functionnality has been disabled.');
}
/* PrestaShop demo mode*/
else if (isset($_POST['Submit']))
{
$errors = array();
if (empty($_POST['email']))
+37 -29
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,7 +31,7 @@ class AdminAccess extends AdminTab
{
private $return_status;
private $return_message;
public function processSubmitAddAccess()
{
$perm = Tools::getValue('perm') ;
@@ -39,7 +39,7 @@ class AdminAccess extends AdminTab
throw new PrestashopException('permission not exists');
$enabled = (int)Tools::getValue('enabled') ;
$id_tab = (int)(Tools::getValue('id_tab'));
$id_tab = (int)(Tools::getValue('id_tab'));
$id_profile = (int)(Tools::getValue('id_profile'));
$res = true;
@@ -53,7 +53,7 @@ class AdminAccess extends AdminTab
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
else
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($perm).'` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
$this->return_status = $res?'ok':'error';
if ($res)
$this->return_message = $this->l('Access successfully updated');
@@ -71,24 +71,24 @@ class AdminAccess extends AdminTab
if (!in_array($perm, array('view', 'configure')))
throw new PrestashopException('permission not exists');
if ($id_module == -1)
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile);
else
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_module` = '.(int)$id_module.' AND `id_profile` = '.(int)$id_profile);
$this->return_status = $res?'ok':'error';
if ($res)
$this->return_message = $this->l('Access successfully updated.');
else
$this->return_message = $this->l('An error when updating access.');
}
public function displayAjax()
{
$return = array('result'=>$this->return_status,'msg'=>$this->return_message);
echo Tools::jsonEncode($return);
}
public function display()
@@ -97,16 +97,16 @@ class AdminAccess extends AdminTab
echo '<script type="text/javascript">
$(document).ready(function(){
$(".ajaxPower").change(function(){
var tout = $(this).attr("rel").split("||");
var tout = $(this).attr("rel").split("||");
var id_tab = tout[0];
var id_profile = tout[1];
var perm = tout[2];
var enabled = $(this).is(":checked")? 1 : 0;
var tabsize = tout[3];
var tabnumber = tout[4];
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber);
$.ajax({
type:"POST",
url : "ajax-tab.php",
@@ -139,9 +139,9 @@ class AdminAccess extends AdminTab
});
});
});</script>';
}
/**
* Get the current profile id
*
@@ -151,7 +151,7 @@ class AdminAccess extends AdminTab
{
return (isset($_GET['profile']) AND !empty($_GET['profile']) AND is_numeric($_GET['profile'])) ? (int)($_GET['profile']) : 1;
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
@@ -159,7 +159,7 @@ class AdminAccess extends AdminTab
$tabs = Tab::getTabs($this->context->language->id);
$profiles = Profile::getProfiles($this->context->language->id);
$accesses = Profile::getProfileAccesses($currentProfile);
echo '
<script type="text/javascript">
setLang(Array(\''.$this->l('Profile updated').'\', \''.$this->l('Request failed!').'\', \''.$this->l('Update in progress. Please wait.').'\', \''.$this->l('Server connection failed!').'\'));
@@ -178,7 +178,7 @@ class AdminAccess extends AdminTab
$tabsize = $tab['id_tab'];
echo ' </select>
</th>';
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
echo '
<th class="center">
@@ -192,17 +192,17 @@ class AdminAccess extends AdminTab
'.$this->l('Add').'
</th>
<th class="center">
<input type="checkbox" name="1" id="editall"
<input type="checkbox" name="1" id="editall"
'.($this->tabAccess['edit'] == 1 ? ' rel="-1||'.$currentProfile.'||edit||'.$tabsize.'||'.sizeof($tabs).'" class="ajaxPower"' : 'disabled="disabled"').' />
'.$this->l('Edit').'
</th>
<th class="center">
<input type="checkbox" name="1" id="deleteall"
<input type="checkbox" name="1" id="deleteall"
'.($this->tabAccess['edit'] == 1 ? ' rel="-1||'.$currentProfile.'||delete||'.$tabsize.'||'.sizeof($tabs).'" class="ajaxPower"' : 'disabled="disabled"').' />
'.$this->l('Delete').'
</th>
<th class="center">
<input type="checkbox" name="1" id="allall"
<input type="checkbox" name="1" id="allall"
'.($this->tabAccess['edit'] == 1 ? ' rel="-1||'.$currentProfile.'||all||'.$tabsize.'||'.sizeof($tabs).'" class="ajaxPower"' : 'disabled="disabled"').' />
'.$this->l('All').'
</th>
@@ -212,7 +212,7 @@ class AdminAccess extends AdminTab
echo '<tr><td colspan="5">'.$this->l('No tab').'</td></tr>';
elseif ($currentProfile == (int)(_PS_ADMIN_PROFILE_))
echo '<tr><td colspan="5">'.$this->l('Administrator permissions can\'t be modified.').'</td></tr>';
else
else
foreach ($tabs AS $tab)
if (!$tab['id_parent'] OR (int)($tab['id_parent']) == -1)
{
@@ -221,17 +221,17 @@ class AdminAccess extends AdminTab
if ($child['id_parent'] === $tab['id_tab'])
if (isset($accesses[$child['id_tab']]))
{
$this->printTabAccess($currentProfile, $child, $accesses[$child['id_tab']], true, $tabsize, sizeof($tabs));
}
}
echo '</table>';
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
$this->displayModuleAccesses($currentProfile);
echo '<div class="clear">&nbsp;</div>';
}
private function printTabAccess($currentProfile, $tab, $access, $is_child, $tabsize, $tabnumber)
{
$result_accesses = 0;
@@ -252,9 +252,17 @@ class AdminAccess extends AdminTab
/>
</td></tr>';
}
public function ajaxProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->tabAccess['edit'] == 1)
{
if (Tools::isSubmit('submitAddaccess'))
@@ -263,7 +271,7 @@ class AdminAccess extends AdminTab
$this->processChangeModuleAccess();
}
}
private function displayModuleAccesses($currentProfile)
{
echo '
@@ -274,7 +282,7 @@ class AdminAccess extends AdminTab
var id_module = tout[0];
var perm = tout[1];
var enabled = $(this).is(":checked")? 1 : 0;
if (id_module == -1)
$(\'.ajax-ma-\'+perm).each(function(key, value) {
$(this).attr("checked", enabled);
@@ -316,7 +324,7 @@ class AdminAccess extends AdminTab
});
});
});
</script>
</script>
<table class="table float" cellspacing="0" style="margin-left:20px">
<tr>
<th>'.$this->l('Modules').'</th>
@@ -332,7 +340,7 @@ class AdminAccess extends AdminTab
ORDER BY m.name');
if (!sizeof($modules))
echo '<tr><td colspan="2">'.$this->l('No modules installed').'</td></tr>';
else
else
foreach ($modules AS $module)
echo '<tr>
<td>&raquo; '.$module['name'].'</td>
+7
View File
@@ -50,6 +50,13 @@ class AdminAttachments extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (Tools::isSubmit('submitAdd'.$this->table))
{
if ($id = (int)(Tools::getValue('id_attachment')) AND $a = new Attachment($id))
+8
View File
@@ -54,6 +54,14 @@ class AdminDb extends AdminPreferences
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (isset($_POST['submitDatabase'.$this->table]))
{
if ($this->tabAccess['edit'] === '1')
+9
View File
@@ -66,6 +66,14 @@ class AdminEmails extends AdminPreferences
public function beforeUpdateOptions()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($_POST['PS_MAIL_METHOD'] == 2 AND (empty($_POST['PS_MAIL_SERVER']) OR empty($_POST['PS_MAIL_SMTP_PORT'])))
$this->_errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.');
}
@@ -73,6 +81,7 @@ class AdminEmails extends AdminPreferences
public function display()
{
parent::display();
$this->_displayMailTest();
}
+15 -7
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -29,17 +29,17 @@ class AdminEmployees extends AdminTab
{
/** @var array profiles list */
private $profilesArray = array();
public function __construct()
{
$this->context = Context::getContext();
$this->table = 'employee';
$this->className = 'Employee';
$this->lang = false;
$this->edit = true;
$this->edit = true;
$this->delete = true;
$this->_select = 'pl.`name` AS profile';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$this->context->language->id.')';
$profiles = Profile::getProfiles($this->context->language->id);
@@ -53,7 +53,7 @@ class AdminEmployees extends AdminTab
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
'firstname' => array('title' => $this->l('First name'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'),
'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
);
@@ -98,7 +98,7 @@ class AdminEmployees extends AdminTab
var employeePage = true;
</script>
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.((int)$this->tabAccess['view'] ? '' : '&updateemployee&id_employee='.(int)$obj->id).'" method="post" enctype="multipart/form-data" autocomplete="off">
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
'.((int)$this->tabAccess['view'] ? '' : '<input type="hidden" name="back" value="'.self::$currentIndex.'&token='.$this->token.'&updateemployee&id_employee='.(int)$obj->id.'" />').'
@@ -184,7 +184,7 @@ class AdminEmployees extends AdminTab
$(\'select[name=id_profile]\').change(function(){
ifSuperAdmin($(this));
});
ifSuperAdmin($(\'select[name=id_profile]\'));
});
@@ -220,6 +220,14 @@ class AdminEmployees extends AdminTab
$this->context = Context::getContext();
if (Tools::isSubmit('deleteemployee') || Tools::isSubmit('status') || Tools::isSubmit('statusemployee'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_ && $id_employee = Tools::getValue('id_employee') && (int)$id_employee == _PS_DEMO_MAIN_BO_ACCOUNT_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->context->employee->id == Tools::getValue('id_employee'))
{
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
+9
View File
@@ -1732,6 +1732,7 @@ class AdminImport extends AdminTab
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
mkdir(_PS_PROD_IMG_DIR_);
break;
case $this->entities[$this->l('Customers')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
@@ -1770,6 +1771,14 @@ class AdminImport extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (Tools::isSubmit('submitFileUpload'))
{
if (isset($_FILES['file']) AND !empty($_FILES['file']['error']))
+14
View File
@@ -223,6 +223,13 @@ class AdminModules extends AdminTab
/* Automatically copy a module from external URL and unarchive it in the appropriated directory */
if (Tools::isSubmit('submitDownload'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->tabAccess['add'] === '1')
{
if (Validate::isModuleUrl($url = Tools::getValue('url'), $this->_errors))
@@ -238,6 +245,13 @@ class AdminModules extends AdminTab
}
if (Tools::isSubmit('submitDownload2'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->tabAccess['add'] === '1')
{
if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
+8
View File
@@ -50,6 +50,14 @@ class AdminProfiles extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (isset($_GET['delete'.$this->table]) AND $_GET[$this->identifier] == (int)(_PS_ADMIN_PROFILE_))
$this->_errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
else
+8
View File
@@ -55,6 +55,14 @@ class AdminTabs extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (($id_tab = (int)(Tools::getValue('id_tab'))) AND ($direction = Tools::getValue('move')) AND Validate::isLoadedObject($tab = new Tab($id_tab)))
{
if ($tab->move($direction))
+8
View File
@@ -424,6 +424,14 @@ class AdminTranslations extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (Tools::isSubmit('submitCopyLang'))
{
if ($this->tabAccess['add'] === '1')
+1 -2
View File
@@ -641,8 +641,7 @@ abstract class AdminTabCore
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
$this->_errors[] = Tools::displayError('Failed to update the position.');
else
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.$token);
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.((($id_category = (int)(Tools::getValue('id_category'))) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$token);
Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_identifier = (int)(Tools::getValue($this->identifier))) ? ('&'.$this->identifier.'='.$id_identifier) : '').'&token='.$token);
}
/* Delete multiple objects */
elseif (Tools::getValue('submitDel'.$this->table))
+6 -4
View File
@@ -1764,8 +1764,12 @@ FileETag INode MTime Size
switch ($type)
{
case 'by' :
$list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
$value = (isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position');
$orderByPrefix = '';
if($prefix) {
if ($prefix)
{
if ($value == 'id_product' || $value == 'date_add' || $value == 'price')
$orderByPrefix = 'p.';
elseif ($value == 'name')
@@ -1776,9 +1780,7 @@ FileETag INode MTime Size
$orderByPrefix = 'cp.';
}
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
$list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
return $orderByPrefix.((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
return $orderByPrefix.$value;
break;
case 'way' :
+2
View File
@@ -26,6 +26,8 @@
*/
define('_PS_MODE_DEV_', true);
define('_PS_MODE_DEMO_', false);
define('_PS_DEMO_MAIN_BO_ACCOUNT_', 1);
$currentDir = dirname(__FILE__);
+10 -2
View File
@@ -127,11 +127,19 @@ class AdminBackupControllerCore extends AdminController
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
// Test if the backup dir is writable
if(!is_writable(_PS_ADMIN_DIR_.'/backups/'))
if (!is_writable(_PS_ADMIN_DIR_.'/backups/'))
$this->warnings[] = $this->l('"Backups" Directory in admin directory must be writeable (CHMOD 755 / 777)');
if($this->action == 'new' && is_writable(_PS_ADMIN_DIR_.'/backups/'))
if ($this->action == 'new' && is_writable(_PS_ADMIN_DIR_.'/backups/'))
{
if (($object = $this->loadObject()))
{
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
+71 -54
View File
@@ -89,18 +89,20 @@ var ajaxCart = {
// try to expand the cart
expand : function(){
if ($('#cart_block #cart_block_list').hasClass('collapsed'))
$(['left_column', 'right_column']).each(function(id, parentId)
{
$('#cart_block #cart_block_summary').slideUp(200, function(){
if ($('#'+parentId+' #cart_block #cart_block_list').hasClass('collapsed'))
{
$('#'+parentId+' #cart_block #cart_block_summary').slideUp(200, function(){
$(this).addClass('collapsed').removeClass('expanded');
$('#cart_block #cart_block_list').slideDown({
$('#'+parentId+' #cart_block #cart_block_list').slideDown({
duration: 600,
complete: function(){$(this).addClass('expanded').removeClass('collapsed');}
});
});
// toogle the button expand/collapse button
$('#cart_block h4 span#block_cart_expand').fadeOut('slow', function(){
$('#cart_block h4 span#block_cart_collapse').fadeIn('fast');
$('#'+parentId+' #cart_block h4 span#block_cart_expand').fadeOut('slow', function(){
$('#'+parentId+' #cart_block h4 span#block_cart_collapse').fadeIn('fast');
});
// save the expand statut in the user cookie
@@ -110,9 +112,8 @@ var ajaxCart = {
async: true,
data: 'ajax_blockcart_display=expand' + '&rand=' + new Date().getTime()
});
}
});
},
// cart to fix display when using back and previous browsers buttons
refresh : function(){
@@ -136,6 +137,7 @@ var ajaxCart = {
// try to collapse the cart
collapse : function(){
return;
if ($('#cart_block #cart_block_list').hasClass('expanded'))
{
@@ -263,6 +265,8 @@ var ajaxCart = {
//hide the products displayed in the page but no more in the json data
hideOldProducts : function(jsonData) {
$(['left_column', 'right_column']).each(function(id, parentId)
{
//delete an eventually removed product of the displayed cart (only if cart is not empty!)
if($('#cart_block #cart_block_list dl.products').length > 0)
{
@@ -270,7 +274,7 @@ var ajaxCart = {
var removedProductData = null;
var removedProductDomId = null;
//look for a product to delete...
$('#cart_block_list dl.products dt').each(function(){
$('#'+parentId+' #cart_block_list dl.products dt').each(function(){
//retrieve idProduct and idCombination from the displayed product in the block cart
var domIdProduct = $(this).attr('id');
var firstCut = domIdProduct.replace('cart_block_product_', '');
@@ -303,48 +307,51 @@ var ajaxCart = {
var firstCut = removedProductId.replace('cart_block_product_', '');
var ids = firstCut.split('_');
$('#'+removedProductId).addClass('strike').fadeTo('slow', 0, function(){
$('#'+parentId+' #'+removedProductId).addClass('strike').fadeTo('slow', 0, function(){
$(this).slideUp('slow', function(){
$(this).remove();
//if the cart is now empty, show the 'no product in the cart' message
if($('#cart_block dl.products dt').length == 0)
if($('#'+parentId+' #cart_block dl.products dt').length == 0)
{
$('p#cart_block_no_products:hidden').slideDown('fast');
$('div#cart_block dl.products').remove();
$('#'+parentId+' p#cart_block_no_products').slideDown('fast');
$('#'+parentId+' div#cart_block dl.products').remove();
}
});
});
$('dd#cart_block_combination_of_' + ids[0] + (ids[1] ? '_'+ids[1] : '') ).fadeTo('fast', 0, function(){
$('#'+parentId+' dd#cart_block_combination_of_' + ids[0] + (ids[1] ? '_'+ids[1] : '') ).fadeTo('fast', 0, function(){
$(this).slideUp('fast', function(){
$(this).remove();
});
});
}
}
});
},
hideOldProductCustomizations : function (product, domIdProduct)
{
var customizationList = $('#cart_block #cart_block_list ul#customization_' + product['id'] + '_' + product['idCombination']);
if(customizationList.length > 0)
$(['left_column', 'right_column']).each(function(id, parentId)
{
$(customizationList).find("li").each(function(){
$(this).find("div").each(function() {
var customizationDiv = $(this).attr('id');
var tmp = customizationDiv.replace('deleteCustomizableProduct_', '');
var ids = tmp.split('_');
if ((parseInt(product.idCombination) == parseInt(ids[2])) && !ajaxCart.doesCustomizationStillExist(product, ids[0]))
$('#' + customizationDiv).parent().addClass('strike').fadeTo('slow', 0, function(){
$(this).slideUp('slow');
$(this).remove();
});
var customizationList = $('#'+parentId+' #cart_block #cart_block_list ul#customization_' + product['id'] + '_' + product['idCombination']);
if(customizationList.length > 0)
{
$(customizationList).find("li").each(function(){
$(this).find("div").each(function() {
var customizationDiv = $(this).attr('id');
var tmp = customizationDiv.replace('deleteCustomizableProduct_', '');
var ids = tmp.split('_');
if ((parseInt(product.idCombination) == parseInt(ids[2])) && !ajaxCart.doesCustomizationStillExist(product, ids[0]))
$('#' + customizationDiv).parent().addClass('strike').fadeTo('slow', 0, function(){
$(this).slideUp('slow');
$(this).remove();
});
});
});
});
}
var removeLinks = $('#cart_block_product_' + domIdProduct).find('a.ajax_cart_block_remove_link');
if (!product.hasCustomizedDatas && !removeLinks.length)
$('#' + domIdProduct + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseDir + 'index.php?controller=cart&amp;delete&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;token=' + static_token + '" title="' + removingLinkText + '"> </a>');
}
var removeLinks = $('#'+parentId+' #cart_block_product_' + domIdProduct).find('a.ajax_cart_block_remove_link');
if (!product.hasCustomizedDatas && !removeLinks.length)
$('#'+parentId+' #' + domIdProduct + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseDir + 'index.php?controller=cart&amp;delete&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;token=' + static_token + '" title="' + removingLinkText + '"> </a>');
});
},
doesCustomizationStillExist : function (product, customizationId)
@@ -393,7 +400,9 @@ var ajaxCart = {
// Update product quantity
updateProductQuantity : function (product, quantity) {
$('dt#cart_block_product_' + product.id + (product.idCombination ? '_' + product.idCombination : '') + ' .quantity').fadeTo('fast', 0, function() {
$(['left_column', 'right_column']).each(function(id, parentId)
{
$('#'+parentId+' dt#cart_block_product_' + product.id + (product.idCombination ? '_' + product.idCombination : '') + ' .quantity').fadeTo('fast', 0, function() {
$(this).text(quantity);
$(this).fadeTo('fast', 1, function(){
$(this).fadeTo('fast', 0, function(){
@@ -405,27 +414,29 @@ var ajaxCart = {
});
});
});
});
},
//display the products witch are in json data but not already displayed
displayNewProducts : function(jsonData) {
$(['left_column', 'right_column']).each(function(id, parentId)
{
//add every new products or update displaying of every updated products
$(jsonData.products).each(function(){
//fix ie6 bug (one more item 'undefined' in IE6)
if (this.id != undefined)
{
//create a container for listing the products and hide the 'no product in the cart' message (only if the cart was empty)
if ($('div#cart_block dl.products').length == 0)
$('p#cart_block_no_products:visible').fadeTo('fast', 0, function(){
if ($('#'+parentId+' div#cart_block dl.products').length == 0)
$('#'+parentId+' p#cart_block_no_products').fadeTo('fast', 0, function(){
$(this).slideUp('fast').fadeTo(0, 1);
}).before('<dl class="products"></dl>');
//if product is not in the displayed cart, add a new product's line
var domIdProduct = this.id + (this.idCombination ? '_' + this.idCombination : '');
var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0');
if($('#cart_block dt#cart_block_product_'+ domIdProduct ).length == 0)
if($('#'+parentId+' #cart_block dt#cart_block_product_'+ domIdProduct ).length == 0)
{
var productId = parseInt(this.id);
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
@@ -441,51 +452,53 @@ var ajaxCart = {
if (this.hasCustomizedDatas)
content += ajaxCart.displayNewCustomizedDatas(this);
if (this.hasAttributes) content += '</dd>';
$('#cart_block dl.products').append(content);
$('#'+parentId+' #cart_block dl.products').append(content);
}
//else update the product's line
else{
var jsonProduct = this;
if($('dt#cart_block_product_' + domIdProduct + ' .quantity').text() != jsonProduct.quantity || $('dt#cart_block_product_' + domIdProduct + ' .price').text() != jsonProduct.priceByLine)
if($('#'+parentId+' dt#cart_block_product_' + domIdProduct + ' .quantity').text() != jsonProduct.quantity || $('dt#cart_block_product_' + domIdProduct + ' .price').text() != jsonProduct.priceByLine)
{
// Usual product
$('dt#cart_block_product_' + domIdProduct + ' .price').text(jsonProduct.priceByLine);
$('#'+parentId+' dt#cart_block_product_' + domIdProduct + ' .price').text(jsonProduct.priceByLine);
ajaxCart.updateProductQuantity(jsonProduct, jsonProduct.quantity);
// Customized product
if (jsonProduct.hasCustomizedDatas)
{
customizationFormatedDatas = ajaxCart.displayNewCustomizedDatas(jsonProduct);
if (!$('#cart_block ul#customization_' + domIdProductAttribute).length)
if (!$('#'+parentId+' #cart_block ul#customization_' + domIdProductAttribute).length)
{
if (jsonProduct.hasAttributes)
$('#cart_block dd#cart_block_combination_of_' + domIdProduct).append(customizationFormatedDatas);
$('#'+parentId+' #cart_block dd#cart_block_combination_of_' + domIdProduct).append(customizationFormatedDatas);
else
$('#cart_block dl.products').append(customizationFormatedDatas);
$('#'+parentId+' #cart_block dl.products').append(customizationFormatedDatas);
}
else
$('#cart_block ul#customization_' + domIdProductAttribute).append(customizationFormatedDatas);
$('#'+parentId+' #cart_block ul#customization_' + domIdProductAttribute).append(customizationFormatedDatas);
}
}
}
$('#cart_block dl.products .hidden').slideDown('slow').removeClass('hidden');
$('#'+parentId+' #cart_block dl.products .hidden').slideDown('slow').removeClass('hidden');
var removeLinks = $('#cart_block_product_' + domIdProduct).find('a.ajax_cart_block_remove_link');
var removeLinks = $('#'+parentId+' #cart_block_product_' + domIdProduct).find('a.ajax_cart_block_remove_link');
if (this.hasCustomizedDatas && removeLinks.length)
$(removeLinks).each(function() {
$(this).remove();
});
}
});
});
},
displayNewCustomizedDatas : function(product)
{
$(['left_column', 'right_column']).each(function(id, parentId)
{
var content = '';
var productId = parseInt(product.id);
var productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
var hasAlreadyCustomizations = $('#cart_block ul#customization_' + productId + '_' + productAttributeId).length;
var hasAlreadyCustomizations = $('#'+parentId+' #cart_block ul#customization_' + productId + '_' + productAttributeId).length;
if (!hasAlreadyCustomizations)
{
@@ -498,7 +511,7 @@ var ajaxCart = {
customizationId = parseInt(this.customizationId);
productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
// If the customization is already displayed on the cart, no update's needed
if($('#cart_block').find("div[id^=deleteCustomizableProduct_" + customizationId + "_]").length)
if($('#'+parentId+' #cart_block').find("div[id^=deleteCustomizableProduct_" + customizationId + "_]").length)
return ('');
content += '<li name="customization"><div class="deleteCustomizableProduct" id="deleteCustomizableProduct_' + customizationId + '_' + productId + '_' + (productAttributeId ? productAttributeId : '0') + '"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseDir + 'index.php?controller=cart&amp;delete&amp;id_product=' + productId + '&amp;ipa=' + productAttributeId + '&amp;id_customization=' + customizationId + '&amp;token=' + static_token + '"> </a></div><span class="quantity-formated"><span class="quantity">' + parseInt(this.quantity) + '</span>x</span>';
@@ -524,8 +537,8 @@ var ajaxCart = {
// Field cleaning
if (customizationId)
{
$('#uploadable_files li div.customizationUploadBrowse img').remove();
$('#text_fields li input').attr('value', '');
$('#'+parentId+' #uploadable_files li div.customizationUploadBrowse img').remove();
$('#'+parentId+' #text_fields li input').attr('value', '');
}
});
@@ -535,6 +548,7 @@ var ajaxCart = {
if (!product.hasAttributes) content += '</dd>';
}
return (content);
});
},
@@ -558,10 +572,13 @@ var ajaxCart = {
ajaxCart.refreshVouchers(jsonData);
//update 'first' and 'last' item classes
$('#cart_block dl.products dt').removeClass('first_item').removeClass('last_item').removeClass('item');
$('#cart_block dl.products dt:first').addClass('first_item');
$('#cart_block dl.products dt:not(:first,:last)').addClass('item');
$('#cart_block dl.products dt:last').addClass('last_item');
$(['left_column', 'right_column']).each(function(id, parentId)
{
$('#'+parentId+' #cart_block dl.products dt').removeClass('first_item').removeClass('last_item').removeClass('item');
$('#'+parentId+' #cart_block dl.products dt:first').addClass('first_item');
$('#'+parentId+' #cart_block dl.products dt:not(:first,:last)').addClass('item');
$('#'+parentId+' #cart_block dl.products dt:last').addClass('last_item');
});
//reset the onlick events in relation to the cart block (it allow to bind the onclick event to the new 'delete' buttons added)
ajaxCart.overrideButtonsInThePage();
+13
View File
@@ -0,0 +1,13 @@
<?php
require_once(realpath(dirname(__FILE__).'/../../config/config.inc.php'));
require_once(realpath(dirname(__FILE__).'/../../init.php'));
require_once(realpath(dirname(__FILE__).'/dejala.php'));
$params['cart'] = new Cart($cookie->id_cart);
$djl = new Dejala() ;
$result = array() ;
$djl->hookProcessCarrier($params) ;
echo json_encode($result);
+9
View File
@@ -74,6 +74,7 @@ class CalendarUtils
return $dateUtc ;
}
public function skipCurDay($dateUtc)
{
$currentDayZero = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
@@ -84,6 +85,7 @@ class CalendarUtils
}
return $dateUtc ;
}
/**
* Renvoie la prochaine journée disponible (soit $dateUtc, soit la prochaine à 00h00)
* Si aucune ds les 15j, renvoie NULL
@@ -97,6 +99,7 @@ class CalendarUtils
$loopcount = 0;
// on positionne au début de journée
$dateUtc = mktime(0, 0, 0, date('m', $dateUtc), date('d', $dateUtc), date('Y', $dateUtc));
// on boucle pour trouver une journée dispo (si ds les 15j, y a pas : on laisse tomber
do
{
@@ -107,6 +110,7 @@ class CalendarUtils
while (!$isDateFree && ($loopcount < 15) );
if ($isDateFree)
return ($dateUtc);
return (NULL);
}
@@ -117,10 +121,13 @@ class CalendarUtils
{
// jour ferié ?
$mCalDate = date("d/m/Y", $dateUtc);
if (in_array($mCalDate, $exceptions))
return (false);
// jour fermé ?
$wd = date('w', $dateUtc);
if (!isset($calendar[$wd]))
return (false);
@@ -128,8 +135,10 @@ class CalendarUtils
$stopHour = (int)($calendar[$wd]['stop_hour']);
$currentHour = (int)(date('H', $dateUtc));
$currentMin = (int)(date('i', $dateUtc));
if ($currentMin > 0)
$currentHour = $currentHour + 1;
// avant l'heure de fermeture ?
if ($currentHour <= $stopHour)
return (true);
+376 -377
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

+97 -23
View File
@@ -1,56 +1,130 @@
<script>
<link href="{$timetable_css}" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript">
// <![CDATA[
var djl_calendar = new Array({foreach from=$dates item=dateItem name=datesLoop}{if !$smarty.foreach.datesLoop.first}, {/if}new Array("{$dateItem.label}", "{$dateItem.value}", {$dateItem.start_hour}, {$dateItem.stop_hour}){/foreach} );
var deliveryDateSelected = {$deliveryDateIndexSelected};
var deliveryHourSelected = {$deliveryHourSelected|intval};
var djlAjaxStoreUrl = '{$module_dir}' + 'ajaxStoreShippingInfo.php' ;
var djlIsOpc = false ;
{if $opc}
djlIsOpc = true ;
{/if}
function DJLupdateCarrierSelectionAndGift() {
if (djlIsOpc) {
djlUpdateCarrierInfo() ;
updateCarrierSelectionAndGift();
}
}
//]]>
</script>
<script type="text/javascript" src="{$timetable_js}"></script>
<link href="{$timetable_css}" rel="stylesheet" type="text/css" media="all" />
{literal}
<script>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
$('input[name="id_carrier"]').each(function(idx, elt) {
if ($(this).parent().hasClass("dejala")) {
if ($(this).get(0).checked) {
toggle_visibility('shipping_pref','1');
}
$(this).click(function() {
toggle_visibility('shipping_pref', 1);
$('div#djl_shipping_pref').show('fast') ;
selectDay();
});
if ($(this).is(':checked')) {
$(this).click() ;
}
else {
$('div#djl_shipping_pref').hide() ;
}
}
else {
$(this).click(function() {
toggle_visibility('shipping_pref', 0);
$('div#djl_shipping_pref').hide('fast') ;
});
}
}) ;
var mHour = deliveryHourSelected;
selectDay(deliveryDateSelected);
selectHour(mHour);
});
function hideUnusedHours(selectedDay) {
entries = jQuery.grep(djl_calendar, function (elt, idx) { if (elt[1] == selectedDay) return true; }) ;
$('#shipping_hours div input').parent().addClass("hidden") ;
$(entries).each(function(idxEach, eltEach) {
$(jQuery.grep($('#shipping_hours div input'), function (elt, idx) { if ($(elt).val() >=eltEach[2] && $(elt).val() <=eltEach[3]) return true; })).parent().removeClass("hidden");
}) ;
}
function selectDay() {
$('#shipping_dates div input').parent().removeClass("djl_active") ;
if ($('#shipping_dates div input:checked').length == 0) {
$('#shipping_dates div input').val([$($('#shipping_dates div input')[0]).val()]) ;
}
$('#shipping_dates div input:checked').parent().addClass("djl_active") ;
hideUnusedHours($('#shipping_dates div input:checked').val()) ;
if ($('#shipping_hours div input:checked').parent().is(':visible')) {
$('#shipping_hours div input').val([$($('#shipping_hours div input:checked')[0]).val()]) ;
}
else {
$('#shipping_hours div input').val([$($('#shipping_hours div input:visible')[0]).val()]) ;
}
selectHour() ;
}
function selectHour() {
$('#shipping_hours div input').parent().removeClass("djl_active") ;
$('#shipping_hours div input:checked').parent().addClass("djl_active") ;
if (djlIsOpc) {
djlUpdateCarrierInfo();
}
}
function djlUpdateCarrierInfo() {
$.ajax({
type: 'POST',
url: djlAjaxStoreUrl,
async: true,
cache: false,
dataType : "json",
data: {
'dejala_id_carrier' : $('input[name=dejala_id_carrier]').val(),
'dejala_id_product' : $('input[name=dejala_id_product]').val(),
'shipping_day' : $('input[name=shipping_day]:checked').val(),
'shipping_hour' : $('input[name=shipping_hour]:checked').val(),
'id_carrier' : $('input[name=id_carrier]:checked').val()
},
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to update Dejala shipping information \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
//]]>
</script>
{/literal}
{*
switchDay(deliveryDateSelected);
switchHours(deliveryHourSelected);
toggleShipping();
*}
{foreach from=$carriers item=carrier name=myLoop}
{foreach from=$djlCarriers item=carrier name=myLoop}
<tr class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{/if} {if $smarty.foreach.myLoop.index % 2}alternate_item{else}item{/if}">
<td class="carrier_action radio dejala">
<input type="hidden" name="dejala_id_carrier" value="{$carrier.id_carrier|intval}"/>
<input type="hidden" name="dejala_id_product" value="{$product.id|intval}"/>
<input type="radio" name="id_carrier" value="{$carrier.id_carrier|intval}" id="id_carrier{$carrier.id_carrier|intval}" {if $my_carrier_selected}checked="checked"{/if}"/>
<input type="radio" name="id_carrier" value="{$carrier.id_carrier|intval}" id="id_carrier{$carrier.id_carrier|intval}" {if $carrier.id_carrier == $djlCarrierChecked}checked="checked"{/if} onclick="javascript:DJLupdateCarrierSelectionAndGift();"/>
</td>
<td class="carrier_name">
<label for="id_carrier{$carrier.id_carrier|intval}">
{if $carrier.img}<img src="{$carrier.img|escape:'htmlall':'UTF-8'}" alt="{$carrier.name|escape:'htmlall':'UTF-8'}" />{else}{$carrier.name|escape:'htmlall':'UTF-8'}{/if}
</label>
</td>
<td class="carrier_infos">{$carrier.delay|escape:'htmlall':'UTF-8'}</td>
<td class="carrier_infos">{$carrier.info|escape:'htmlall':'UTF-8'}</td>
<td class="carrier_price">
{if $carrier.price}
<span class="price">
+2 -2
View File
@@ -1,9 +1,9 @@
{foreach from=$carriers item=carrier name=myLoop}
{foreach from=$djlCarriers item=carrier name=myLoop}
<tr class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{/if} {if $smarty.foreach.myLoop.index % 2}alternate_item{else}item{/if}">
<td class="carrier_action radio dejala">
<input type="hidden" name="dejala_id_carrier" value="{$carrier.id_carrier|intval}"/>
<input type="hidden" name="dejala_id_product" value="{$product.id|intval}"/>
<input type="radio" name="id_carrier" value="{$carrier.id_carrier|intval}" id="id_carrier{$carrier.id_carrier|intval}" {if $carrier.id_carrier == $checked}checked="checked"{/if} />
<input type="radio" name="id_carrier" value="{$carrier.id_carrier|intval}" id="id_carrier{$carrier.id_carrier|intval}" {if $carrier.id_carrier == $djlCarrierChecked}checked="checked"{/if} />
</td>
<td class="carrier_name">
<label for="id_carrier{$carrier.id_carrier|intval}">
+11 -7
View File
@@ -1,21 +1,26 @@
{* MFR081028 - information de shipping *}
<tr style="border-top: 0px solid #bdc2c9;">
<td colspan="4" style="border-top: 0px solid #bdc2c9;width:100%;padding:0px 2px 0px 2px;">
<div id="shipping_pref" {if !$my_carrier_selected}style="display:none;"{/if}>
<div id="djl_shipping_pref" class="{if $djlCarrierChecked < 0}hidden{/if}">
<div id="shipping_div">
<div id="shipping_dates">
<div id="shipping_dates" class="{if $isCartOutOfStock}disabled{/if}">
<label class="title">{l s='Choose your delivery day' mod='dejala'}:</label><br class="clear"/>
{foreach from=$dates item=dateItem name=dateLabelLoop}
{assign var='curIdxDate' value=$smarty.foreach.dateLabelLoop.index}
<div><label><input type="radio" name="shipping_day" id="shipd{$curIdxDate}" value="{$dateItem.value}" onClick="selectDay({$curIdxDate});" {if ($deliveryDateSelected==$dateItem.value)}checked="checked" {/if}/> {$dateItem.label}</label></div>
<div>
<input type="radio" name="shipping_day" id="shipd{$curIdxDate}" autocomplete="off" value="{$dateItem.value}" onClick="selectDay();" {if ($deliveryDateSelected==$dateItem.value)}checked="checked"{/if} {if $isCartOutOfStock}disabled="disabled"{/if}/>
<label for="shipd{$curIdxDate}">{$dateItem.label}</label>
</div>
{/foreach}
</div>
<div id="shipping_hours">
<div id="shipping_hours" class="{if $isCartOutOfStock}disabled{/if}">
<label class="title">{l s='Choose you delivery timeslot' mod='dejala'}:</label><br class="clear"/>
{section name=hour start=0 loop=24 step=1}
{assign var='curIdxhour' value=$smarty.section.hour.index}
<div id="divhr{$curIdxhour}"><label><input type="radio" name="shipping_hour" id="shiphr{$curIdxhour}" value="{$curIdxhour}" OnClick="selectHour({$curIdxhour});" {if ($deliveryHourSelected==$curIdxhour)}checked="checked"{/if}/> {$hourLabels.$curIdxhour}</label></div>
<div id="divhr{$curIdxhour}">
<input type="radio" name="shipping_hour" id="shiphr{$curIdxhour}" autocomplete="off" value="{$curIdxhour}" OnClick="selectHour();" {if ($deliveryHourSelected==$curIdxhour)}checked="checked"{/if} {if $isCartOutOfStock}disabled="disabled"{/if}/>
<label for="shiphr{$curIdxhour}">{$hourLabels.$curIdxhour}</label>
</div>
{/section}
</div>
</div>
@@ -24,4 +29,3 @@
</td>
</tr>
{* MFR081028 - information de shipping *}
+54 -21
View File
@@ -6,7 +6,7 @@
class DejalaCarrierUtils
{
/**
* creates of a dejala carrier corresponding to $dejalaProduct
* creates a dejala carrier corresponding to $dejalaProduct
*/
public static function createDejalaCarrier($dejalaConfig)
{
@@ -43,7 +43,7 @@ class DejalaCarrierUtils
$tr->id_tax_rules_group = $trg_id;
$tr->id_country = (int) $countryID;
$tr->id_state = 0;
$tr->id_tax = (int)$tax->id;
$tr->id_tax = (int)$tax->id;
$tr->state_behavior = 0;
$tr->save();
}
@@ -65,35 +65,68 @@ class DejalaCarrierUtils
$languages = Language::getLanguages(true);
foreach ($languages as $language)
$carrier->delay[$language['id_lang']] = 'Dejala' ;
$carrier->add();
$carrier->addZone((int)$id_zone) ;
/*$sql = 'INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier` , `id_zone`) VALUES ('.(int)($carrier->id).', ' . (int)($id_zone) . ')';
Db::getInstance()->execute($sql);
$rangeW = new RangeWeight();
$rangeW->id_carrier = $carrier->id;
$rangeW->delimiter1 = 0;
$rangeW->delimiter2 = $dejalaProduct['max_weight'];
$rangeW->add();
$vat_factor = (1+ ($dejalaProduct['vat'] / 100));
$priceTTC = round(($dejalaProduct['price']*$vat_factor) + $dejalaProduct['margin'], 2);
$priceHT = round($priceTTC/$vat_factor, 2);
$priceList = '(NULL'.','.$rangeW->id.','.$carrier->id.','.$id_zone.','.$priceHT.')';
$carrier->addDeliveryPrice($priceList);*/
$groups = Group::getGroups(true);
foreach ($groups as $group)
Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier_group', array('id_carrier' => (int)($carrier->id), 'id_group' => (int)($group['id_group'])), 'INSERT');
// $rangeW = new RangeWeight();
// $rangeW->id_carrier = $carrier->id;
// $rangeW->delimiter1 = 0;
// $rangeW->delimiter2 = $dejalaProduct['max_weight'];
// $rangeW->add();
// $vat_factor = (1+ ($dejalaProduct['vat'] / 100));
// $priceTTC = round(($dejalaProduct['price']*$vat_factor) + $dejalaProduct['margin'], 2);
// $priceHT = round($priceTTC/$vat_factor, 2);
// $priceList = '(NULL'.','.$rangeW->id.','.$carrier->id.','.$id_zone.','.$priceHT.')';
// $carrier->addDeliveryPrice($priceList);
return true;
}
public static function getCarrierByName($name)
{
$carriers = Carrier::getCarriers(Context::getContext()->language->id, true, false, false, null, Carrier::ALL_CARRIERS);
foreach($carriers as $carrier)
if (!$carrier['deleted'] AND $carrier['external_module_name'] == $name)
public static function getCarrierByName($name, $includeInactive = false) {
global $cookie ;
$carriers = Carrier::getCarriers((int)$cookie->id_lang, false, false, false, NULL, ALL_CARRIERS);
foreach($carriers as $carrier) {
if ($carrier['deleted']) continue ;
if ($includeInactive !== true && $carrier['active'] != 1) continue ;
if (self::getCarrierName($carrier) == $name) {
return new Carrier((int)$carrier['id_carrier']) ;
}
}
return null ;
}
public static function getFirstActiveCarrierWithNameNotBeing($name) {
global $cookie ;
$carriers = Carrier::getCarriers((int)$cookie->id_lang, false, false, false, NULL, ALL_CARRIERS);
foreach($carriers as $carrier) {
if ($carrier['deleted']) continue ;
if ((self::getCarrierName($carrier) != $name) && $carrier['active'] == 1) {
return new Carrier((int)$carrier['id_carrier']) ;
}
}
return null ;
}
public static function getCarrierName($carrier) {
if (is_object($carrier)) {
if (!empty($carrier->external_module_name)) return $carrier->external_module_name ;
return $carrier->name ;
}
else {
if (array_key_exists("external_module_name", $carrier) && !empty($carrier['external_module_name'])) return $carrier['external_module_name'] ;
return $carrier['name'] ;
}
}
}
-1
View File
@@ -113,7 +113,6 @@ class DejalaConfig
if ($this->useSSL !== 0)
if (0 === strpos($l_serviceURL, 'http:'))
$l_serviceURL = 'https'.substr($l_serviceURL, 4);
return ($l_serviceURL);
}
}
+27 -16
View File
@@ -45,7 +45,6 @@ class DejalaUtils
$responseArray = $this->makeRequest($dejalaConfig, $serviceURL, $postargs, 'POST', FALSE);
return ($responseArray);
}
public static function wtf($var, $arrayOfObjectsToHide=null, $fontSize=11)
{
$text = print_r($var, true);
@@ -114,7 +113,6 @@ class DejalaUtils
if ($nodeList->length > 0)
foreach ($nodeList as $element)
$calendar['exceptions'][] = $this->getNodeValue($element);
}
return ($responseArray);
}
@@ -143,7 +141,6 @@ class DejalaUtils
if ($nodeList)
foreach ($nodeList as $element)
$currentContactNode[$element->nodeName] = $element->textContent;
$contacts[$name] = $currentContactNode;
}
}
@@ -184,19 +181,19 @@ class DejalaUtils
{
if (($a['price'] == $b['price']))
return ($a['id'] < $b['id']) ? -1 : 1 ;
return ($a['price'] < $b['price']) ? -1 : 1 ;
}
return ($a['priority'] < $b['priority']) ? -1 : 1;
}
public function getStoreQuotation($dejalaConfig, $quotationElements, &$products)
public function getStoreQuotation($dejalaConfig, $quotationElements, &$products, &$storeAttributes)
{
$serviceURL = $dejalaConfig->getRootServiceURI() . '/mystore/quotation';
$serviceURL = $dejalaConfig->getRootServiceURI() . '/mystore/quotationV2';
$postargs = $quotationElements;
$responseArray = $this->makeRequest($dejalaConfig, $serviceURL, $postargs, 'GET', TRUE);
if (!($xml = strstr($responseArray['response'], '<?xml')))
if (!($xml = strstr($responseArray['response'], '<?xml'))) {
$xml = null;
}
else
{
$doc = new DOMDocument();
@@ -206,17 +203,27 @@ class DejalaUtils
{
$currentProduct = $this->getNodeValue($productNode);
unset($currentProduct['calendar']['entries']['entry']);
$calendarNodeList = $doc->getElementsByTagName('entry');
foreach ($calendarNodeList as $calendarNode)
{
unset($currentProduct['computed_calendar']['entries']['entry']);
$productCalendars = $productNode->getElementsByTagName('calendar');
$calendarNodeList = $productCalendars->item(0)->getElementsByTagName('entry');
foreach ($calendarNodeList as $calendarNode) {
$calendarEntry = $this->getNodeValue($calendarNode);
$currentProduct['calendar']['entries'][$calendarEntry['weekday']] = $calendarEntry;
}
$exceptionNodeList = $doc->getElementsByTagName('exception');
$currentProduct['calendar']['exceptions'] = array();
foreach ($exceptionNodeList as $exceptionNode)
foreach ($exceptionNodeList as $exceptionNode) {
$currentProduct['calendar']['exceptions'][] = $this->getNodeValue($exceptionNode);
}
$productComputedCalendars = $productNode->getElementsByTagName('computed_calendar');
if ($productComputedCalendars->length > 0) {
$calendarNodeList = $productComputedCalendars->item(0)->getElementsByTagName('computed_entry');
foreach ($calendarNodeList as $calendarNode) {
$calendarEntry = $this->getNodeValue($calendarNode);
$currentProduct['computed_calendar']['entries'][] = $calendarEntry;
}
}
/*$currentProduct = array();
$nodeList = $productNode->childNodes;
foreach ($nodeList as $element) {
@@ -226,8 +233,17 @@ class DejalaUtils
if (count($currentProduct))
$products[] = $currentProduct;
}
$nodeList = $doc->getElementsByTagName('store');
if ($nodeList->length > 0) {
$nodeList = $nodeList->item(0)->getElementsByTagName('attributes');
if ($nodeList->length > 0) {
$storeAttributes = $this->getNodeValue($nodeList->item(0));
}
}
}
usort($products, array("DejalaUtils", "cmpProducts"));
return ($responseArray);
}
@@ -248,13 +264,11 @@ class DejalaUtils
$childNodes = $fatherNodeList->item(0)->childNodes;
foreach ($childNodes as $childNode)
$store[$childNode->nodeName] = $childNode->textContent;
}
$nodeList = $doc->getElementsByTagName('attributes');
$store['attributes'] = array();
if ($nodeList->length > 0)
$store['attributes'] = $this->getNodeValue($nodeList->item(0));
}
return ($responseArray);
}
@@ -362,7 +376,6 @@ class DejalaUtils
$childNodes = $doc->getElementsByTagName('delivery');
foreach ($childNodes as $childNode)
$deliveries[] = $this->getNodeValue($childNode);
}
return ($responseArray);
}
@@ -479,11 +492,9 @@ class DejalaUtils
public function mylog($msg)
{
require_once(dirname(__FILE__) . "/MyLogUtils.php");
$myFile = dirname(__FILE__) . "/logFile.txt";
MyLogUtils::myLog($myFile, $msg);
}
// get a string of a value for Log purposes
+2 -2
View File
@@ -9,7 +9,7 @@ $_MODULE['<{dejala}prestashop>dejala_796c163589f295373e171842f37265d5'] = 'Mercr
$_MODULE['<{dejala}prestashop>dejala_78ae6f0cd191d25147e252dc54768238'] = 'Jeudi';
$_MODULE['<{dejala}prestashop>dejala_c33b138a163847cdb6caeeb7c9a126b4'] = 'Vendredi';
$_MODULE['<{dejala}prestashop>dejala_8b7051187b9191cdcdae6ed5a10e5adc'] = 'Samedi';
$_MODULE['<{dejala}prestashop>dejala_9902522831a16af239ba868918f984c6'] = 'dejala.com : le transport par coursier';
$_MODULE['<{dejala}prestashop>dejala_9902522831a16af239ba868918f984c6'] = 'Dejala.com : le transport par coursier';
$_MODULE['<{dejala}prestashop>dejala_69a226fe54256a93edb693bc97a7bcb5'] = 'Envoie les demandes de livraisons vers dejala.com';
$_MODULE['<{dejala}prestashop>dejala_f66e08578735b3cde28a2d8215b68a52'] = 'Le module nécessite l\'extension php Dejala cURL pour fonctionner correctement. Merci d\'installer l\'extension php \"curl \"';
$_MODULE['<{dejala}prestashop>dejala_0e334c81db8c621e16d82618aaf746ab'] = 'Entrez votre nom d\'utilisateur';
@@ -32,8 +32,8 @@ $_MODULE['<{dejala}prestashop>dejala_dfa53d8241c9f6908e669371b50e95f3'] = 'Ce mo
$_MODULE['<{dejala}prestashop>dejala_4c7d16a1e83bcbfd9b33e95f8e90a625'] = 'Une erreur est survenue lors de l\'authentification de votre compte sur Dejala.com. Ceci peut être du à une erreur réseau ou à un problème de plate-forme. Réessayez plus tard ou contactez Dejala.com.';
$_MODULE['<{dejala}prestashop>dejala_94939d114a8c65173b70b6e01aad11c0'] = 'Une erreur est survenue lors de la récupération des informations. Réessayez plus tard ou contactez Dejala.com.';
$_MODULE['<{dejala}prestashop>dejala_41d211dd68bf0f87cf3181b0c8dac6e7'] = 'Dejala.com';
$_MODULE['<{dejala}prestashop>dejala_3d8764621d6076807b0d60cfcadb7213'] = 'Quand vous voulez... Par coursier';
$_MODULE['<{dejala}prestashop>dejala_627db4c965627fb7f03682dbbc43a4a1'] = 'Je choisirai mon heure de livraison quand mon colis sera prêt.';
$_MODULE['<{dejala}prestashop>dejala_3d8764621d6076807b0d60cfcadb7213'] = 'Quand vous voulez... Par coursier';
$_MODULE['<{dejala}prestashop>dejala_07e9ea0147aee652244a280da00efb5a'] = 'Livraison souhaitée le';
$_MODULE['<{dejala}prestashop>dejala_47a4dfe5ab79feb7884fa57786ea587c'] = 'à partir de';
$_MODULE['<{dejala}prestashop>dejala_ba93cc89ba75ee6e74699a49a69c0600'] = 'Livraison dont la date doit être fixée avec le client.';
+21 -15
View File
@@ -1,23 +1,15 @@
/* MFR081108 - Shipping Preferences */
#shipping_now {
width:99%;
height:25px;
border:1px solid lightgrey;
margin-top:5;
padding-top:10px;
}
#shipping_div {
#djl_shipping_pref #shipping_div {
width:100%;
}
#shipping_dates {
#djl_shipping_pref #shipping_dates {
width:100%;
float:left;
border:1px solid lightgrey;
}
#shipping_dates div {
#djl_shipping_pref #shipping_dates div {
height:25px;
width:24.9%;
margin-top:5px;
@@ -25,25 +17,39 @@
padding-top:10px;
}
#shipping_hours {
#djl_shipping_pref #shipping_hours {
float:left;
width:100%;
border:1px solid lightgrey;
margin-top:5px;
}
#shipping_hours div {
#djl_shipping_pref #shipping_hours div {
height:31px;
width:19.9%;
float:left;
padding-top:10px;
}
.title {
#djl_shipping_pref .title {
margin:5px;
font-size:1.1em;
font-weight:bold;
color:#993300;
}
#shipping_pref input {border:none;}
#djl_shipping_pref input {border:none;}
#djl_shipping_pref #shipping_hours div[class=djl_active], #djl_shipping_pref #shipping_dates div[class=djl_active] {
font-weight: bold;
color: rgb(153, 51, 0);
}
#djl_shipping_pref .disabled {
zoom: 1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
+7 -1
View File
@@ -293,7 +293,13 @@ class importerosc extends ImportModule
$images[] = Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$res['image'];
$product['images'] = array_merge(array($product['images']), $images);
$product['link_rewrite'] = Tools::link_rewrite($product['name']);
$product['association'] = array('category_product' => array($product['id_category_default'] => $product['id_product']));
$result = $this->ExecuteS('SELECT `categories_id` FROM `'.bqSQL($this->prefix).'products_to_categories` WHERE products_id = '.(int)$product['id_product']);
$category_product = array('category_product' => array($product['id_category_default'] => $product['id_product']));
foreach($result as $res)
$category_product['category_product'][$res['categories_id']] = $product['id_product'];
$product['association'] = $category_product;
}
return $this->autoFormat($products, $identifier, $keyLanguage, $multiLangFields);
}
+7 -1
View File
@@ -56,7 +56,7 @@ class ProductToolTip extends Module
Configuration::updateValue('PS_PTOOLTIP_DAYS', 3);
Configuration::updateValue('PS_PTOOLTIP_LIFETIME', 30);
return $this->registerHook('productfooter');
return $this->registerHook('header') AND $this->registerHook('productfooter');
}
public function uninstall()
@@ -131,6 +131,12 @@ class ProductToolTip extends Module
return $output;
}
public function hookHeader($params)
{
Tools::addCSS(__PS_BASE_URI__.'css/jquery.jgrowl.css', 'all');
Tools::addJS(__PS_BASE_URI__.'js/jquery/jquery.jgrowl-1.2.1.min.js');
}
public function hookProductFooter($params)
{
$id_product = (int)($params['product']->id);
@@ -24,9 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript" src="{$base_dir}js/jquery/jquery.jgrowl-1.2.1.min.js"></script>
<link href="{$base_dir}css/jquery.jgrowl.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {ldelim}
{if isset($nb_people)}$.jGrowl('{$nb_people} {if $nb_people == 1}{l s='person is currently watching' mod='producttooltip'}{else}{l s='people are currently watching' mod='producttooltip'}{/if} {l s='this product' mod='producttooltip'}', {literal}{ life: 3500 }{/literal});{/if}
+4 -1
View File
@@ -210,6 +210,8 @@ var shopImporter = {
if (isOk)
{
shopImporter.syncCurrency(function(isOk) {
if (isOk)
{
$.ajax({
type: 'GET',
url: '../modules/shopimporter/ajax.php',
@@ -268,6 +270,7 @@ var shopImporter = {
$('#technical_error_feedback').fadeIn('slow');
}
});
}
});
}
});
@@ -692,7 +695,7 @@ function validateSpecificOptions(moduleName, specificOptions)
async: false,
cache: false,
dataType : 'json',
data: 'ajax=true&token='+this.token+'&validateSpecificOptions&moduleName='+moduleName+specificOptions ,
data: 'ajax=true&token='+token+'&validateSpecificOptions&moduleName='+moduleName+specificOptions ,
success: function(jsonData)
{
var jsonError = '';
+1
View File
@@ -1265,6 +1265,7 @@ class shopimporter extends ImportModule
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
Image::clearTmpDir();
@mkdir(_PS_PROD_IMG_DIR_);
break;
case 'manufacturer' :
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer');
+1 -1
View File
@@ -61,7 +61,7 @@
{if $type == $smarty.const._CUSTOMIZE_FILE_}
<ul class="customizationUploaded">
{foreach from=$datas item='data'}
<li>WAHOU<img src="{$pic_dir}{$data.value}_small" alt="" class="customizationUploaded" /></li>
<li><img src="{$pic_dir}{$data.value}_small" alt="" class="customizationUploaded" /></li>
{/foreach}
</ul>
{elseif $type == $smarty.const._CUSTOMIZE_TEXTFIELD_}