/modules/socolissimo/views/templates/front/socolissimo_redirect.tpl

https://gitlab.com/ptisky/API_prestashop · Smarty Template · 85 lines · 55 code · 6 blank · 24 comment · 16 complexity · 15e6e8e2124f47a28a36eb32ce883401 MD5 · raw file

  1. {*
  2. * 2007-2016 PrestaShop
  3. *
  4. * NOTICE OF LICENSE
  5. *
  6. * This source file is subject to the Academic Free License (AFL 3.0)
  7. * that is bundled with this package in the file LICENSE.txt.
  8. * It is also available through the world-wide-web at this URL:
  9. * http://opensource.org/licenses/afl-3.0.php
  10. * If you did not receive a copy of the license and are unable to
  11. * obtain it through the world-wide-web, please send an email
  12. * to license@prestashop.com so we can send you a copy immediately.
  13. *
  14. * DISCLAIMER
  15. *
  16. * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  17. * versions in the future. If you wish to customize PrestaShop for your
  18. * needs please refer to http://www.prestashop.com for more information.
  19. *
  20. * @author PrestaShop SA <contact@prestashop.com> Quadra Informatique <modules@quadra-informatique.fr>
  21. * @copyright 2007-2016 PrestaShop SA
  22. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
  23. * International Registered Trademark & Property of PrestaShop SA
  24. *}
  25. <script type="text/javascript">
  26. var link_socolissimo = "{$link_socolissimo|escape:'UTF-8'}";
  27. var soInputs = new Object();
  28. var soBwdCompat = "{$SOBWD_C|escape:'htmlall'}";
  29. var initialCost_label = "{$initialCost_label|escape:'htmlall'}"
  30. var initialCost = "{$initialCost|escape:'htmlall'}";
  31. var soCarrierId = "{$id_carrier|escape:'htmlall'}";
  32. var taxMention = "{$taxMention|escape:'htmlall'}";
  33. var baseDir = '{$content_dir|escape:'htmlall'}';
  34. var rewriteActive = '{$rewrite_active|escape:'htmlall'}';
  35. {foreach from=$inputs item=input key=name name=myLoop}
  36. soInputs.{$name} = "{$input|strip_tags|addslashes}";
  37. {/foreach}
  38. {literal}
  39. $(document).ready(function () {
  40. $('.delivery_option').each(function ( ) {
  41. if ($(this).children('.delivery_option_radio').val() == '{/literal}{$id_carrier_seller}{literal},') {
  42. $(this).remove();
  43. }
  44. });
  45. $('#id_carrier{/literal}{$id_carrier_seller}{literal}').parent().parent().remove();
  46. if (!soBwdCompat) {
  47. $($('#carrierTable input#id_carrier' + soCarrierId).parent().parent()).find('.carrier_price .price').html(initialCost_label + '<br/>' + initialCost);
  48. $($('#carrierTable input#id_carrier' + soCarrierId).parent().parent()).find('.carrier_price').css('white-space', 'nowrap');
  49. } else {
  50. $('input.delivery_option_radio').each(function () {
  51. if ($(this).val() == soCarrierId + ',') {
  52. $(this).next().children().children().find('div.delivery_option_price').html(initialCost_label + '<br/>' + initialCost + taxMention);
  53. // 1.6 themes
  54. if ($(this).next().children('div.delivery_option_price').length == 0)
  55. $(this).parents('tr').children('td.delivery_option_price').find('div.delivery_option_price').html(initialCost_label + '<br/>' + initialCost + taxMention);
  56. }
  57. });
  58. }
  59. $("#form").submit(function () {
  60. if (!soBwdCompat) {
  61. if ($('#id_carrier{/literal}{$id_carrier}{literal}').is(':checked'))
  62. $('#form').attr("action", baseDir + 'modules/socolissimo/redirect.php' + serialiseInput(soInputs));
  63. } else {
  64. if ($("input[name*='delivery_option[']:checked").val().replace(",", "") == soCarrierId)
  65. $('#form').attr('action', link_socolissimo + serialiseInput(soInputs));
  66. }
  67. });
  68. });
  69. function serialiseInput(inputs) {
  70. if (soBwdCompat && !rewriteActive)
  71. var str = '&first_call=1&';
  72. else
  73. var str = '?first_call=1&';
  74. for (var cle in inputs)
  75. str += cle + '=' + inputs[cle] + '&';
  76. return (str + 'gift=' + $('#gift').attr('checked') + '&gift_message=' + $('#gift_message').attr('value'));
  77. }
  78. {/literal}
  79. </script>