var/cache/dev/twig/80/802503f26f957e347655210fa2f4fcbd83b594d07150b9604ad5c79b2923ab54.php line 40

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\CoreExtension;
  6. use Twig\Extension\SandboxExtension;
  7. use Twig\Markup;
  8. use Twig\Sandbox\SecurityError;
  9. use Twig\Sandbox\SecurityNotAllowedTagError;
  10. use Twig\Sandbox\SecurityNotAllowedFilterError;
  11. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  12. use Twig\Source;
  13. use Twig\Template;
  14. /* application/cart/index.html.twig */
  15. class __TwigTemplate_be0c9c969b30e7db22307d83a1035d25df30b0c520d84948e16a9fc15cbf0995 extends Template
  16. {
  17.     private $source;
  18.     private $macros = [];
  19.     public function __construct(Environment $env)
  20.     {
  21.         parent::__construct($env);
  22.         $this->source $this->getSourceContext();
  23.         $this->blocks = [
  24.             'content' => [$this'block_content'],
  25.             'scripts' => [$this'block_scripts'],
  26.         ];
  27.     }
  28.     protected function doGetParent(array $context)
  29.     {
  30.         // line 1
  31.         return "application/layout.html.twig";
  32.     }
  33.     protected function doDisplay(array $context, array $blocks = [])
  34.     {
  35.         $macros $this->macros;
  36.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  37.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""application/cart/index.html.twig"));
  38.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  39.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""application/cart/index.html.twig"));
  40.         $this->parent $this->loadTemplate("application/layout.html.twig""application/cart/index.html.twig"1);
  41.         yield from $this->parent->unwrap()->yield($contextarray_merge($this->blocks$blocks));
  42.         
  43.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  44.         
  45.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  46.     }
  47.     // line 3
  48.     public function block_content($context, array $blocks = [])
  49.     {
  50.         $macros $this->macros;
  51.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  52.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""content"));
  53.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  54.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""content"));
  55.         // line 4
  56.         yield "    <main class=\"main\">
  57.         <div class=\"breadcrumb\">
  58.             <div class=\"container\">
  59.                 <ol class=\"breadcrumb__list\">
  60.                     <li class=\"breadcrumb__item\"><a href=\"";
  61.         // line 8
  62.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("home");
  63.         yield "\" class=\"breadcrumb__link\">Главная</a></li>
  64.                     <li class=\"breadcrumb__item active\" aria-current=\"page\">Корзина</li>
  65.                 </ol>
  66.             </div>
  67.         </div>
  68.         <div id=\"cartItems\">
  69.             ";
  70.         // line 15
  71.         yield Twig\Extension\CoreExtension::include($this->env$context"application/cart/items.html.twig");
  72.         yield "
  73.         </div>
  74.     </main>
  75. ";
  76.         
  77.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  78.         
  79.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  80.         return; yield '';
  81.     }
  82.     // line 21
  83.     public function block_scripts($context, array $blocks = [])
  84.     {
  85.         $macros $this->macros;
  86.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  87.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""scripts"));
  88.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  89.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""scripts"));
  90.         // line 22
  91.         yield "<script>
  92.     function initCartItems() {
  93.         \$('#clearPromo').click(function () {
  94.             \$(this).hide();
  95.             \$.ajax({
  96.                 type: \"POST\",
  97.                 url: '";
  98.         // line 29
  99.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("clear-promo-ajax");
  100.         yield "',
  101.                 success: function (data) {
  102.                     location.reload();
  103.                 }
  104.             }).fail(function() {
  105.                 alertPopup('Ошибка');
  106.             });
  107.             return false;
  108.         });
  109.         \$('#promoForm').submit(function () {
  110.             \$.ajax({
  111.                 type: \"POST\",
  112.                 url: '";
  113.         // line 43
  114.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("apply-promo-ajax");
  115.         yield "',
  116.                 data: \$(this).serialize(),
  117.                 success: function (data) {
  118.                     if (data.success) {
  119.                         //alertPopup('Промокод успешно активирован');
  120.                         /*
  121.                         \$('#promoButton').hide();
  122.                         \$('#promoAlert').show();
  123.                         \$('#clearPromo').show();
  124.                         promo.attr('disabled', 'disabled');
  125.                          */
  126.                         location.reload();
  127.                     } else {
  128.                         alertPopup('Неверный промокод');
  129.                     }
  130.                 }
  131.             }).fail(function() {
  132.                 alertPopup('Ошибка');
  133.             });
  134.             return false;
  135.         });
  136.         \$('.addRelatedProduct').click(function () {
  137.             let id = \$(this).attr('data-id');
  138.             \$.ajax({
  139.                 type: \"POST\",
  140.                 url: '";
  141.         // line 71
  142.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-put-ajax");
  143.         yield "',
  144.                 data: {
  145.                     id: id,
  146.                     count: 1
  147.                 },
  148.                 success: function (data) {
  149.                     \$('#cartDiv').html(data.cartHtml);
  150.                     \$('#cartItems').html(data.itemsHtml);
  151.                     initCartItems();
  152.                     prepareProductBlockCount(\$('#cartItems'));
  153.                 }
  154.             }).fail(function() {
  155.                 alertPopup('Ошибка');
  156.             })
  157.         });
  158.         \$('.cart-quantity').change(function () {
  159.             let id = \$(this).attr('data-id');
  160.             let count = \$(this).val();
  161.             \$.ajax({
  162.                 type: \"POST\",
  163.                 url: '";
  164.         // line 92
  165.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-put-ajax");
  166.         yield "',
  167.                 data: {
  168.                     id: id,
  169.                     count: count
  170.                 },
  171.                 success: function (data) {
  172.                     \$('#cartDiv').html(data.cartHtml);
  173.                     \$('#cartItems').html(data.itemsHtml);
  174.                     initCartItems();
  175.                     prepareProductBlockCount(\$('#cartItems'));
  176.                 }
  177.             }).fail(function() {
  178.                 alertPopup('Ошибка');
  179.             })
  180.         });
  181.         \$('.cart-delete').click(function () {
  182.             let button = \$(this);
  183.             let id = button.attr('data-id');
  184.             button.attr('disabled', 'disabled');
  185.             \$.ajax({
  186.                 type: \"POST\",
  187.                 url: '";
  188.         // line 114
  189.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-delete-ajax");
  190.         yield "',
  191.                 data: {
  192.                     id: id
  193.                 },
  194.                 success: function (data) {
  195.                     \$('#cartDiv').html(data.cartHtml);
  196.                     \$('#cartItems').html(data.itemsHtml);
  197.                     initCartItems();
  198.                     prepareProductBlockCount(\$('#cartItems'));
  199.                 }
  200.             }).fail(function() {
  201.                 alertPopup('Ошибка');
  202.             }).always(function() {
  203.                 button.removeAttr('disabled');
  204.             });
  205.             return false;
  206.         });
  207.         \$('#draftSave').click(function () {
  208.             let button = \$(this);
  209.             button.attr('disabled', 'disabled');
  210.             \$.ajax({
  211.                 type: \"POST\",
  212.                 url: '";
  213.         // line 138
  214.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("draft-save-ajax");
  215.         yield "',
  216.                 success: function (data) {
  217.                     alertPopup('Черновик сохранен');
  218.                 }
  219.             }).fail(function() {
  220.                 alertPopup('Ошибка');
  221.             }).always(function() {
  222.                 button.removeAttr('disabled');
  223.             });
  224.             return false;
  225.         });
  226.         \$('#clearCart').click(function () {
  227.             let button = \$(this);
  228.             button.attr('disabled', 'disabled');
  229.             \$.ajax({
  230.                 type: \"POST\",
  231.                 url: '";
  232.         // line 156
  233.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-clear-ajax");
  234.         yield "',
  235.                 success: function (data) {
  236.                     \$('#cartDiv').html(data.cartHtml);
  237.                     \$('#cartItems').html(data.itemsHtml);
  238.                     initCartItems();
  239.                     prepareProductBlockCount(\$('#cartItems'));
  240.                 }
  241.             }).fail(function() {
  242.                 alertPopup('Ошибка');
  243.             }).always(function() {
  244.                 button.removeAttr('disabled');
  245.             });
  246.             return false;
  247.         });
  248.         \$('#cartLoadRetail').click(function () {
  249.             let button = \$(this);
  250.             button.attr('disabled', 'disabled');
  251.             \$.ajax({
  252.                 type: \"POST\",
  253.                 url: '";
  254.         // line 177
  255.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("cart-load-retail-ajax");
  256.         yield "',
  257.                 success: function (data) {
  258.                     \$('#cartDiv').html(data.cartHtml);
  259.                     \$('#cartItems').html(data.itemsHtml);
  260.                     initCartItems();
  261.                     prepareProductBlockCount(\$('#cartItems'));
  262.                 }
  263.             }).fail(function() {
  264.                 alertPopup('Ошибка');
  265.             }).always(function() {
  266.                 button.removeAttr('disabled');
  267.             });
  268.             return false;
  269.         });
  270.     }
  271.     initCartItems();
  272.     ";
  273.         // line 196
  274.         if (CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'196$this->source); })()), "request", [], "any"falsefalsefalse196), "query", [], "any"falsefalsefalse196), "get", ["changed"], "method"falsefalsefalse196)) {
  275.             // line 197
  276.             yield "    alertPopup('Состав корзины был актуализирован в соответствии с доступными остатками');
  277.     ";
  278.         }
  279.         // line 199
  280.         yield "    ";
  281.         if (CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'199$this->source); })()), "request", [], "any"falsefalsefalse199), "query", [], "any"falsefalsefalse199), "get", ["notInStock"], "method"falsefalsefalse199)) {
  282.             // line 200
  283.             yield "    alertPopup('На складе нет нужного количества товаров');
  284.     ";
  285.         }
  286.         // line 202
  287.         yield "    ";
  288.         if (CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'202$this->source); })()), "request", [], "any"falsefalsefalse202), "query", [], "any"falsefalsefalse202), "get", ["notValid"], "method"falsefalsefalse202)) {
  289.             // line 203
  290.             yield "    alertPopup('Для приема заказа недостаточно информации. Просим Вас обратиться к Вашему менеджеру');
  291.     ";
  292.         }
  293.         // line 205
  294.         yield "</script>
  295. ";
  296.         
  297.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  298.         
  299.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  300.         return; yield '';
  301.     }
  302.     /**
  303.      * @codeCoverageIgnore
  304.      */
  305.     public function getTemplateName()
  306.     {
  307.         return "application/cart/index.html.twig";
  308.     }
  309.     /**
  310.      * @codeCoverageIgnore
  311.      */
  312.     public function isTraitable()
  313.     {
  314.         return false;
  315.     }
  316.     /**
  317.      * @codeCoverageIgnore
  318.      */
  319.     public function getDebugInfo()
  320.     {
  321.         return array (  332 => 205,  328 => 203,  325 => 202,  321 => 200,  318 => 199,  314 => 197,  312 => 196,  290 => 177,  266 => 156,  245 => 138,  218 => 114,  193 => 92,  169 => 71,  138 => 43,  121 => 29,  112 => 22,  102 => 21,  86 => 15,  76 => 8,  70 => 4,  60 => 3,  37 => 1,);
  322.     }
  323.     public function getSourceContext()
  324.     {
  325.         return new Source("{% extends 'application/layout.html.twig' %}
  326. {% block content %}
  327.     <main class=\"main\">
  328.         <div class=\"breadcrumb\">
  329.             <div class=\"container\">
  330.                 <ol class=\"breadcrumb__list\">
  331.                     <li class=\"breadcrumb__item\"><a href=\"{{ path('home') }}\" class=\"breadcrumb__link\">Главная</a></li>
  332.                     <li class=\"breadcrumb__item active\" aria-current=\"page\">Корзина</li>
  333.                 </ol>
  334.             </div>
  335.         </div>
  336.         <div id=\"cartItems\">
  337.             {{ include('application/cart/items.html.twig') }}
  338.         </div>
  339.     </main>
  340. {% endblock %}
  341. {% block scripts %}
  342. <script>
  343.     function initCartItems() {
  344.         \$('#clearPromo').click(function () {
  345.             \$(this).hide();
  346.             \$.ajax({
  347.                 type: \"POST\",
  348.                 url: '{{ path('clear-promo-ajax') }}',
  349.                 success: function (data) {
  350.                     location.reload();
  351.                 }
  352.             }).fail(function() {
  353.                 alertPopup('Ошибка');
  354.             });
  355.             return false;
  356.         });
  357.         \$('#promoForm').submit(function () {
  358.             \$.ajax({
  359.                 type: \"POST\",
  360.                 url: '{{ path('apply-promo-ajax') }}',
  361.                 data: \$(this).serialize(),
  362.                 success: function (data) {
  363.                     if (data.success) {
  364.                         //alertPopup('Промокод успешно активирован');
  365.                         /*
  366.                         \$('#promoButton').hide();
  367.                         \$('#promoAlert').show();
  368.                         \$('#clearPromo').show();
  369.                         promo.attr('disabled', 'disabled');
  370.                          */
  371.                         location.reload();
  372.                     } else {
  373.                         alertPopup('Неверный промокод');
  374.                     }
  375.                 }
  376.             }).fail(function() {
  377.                 alertPopup('Ошибка');
  378.             });
  379.             return false;
  380.         });
  381.         \$('.addRelatedProduct').click(function () {
  382.             let id = \$(this).attr('data-id');
  383.             \$.ajax({
  384.                 type: \"POST\",
  385.                 url: '{{ path('cart-put-ajax') }}',
  386.                 data: {
  387.                     id: id,
  388.                     count: 1
  389.                 },
  390.                 success: function (data) {
  391.                     \$('#cartDiv').html(data.cartHtml);
  392.                     \$('#cartItems').html(data.itemsHtml);
  393.                     initCartItems();
  394.                     prepareProductBlockCount(\$('#cartItems'));
  395.                 }
  396.             }).fail(function() {
  397.                 alertPopup('Ошибка');
  398.             })
  399.         });
  400.         \$('.cart-quantity').change(function () {
  401.             let id = \$(this).attr('data-id');
  402.             let count = \$(this).val();
  403.             \$.ajax({
  404.                 type: \"POST\",
  405.                 url: '{{ path('cart-put-ajax') }}',
  406.                 data: {
  407.                     id: id,
  408.                     count: count
  409.                 },
  410.                 success: function (data) {
  411.                     \$('#cartDiv').html(data.cartHtml);
  412.                     \$('#cartItems').html(data.itemsHtml);
  413.                     initCartItems();
  414.                     prepareProductBlockCount(\$('#cartItems'));
  415.                 }
  416.             }).fail(function() {
  417.                 alertPopup('Ошибка');
  418.             })
  419.         });
  420.         \$('.cart-delete').click(function () {
  421.             let button = \$(this);
  422.             let id = button.attr('data-id');
  423.             button.attr('disabled', 'disabled');
  424.             \$.ajax({
  425.                 type: \"POST\",
  426.                 url: '{{ path('cart-delete-ajax') }}',
  427.                 data: {
  428.                     id: id
  429.                 },
  430.                 success: function (data) {
  431.                     \$('#cartDiv').html(data.cartHtml);
  432.                     \$('#cartItems').html(data.itemsHtml);
  433.                     initCartItems();
  434.                     prepareProductBlockCount(\$('#cartItems'));
  435.                 }
  436.             }).fail(function() {
  437.                 alertPopup('Ошибка');
  438.             }).always(function() {
  439.                 button.removeAttr('disabled');
  440.             });
  441.             return false;
  442.         });
  443.         \$('#draftSave').click(function () {
  444.             let button = \$(this);
  445.             button.attr('disabled', 'disabled');
  446.             \$.ajax({
  447.                 type: \"POST\",
  448.                 url: '{{ path('draft-save-ajax') }}',
  449.                 success: function (data) {
  450.                     alertPopup('Черновик сохранен');
  451.                 }
  452.             }).fail(function() {
  453.                 alertPopup('Ошибка');
  454.             }).always(function() {
  455.                 button.removeAttr('disabled');
  456.             });
  457.             return false;
  458.         });
  459.         \$('#clearCart').click(function () {
  460.             let button = \$(this);
  461.             button.attr('disabled', 'disabled');
  462.             \$.ajax({
  463.                 type: \"POST\",
  464.                 url: '{{ path('cart-clear-ajax') }}',
  465.                 success: function (data) {
  466.                     \$('#cartDiv').html(data.cartHtml);
  467.                     \$('#cartItems').html(data.itemsHtml);
  468.                     initCartItems();
  469.                     prepareProductBlockCount(\$('#cartItems'));
  470.                 }
  471.             }).fail(function() {
  472.                 alertPopup('Ошибка');
  473.             }).always(function() {
  474.                 button.removeAttr('disabled');
  475.             });
  476.             return false;
  477.         });
  478.         \$('#cartLoadRetail').click(function () {
  479.             let button = \$(this);
  480.             button.attr('disabled', 'disabled');
  481.             \$.ajax({
  482.                 type: \"POST\",
  483.                 url: '{{ path('cart-load-retail-ajax') }}',
  484.                 success: function (data) {
  485.                     \$('#cartDiv').html(data.cartHtml);
  486.                     \$('#cartItems').html(data.itemsHtml);
  487.                     initCartItems();
  488.                     prepareProductBlockCount(\$('#cartItems'));
  489.                 }
  490.             }).fail(function() {
  491.                 alertPopup('Ошибка');
  492.             }).always(function() {
  493.                 button.removeAttr('disabled');
  494.             });
  495.             return false;
  496.         });
  497.     }
  498.     initCartItems();
  499.     {% if app.request.query.get('changed') %}
  500.     alertPopup('Состав корзины был актуализирован в соответствии с доступными остатками');
  501.     {% endif %}
  502.     {% if app.request.query.get('notInStock') %}
  503.     alertPopup('На складе нет нужного количества товаров');
  504.     {% endif %}
  505.     {% if app.request.query.get('notValid') %}
  506.     alertPopup('Для приема заказа недостаточно информации. Просим Вас обратиться к Вашему менеджеру');
  507.     {% endif %}
  508. </script>
  509. {% endblock %}""application/cart/index.html.twig""/var/www/html/templates/application/cart/index.html.twig");
  510.     }
  511. }