diff --git a/cache/class_index.php b/cache/class_index.php index d2876e362..56e60ae8b 100644 --- a/cache/class_index.php +++ b/cache/class_index.php @@ -546,7 +546,7 @@ 'StateCore' => 'classes/State.php', 'StatisticsController' => 'override/controllers/front/StatisticsController.php', 'StatisticsControllerCore' => 'controllers/front/StatisticsController.php', - 'Stock' => 'override/classes/stock/Stock.php', + 'Stock' => 'override/classes/Stock.php', 'StockAvailable' => 'override/classes/stock/StockAvailable.php', 'StockAvailableCore' => 'classes/stock/StockAvailable.php', 'StockCore' => 'classes/stock/Stock.php', @@ -557,9 +557,9 @@ 'StockManagerInterface' => 'classes/stock/StockManagerInterface.php', 'StockManagerModule' => 'override/classes/stock/StockManagerModule.php', 'StockManagerModuleCore' => 'classes/stock/StockManagerModule.php', - 'StockMvt' => 'override/classes/stock/StockMvt.php', + 'StockMvt' => 'override/classes/StockMvt.php', 'StockMvtCore' => 'classes/stock/StockMvt.php', - 'StockMvtReason' => 'override/classes/stock/StockMvtReason.php', + 'StockMvtReason' => 'override/classes/StockMvtReason.php', 'StockMvtReasonCore' => 'classes/stock/StockMvtReason.php', 'StockMvtWS' => 'override/classes/stock/StockMvtWS.php', 'StockMvtWSCore' => 'classes/stock/StockMvtWS.php', diff --git a/modules/carriercompare/carriercompare.js b/modules/carriercompare/carriercompare.js index 00f012db9..05713de73 100644 --- a/modules/carriercompare/carriercompare.js +++ b/modules/carriercompare/carriercompare.js @@ -23,19 +23,42 @@ * International Registered Trademark & Property of PrestaShop SA */ -var ajaxQueries = new Array(); - -function resetAjaxQueries() +function PS_SE_HandleEvent() { - for (i = 0; i < ajaxQueries.length; ++i) - ajaxQueries[i].abort(); + $(document).ready(function() { - ajaxQueries = new Array(); + $('#id_country').change(function() { + resetAjaxQueries(); + updateStateByIdCountry(); + }); + if (SE_RefreshMethod == 0) + { + $('#id_state').change(function() { + resetAjaxQueries(); + updateCarriersList(); + }); + $('#zipcode').bind('blur keyup',function(e) { + if (e.type == 'blur' || e.keyCode == '13') + { + resetAjaxQueries(); + updateCarriersList(); + } + }); + } + $('#update_carriers_list').click(function() { + updateCarriersList(); + }); + $('#carriercompare_submit').click(function() { + resetAjaxQueries(); + saveSelection(); + return false; + }); + updateStateByIdCountry(); + }); } function displayWaitingAjax(type, message) { - $('#SE_AjaxDisplay').find('p').html(message); $('#SE_AjaxDisplay').css('display', type); } @@ -72,63 +95,67 @@ function updateStateByIdCountry() function updateCarriersList() { - $('#carriers_list').children().remove(); - $('#availableCarriers').slideUp('fast'); - $('#noCarrier').slideUp('fast'); - displayWaitingAjax('block', SE_RetrievingInfoTS); - - var query = $.ajax({ - type: 'POST', - headers: { "cache-control": "no-cache" }, - url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(), - data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(), - dataType: 'json', - success: function(json) { - if (json.length) - { - for (carrier in json) + $('#carriercompare_errors_list').children().remove(); + $('#availableCarriers').slideUp('normal', function(){ + $(this).find(('tbody')).children().remove(); + $('#noCarrier').slideUp('fast'); + displayWaitingAjax('block', SE_RetrievingInfoTS); + + var query = $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(), + data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(), + dataType: 'json', + success: function(json) { + if (json.length) { - var html = ''+ - ''+ - ''+ + for (carrier in json) + { + var html = ''+ + ''+ + ''+ + ''+ + ''+ + ''+ ''+ - ''+ - ''+ - ''+ - ''+((json[carrier].delay != null) ? json[carrier].delay : '') +''+ - ''; - - if (json[carrier].price) - { - html += ''+(displayPrice == 1 ? formatCurrency(json[carrier].price_tax_exc, currencyFormat, currencySign, currencyBlank) : formatCurrency(json[carrier].price, currencyFormat, currencySign, currencyBlank))+''; + ''+((json[carrier].delay != null) ? json[carrier].delay : '') +''+ + ''; + + if (json[carrier].price) + { + html += ''+(displayPrice == 1 ? formatCurrency(json[carrier].price_tax_exc, currencyFormat, currencySign, currencyBlank) : formatCurrency(json[carrier].price, currencyFormat, currencySign, currencyBlank))+''; + } + else + { + html += txtFree; + } + html += ''+ + ''; + $('#carriers_list').append(html); } - else - { - html += txtFree; - } - html += ''+ - ''; - $('#carriers_list').append(html); + displayWaitingAjax('none', ''); + $('#availableCarriers').slideDown(); + } + else + { + displayWaitingAjax('none', ''); + $('#noCarrier').slideDown(); } - $('#availableCarriers').slideDown('fast'); } - else - $('#noCarrier').slideDown('fast'); - displayWaitingAjax('none', ''); - } + }); + ajaxQueries.push(query); }); - ajaxQueries.push(query); } - + function saveSelection() { + $('#carriercompare_errors').slideUp(); $('#carriercompare_errors_list').children().remove(); - $('#carriercompare_errors').slideUp('fast'); displayWaitingAjax('block', SE_RedirectTS); - $('#carriercompare_submit').attr('disabled', true); - + var query = $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, @@ -140,9 +167,8 @@ function saveSelection() { for (error in json) $('#carriercompare_errors_list').append('
  • '+json[error]+'
  • '); - $('#carriercompare_errors').slideDown('fast'); + $('#carriercompare_errors').slideDown(); displayWaitingAjax('none', ''); - $('#carriercompare_submit').removeAttr('disabled'); } else { @@ -155,35 +181,10 @@ function saveSelection() return false; } -function PS_SE_HandleEvent() +var ajaxQueries = new Array(); +function resetAjaxQueries() { - $(document).ready(function() { - $('#id_country').change(function() { - resetAjaxQueries(); - updateStateByIdCountry(); - }); - - if (SE_RefreshMethod == 0) - { - $('#id_state,#zipcode').change(function() { - resetAjaxQueries(); - updateCarriersList(); - }); - $('#zipcode').keyup(function() { - resetAjaxQueries(); - updateCarriersList(); - }); - } - - $('#update_carriers_list').click(function() { - updateCarriersList(); - }); - - $('#carriercompare_submit').click(function() { - resetAjaxQueries(); - saveSelection(); - return false; - }); - updateStateByIdCountry(); - }); -} + for (i = 0; i < ajaxQueries.length; ++i) + ajaxQueries[i].abort(); + ajaxQueries = new Array(); +} \ No newline at end of file diff --git a/modules/carriercompare/carriercompare.php b/modules/carriercompare/carriercompare.php index 0c28febd7..b3e6a29ec 100755 --- a/modules/carriercompare/carriercompare.php +++ b/modules/carriercompare/carriercompare.php @@ -204,8 +204,17 @@ class CarrierCompare extends Module $this->context->cookie->id_state = $id_state; $this->context->cookie->postcode = $zipcode; $this->context->cart->id_carrier = $id_carrier; + $delivery_option_list = $this->context->cart->getDeliveryOptionList(); + + $delivery_option = reset($delivery_option_list); + $id_carrier = (string)$id_carrier; + $id_carrier .= ','; + foreach ($delivery_option_list as $id_address => $options) + if (isset($options[$id_carrier])) + $this->context->cart->setDeliveryOption(array($id_address => $id_carrier)); + if (!$this->context->cart->update()) - return array($this->l('Cannot update the cart')); + return array($this->l('Cannot update the cart')); return array(); } @@ -254,8 +263,8 @@ class CarrierCompare extends Module * If visitor is logged, the module isn't available on Front office, * we use the account informations for carrier selection and taxes. */ - if (Context::getContext()->customer->id) - return false; + /*if (Context::getContext()->customer->id) + return false;*/ return true; } } diff --git a/modules/carriercompare/carriercompare.tpl b/modules/carriercompare/carriercompare.tpl deleted file mode 100644 index 81878fcfb..000000000 --- a/modules/carriercompare/carriercompare.tpl +++ /dev/null @@ -1,94 +0,0 @@ -{* -* 2007-2013 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 -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -**} - -{if !$opc} - -
    -
    -

    {l s='Estimate your shipping & taxes' mod='carriercompare'}

    - -
      - -
    -

    - -

    - - -

    - - - -

    - - ({l s='Needed for certain carriers' mod='carriercompare'}) -

    - - - - -

    - -

    -
    -
    -{/if} diff --git a/modules/carriercompare/template/carriercompare.tpl b/modules/carriercompare/template/carriercompare.tpl index 40b3e3a0c..a66b3e4da 100755 --- a/modules/carriercompare/template/carriercompare.tpl +++ b/modules/carriercompare/template/carriercompare.tpl @@ -21,40 +21,30 @@ * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA -**} +*} {if !$opc} -

    {l s='Estimate your shipping & taxes' mod='carriercompare'}

    - -
      - -
    -

    -

    - -

    ({l s='Needed for certain carriers' mod='carriercompare'})

    - +

    - -