// 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:
1 parent
43958d54e7
commit
42564ca3d0
34 files changed
+679
-398
No files matched your search
@@ -35,8 +35,13 @@ $errors = array();
|
|||||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||||
$iso = strtolower(Language::getIsoById((int)$id_lang));
|
$iso = strtolower(Language::getIsoById((int)$id_lang));
|
||||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||||
|
/* PrestaShop demo mode */
|
||||||
if (isset($_POST['Submit']))
|
if (_PS_MODE_DEMO_)
|
||||||
|
{
|
||||||
|
$errors[] = Tools::displayError('This functionnality has been disabled.');
|
||||||
|
}
|
||||||
|
/* PrestaShop demo mode*/
|
||||||
|
else if (isset($_POST['Submit']))
|
||||||
{
|
{
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if (empty($_POST['email']))
|
if (empty($_POST['email']))
|
||||||
|
|||||||
@@ -255,6 +255,14 @@ class AdminAccess extends AdminTab
|
|||||||
|
|
||||||
public function ajaxProcess()
|
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 ($this->tabAccess['edit'] == 1)
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('submitAddaccess'))
|
if (Tools::isSubmit('submitAddaccess'))
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ class AdminAttachments extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
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 (Tools::isSubmit('submitAdd'.$this->table))
|
||||||
{
|
{
|
||||||
if ($id = (int)(Tools::getValue('id_attachment')) AND $a = new Attachment($id))
|
if ($id = (int)(Tools::getValue('id_attachment')) AND $a = new Attachment($id))
|
||||||
|
|||||||
@@ -54,6 +54,14 @@ class AdminDb extends AdminPreferences
|
|||||||
|
|
||||||
public function postProcess()
|
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 (isset($_POST['submitDatabase'.$this->table]))
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['edit'] === '1')
|
if ($this->tabAccess['edit'] === '1')
|
||||||
|
|||||||
@@ -66,6 +66,14 @@ class AdminEmails extends AdminPreferences
|
|||||||
|
|
||||||
public function beforeUpdateOptions()
|
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'])))
|
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.');
|
$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()
|
public function display()
|
||||||
{
|
{
|
||||||
parent::display();
|
parent::display();
|
||||||
|
|
||||||
$this->_displayMailTest();
|
$this->_displayMailTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,14 @@ class AdminEmployees extends AdminTab
|
|||||||
$this->context = Context::getContext();
|
$this->context = Context::getContext();
|
||||||
if (Tools::isSubmit('deleteemployee') || Tools::isSubmit('status') || Tools::isSubmit('statusemployee'))
|
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'))
|
if ($this->context->employee->id == Tools::getValue('id_employee'))
|
||||||
{
|
{
|
||||||
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
|
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
|
||||||
|
|||||||
@@ -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');
|
||||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
|
||||||
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
|
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
|
||||||
|
mkdir(_PS_PROD_IMG_DIR_);
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Customers')]:
|
case $this->entities[$this->l('Customers')]:
|
||||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
|
||||||
@@ -1770,6 +1771,14 @@ class AdminImport extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
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 (Tools::isSubmit('submitFileUpload'))
|
||||||
{
|
{
|
||||||
if (isset($_FILES['file']) AND !empty($_FILES['file']['error']))
|
if (isset($_FILES['file']) AND !empty($_FILES['file']['error']))
|
||||||
|
|||||||
@@ -223,6 +223,13 @@ class AdminModules extends AdminTab
|
|||||||
/* Automatically copy a module from external URL and unarchive it in the appropriated directory */
|
/* Automatically copy a module from external URL and unarchive it in the appropriated directory */
|
||||||
if (Tools::isSubmit('submitDownload'))
|
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 ($this->tabAccess['add'] === '1')
|
||||||
{
|
{
|
||||||
if (Validate::isModuleUrl($url = Tools::getValue('url'), $this->_errors))
|
if (Validate::isModuleUrl($url = Tools::getValue('url'), $this->_errors))
|
||||||
@@ -238,6 +245,13 @@ class AdminModules extends AdminTab
|
|||||||
}
|
}
|
||||||
if (Tools::isSubmit('submitDownload2'))
|
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 ($this->tabAccess['add'] === '1')
|
||||||
{
|
{
|
||||||
if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
|
if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ class AdminProfiles extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
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_))
|
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');
|
$this->_errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ class AdminTabs extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
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 (($id_tab = (int)(Tools::getValue('id_tab'))) AND ($direction = Tools::getValue('move')) AND Validate::isLoadedObject($tab = new Tab($id_tab)))
|
||||||
{
|
{
|
||||||
if ($tab->move($direction))
|
if ($tab->move($direction))
|
||||||
|
|||||||
@@ -424,6 +424,14 @@ class AdminTranslations extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
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 (Tools::isSubmit('submitCopyLang'))
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['add'] === '1')
|
if ($this->tabAccess['add'] === '1')
|
||||||
|
|||||||
@@ -641,8 +641,7 @@ abstract class AdminTabCore
|
|||||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||||
else
|
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_identifier = (int)(Tools::getValue($this->identifier))) ? ('&'.$this->identifier.'='.$id_identifier) : '').'&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);
|
|
||||||
}
|
}
|
||||||
/* Delete multiple objects */
|
/* Delete multiple objects */
|
||||||
elseif (Tools::getValue('submitDel'.$this->table))
|
elseif (Tools::getValue('submitDel'.$this->table))
|
||||||
|
|||||||
+6
-4
@@ -1764,8 +1764,12 @@ FileETag INode MTime Size
|
|||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 'by' :
|
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 = '';
|
$orderByPrefix = '';
|
||||||
if($prefix) {
|
if ($prefix)
|
||||||
|
{
|
||||||
if ($value == 'id_product' || $value == 'date_add' || $value == 'price')
|
if ($value == 'id_product' || $value == 'date_add' || $value == 'price')
|
||||||
$orderByPrefix = 'p.';
|
$orderByPrefix = 'p.';
|
||||||
elseif ($value == 'name')
|
elseif ($value == 'name')
|
||||||
@@ -1776,9 +1780,7 @@ FileETag INode MTime Size
|
|||||||
$orderByPrefix = 'cp.';
|
$orderByPrefix = 'cp.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
|
return $orderByPrefix.$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'));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'way' :
|
case 'way' :
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
define('_PS_MODE_DEV_', true);
|
define('_PS_MODE_DEV_', true);
|
||||||
|
define('_PS_MODE_DEMO_', false);
|
||||||
|
define('_PS_DEMO_MAIN_BO_ACCOUNT_', 1);
|
||||||
|
|
||||||
$currentDir = dirname(__FILE__);
|
$currentDir = dirname(__FILE__);
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,14 @@ class AdminBackupControllerCore extends AdminController
|
|||||||
|
|
||||||
public function postProcess()
|
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
|
// 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)');
|
$this->warnings[] = $this->l('"Backups" Directory in admin directory must be writeable (CHMOD 755 / 777)');
|
||||||
|
|||||||
@@ -89,18 +89,20 @@ var ajaxCart = {
|
|||||||
|
|
||||||
// try to expand the cart
|
// try to expand the cart
|
||||||
expand : function(){
|
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');
|
$(this).addClass('collapsed').removeClass('expanded');
|
||||||
$('#cart_block #cart_block_list').slideDown({
|
$('#'+parentId+' #cart_block #cart_block_list').slideDown({
|
||||||
duration: 600,
|
duration: 600,
|
||||||
complete: function(){$(this).addClass('expanded').removeClass('collapsed');}
|
complete: function(){$(this).addClass('expanded').removeClass('collapsed');}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// toogle the button expand/collapse button
|
// toogle the button expand/collapse button
|
||||||
$('#cart_block h4 span#block_cart_expand').fadeOut('slow', function(){
|
$('#'+parentId+' #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_collapse').fadeIn('fast');
|
||||||
});
|
});
|
||||||
|
|
||||||
// save the expand statut in the user cookie
|
// save the expand statut in the user cookie
|
||||||
@@ -110,9 +112,8 @@ var ajaxCart = {
|
|||||||
async: true,
|
async: true,
|
||||||
data: 'ajax_blockcart_display=expand' + '&rand=' + new Date().getTime()
|
data: 'ajax_blockcart_display=expand' + '&rand=' + new Date().getTime()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// cart to fix display when using back and previous browsers buttons
|
// cart to fix display when using back and previous browsers buttons
|
||||||
refresh : function(){
|
refresh : function(){
|
||||||
@@ -136,6 +137,7 @@ var ajaxCart = {
|
|||||||
|
|
||||||
// try to collapse the cart
|
// try to collapse the cart
|
||||||
collapse : function(){
|
collapse : function(){
|
||||||
|
return;
|
||||||
|
|
||||||
if ($('#cart_block #cart_block_list').hasClass('expanded'))
|
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
|
//hide the products displayed in the page but no more in the json data
|
||||||
hideOldProducts : function(jsonData) {
|
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!)
|
//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)
|
if($('#cart_block #cart_block_list dl.products').length > 0)
|
||||||
{
|
{
|
||||||
@@ -270,7 +274,7 @@ var ajaxCart = {
|
|||||||
var removedProductData = null;
|
var removedProductData = null;
|
||||||
var removedProductDomId = null;
|
var removedProductDomId = null;
|
||||||
//look for a product to delete...
|
//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
|
//retrieve idProduct and idCombination from the displayed product in the block cart
|
||||||
var domIdProduct = $(this).attr('id');
|
var domIdProduct = $(this).attr('id');
|
||||||
var firstCut = domIdProduct.replace('cart_block_product_', '');
|
var firstCut = domIdProduct.replace('cart_block_product_', '');
|
||||||
@@ -303,30 +307,32 @@ var ajaxCart = {
|
|||||||
var firstCut = removedProductId.replace('cart_block_product_', '');
|
var firstCut = removedProductId.replace('cart_block_product_', '');
|
||||||
var ids = firstCut.split('_');
|
var ids = firstCut.split('_');
|
||||||
|
|
||||||
$('#'+removedProductId).addClass('strike').fadeTo('slow', 0, function(){
|
$('#'+parentId+' #'+removedProductId).addClass('strike').fadeTo('slow', 0, function(){
|
||||||
$(this).slideUp('slow', function(){
|
$(this).slideUp('slow', function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
//if the cart is now empty, show the 'no product in the cart' message
|
//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');
|
$('#'+parentId+' p#cart_block_no_products').slideDown('fast');
|
||||||
$('div#cart_block dl.products').remove();
|
$('#'+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).slideUp('fast', function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
hideOldProductCustomizations : function (product, domIdProduct)
|
hideOldProductCustomizations : function (product, domIdProduct)
|
||||||
{
|
{
|
||||||
var customizationList = $('#cart_block #cart_block_list ul#customization_' + product['id'] + '_' + product['idCombination']);
|
$(['left_column', 'right_column']).each(function(id, parentId)
|
||||||
|
{
|
||||||
|
var customizationList = $('#'+parentId+' #cart_block #cart_block_list ul#customization_' + product['id'] + '_' + product['idCombination']);
|
||||||
if(customizationList.length > 0)
|
if(customizationList.length > 0)
|
||||||
{
|
{
|
||||||
$(customizationList).find("li").each(function(){
|
$(customizationList).find("li").each(function(){
|
||||||
@@ -342,9 +348,10 @@ var ajaxCart = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
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 (!product.hasCustomizedDatas && !removeLinks.length)
|
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&delete&id_product=' + product['id'] + '&ipa=' + product['idCombination'] + '&token=' + static_token + '" title="' + removingLinkText + '"> </a>');
|
$('#'+parentId+' #' + domIdProduct + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseDir + 'index.php?controller=cart&delete&id_product=' + product['id'] + '&ipa=' + product['idCombination'] + '&token=' + static_token + '" title="' + removingLinkText + '"> </a>');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
doesCustomizationStillExist : function (product, customizationId)
|
doesCustomizationStillExist : function (product, customizationId)
|
||||||
@@ -393,7 +400,9 @@ var ajaxCart = {
|
|||||||
|
|
||||||
// Update product quantity
|
// Update product quantity
|
||||||
updateProductQuantity : function (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).text(quantity);
|
||||||
$(this).fadeTo('fast', 1, function(){
|
$(this).fadeTo('fast', 1, function(){
|
||||||
$(this).fadeTo('fast', 0, function(){
|
$(this).fadeTo('fast', 0, function(){
|
||||||
@@ -405,27 +414,29 @@ var ajaxCart = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
//display the products witch are in json data but not already displayed
|
//display the products witch are in json data but not already displayed
|
||||||
displayNewProducts : function(jsonData) {
|
displayNewProducts : function(jsonData) {
|
||||||
|
$(['left_column', 'right_column']).each(function(id, parentId)
|
||||||
|
{
|
||||||
//add every new products or update displaying of every updated products
|
//add every new products or update displaying of every updated products
|
||||||
$(jsonData.products).each(function(){
|
$(jsonData.products).each(function(){
|
||||||
//fix ie6 bug (one more item 'undefined' in IE6)
|
//fix ie6 bug (one more item 'undefined' in IE6)
|
||||||
if (this.id != undefined)
|
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)
|
//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)
|
if ($('#'+parentId+' div#cart_block dl.products').length == 0)
|
||||||
$('p#cart_block_no_products:visible').fadeTo('fast', 0, function(){
|
$('#'+parentId+' p#cart_block_no_products').fadeTo('fast', 0, function(){
|
||||||
$(this).slideUp('fast').fadeTo(0, 1);
|
$(this).slideUp('fast').fadeTo(0, 1);
|
||||||
}).before('<dl class="products"></dl>');
|
}).before('<dl class="products"></dl>');
|
||||||
|
|
||||||
//if product is not in the displayed cart, add a new product's line
|
//if product is not in the displayed cart, add a new product's line
|
||||||
var domIdProduct = this.id + (this.idCombination ? '_' + this.idCombination : '');
|
var domIdProduct = this.id + (this.idCombination ? '_' + this.idCombination : '');
|
||||||
var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0');
|
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 productId = parseInt(this.id);
|
||||||
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
|
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
|
||||||
@@ -441,51 +452,53 @@ var ajaxCart = {
|
|||||||
if (this.hasCustomizedDatas)
|
if (this.hasCustomizedDatas)
|
||||||
content += ajaxCart.displayNewCustomizedDatas(this);
|
content += ajaxCart.displayNewCustomizedDatas(this);
|
||||||
if (this.hasAttributes) content += '</dd>';
|
if (this.hasAttributes) content += '</dd>';
|
||||||
|
$('#'+parentId+' #cart_block dl.products').append(content);
|
||||||
$('#cart_block dl.products').append(content);
|
|
||||||
}
|
}
|
||||||
//else update the product's line
|
//else update the product's line
|
||||||
else{
|
else{
|
||||||
var jsonProduct = this;
|
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
|
// 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);
|
ajaxCart.updateProductQuantity(jsonProduct, jsonProduct.quantity);
|
||||||
|
|
||||||
// Customized product
|
// Customized product
|
||||||
if (jsonProduct.hasCustomizedDatas)
|
if (jsonProduct.hasCustomizedDatas)
|
||||||
{
|
{
|
||||||
customizationFormatedDatas = ajaxCart.displayNewCustomizedDatas(jsonProduct);
|
customizationFormatedDatas = ajaxCart.displayNewCustomizedDatas(jsonProduct);
|
||||||
if (!$('#cart_block ul#customization_' + domIdProductAttribute).length)
|
if (!$('#'+parentId+' #cart_block ul#customization_' + domIdProductAttribute).length)
|
||||||
{
|
{
|
||||||
if (jsonProduct.hasAttributes)
|
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
|
else
|
||||||
$('#cart_block dl.products').append(customizationFormatedDatas);
|
$('#'+parentId+' #cart_block dl.products').append(customizationFormatedDatas);
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (this.hasCustomizedDatas && removeLinks.length)
|
||||||
$(removeLinks).each(function() {
|
$(removeLinks).each(function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
displayNewCustomizedDatas : function(product)
|
displayNewCustomizedDatas : function(product)
|
||||||
|
{
|
||||||
|
$(['left_column', 'right_column']).each(function(id, parentId)
|
||||||
{
|
{
|
||||||
var content = '';
|
var content = '';
|
||||||
var productId = parseInt(product.id);
|
var productId = parseInt(product.id);
|
||||||
var productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
|
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)
|
if (!hasAlreadyCustomizations)
|
||||||
{
|
{
|
||||||
@@ -498,7 +511,7 @@ var ajaxCart = {
|
|||||||
customizationId = parseInt(this.customizationId);
|
customizationId = parseInt(this.customizationId);
|
||||||
productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
|
productAttributeId = typeof(product.idCombination) == 'undefined' ? 0 : parseInt(product.idCombination);
|
||||||
// If the customization is already displayed on the cart, no update's needed
|
// 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 ('');
|
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&delete&id_product=' + productId + '&ipa=' + productAttributeId + '&id_customization=' + customizationId + '&token=' + static_token + '"> </a></div><span class="quantity-formated"><span class="quantity">' + parseInt(this.quantity) + '</span>x</span>';
|
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&delete&id_product=' + productId + '&ipa=' + productAttributeId + '&id_customization=' + customizationId + '&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
|
// Field cleaning
|
||||||
if (customizationId)
|
if (customizationId)
|
||||||
{
|
{
|
||||||
$('#uploadable_files li div.customizationUploadBrowse img').remove();
|
$('#'+parentId+' #uploadable_files li div.customizationUploadBrowse img').remove();
|
||||||
$('#text_fields li input').attr('value', '');
|
$('#'+parentId+' #text_fields li input').attr('value', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -535,6 +548,7 @@ var ajaxCart = {
|
|||||||
if (!product.hasAttributes) content += '</dd>';
|
if (!product.hasAttributes) content += '</dd>';
|
||||||
}
|
}
|
||||||
return (content);
|
return (content);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -558,10 +572,13 @@ var ajaxCart = {
|
|||||||
ajaxCart.refreshVouchers(jsonData);
|
ajaxCart.refreshVouchers(jsonData);
|
||||||
|
|
||||||
//update 'first' and 'last' item classes
|
//update 'first' and 'last' item classes
|
||||||
$('#cart_block dl.products dt').removeClass('first_item').removeClass('last_item').removeClass('item');
|
$(['left_column', 'right_column']).each(function(id, parentId)
|
||||||
$('#cart_block dl.products dt:first').addClass('first_item');
|
{
|
||||||
$('#cart_block dl.products dt:not(:first,:last)').addClass('item');
|
$('#'+parentId+' #cart_block dl.products dt').removeClass('first_item').removeClass('last_item').removeClass('item');
|
||||||
$('#cart_block dl.products dt:last').addClass('last_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)
|
//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();
|
ajaxCart.overrideButtonsInThePage();
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -74,6 +74,7 @@ class CalendarUtils
|
|||||||
|
|
||||||
return $dateUtc ;
|
return $dateUtc ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function skipCurDay($dateUtc)
|
public function skipCurDay($dateUtc)
|
||||||
{
|
{
|
||||||
$currentDayZero = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
|
$currentDayZero = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
|
||||||
@@ -84,6 +85,7 @@ class CalendarUtils
|
|||||||
}
|
}
|
||||||
return $dateUtc ;
|
return $dateUtc ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoie la prochaine journée disponible (soit $dateUtc, soit la prochaine à 00h00)
|
* Renvoie la prochaine journée disponible (soit $dateUtc, soit la prochaine à 00h00)
|
||||||
* Si aucune ds les 15j, renvoie NULL
|
* Si aucune ds les 15j, renvoie NULL
|
||||||
@@ -97,6 +99,7 @@ class CalendarUtils
|
|||||||
$loopcount = 0;
|
$loopcount = 0;
|
||||||
// on positionne au début de journée
|
// on positionne au début de journée
|
||||||
$dateUtc = mktime(0, 0, 0, date('m', $dateUtc), date('d', $dateUtc), date('Y', $dateUtc));
|
$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
|
// on boucle pour trouver une journée dispo (si ds les 15j, y a pas : on laisse tomber
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -107,6 +110,7 @@ class CalendarUtils
|
|||||||
while (!$isDateFree && ($loopcount < 15) );
|
while (!$isDateFree && ($loopcount < 15) );
|
||||||
if ($isDateFree)
|
if ($isDateFree)
|
||||||
return ($dateUtc);
|
return ($dateUtc);
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,10 +121,13 @@ class CalendarUtils
|
|||||||
{
|
{
|
||||||
// jour ferié ?
|
// jour ferié ?
|
||||||
$mCalDate = date("d/m/Y", $dateUtc);
|
$mCalDate = date("d/m/Y", $dateUtc);
|
||||||
|
|
||||||
if (in_array($mCalDate, $exceptions))
|
if (in_array($mCalDate, $exceptions))
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
// jour fermé ?
|
// jour fermé ?
|
||||||
$wd = date('w', $dateUtc);
|
$wd = date('w', $dateUtc);
|
||||||
|
|
||||||
if (!isset($calendar[$wd]))
|
if (!isset($calendar[$wd]))
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
@@ -128,8 +135,10 @@ class CalendarUtils
|
|||||||
$stopHour = (int)($calendar[$wd]['stop_hour']);
|
$stopHour = (int)($calendar[$wd]['stop_hour']);
|
||||||
$currentHour = (int)(date('H', $dateUtc));
|
$currentHour = (int)(date('H', $dateUtc));
|
||||||
$currentMin = (int)(date('i', $dateUtc));
|
$currentMin = (int)(date('i', $dateUtc));
|
||||||
|
|
||||||
if ($currentMin > 0)
|
if ($currentMin > 0)
|
||||||
$currentHour = $currentHour + 1;
|
$currentHour = $currentHour + 1;
|
||||||
|
|
||||||
// avant l'heure de fermeture ?
|
// avant l'heure de fermeture ?
|
||||||
if ($currentHour <= $stopHour)
|
if ($currentHour <= $stopHour)
|
||||||
return (true);
|
return (true);
|
||||||
|
|||||||
+257
-258
@@ -1,29 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
* 2007-2011 PrestaShop
|
|
||||||
*
|
|
||||||
* NOTICE OF LICENSE
|
|
||||||
*
|
|
||||||
* This source file is subject to the Academic Free License (AFL 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/afl-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/afl-3.0.php Academic Free License (AFL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('_PS_VERSION_'))
|
if (!defined('_PS_VERSION_'))
|
||||||
exit;
|
exit;
|
||||||
@@ -46,6 +21,8 @@ class Dejala extends CarrierModule
|
|||||||
public $id_lang ;
|
public $id_lang ;
|
||||||
private $wday_labels ;
|
private $wday_labels ;
|
||||||
private static $INSTANCE = NULL ;
|
private static $INSTANCE = NULL ;
|
||||||
|
private $useAlphaPDFInvoicePatcher = true ;
|
||||||
|
private $useBetaOrderDetailPatch = true ;
|
||||||
|
|
||||||
public static function getInstance()
|
public static function getInstance()
|
||||||
{
|
{
|
||||||
@@ -58,18 +35,19 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
global $cookie ;
|
||||||
|
|
||||||
//TODO Iso code of countries where the module can be used, if none module available for all countries
|
//TODO Iso code of countries where the module can be used, if none module available for all countries
|
||||||
$this->limited_countries = array('fr');
|
$this->limited_countries = array('fr');
|
||||||
$this->name = 'dejala';
|
$this->name = 'dejala';
|
||||||
$this->tab = 'shipping_logistics';
|
$this->tab = 'shipping_logistics';
|
||||||
$this->version = 1.4;
|
$this->version = 1.4;
|
||||||
$this->internal_version = '1.3';
|
$this->internal_version = '1.4';
|
||||||
parent::__construct();
|
$this->id_lang = (!isset($cookie) OR !is_object($cookie)) ? (int)(Configuration::get('PS_LANG_DEFAULT')) : (int)($cookie->id_lang);
|
||||||
|
|
||||||
$this->id_lang = $this->context->language->id;
|
|
||||||
$this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday'));
|
$this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday'));
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
// The parent construct is required for translations
|
// The parent construct is required for translations
|
||||||
$this->page = basename(__FILE__, '.php');
|
$this->page = basename(__FILE__, '.php');
|
||||||
$this->displayName = $this->l('Dejala.com : Courier delivery');
|
$this->displayName = $this->l('Dejala.com : Courier delivery');
|
||||||
@@ -90,16 +68,16 @@ class Dejala extends CarrierModule
|
|||||||
if (!isset($this->dejalaConfig->internal_version) || $this->dejalaConfig->internal_version < $this->internal_version)
|
if (!isset($this->dejalaConfig->internal_version) || $this->dejalaConfig->internal_version < $this->internal_version)
|
||||||
{
|
{
|
||||||
$this->unregisterHook('cart') ;
|
$this->unregisterHook('cart') ;
|
||||||
$res = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'dejala_cart` LIMIT 1') ;
|
$res = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'dejala_cart` LIMIT 1') ;
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
if (!array_key_exists('cart_date_upd', (int)$res[0]))
|
if (!array_key_exists('cart_date_upd', $res[0]))
|
||||||
{
|
{
|
||||||
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'dejala_cart` ADD COLUMN cart_date_upd DATETIME DEFAULT 0;');
|
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'dejala_cart` ADD COLUMN cart_date_upd DATETIME DEFAULT 0;');
|
||||||
}
|
}
|
||||||
if (!array_key_exists('delivery_price', (int)$res[0]))
|
if (!array_key_exists('delivery_price', $res[0]))
|
||||||
{
|
{
|
||||||
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'dejala_cart` ADD COLUMN delivery_price FLOAT DEFAULT NULL;');
|
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'dejala_cart` ADD COLUMN delivery_price FLOAT DEFAULT NULL;');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->dejalaConfig->internal_version = $this->internal_version ;
|
$this->dejalaConfig->internal_version = $this->internal_version ;
|
||||||
@@ -108,7 +86,6 @@ class Dejala extends CarrierModule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* install dejala module
|
* install dejala module
|
||||||
*/
|
*/
|
||||||
@@ -125,49 +102,61 @@ class Dejala extends CarrierModule
|
|||||||
foreach ($sql as $query)
|
foreach ($sql as $query)
|
||||||
if (!empty($query))
|
if (!empty($query))
|
||||||
{
|
{
|
||||||
if (!Db::getInstance()->execute(trim($query)))
|
if (!Db::getInstance()->Execute(trim($query)))
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent::install() == false
|
if (parent::install() == false
|
||||||
OR $this->registerHook('updateOrderStatus') == false
|
OR $this->registerHook('updateOrderStatus') == false
|
||||||
OR $this->registerHook('extraCarrier') == false
|
OR $this->registerHook('extraCarrier') == false
|
||||||
OR $this->registerHook('processCarrier') == false)
|
OR $this->registerHook('processCarrier') == false
|
||||||
|
OR $this->registerHook('orderDetailDisplayed') == false
|
||||||
|
OR $this->registerHook('PDFInvoice') == false
|
||||||
|
)
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
|
|
||||||
$this->dejalaConfig = new DejalaConfig();
|
$this->dejalaConfig = new DejalaConfig();
|
||||||
|
|
||||||
if (!$this->dejalaConfig->saveConfig())
|
if (!$this->dejalaConfig->saveConfig())
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
|
// Cleanup pre-existing Dejala Carriers (in case the module had previously been tested and not removed cleanly)
|
||||||
|
while (!is_null($carrier = DejalaCarrierUtils::getCarrierByName($this->name, true))) {
|
||||||
|
$carrier->deleted = 1 ;
|
||||||
|
if (!$carrier->update()) return false;
|
||||||
|
}
|
||||||
|
|
||||||
DejalaCarrierUtils::createDejalaCarrier($this->dejalaConfig) ;
|
DejalaCarrierUtils::createDejalaCarrier($this->dejalaConfig) ;
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
{
|
{
|
||||||
|
|
||||||
// If Dejala is default carrier, try to set another one as default
|
// If Dejala is default carrier, try to set another one as default
|
||||||
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
$defaultCarrier = new Carrier((int)Configuration::get('PS_CARRIER_DEFAULT')) ;
|
||||||
if (Configuration::get('PS_CARRIER_DEFAULT') == (int)($djlCarrier->id))
|
if (DejalaCarrierUtils::getCarrierName($defaultCarrier) == $this->name) {
|
||||||
{
|
$defaultCarrier = DejalaCarrierUtils::getFirstActiveCarrierWithNameNotBeing($this->name) ;
|
||||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
if (Validate::isLoadedObject($defaultCarrier)) {
|
||||||
foreach($carriers as $carrier)
|
Configuration::updateValue('PS_CARRIER_DEFAULT', $defaultCarrier->id_carrier) ;
|
||||||
{
|
|
||||||
if ($carrier['active'] AND !$carrier['deleted'] AND ($carrier['external_module_name'] != $this->name))
|
|
||||||
{
|
|
||||||
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)$carrier['id_carrier']);
|
|
||||||
break ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!is_null($carrier = DejalaCarrierUtils::getCarrierByName($this->name, true))) {
|
||||||
|
$carrier->deleted = 1 ;
|
||||||
|
if (!$carrier->update()) return false;
|
||||||
}
|
}
|
||||||
$djlCarrier->deleted = 1;
|
|
||||||
if (!$djlCarrier->update()) return false;
|
|
||||||
|
|
||||||
$this->dejalaConfig->uninstall();
|
$this->dejalaConfig->uninstall();
|
||||||
if (!parent::uninstall() OR
|
if (!parent::uninstall() OR
|
||||||
!$this->unregisterHook('updateOrderStatus') OR
|
!$this->unregisterHook('updateOrderStatus') OR
|
||||||
!$this->unregisterHook('extraCarrier') OR
|
!$this->unregisterHook('extraCarrier') OR
|
||||||
!$this->unregisterHook('processCarrier'))
|
!$this->unregisterHook('processCarrier') OR
|
||||||
|
!$this->unregisterHook('orderDetailDisplayed') OR
|
||||||
|
!$this->registerHook('PDFInvoice')
|
||||||
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -254,6 +243,7 @@ class Dejala extends CarrierModule
|
|||||||
**/
|
**/
|
||||||
public function _postProcess()
|
public function _postProcess()
|
||||||
{
|
{
|
||||||
|
global $smarty;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$method = Tools::getValue('method');
|
$method = Tools::getValue('method');
|
||||||
@@ -294,6 +284,7 @@ class Dejala extends CarrierModule
|
|||||||
$this->dejalaConfig->sandboxServiceURL = str_replace('.fr', '.'.$this->dejalaConfig->country, $this->dejalaConfig->sandboxServiceURL);
|
$this->dejalaConfig->sandboxServiceURL = str_replace('.fr', '.'.$this->dejalaConfig->country, $this->dejalaConfig->sandboxServiceURL);
|
||||||
$this->dejalaConfig->storeUrl = Dejala::getHttpHost(true, true) ;
|
$this->dejalaConfig->storeUrl = Dejala::getHttpHost(true, true) ;
|
||||||
$response = $djlUtil->createInstantStore($this->dejalaConfig, Tools::getValue('store_name'));
|
$response = $djlUtil->createInstantStore($this->dejalaConfig, Tools::getValue('store_name'));
|
||||||
|
|
||||||
if ($response['status'] == 201)
|
if ($response['status'] == 201)
|
||||||
$this->dejalaConfig->saveConfig();
|
$this->dejalaConfig->saveConfig();
|
||||||
elseif ($response['status'] == 409)
|
elseif ($response['status'] == 409)
|
||||||
@@ -333,11 +324,11 @@ class Dejala extends CarrierModule
|
|||||||
}
|
}
|
||||||
elseif ($method == 'technical_options')
|
elseif ($method == 'technical_options')
|
||||||
{
|
{
|
||||||
$maxSatuses = (int)$_POST['status_max'];
|
$maxStatuses = (int)$_POST['status_max'];
|
||||||
if ($maxSatuses > 30)
|
if ($maxStatuses > 30)
|
||||||
$maxSatuses = 30;
|
$maxStatuses = 30;
|
||||||
$selectedTriggers=array();
|
$selectedTriggers=array();
|
||||||
for ($i = 0; $i < $maxSatuses; $i++)
|
for ($i = 0; $i < $maxStatuses; $i++)
|
||||||
{
|
{
|
||||||
$l_val = Tools::getValue('status_'.$i);
|
$l_val = Tools::getValue('status_'.$i);
|
||||||
if ($l_val)
|
if ($l_val)
|
||||||
@@ -414,8 +405,9 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
|
global $smarty;
|
||||||
|
|
||||||
//$this->context->smarty->assign('country', $this->dejalaConfig->country);
|
$smarty->assign('country', $this->dejalaConfig->country);
|
||||||
$output = $this->display(__FILE__, 'dejala_header.tpl');
|
$output = $this->display(__FILE__, 'dejala_header.tpl');
|
||||||
if (!empty($_POST))
|
if (!empty($_POST))
|
||||||
{
|
{
|
||||||
@@ -441,17 +433,18 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
public function displayForm()
|
public function displayForm()
|
||||||
{
|
{
|
||||||
|
global $smarty, $cookie;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$outputMain = '';
|
$outputMain = '';
|
||||||
$this->context->smarty->assign("djl_mode", $this->dejalaConfig->mode);
|
$smarty->assign("djl_mode", $this->dejalaConfig->mode);
|
||||||
$this->context->smarty->assign("disabled", '');
|
$smarty->assign("disabled", '');
|
||||||
if ($this->dejalaConfig->mode == 'PROD')
|
if ($this->dejalaConfig->mode == 'PROD')
|
||||||
$this->context->smarty->assign("disabled", 'disabled="disabled"');
|
$smarty->assign("disabled", 'disabled="disabled"');
|
||||||
if (true !== extension_loaded('curl'))
|
if (true !== extension_loaded('curl'))
|
||||||
{
|
{
|
||||||
$errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.');
|
$errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.');
|
||||||
$this->context->smarty->assign("disabled", 'disabled="disabled"');
|
$smarty->assign("disabled", 'disabled="disabled"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$registered = TRUE;
|
$registered = TRUE;
|
||||||
@@ -473,7 +466,7 @@ class Dejala extends CarrierModule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign("registered", $registered?"1":"0");
|
$smarty->assign("registered", $registered?"1":"0");
|
||||||
|
|
||||||
|
|
||||||
if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']===''))
|
if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']===''))
|
||||||
@@ -481,19 +474,19 @@ class Dejala extends CarrierModule
|
|||||||
else
|
else
|
||||||
$currentTab=$_GET['cat'];
|
$currentTab=$_GET['cat'];
|
||||||
|
|
||||||
$this->context->smarty->assign("currentTab", $currentTab);
|
$smarty->assign("currentTab", $currentTab);
|
||||||
$this->context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
|
$smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
|
||||||
$this->context->smarty->assign("formAction", Tools::safeOutput($_SERVER['REQUEST_URI']));
|
$smarty->assign("formAction", Tools::safeOutput($_SERVER['REQUEST_URI']));
|
||||||
$outputMenu = $this->display(__FILE__, 'dejala_menu.tpl');
|
$outputMenu = $this->display(__FILE__, 'dejala_menu.tpl');
|
||||||
|
|
||||||
if ($currentTab === 'home')
|
if ($currentTab === 'home')
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
|
$smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
|
||||||
if ($registered)
|
if ($registered)
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
|
$smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
|
||||||
$this->context->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
|
$smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
|
||||||
$this->context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
|
$smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
|
||||||
$smartifyErrors = $this->smartyfyStoreAttributes();
|
$smartifyErrors = $this->smartyfyStoreAttributes();
|
||||||
if (isset($smartifyErrors) && count($smartifyErrors))
|
if (isset($smartifyErrors) && count($smartifyErrors))
|
||||||
$errors = $smartifyErrors;
|
$errors = $smartifyErrors;
|
||||||
@@ -503,7 +496,7 @@ class Dejala extends CarrierModule
|
|||||||
$shopName = Configuration::get('PS_SHOP_NAME');
|
$shopName = Configuration::get('PS_SHOP_NAME');
|
||||||
if (strlen($shopName) >= 15)
|
if (strlen($shopName) >= 15)
|
||||||
$shopName = substr($shopName, 0, 15);
|
$shopName = substr($shopName, 0, 15);
|
||||||
$this->context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
|
$smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
|
||||||
}
|
}
|
||||||
$outputMain = $this->display(__FILE__, 'dejala_home.tpl');
|
$outputMain = $this->display(__FILE__, 'dejala_home.tpl');
|
||||||
}
|
}
|
||||||
@@ -516,7 +509,7 @@ class Dejala extends CarrierModule
|
|||||||
{
|
{
|
||||||
foreach ($contacts as $contactName=>$contactData) {
|
foreach ($contacts as $contactName=>$contactData) {
|
||||||
foreach ($contactData as $key=>$value) {
|
foreach ($contactData as $key=>$value) {
|
||||||
$this->context->smarty->assign($contactName.'_'.$key, $value);
|
$smarty->assign($contactName.'_'.$key, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,8 +523,7 @@ class Dejala extends CarrierModule
|
|||||||
if ('200' == $responseArray['status'])
|
if ('200' == $responseArray['status'])
|
||||||
{
|
{
|
||||||
foreach ($location as $key=>$value)
|
foreach ($location as $key=>$value)
|
||||||
$this->context->smarty->assign($key, $value);
|
$smarty->assign($key, $value);
|
||||||
|
|
||||||
$outputMain = $this->display(__FILE__, 'dejala_location.tpl');
|
$outputMain = $this->display(__FILE__, 'dejala_location.tpl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -543,7 +535,7 @@ class Dejala extends CarrierModule
|
|||||||
if ('200' == $responseArray['status'])
|
if ('200' == $responseArray['status'])
|
||||||
{
|
{
|
||||||
foreach ($processes as $key=>$value)
|
foreach ($processes as $key=>$value)
|
||||||
$this->context->smarty->assign($key, $value);
|
$smarty->assign($key, $value);
|
||||||
|
|
||||||
$outputMain = $this->display(__FILE__, 'dejala_processes.tpl');
|
$outputMain = $this->display(__FILE__, 'dejala_processes.tpl');
|
||||||
}
|
}
|
||||||
@@ -564,7 +556,7 @@ class Dejala extends CarrierModule
|
|||||||
$product['public_price'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', '');
|
$product['public_price'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', '');
|
||||||
$product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', '');
|
$product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', '');
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('products', $products);
|
$smarty->assign('products', $products);
|
||||||
$outputMain = $this->display(__FILE__, 'dejala_products.tpl');
|
$outputMain = $this->display(__FILE__, 'dejala_products.tpl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -577,6 +569,7 @@ class Dejala extends CarrierModule
|
|||||||
$djlUtil = new DejalaUtils();
|
$djlUtil = new DejalaUtils();
|
||||||
$deliveries = array();
|
$deliveries = array();
|
||||||
$responseArray = $djlUtil->getStoreDeliveries($this->dejalaConfig, $deliveries);
|
$responseArray = $djlUtil->getStoreDeliveries($this->dejalaConfig, $deliveries);
|
||||||
|
|
||||||
if ('200'==$responseArray['status'])
|
if ('200'==$responseArray['status'])
|
||||||
{
|
{
|
||||||
foreach ($deliveries as &$delivery)
|
foreach ($deliveries as &$delivery)
|
||||||
@@ -602,10 +595,10 @@ class Dejala extends CarrierModule
|
|||||||
$delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']);
|
$delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
|
$smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
|
||||||
$this->context->smarty->assign('defaultDateFrom', date('01/m/Y'));
|
$smarty->assign('defaultDateFrom', date('01/m/Y'));
|
||||||
$this->context->smarty->assign('defaultDateTo', date('d/m/Y'));
|
$smarty->assign('defaultDateTo', date('d/m/Y'));
|
||||||
$this->context->smarty->assign('deliveries', $deliveries);
|
$smarty->assign('deliveries', $deliveries);
|
||||||
$outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl');
|
$outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -628,9 +621,9 @@ class Dejala extends CarrierModule
|
|||||||
$m_status['checked'] = '0';
|
$m_status['checked'] = '0';
|
||||||
$orderStatuses[] = $m_status;
|
$orderStatuses[] = $m_status;
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('statuses', $orderStatuses);
|
$smarty->assign('statuses', $orderStatuses);
|
||||||
|
|
||||||
$this->context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
|
$smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
|
||||||
$outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl');
|
$outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,6 +643,8 @@ class Dejala extends CarrierModule
|
|||||||
// put in smarty context store attributes
|
// put in smarty context store attributes
|
||||||
function smartyfyStoreAttributes()
|
function smartyfyStoreAttributes()
|
||||||
{
|
{
|
||||||
|
global $smarty;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$djlUtil = new DejalaUtils();
|
$djlUtil = new DejalaUtils();
|
||||||
$storeAttrs = array();
|
$storeAttrs = array();
|
||||||
@@ -658,20 +653,21 @@ class Dejala extends CarrierModule
|
|||||||
$errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
|
$errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign("account_balance", $storeAttrs['account_balance']);
|
$smarty->assign("account_balance", $storeAttrs['account_balance']);
|
||||||
$this->context->smarty->assign("store_name", $storeAttrs['name']);
|
$smarty->assign("store_name", $storeAttrs['name']);
|
||||||
|
|
||||||
// Check if account exists in production
|
// Check if account exists in production
|
||||||
$responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD');
|
$responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD');
|
||||||
if ('200' == $responsePing['status'])
|
if ('200' == $responsePing['status']) {
|
||||||
$this->context->smarty->assign('isLiveReady', '1');
|
$smarty->assign('isLiveReady', '1');
|
||||||
else
|
$smarty->assign('isLiveRequested', '0');
|
||||||
{
|
}
|
||||||
$this->context->smarty->assign('isLiveReady', '0');
|
else {
|
||||||
|
$smarty->assign('isLiveReady', '0');
|
||||||
if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true'))
|
if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true'))
|
||||||
$this->context->smarty->assign('isLiveRequested', '1');
|
$smarty->assign('isLiveRequested', '1');
|
||||||
else
|
else
|
||||||
$this->context->smarty->assign('isLiveRequested', '0');
|
$smarty->assign('isLiveRequested', '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ($errors);
|
return ($errors);
|
||||||
@@ -679,11 +675,15 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
|
|
||||||
function getOrderStates(){
|
function getOrderStates(){
|
||||||
|
global $cookie;
|
||||||
|
|
||||||
$states = OrderState::getOrderStates($this->id_lang);
|
$states = OrderState::getOrderStates($this->id_lang);
|
||||||
return ($states);
|
return ($states);
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayDeliveryOptions(){
|
function displayDeliveryOptions(){
|
||||||
|
global $smarty;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Au moment du choix du créneau
|
Au moment du choix du créneau
|
||||||
Pour déterminer le créneau de départ proposé :
|
Pour déterminer le créneau de départ proposé :
|
||||||
@@ -700,26 +700,26 @@ class Dejala extends CarrierModule
|
|||||||
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
||||||
if ($response['status'] == 200)
|
if ($response['status'] == 200)
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
|
$smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
|
||||||
$this->context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
|
$smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
|
||||||
if (isset($store['attributes']['delivery_partial']))
|
if (isset($store['attributes']['delivery_partial']))
|
||||||
$this->context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
|
$smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wday_selected = array(1, 1, 1, 1, 1, 1, 1);
|
$wday_selected = array(1, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
$this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
// $smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||||
$this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
// $smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||||
$this->context->smarty->assign("weekdayLabels", $this->wday_labels);
|
$smarty->assign("weekdayLabels", $this->wday_labels);
|
||||||
$this->context->smarty->assign("weekdaySelected", $wday_selected);
|
$smarty->assign("weekdaySelected", $wday_selected);
|
||||||
|
|
||||||
|
|
||||||
$calendar = array();
|
$calendar = array();
|
||||||
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar);
|
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar);
|
||||||
if ($response['status'] == 200)
|
if ($response['status'] == 200)
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign("calendar", $calendar);
|
$smarty->assign("calendar", $calendar);
|
||||||
$this->context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
|
$smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
|
||||||
}
|
}
|
||||||
$output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl');
|
$output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl');
|
||||||
|
|
||||||
@@ -745,14 +745,15 @@ class Dejala extends CarrierModule
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Affiche le transporteur Dejala.com dans la liste des transporteurs sur le Front Office
|
** Affiche le transporteur Dejala.com dans la liste des transporteurs sur le Front Office
|
||||||
*/
|
*/
|
||||||
public function hookExtraCarrier($params)
|
public function hookExtraCarrier($params)
|
||||||
{
|
{
|
||||||
|
global $smarty, $defaultCountry;
|
||||||
|
|
||||||
$cart = $params['cart'];
|
$cart = $params['cart'];
|
||||||
|
$cookie = $params['cookie'];
|
||||||
|
|
||||||
$this->hooklog("ExtraCarrier", $params);
|
$this->hooklog("ExtraCarrier", $params);
|
||||||
|
|
||||||
@@ -760,35 +761,32 @@ class Dejala extends CarrierModule
|
|||||||
if ($this->dejalaConfig->visibility_status == "invisible")
|
if ($this->dejalaConfig->visibility_status == "invisible")
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$this->context->customer->id > 0))
|
if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)($cookie->id_customer) > 0))
|
||||||
{
|
{
|
||||||
$customer = $this->context->customer;
|
$customer = new Customer((int)($cookie->id_customer));
|
||||||
if (!in_array($customer->email, preg_split("/[\s,]+/", $this->dejalaConfig->visible_users_list)))
|
if (!in_array($customer->email, preg_split("/[\s,]+/", $this->dejalaConfig->visible_users_list)))
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$djlUtil = new DejalaUtils();
|
// $djlUtil = new DejalaUtils();
|
||||||
$responseGetStore = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
// $responseGetStore = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
||||||
if ($responseGetStore['status']!='200')
|
// if ($responseGetStore['status']!='200')
|
||||||
return ;
|
// return ;
|
||||||
|
//
|
||||||
$isCartOutOfStock = '0';
|
$isCartOutOfStock = $this->isCartOutOfStock($cart) ;
|
||||||
if ($this->isCartOutOfStock($cart))
|
|
||||||
$isCartOutOfStock = '1';
|
|
||||||
$this->mylog('isCartOutOfStock=' . $isCartOutOfStock . '');
|
$this->mylog('isCartOutOfStock=' . $isCartOutOfStock . '');
|
||||||
|
|
||||||
$acceptPartial = true;
|
|
||||||
if (!isset($store['attributes']) || !isset($store['attributes']['delivery_partial']) || ($store['attributes']['delivery_partial'] != '1'))
|
|
||||||
$acceptPartial = false;
|
|
||||||
if ( ($isCartOutOfStock == '1') && !$acceptPartial)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
$electedProduct = $this->getDejalaProduct($cart) ;
|
$electedProduct = $this->getDejalaProduct($cart) ;
|
||||||
// Get id zone
|
$this->mylog("product$=" . $this->logValue($electedProduct,1));
|
||||||
if (isset($cart->id_address_delivery) AND $cart->id_address_delivery)
|
|
||||||
$id_zone = (int)Address::getZoneById((int)($cart->id_address_delivery));
|
if (is_null($electedProduct)) return "" ;
|
||||||
else
|
|
||||||
$id_zone = (int)$this->context->country->id_zone;
|
$acceptPartial = false;
|
||||||
|
if (isset($electedProduct['store_attributes']) && isset($electedProduct['store_attributes']['delivery_partial']) && ($electedProduct['store_attributes']['delivery_partial'] == '1'))
|
||||||
|
$acceptPartial = true;
|
||||||
|
|
||||||
|
if ($isCartOutOfStock && !$acceptPartial)
|
||||||
|
return ;
|
||||||
|
|
||||||
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
||||||
|
|
||||||
@@ -797,166 +795,73 @@ class Dejala extends CarrierModule
|
|||||||
if ($djlCarrier == null)
|
if ($djlCarrier == null)
|
||||||
return null ;
|
return null ;
|
||||||
|
|
||||||
// Calcul des dates dispo
|
$dates = $electedProduct['computed_calendar']['entries'] ;
|
||||||
$productCalendar = $electedProduct['calendar']['entries'];
|
|
||||||
// MFR090831 - add picking time : the store is open to (stop_hour - picking time), it is more natural to merchants to set opening hours instead of dejala delivery time
|
|
||||||
if ($electedProduct['pickingtime'])
|
|
||||||
$pickingtime = (int)($electedProduct['pickingtime']);
|
|
||||||
else
|
|
||||||
$pickingtime = $electedProduct['timelimit'];
|
|
||||||
$djlUtil = new DejalaUtils();
|
|
||||||
$storeCalendar = array();
|
|
||||||
$calendar = array();
|
|
||||||
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $storeCalendar);
|
|
||||||
$this->mylog("productCalendar=" . $this->logValue($productCalendar,1));
|
|
||||||
$this->mylog("storeCalendar=" . $this->logValue($storeCalendar,1));
|
|
||||||
$this->mylog("response['status']=" . $response['status']);
|
|
||||||
if ($response['status'] == 200)
|
|
||||||
{
|
|
||||||
foreach ($storeCalendar['entries'] as $weekday=>$calEntry)
|
|
||||||
{
|
|
||||||
if (isset($productCalendar[$weekday]))
|
|
||||||
{
|
|
||||||
$calendar[$weekday]["weekday"] = $weekday;
|
|
||||||
$calendar[$weekday]["start_hour"] = max((int)($productCalendar[$weekday]["start_hour"]), (int)($calEntry["start_hour"]));
|
|
||||||
// MFR090831 - manage picking time : the store is open to (stop_hour - picking time)
|
|
||||||
$calendar[$weekday]["stop_hour"] = min((int)($productCalendar[$weekday]["stop_hour"]-1), (int)($calEntry["stop_hour"] - $pickingtime));
|
|
||||||
if ($calendar[$weekday]["stop_hour"] < $calendar[$weekday]["start_hour"])
|
|
||||||
unset($calendar[$weekday]);
|
|
||||||
|
|
||||||
|
// Adjust labels
|
||||||
|
foreach ($dates as $idx => $date) {
|
||||||
|
$dates[$idx]['label'] = $this->wday_labels[date('w', $date['ts'])] . " " . date("j", $date['ts']);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcul de la date de démarrage pour les créneaux :
|
|
||||||
// Avancement jusque jour dispo & ouvert
|
|
||||||
// Ajout du temps de préparation : 0.5 jour ou 1 nb de jours
|
|
||||||
// Ajustement de l'heure sur l'ouverture ou l'heure suivante xxh00
|
|
||||||
$deliveryDelay = $store['attributes']['delivery_delay'];
|
|
||||||
$skipCurDay = false ;
|
|
||||||
$calUtils = new CalendarUtils();
|
|
||||||
$all_exceptions = array_merge($storeCalendar['exceptions'], $electedProduct['calendar']['exceptions']);
|
|
||||||
$dateUtc = $calUtils->getNextDateAvailable(time(), $calendar, $all_exceptions);
|
|
||||||
|
|
||||||
if ($dateUtc == NULL)
|
|
||||||
return ;
|
|
||||||
if ($deliveryDelay > 0)
|
|
||||||
{
|
|
||||||
if ($skipCurDay)
|
|
||||||
$dateUtc = $calUtils->skipCurDay($dateUtc);
|
|
||||||
|
|
||||||
$dateUtc = $calUtils->addDelay($dateUtc, $deliveryDelay, $calendar, $all_exceptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($dateUtc == NULL)
|
|
||||||
return ;
|
|
||||||
$dateUtc = $calUtils->adjustHour($dateUtc, $calendar);
|
|
||||||
$this->mylog("calendar=" . $this->logValue($calendar,1));
|
|
||||||
$this->mylog("starting date=" . $this->logValue(date("d/m/Y - H:i:s", $dateUtc),1));
|
|
||||||
|
|
||||||
$today = getDate();
|
|
||||||
$ctime = time();
|
|
||||||
$nbDeliveryDates = $deliveryDelay = $store['attributes']['nb_days_displayed'];
|
|
||||||
$iDate = 0;
|
|
||||||
$dates = array();
|
|
||||||
$balladUtc = $dateUtc;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
$wd = date("w", $balladUtc);
|
|
||||||
if ((int)($calendar[$wd]['stop_hour']) < (int)($calendar[$wd]['start_hour'])) continue ;
|
|
||||||
|
|
||||||
$dates[$iDate]['value'] = date("Y/m/d", $balladUtc);
|
|
||||||
$dates[$iDate]['ts'] = $balladUtc ;
|
|
||||||
$dates[$iDate]['label'] = $this->wday_labels[$wd] . " " . date("j", $balladUtc);
|
|
||||||
$dates[$iDate]['start_hour'] = (int)($calendar[$wd]['start_hour']);
|
|
||||||
$dates[$iDate]['stop_hour'] = (int)($calendar[$wd]['stop_hour']);
|
|
||||||
$balladUtc = strtotime(date("Y-m-d", $balladUtc) . " +1 day");
|
|
||||||
$balladUtc = mktime(0, 0, 0, date('m', $balladUtc), date('d', $balladUtc), date('Y', $balladUtc));
|
|
||||||
$balladUtc = $calUtils->getNextDateAvailable($balladUtc, $calendar, $all_exceptions);
|
|
||||||
$iDate++;
|
|
||||||
} while (($iDate < $nbDeliveryDates) && ($balladUtc));
|
|
||||||
// impossibilité de trouver un jour dispo
|
|
||||||
if (!isset($dates[0]))
|
|
||||||
return ;
|
|
||||||
|
|
||||||
$now = (int)(date("H", $ctime)) ;
|
|
||||||
if ((int)($dates[0]['stop_hour']) > $now && (int)($dates[0]['start_hour']) < $now)
|
|
||||||
$dates[0]['start_hour'] = $now ;
|
|
||||||
elseif ((int)($dates[0]['ts']) == $now && (int)($dates[0]['stop_hour']) < $now)
|
|
||||||
array_shift($dates) ;
|
|
||||||
|
|
||||||
|
|
||||||
$this->mylog("date$=" . $this->logValue($dates,1));
|
$this->mylog("date$=" . $this->logValue($dates,1));
|
||||||
$this->context->smarty->assign('nb_days', $nbDeliveryDates);
|
$smarty->assign('nb_days', sizeof($dates));
|
||||||
$this->context->smarty->assign('dates', $dates);
|
$smarty->assign('dates', $dates);
|
||||||
for ($i=0; $i < 24; $i++)
|
for ($i=0; $i < 24; $i++) {
|
||||||
{
|
|
||||||
$endHour = (($i+$electedProduct['timelimit'])%24);
|
$endHour = (($i+$electedProduct['timelimit'])%24);
|
||||||
if ($endHour == 0)
|
if ($endHour == 0)
|
||||||
$endHour = 24;
|
$endHour = 24;
|
||||||
$hourLabels[] = $i . 'h-' . $endHour . 'h';
|
$hourLabels[] = $i . 'h-' . $endHour . 'h';
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('hourLabels', $hourLabels);
|
$smarty->assign('hourLabels', $hourLabels);
|
||||||
|
|
||||||
$this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
$smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||||
$this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
|
||||||
|
|
||||||
$this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id));
|
$this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id));
|
||||||
$mCarrier = $djlCarrier;
|
$mCarrier = $djlCarrier;
|
||||||
$row['id_carrier'] = (int)($djlCarrier->id);
|
$row['id_carrier'] = (int)($djlCarrier->id);
|
||||||
$row['name'] = $this->l('Dejala.com');
|
$row['name'] = $this->l('Dejala.com');
|
||||||
$row['delay'] = $this->l('When you want... Dispatch rider') . ', ' . $electedProduct['timelimit'].'H' ;
|
|
||||||
$row['price'] = $cart->getOrderShippingCost($djlCarrier->id);
|
$row['price'] = $cart->getOrderShippingCost($djlCarrier->id);
|
||||||
$row['price_tax_exc'] = $cart->getOrderShippingCost($djlCarrier->id, false);
|
$row['price_tax_exc'] = $cart->getOrderShippingCost($djlCarrier->id, false);
|
||||||
$row['img'] = _MODULE_DIR_.$this->name.'/dejala_carrier.gif';
|
$row['img'] = _MODULE_DIR_.$this->name.'/dejala_carrier.gif';
|
||||||
|
|
||||||
|
if ($isCartOutOfStock) {
|
||||||
|
$row['info'] = $this->l('I will select my shipping date when my product is available.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$row['info'] = $this->l('When you want... Dispatch rider') . ', ' . $electedProduct['timelimit'].'H' ;
|
||||||
|
}
|
||||||
|
|
||||||
$resultsArray[] = $row;
|
$resultsArray[] = $row;
|
||||||
|
|
||||||
$this->context->smarty->assign('carriers', $resultsArray);
|
$smarty->assign('djlCarriers', $resultsArray);
|
||||||
$this->context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
|
$smarty->assign('djlCarrierChecked', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id ? $djlCarrier->id : -1)) ;
|
||||||
$this->context->smarty->assign('product', $electedProduct);
|
$smarty->assign('product', $electedProduct);
|
||||||
|
|
||||||
|
|
||||||
$djlCart = new DejalaCart($cart->id);
|
$djlCart = new DejalaCart($cart->id);
|
||||||
$setDefaultDate = TRUE;
|
$setDefaultDate = TRUE;
|
||||||
|
|
||||||
|
$smarty->assign("deliveryDateSelected", $dates[0]['value']);
|
||||||
|
$smarty->assign("deliveryHourSelected", $dates[0]['start_hour']);
|
||||||
|
|
||||||
if ($djlCart && isset($djlCart->shipping_date) && !empty($djlCart->shipping_date))
|
if ($djlCart && isset($djlCart->shipping_date) && !empty($djlCart->shipping_date))
|
||||||
{
|
{
|
||||||
$mShippingDate = $djlCart->shipping_date;
|
$mShippingDate = $djlCart->shipping_date;
|
||||||
$this->mylog("shipping_date=" . $this->logValue($mShippingDate));
|
$this->mylog("shipping_date=" . $this->logValue($mShippingDate));
|
||||||
$m_day = date("d", $mShippingDate);
|
|
||||||
$m_hour = date("H", $mShippingDate);
|
$m_hour = date("H", $mShippingDate);
|
||||||
$deliveryDateSelected = date("Y/m/d", $mShippingDate);
|
$deliveryDateSelected = date("Y/m/d", $mShippingDate);
|
||||||
$this->mylog("shipping_date=" . $this->logValue($deliveryDateSelected));
|
$this->mylog("shipping_date=" . $this->logValue($deliveryDateSelected));
|
||||||
foreach ($dates as $l_key=>$l_date)
|
$smarty->assign("deliveryDateSelected", $deliveryDateSelected);
|
||||||
{
|
$smarty->assign("deliveryHourSelected", $m_hour);
|
||||||
if ($l_date['value'] == $deliveryDateSelected)
|
|
||||||
{
|
|
||||||
$this->context->smarty->assign("deliveryDateIndexSelected", $l_key);
|
|
||||||
$this->context->smarty->assign("deliveryDateSelected", $deliveryDateSelected);
|
|
||||||
$this->context->smarty->assign("deliveryHourSelected", $m_hour);
|
|
||||||
$setDefaultDate = FALSE;
|
$setDefaultDate = FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($setDefaultDate)
|
|
||||||
{
|
|
||||||
$this->context->smarty->assign("deliveryDateIndexSelected", 0);
|
|
||||||
$this->context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
|
|
||||||
$this->context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->context->smarty->assign("isCartOutOfStock", $isCartOutOfStock);
|
// $smarty->assign('one_page_checkout', (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0)) ;
|
||||||
if (!$isCartOutOfStock)
|
|
||||||
{
|
$smarty->assign("isCartOutOfStock", $isCartOutOfStock);
|
||||||
|
|
||||||
$buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
|
$buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
|
||||||
$buffer = $buffer . $this->display(__FILE__, 'dejala_timetable.tpl');
|
$buffer = $buffer . $this->display(__FILE__, 'dejala_timetable.tpl');
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->context->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.'));
|
|
||||||
$buffer = $this->display(__FILE__, 'dejala_carrier_nostock.tpl');
|
|
||||||
}
|
|
||||||
return $buffer;
|
return $buffer;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1025,6 +930,7 @@ class Dejala extends CarrierModule
|
|||||||
{
|
{
|
||||||
foreach ($arrayOfObjectsToHide as $objectName)
|
foreach ($arrayOfObjectsToHide as $objectName)
|
||||||
{
|
{
|
||||||
|
|
||||||
$searchPattern = '#('.$objectName.' Object\n(\s+)\().*?\n\2\)\n#s';
|
$searchPattern = '#('.$objectName.' Object\n(\s+)\().*?\n\2\)\n#s';
|
||||||
$replace = "$1<span style=\"color: #FF9900;\">--> HIDDEN - courtesy of wtf() <--</span>)";
|
$replace = "$1<span style=\"color: #FF9900;\">--> HIDDEN - courtesy of wtf() <--</span>)";
|
||||||
$text = preg_replace($searchPattern, $replace, $text);
|
$text = preg_replace($searchPattern, $replace, $text);
|
||||||
@@ -1042,6 +948,7 @@ class Dejala extends CarrierModule
|
|||||||
public function hookProcessCarrier($params)
|
public function hookProcessCarrier($params)
|
||||||
{
|
{
|
||||||
// FO: Temporary. Necessary to go around the product's cart re-instanciation bug.
|
// FO: Temporary. Necessary to go around the product's cart re-instanciation bug.
|
||||||
|
global $cart ;
|
||||||
|
|
||||||
$cartParams = $params['cart'];
|
$cartParams = $params['cart'];
|
||||||
$this->hooklog("processCarrier", $params) ;
|
$this->hooklog("processCarrier", $params) ;
|
||||||
@@ -1089,7 +996,7 @@ class Dejala extends CarrierModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FO: VERY DIRTY HACK.... Re-assign the global cart to what it was before.
|
// FO: VERY DIRTY HACK.... Re-assign the global cart to what it was before.
|
||||||
$this->context->cart = $cartParams ;
|
$cart = $cartParams ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1099,9 +1006,44 @@ class Dejala extends CarrierModule
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Still in development
|
||||||
|
public function hookOrderDetailDisplayed($param)
|
||||||
|
{
|
||||||
|
if (!$this->useBetaOrderDetailPatch) return "" ;
|
||||||
|
|
||||||
|
$this->hooklog("OrderDetailDisplayed", $param);
|
||||||
|
$retStr = "" ;
|
||||||
|
$djlCart = new DejalaCart($param['order']->id_cart);
|
||||||
|
if (Validate::isLoadedObject($djlCart) && isset($djlCart->id_dejala_product) && isset($djlCart->shipping_date) && !empty($djlCart->shipping_date)) {
|
||||||
|
$retStr .= "<div class=\"table_block clear\">
|
||||||
|
<table class=\"std\">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class=\"first_item\">Dejala</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class=\"first_item item\">
|
||||||
|
<td>" ;
|
||||||
|
$mShippingDate = $djlCart->shipping_date;
|
||||||
|
|
||||||
|
if (!empty($mShippingDate)) {
|
||||||
|
$retStr .= $this->l('Shipping date selected') . ' : ' .date('d/m/Y',$mShippingDate). ', ' . $this->l('starting at') . ' : ' .date('H\hi', $mShippingDate) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$retStr .= $this->l('Shipping date not yet selected by the customer') ;
|
||||||
|
}
|
||||||
|
$retStr .= " </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>" ;
|
||||||
|
}
|
||||||
|
return $retStr ;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appelé après la modification d'une commande
|
* Called when an order's status changes.
|
||||||
**/
|
**/
|
||||||
public function hookUpdateOrderStatus($params)
|
public function hookUpdateOrderStatus($params)
|
||||||
{
|
{
|
||||||
@@ -1212,7 +1154,7 @@ class Dejala extends CarrierModule
|
|||||||
$id_cart = (int)$mOrder->id_cart;
|
$id_cart = (int)$mOrder->id_cart;
|
||||||
/* set weight */
|
/* set weight */
|
||||||
$cart = new Cart($id_cart);
|
$cart = new Cart($id_cart);
|
||||||
$delivery['weight'] = (float)($cart->getTotalWeight());
|
$delivery['weight'] = Configuration::get('PS_WEIGHT_UNIT') == 'g' ? (float)($cart->getTotalWeight() / 1000) : (float)($cart->getTotalWeight());
|
||||||
|
|
||||||
/* set dejalaProductID and sender_availability = shipping date */
|
/* set dejalaProductID and sender_availability = shipping date */
|
||||||
$djlCart = new DejalaCart($id_cart);
|
$djlCart = new DejalaCart($id_cart);
|
||||||
@@ -1223,7 +1165,6 @@ class Dejala extends CarrierModule
|
|||||||
$mShippingDate = $djlCart->shipping_date;
|
$mShippingDate = $djlCart->shipping_date;
|
||||||
if ( is_null($mShippingDate) || empty($mShippingDate) )
|
if ( is_null($mShippingDate) || empty($mShippingDate) )
|
||||||
$mShippingDate = 0;
|
$mShippingDate = 0;
|
||||||
|
|
||||||
$delivery["shipping_start_utc"]=$mShippingDate;
|
$delivery["shipping_start_utc"]=$mShippingDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1238,7 +1179,13 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
public function getOrderShippingCost($cart, $shipping_cost)
|
public function getOrderShippingCost($cart, $shipping_cost)
|
||||||
{
|
{
|
||||||
return $this->getDejalaProductPrice($cart) ;
|
$this->hooklog("getOrderShippingCost", null);
|
||||||
|
$price = $this->getDejalaProductPrice($cart) ;
|
||||||
|
if ($price < 0) {
|
||||||
|
$price = $shipping_cost ;
|
||||||
|
}
|
||||||
|
$this->mylog('returning : ' . $price);
|
||||||
|
return $price ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1251,8 +1198,10 @@ class Dejala extends CarrierModule
|
|||||||
$djlCart = $this->getDejalaCart($cart->id) ;
|
$djlCart = $this->getDejalaCart($cart->id) ;
|
||||||
if (isset($djlCart->delivery_price) && $cart->date_upd <= $djlCart->cart_date_upd)
|
if (isset($djlCart->delivery_price) && $cart->date_upd <= $djlCart->cart_date_upd)
|
||||||
return $djlCart->delivery_price ;
|
return $djlCart->delivery_price ;
|
||||||
|
|
||||||
$product = $this->getDejalaProduct($cart) ;
|
$product = $this->getDejalaProduct($cart) ;
|
||||||
|
if (is_null($product)) {
|
||||||
|
return -1 ;
|
||||||
|
}
|
||||||
return $product["price"] ;
|
return $product["price"] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1265,7 +1214,6 @@ class Dejala extends CarrierModule
|
|||||||
if ($productId >= 0 && $djlCart->product["id"] == $productId)
|
if ($productId >= 0 && $djlCart->product["id"] == $productId)
|
||||||
return $djlCart->product ;
|
return $djlCart->product ;
|
||||||
|
|
||||||
|
|
||||||
$djlUtil = new DejalaUtils();
|
$djlUtil = new DejalaUtils();
|
||||||
$responseGetStore = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
$responseGetStore = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
||||||
if ($responseGetStore['status']!='200') return ;
|
if ($responseGetStore['status']!='200') return ;
|
||||||
@@ -1295,7 +1243,8 @@ class Dejala extends CarrierModule
|
|||||||
$quotation["receiver_phone_mobile"] = $address->phone_mobile;
|
$quotation["receiver_phone_mobile"] = $address->phone_mobile;
|
||||||
$quotation["receiver_comments"] = $address->other;
|
$quotation["receiver_comments"] = $address->other;
|
||||||
$quotation["timelimit"] = 10;
|
$quotation["timelimit"] = 10;
|
||||||
$quotation["weight"] = (float)($cart->getTotalWeight());
|
$quotation["weight"] = Configuration::get('PS_WEIGHT_UNIT') == 'g' ? (float)($cart->getTotalWeight() / 1000) : (float)($cart->getTotalWeight());
|
||||||
|
|
||||||
$quotation["price"] = $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING) ;
|
$quotation["price"] = $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING) ;
|
||||||
$quotation["module_version"] = $this->internal_version ;
|
$quotation["module_version"] = $this->internal_version ;
|
||||||
$quotation["platform"] = "PS " . _PS_VERSION_ ;
|
$quotation["platform"] = "PS " . _PS_VERSION_ ;
|
||||||
@@ -1303,9 +1252,14 @@ class Dejala extends CarrierModule
|
|||||||
$this->mylog("asking for quotation=" . $this->logValue($quotation,1));
|
$this->mylog("asking for quotation=" . $this->logValue($quotation,1));
|
||||||
|
|
||||||
$products = array();
|
$products = array();
|
||||||
$responseArray = $djlUtil->getStoreQuotation($this->dejalaConfig, $quotation, $products);
|
$storeAttributes = array();
|
||||||
if ($responseArray['status']!='200')
|
$responseArray = $djlUtil->getStoreQuotation($this->dejalaConfig, $quotation, $products, $storeAttributes);
|
||||||
return $shipping_cost;
|
if ($responseArray['status']!='200') {
|
||||||
|
$djlCart->delivery_price = -1 ;
|
||||||
|
$djlCart->cart_date_upd = $cart->date_upd ;
|
||||||
|
$djlCart->save() ;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$this->mylog("found quotation=" . $this->logValue($responseArray['response'],1));
|
$this->mylog("found quotation=" . $this->logValue($responseArray['response'],1));
|
||||||
|
|
||||||
$electedProduct = NULL;
|
$electedProduct = NULL;
|
||||||
@@ -1313,8 +1267,12 @@ class Dejala extends CarrierModule
|
|||||||
if ( is_null($electedProduct) || ((int)($electedProduct['priority']) > (int)($key)) )
|
if ( is_null($electedProduct) || ((int)($electedProduct['priority']) > (int)($key)) )
|
||||||
$electedProduct = $product;
|
$electedProduct = $product;
|
||||||
|
|
||||||
if (is_null($electedProduct))
|
if (is_null($electedProduct)) {
|
||||||
return $shipping_cost;
|
$djlCart->delivery_price = -1 ;
|
||||||
|
$djlCart->cart_date_upd = $cart->date_upd ;
|
||||||
|
$djlCart->save() ;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$djlCart->id_dejala_product = (int)$electedProduct["id"];
|
$djlCart->id_dejala_product = (int)$electedProduct["id"];
|
||||||
$djlCart->id_delivery = NULL;
|
$djlCart->id_delivery = NULL;
|
||||||
@@ -1322,18 +1280,37 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
$vat_factor = (1+ ($electedProduct['vat'] / 100));
|
$vat_factor = (1+ ($electedProduct['vat'] / 100));
|
||||||
$priceTTC = round(($electedProduct['price']*$vat_factor) + $electedProduct['margin'], 2);
|
$priceTTC = round(($electedProduct['price']*$vat_factor) + $electedProduct['margin'], 2);
|
||||||
$priceHT = round($priceTTC/$vat_factor, 2);
|
$priceHT = round($priceTTC/$vat_factor, 5);
|
||||||
|
$productPrice = $priceHT;
|
||||||
|
|
||||||
$djlCart->delivery_price = $priceHT ;
|
$djlCart->delivery_price = $priceHT ;
|
||||||
$djlCart->cart_date_upd = $cart->date_upd ;
|
$djlCart->cart_date_upd = $cart->date_upd ;
|
||||||
$djlCart->product = $electedProduct ;
|
$djlCart->product = $electedProduct ;
|
||||||
|
|
||||||
$djlCart->save() ;
|
$djlCart->save() ;
|
||||||
|
$electedProduct['store_attributes'] = $storeAttributes ;
|
||||||
return $electedProduct ;
|
return $electedProduct ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hookPDFInvoice($params) {
|
||||||
|
if (!$this->useAlphaPDFInvoicePatcher) return ;
|
||||||
|
$order = new Order($params['id_order']) ;
|
||||||
|
$djlCart = new DejalaCart($order->id_cart);
|
||||||
|
if (Validate::isLoadedObject($djlCart) && isset($djlCart->id_dejala_product) && isset($djlCart->shipping_date) && !empty($djlCart->shipping_date)) {
|
||||||
|
$deliveryEndDate = "" ;
|
||||||
|
|
||||||
|
// TODO : Store the delivery timelimit in the dejalacart table at order time and use it here instead of querying something that might have changed.
|
||||||
|
$djlUtil = new DejalaUtils();
|
||||||
|
$responseArray = $djlUtil->getStoreProductByID($this->dejalaConfig, $djlCart->id_dejala_product, $products);
|
||||||
|
if ('200' == $responseArray['status'] && is_array($products)) {
|
||||||
|
$deliveryEndDate = date('H\h', $djlCart->shipping_date + (int)$products['timelimit']*3600) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$params['pdf']->pages[1] = str_replace($this->name . ")", $this->name . " \(" . date('d/m/Y',$djlCart->shipping_date). ', ' . date('H\h', $djlCart->shipping_date) . "-" . $deliveryEndDate . "\))", $params['pdf']->pages[1]) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function mylog($msg) {
|
public function mylog($msg) {
|
||||||
if ($this->DEJALA_DEBUG) {
|
if ($this->DEJALA_DEBUG) {
|
||||||
require_once(dirname(__FILE__) . "/MyLogUtils.php");
|
require_once(dirname(__FILE__) . "/MyLogUtils.php");
|
||||||
@@ -1352,7 +1329,7 @@ class Dejala extends CarrierModule
|
|||||||
|
|
||||||
|
|
||||||
public function hooklog($hookname, $params) {
|
public function hooklog($hookname, $params) {
|
||||||
$this->mylog($hookname);
|
$this->mylog("Hook : " . $hookname);
|
||||||
$this->mylog("\r\nparams" . $this->logValue($params), 1);
|
$this->mylog("\r\nparams" . $this->logValue($params), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,5 +1343,27 @@ class Dejala extends CarrierModule
|
|||||||
$host = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$host;
|
$host = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$host;
|
||||||
return $host;
|
return $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function hookLeftColumn($param) {
|
||||||
|
// return '<div style="color: red;">hookLeftColumn</div>' ;
|
||||||
|
// }
|
||||||
|
// public function hookRightColumn($param) {
|
||||||
|
// return '<div style="color: red;">hookRightColumn</div>' ;
|
||||||
|
// }
|
||||||
|
// public function hookHome($param) {
|
||||||
|
// return '<div style="color: red;">hookHome</div>' ;
|
||||||
|
// }
|
||||||
|
// public function hookHeader($param) {
|
||||||
|
// return '<div style="color: red;">hookHeader</div>' ;
|
||||||
|
// }
|
||||||
|
// public function hookTop($param) {
|
||||||
|
// return '<div style="color: red;">hookTop</div>' ;
|
||||||
|
// }
|
||||||
|
// public function hookProductActions($param) {
|
||||||
|
// return '<div style="color: red;">hookProductActions</div>' ;
|
||||||
|
// }
|
||||||
|
// public function hookProductFooter($param) {
|
||||||
|
// return '<div style="color: red;">hookProductFooter</div>' ;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 5.0 KiB |
@@ -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 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 djlAjaxStoreUrl = '{$module_dir}' + 'ajaxStoreShippingInfo.php' ;
|
||||||
var deliveryHourSelected = {$deliveryHourSelected|intval};
|
var djlIsOpc = false ;
|
||||||
|
{if $opc}
|
||||||
|
djlIsOpc = true ;
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
function DJLupdateCarrierSelectionAndGift() {
|
||||||
|
if (djlIsOpc) {
|
||||||
|
djlUpdateCarrierInfo() ;
|
||||||
|
updateCarrierSelectionAndGift();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="{$timetable_js}"></script>
|
|
||||||
<link href="{$timetable_css}" rel="stylesheet" type="text/css" media="all" />
|
|
||||||
{literal}
|
{literal}
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
|
// <![CDATA[
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('input[name="id_carrier"]').each(function(idx, elt) {
|
$('input[name="id_carrier"]').each(function(idx, elt) {
|
||||||
if ($(this).parent().hasClass("dejala")) {
|
if ($(this).parent().hasClass("dejala")) {
|
||||||
if ($(this).get(0).checked) {
|
|
||||||
toggle_visibility('shipping_pref','1');
|
|
||||||
}
|
|
||||||
$(this).click(function() {
|
$(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 {
|
else {
|
||||||
$(this).click(function() {
|
$(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>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
|
||||||
{*
|
{foreach from=$djlCarriers item=carrier name=myLoop}
|
||||||
switchDay(deliveryDateSelected);
|
|
||||||
switchHours(deliveryHourSelected);
|
|
||||||
toggleShipping();
|
|
||||||
*}
|
|
||||||
|
|
||||||
{foreach from=$carriers 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}">
|
<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">
|
<td class="carrier_action radio dejala">
|
||||||
<input type="hidden" name="dejala_id_carrier" value="{$carrier.id_carrier|intval}"/>
|
<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="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>
|
||||||
<td class="carrier_name">
|
<td class="carrier_name">
|
||||||
<label for="id_carrier{$carrier.id_carrier|intval}">
|
<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}
|
{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>
|
</label>
|
||||||
</td>
|
</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">
|
<td class="carrier_price">
|
||||||
{if $carrier.price}
|
{if $carrier.price}
|
||||||
<span class="price">
|
<span class="price">
|
||||||
|
|||||||
@@ -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}">
|
<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">
|
<td class="carrier_action radio dejala">
|
||||||
<input type="hidden" name="dejala_id_carrier" value="{$carrier.id_carrier|intval}"/>
|
<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="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>
|
||||||
<td class="carrier_name">
|
<td class="carrier_name">
|
||||||
<label for="id_carrier{$carrier.id_carrier|intval}">
|
<label for="id_carrier{$carrier.id_carrier|intval}">
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
{* MFR081028 - information de shipping *}
|
|
||||||
<tr style="border-top: 0px solid #bdc2c9;">
|
<tr style="border-top: 0px solid #bdc2c9;">
|
||||||
<td colspan="4" style="border-top: 0px solid #bdc2c9;width:100%;padding:0px 2px 0px 2px;">
|
<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_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"/>
|
<label class="title">{l s='Choose your delivery day' mod='dejala'}:</label><br class="clear"/>
|
||||||
{foreach from=$dates item=dateItem name=dateLabelLoop}
|
{foreach from=$dates item=dateItem name=dateLabelLoop}
|
||||||
{assign var='curIdxDate' value=$smarty.foreach.dateLabelLoop.index}
|
{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}
|
{/foreach}
|
||||||
</div>
|
</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"/>
|
<label class="title">{l s='Choose you delivery timeslot' mod='dejala'}:</label><br class="clear"/>
|
||||||
{section name=hour start=0 loop=24 step=1}
|
{section name=hour start=0 loop=24 step=1}
|
||||||
{assign var='curIdxhour' value=$smarty.section.hour.index}
|
{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}
|
{/section}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,4 +29,3 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{* MFR081028 - information de shipping *}
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
class DejalaCarrierUtils
|
class DejalaCarrierUtils
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* creates of a dejala carrier corresponding to $dejalaProduct
|
* creates a dejala carrier corresponding to $dejalaProduct
|
||||||
*/
|
*/
|
||||||
public static function createDejalaCarrier($dejalaConfig)
|
public static function createDejalaCarrier($dejalaConfig)
|
||||||
{
|
{
|
||||||
@@ -69,31 +69,64 @@ class DejalaCarrierUtils
|
|||||||
$carrier->add();
|
$carrier->add();
|
||||||
|
|
||||||
$carrier->addZone((int)$id_zone) ;
|
$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();
|
$groups = Group::getGroups(true);
|
||||||
$rangeW->id_carrier = $carrier->id;
|
foreach ($groups as $group)
|
||||||
$rangeW->delimiter1 = 0;
|
Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier_group', array('id_carrier' => (int)($carrier->id), 'id_group' => (int)($group['id_group'])), 'INSERT');
|
||||||
$rangeW->delimiter2 = $dejalaProduct['max_weight'];
|
|
||||||
$rangeW->add();
|
|
||||||
$vat_factor = (1+ ($dejalaProduct['vat'] / 100));
|
// $rangeW = new RangeWeight();
|
||||||
$priceTTC = round(($dejalaProduct['price']*$vat_factor) + $dejalaProduct['margin'], 2);
|
// $rangeW->id_carrier = $carrier->id;
|
||||||
$priceHT = round($priceTTC/$vat_factor, 2);
|
// $rangeW->delimiter1 = 0;
|
||||||
$priceList = '(NULL'.','.$rangeW->id.','.$carrier->id.','.$id_zone.','.$priceHT.')';
|
// $rangeW->delimiter2 = $dejalaProduct['max_weight'];
|
||||||
$carrier->addDeliveryPrice($priceList);*/
|
// $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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCarrierByName($name)
|
public static function getCarrierByName($name, $includeInactive = false) {
|
||||||
{
|
global $cookie ;
|
||||||
$carriers = Carrier::getCarriers(Context::getContext()->language->id, true, false, false, null, Carrier::ALL_CARRIERS);
|
|
||||||
foreach($carriers as $carrier)
|
$carriers = Carrier::getCarriers((int)$cookie->id_lang, false, false, false, NULL, ALL_CARRIERS);
|
||||||
if (!$carrier['deleted'] AND $carrier['external_module_name'] == $name)
|
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 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'] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,6 @@ class DejalaConfig
|
|||||||
if ($this->useSSL !== 0)
|
if ($this->useSSL !== 0)
|
||||||
if (0 === strpos($l_serviceURL, 'http:'))
|
if (0 === strpos($l_serviceURL, 'http:'))
|
||||||
$l_serviceURL = 'https'.substr($l_serviceURL, 4);
|
$l_serviceURL = 'https'.substr($l_serviceURL, 4);
|
||||||
|
|
||||||
return ($l_serviceURL);
|
return ($l_serviceURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,6 @@ class DejalaUtils
|
|||||||
$responseArray = $this->makeRequest($dejalaConfig, $serviceURL, $postargs, 'POST', FALSE);
|
$responseArray = $this->makeRequest($dejalaConfig, $serviceURL, $postargs, 'POST', FALSE);
|
||||||
return ($responseArray);
|
return ($responseArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function wtf($var, $arrayOfObjectsToHide=null, $fontSize=11)
|
public static function wtf($var, $arrayOfObjectsToHide=null, $fontSize=11)
|
||||||
{
|
{
|
||||||
$text = print_r($var, true);
|
$text = print_r($var, true);
|
||||||
@@ -114,7 +113,6 @@ class DejalaUtils
|
|||||||
if ($nodeList->length > 0)
|
if ($nodeList->length > 0)
|
||||||
foreach ($nodeList as $element)
|
foreach ($nodeList as $element)
|
||||||
$calendar['exceptions'][] = $this->getNodeValue($element);
|
$calendar['exceptions'][] = $this->getNodeValue($element);
|
||||||
|
|
||||||
}
|
}
|
||||||
return ($responseArray);
|
return ($responseArray);
|
||||||
}
|
}
|
||||||
@@ -143,7 +141,6 @@ class DejalaUtils
|
|||||||
if ($nodeList)
|
if ($nodeList)
|
||||||
foreach ($nodeList as $element)
|
foreach ($nodeList as $element)
|
||||||
$currentContactNode[$element->nodeName] = $element->textContent;
|
$currentContactNode[$element->nodeName] = $element->textContent;
|
||||||
|
|
||||||
$contacts[$name] = $currentContactNode;
|
$contacts[$name] = $currentContactNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,19 +181,19 @@ class DejalaUtils
|
|||||||
{
|
{
|
||||||
if (($a['price'] == $b['price']))
|
if (($a['price'] == $b['price']))
|
||||||
return ($a['id'] < $b['id']) ? -1 : 1 ;
|
return ($a['id'] < $b['id']) ? -1 : 1 ;
|
||||||
|
|
||||||
return ($a['price'] < $b['price']) ? -1 : 1 ;
|
return ($a['price'] < $b['price']) ? -1 : 1 ;
|
||||||
}
|
}
|
||||||
return ($a['priority'] < $b['priority']) ? -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;
|
$postargs = $quotationElements;
|
||||||
$responseArray = $this->makeRequest($dejalaConfig, $serviceURL, $postargs, 'GET', TRUE);
|
$responseArray = $this->makeRequest($dejalaConfig, $serviceURL, $postargs, 'GET', TRUE);
|
||||||
if (!($xml = strstr($responseArray['response'], '<?xml')))
|
if (!($xml = strstr($responseArray['response'], '<?xml'))) {
|
||||||
$xml = null;
|
$xml = null;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@@ -206,17 +203,27 @@ class DejalaUtils
|
|||||||
{
|
{
|
||||||
$currentProduct = $this->getNodeValue($productNode);
|
$currentProduct = $this->getNodeValue($productNode);
|
||||||
unset($currentProduct['calendar']['entries']['entry']);
|
unset($currentProduct['calendar']['entries']['entry']);
|
||||||
$calendarNodeList = $doc->getElementsByTagName('entry');
|
unset($currentProduct['computed_calendar']['entries']['entry']);
|
||||||
foreach ($calendarNodeList as $calendarNode)
|
$productCalendars = $productNode->getElementsByTagName('calendar');
|
||||||
{
|
$calendarNodeList = $productCalendars->item(0)->getElementsByTagName('entry');
|
||||||
|
foreach ($calendarNodeList as $calendarNode) {
|
||||||
$calendarEntry = $this->getNodeValue($calendarNode);
|
$calendarEntry = $this->getNodeValue($calendarNode);
|
||||||
$currentProduct['calendar']['entries'][$calendarEntry['weekday']] = $calendarEntry;
|
$currentProduct['calendar']['entries'][$calendarEntry['weekday']] = $calendarEntry;
|
||||||
}
|
}
|
||||||
$exceptionNodeList = $doc->getElementsByTagName('exception');
|
$exceptionNodeList = $doc->getElementsByTagName('exception');
|
||||||
$currentProduct['calendar']['exceptions'] = array();
|
$currentProduct['calendar']['exceptions'] = array();
|
||||||
foreach ($exceptionNodeList as $exceptionNode)
|
foreach ($exceptionNodeList as $exceptionNode) {
|
||||||
$currentProduct['calendar']['exceptions'][] = $this->getNodeValue($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();
|
/*$currentProduct = array();
|
||||||
$nodeList = $productNode->childNodes;
|
$nodeList = $productNode->childNodes;
|
||||||
foreach ($nodeList as $element) {
|
foreach ($nodeList as $element) {
|
||||||
@@ -226,8 +233,17 @@ class DejalaUtils
|
|||||||
if (count($currentProduct))
|
if (count($currentProduct))
|
||||||
$products[] = $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"));
|
usort($products, array("DejalaUtils", "cmpProducts"));
|
||||||
|
|
||||||
return ($responseArray);
|
return ($responseArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,13 +264,11 @@ class DejalaUtils
|
|||||||
$childNodes = $fatherNodeList->item(0)->childNodes;
|
$childNodes = $fatherNodeList->item(0)->childNodes;
|
||||||
foreach ($childNodes as $childNode)
|
foreach ($childNodes as $childNode)
|
||||||
$store[$childNode->nodeName] = $childNode->textContent;
|
$store[$childNode->nodeName] = $childNode->textContent;
|
||||||
|
|
||||||
}
|
}
|
||||||
$nodeList = $doc->getElementsByTagName('attributes');
|
$nodeList = $doc->getElementsByTagName('attributes');
|
||||||
$store['attributes'] = array();
|
$store['attributes'] = array();
|
||||||
if ($nodeList->length > 0)
|
if ($nodeList->length > 0)
|
||||||
$store['attributes'] = $this->getNodeValue($nodeList->item(0));
|
$store['attributes'] = $this->getNodeValue($nodeList->item(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
return ($responseArray);
|
return ($responseArray);
|
||||||
}
|
}
|
||||||
@@ -362,7 +376,6 @@ class DejalaUtils
|
|||||||
$childNodes = $doc->getElementsByTagName('delivery');
|
$childNodes = $doc->getElementsByTagName('delivery');
|
||||||
foreach ($childNodes as $childNode)
|
foreach ($childNodes as $childNode)
|
||||||
$deliveries[] = $this->getNodeValue($childNode);
|
$deliveries[] = $this->getNodeValue($childNode);
|
||||||
|
|
||||||
}
|
}
|
||||||
return ($responseArray);
|
return ($responseArray);
|
||||||
}
|
}
|
||||||
@@ -479,11 +492,9 @@ class DejalaUtils
|
|||||||
|
|
||||||
public function mylog($msg)
|
public function mylog($msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . "/MyLogUtils.php");
|
require_once(dirname(__FILE__) . "/MyLogUtils.php");
|
||||||
$myFile = dirname(__FILE__) . "/logFile.txt";
|
$myFile = dirname(__FILE__) . "/logFile.txt";
|
||||||
MyLogUtils::myLog($myFile, $msg);
|
MyLogUtils::myLog($myFile, $msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a string of a value for Log purposes
|
// get a string of a value for Log purposes
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ $_MODULE['<{dejala}prestashop>dejala_796c163589f295373e171842f37265d5'] = 'Mercr
|
|||||||
$_MODULE['<{dejala}prestashop>dejala_78ae6f0cd191d25147e252dc54768238'] = 'Jeudi';
|
$_MODULE['<{dejala}prestashop>dejala_78ae6f0cd191d25147e252dc54768238'] = 'Jeudi';
|
||||||
$_MODULE['<{dejala}prestashop>dejala_c33b138a163847cdb6caeeb7c9a126b4'] = 'Vendredi';
|
$_MODULE['<{dejala}prestashop>dejala_c33b138a163847cdb6caeeb7c9a126b4'] = 'Vendredi';
|
||||||
$_MODULE['<{dejala}prestashop>dejala_8b7051187b9191cdcdae6ed5a10e5adc'] = 'Samedi';
|
$_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_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_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';
|
$_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_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_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_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_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_07e9ea0147aee652244a280da00efb5a'] = 'Livraison souhaitée le';
|
||||||
$_MODULE['<{dejala}prestashop>dejala_47a4dfe5ab79feb7884fa57786ea587c'] = 'à partir de';
|
$_MODULE['<{dejala}prestashop>dejala_47a4dfe5ab79feb7884fa57786ea587c'] = 'à partir de';
|
||||||
$_MODULE['<{dejala}prestashop>dejala_ba93cc89ba75ee6e74699a49a69c0600'] = 'Livraison dont la date doit être fixée avec le client.';
|
$_MODULE['<{dejala}prestashop>dejala_ba93cc89ba75ee6e74699a49a69c0600'] = 'Livraison dont la date doit être fixée avec le client.';
|
||||||
|
|||||||
@@ -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%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#shipping_dates {
|
#djl_shipping_pref #shipping_dates {
|
||||||
width:100%;
|
width:100%;
|
||||||
float:left;
|
float:left;
|
||||||
border:1px solid lightgrey;
|
border:1px solid lightgrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
#shipping_dates div {
|
#djl_shipping_pref #shipping_dates div {
|
||||||
height:25px;
|
height:25px;
|
||||||
width:24.9%;
|
width:24.9%;
|
||||||
margin-top:5px;
|
margin-top:5px;
|
||||||
@@ -25,25 +17,39 @@
|
|||||||
padding-top:10px;
|
padding-top:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#shipping_hours {
|
#djl_shipping_pref #shipping_hours {
|
||||||
float:left;
|
float:left;
|
||||||
width:100%;
|
width:100%;
|
||||||
border:1px solid lightgrey;
|
border:1px solid lightgrey;
|
||||||
margin-top:5px;
|
margin-top:5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#shipping_hours div {
|
#djl_shipping_pref #shipping_hours div {
|
||||||
height:31px;
|
height:31px;
|
||||||
width:19.9%;
|
width:19.9%;
|
||||||
float:left;
|
float:left;
|
||||||
padding-top:10px;
|
padding-top:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
#djl_shipping_pref .title {
|
||||||
margin:5px;
|
margin:5px;
|
||||||
font-size:1.1em;
|
font-size:1.1em;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
color:#993300;
|
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;
|
||||||
|
}
|
||||||
@@ -293,7 +293,13 @@ class importerosc extends ImportModule
|
|||||||
$images[] = Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$res['image'];
|
$images[] = Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$res['image'];
|
||||||
$product['images'] = array_merge(array($product['images']), $images);
|
$product['images'] = array_merge(array($product['images']), $images);
|
||||||
$product['link_rewrite'] = Tools::link_rewrite($product['name']);
|
$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);
|
return $this->autoFormat($products, $identifier, $keyLanguage, $multiLangFields);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class ProductToolTip extends Module
|
|||||||
Configuration::updateValue('PS_PTOOLTIP_DAYS', 3);
|
Configuration::updateValue('PS_PTOOLTIP_DAYS', 3);
|
||||||
Configuration::updateValue('PS_PTOOLTIP_LIFETIME', 30);
|
Configuration::updateValue('PS_PTOOLTIP_LIFETIME', 30);
|
||||||
|
|
||||||
return $this->registerHook('productfooter');
|
return $this->registerHook('header') AND $this->registerHook('productfooter');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
@@ -131,6 +131,12 @@ class ProductToolTip extends Module
|
|||||||
return $output;
|
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)
|
public function hookProductFooter($params)
|
||||||
{
|
{
|
||||||
$id_product = (int)($params['product']->id);
|
$id_product = (int)($params['product']->id);
|
||||||
|
|||||||
@@ -24,9 +24,6 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* 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">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {ldelim}
|
$(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}
|
{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}
|
||||||
|
|||||||
@@ -210,6 +210,8 @@ var shopImporter = {
|
|||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
shopImporter.syncCurrency(function(isOk) {
|
shopImporter.syncCurrency(function(isOk) {
|
||||||
|
if (isOk)
|
||||||
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '../modules/shopimporter/ajax.php',
|
url: '../modules/shopimporter/ajax.php',
|
||||||
@@ -268,6 +270,7 @@ var shopImporter = {
|
|||||||
$('#technical_error_feedback').fadeIn('slow');
|
$('#technical_error_feedback').fadeIn('slow');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -692,7 +695,7 @@ function validateSpecificOptions(moduleName, specificOptions)
|
|||||||
async: false,
|
async: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
data: 'ajax=true&token='+this.token+'&validateSpecificOptions&moduleName='+moduleName+specificOptions ,
|
data: 'ajax=true&token='+token+'&validateSpecificOptions&moduleName='+moduleName+specificOptions ,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
var jsonError = '';
|
var jsonError = '';
|
||||||
|
|||||||
@@ -1265,6 +1265,7 @@ class shopimporter extends ImportModule
|
|||||||
|
|
||||||
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
|
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
|
||||||
Image::clearTmpDir();
|
Image::clearTmpDir();
|
||||||
|
@mkdir(_PS_PROD_IMG_DIR_);
|
||||||
break;
|
break;
|
||||||
case 'manufacturer' :
|
case 'manufacturer' :
|
||||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer');
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
{if $type == $smarty.const._CUSTOMIZE_FILE_}
|
{if $type == $smarty.const._CUSTOMIZE_FILE_}
|
||||||
<ul class="customizationUploaded">
|
<ul class="customizationUploaded">
|
||||||
{foreach from=$datas item='data'}
|
{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}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
{elseif $type == $smarty.const._CUSTOMIZE_TEXTFIELD_}
|
{elseif $type == $smarty.const._CUSTOMIZE_TEXTFIELD_}
|
||||||
|
|||||||
Reference in new issue
Block a user