Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 14.28 KB | None | 0 0
  1. <modification>
  2.     <id>Acute Boxberry</id>
  3.         <code>Acute-Boxberry</code>
  4.         <name>Acute Boxberry shipping</name>
  5.     <author><![CDATA[tabook]]></author>
  6.     <version>2.7.1.3</version>
  7.     <file path="catalog/model/checkout/order.php">
  8.         <operation>
  9.             <search><![CDATA[
  10.            public function addOrder($data) {
  11.            ]]></search>
  12.             <add position="after"><![CDATA[
  13.        $integration_installed = false;
  14.        $kd_delivery = 0;
  15.        $pvz_id = 0;
  16.        $shipping_method = isset($this->session->data['shipping_method']['code']) ? $this->session->data['shipping_method']['code'] : '';
  17.        $shipping_method = explode('.', $shipping_method);
  18.        if (!empty($shipping_method[1]) && $shipping_method[0] == 'bb') {
  19.            $query = $this->db->query("SHOW TABLES LIKE '" . DB_PREFIX . "order_bb'");
  20.            $integration_installed = ($query->rows);
  21.            $kd_delivery = ($shipping_method[1] == 'kd') ? 1 : 0;
  22.            if ($shipping_method[1] == 'pickup') {
  23.                $data['shipping_address_1'] = (isset($this->session->data['bb_shipping_office_addr1']) ? $this->session->data['bb_shipping_office_addr1'] : '');
  24.                $data['shipping_address_2'] = (isset($this->session->data['bb_shipping_office_addr2']) ? $this->session->data['bb_shipping_office_addr2'] : '');
  25.            }
  26.            if (isset($this->session->data['bb_shipping_pvz_id'])) {
  27.                $pvz_id = $this->session->data['bb_shipping_pvz_id'];
  28.                if (!$integration_installed) {
  29.                    $data['shipping_address_2'] = '# '. $this->session->data['bb_shipping_pvz_id'];
  30.                }
  31.            }
  32.        }
  33.            ]]></add>
  34.         </operation>
  35.         <operation>
  36.             <search><![CDATA[
  37.            return $order_id;
  38.            ]]></search>
  39.             <add position="before"><![CDATA[
  40.        if ($integration_installed) {
  41.            $this->db->query("INSERT INTO `" . DB_PREFIX . "order_bb` SET order_id = '" . $order_id . "', pvz_id = '" . $pvz_id . "', kd_delivery = '" . $kd_delivery . "'");
  42.        }
  43.            ]]></add>
  44.         </operation>
  45.     </file>
  46.     <file path="catalog/view/theme/*/template/checkout/fastorder/fastorder.tpl">
  47.         <operation>
  48.             <search><![CDATA[<?php echo $quote['title']; ?> - <?php echo $quote['text']; ?>]]></search>
  49.             <add position="replace"><![CDATA[<?php echo $quote['title']; ?> - <?php echo $quote['text']; ?>
  50.            <?php if (isset($quote['bb_html'])) { ?>
  51.                        <br><?php echo $quote['bb_html']; ?>
  52.            <?php } ?>
  53.            ]]></add>
  54.         </operation>
  55.     </file>
  56.  
  57.     <file path="catalog/view/theme/*/template/checkout/shipping_method.tpl">
  58.         <operation>
  59.             <search><![CDATA[<?php echo $quote['title']; ?> - <?php echo $quote['text']; ?>]]></search>
  60.             <add position="replace"><![CDATA[<?php echo $quote['title']; ?> - <?php echo $quote['text']; ?>
  61.            <?php if (isset($quote['bb_html'])) { ?>
  62.                        <br><?php echo $quote['bb_html']; ?>
  63.            <?php } ?>
  64.            ]]></add>
  65.         </operation>
  66.     </file>
  67.  
  68.     <file path="catalog/language/*/checkout/simplecheckout.php">
  69.         <operation>
  70.             <search><![CDATA[
  71.            <?php
  72.            ]]></search>
  73.             <add position="after"><![CDATA[$_['error_bb_pvz'] = 'Выберите пункт выдачи Boxberry'; ]]></add>
  74.         </operation>
  75.     </file>
  76.     <file path="catalog/language/*/checkout/checkout.php">
  77.         <operation>
  78.             <search><![CDATA[
  79.            <?php
  80.            ]]></search>
  81.             <add position="after"><![CDATA[$_['error_bb_pvz'] = 'Выберите пункт выдачи Boxberry'; ]]></add>
  82.         </operation>
  83.     </file>
  84.     <file path="catalog/language/*/checkout/fastorder.php">
  85.         <operation>
  86.             <search><![CDATA[
  87.            <?php
  88.            ]]></search>
  89.             <add position="after"><![CDATA[$_['error_bb_pvz'] = 'Выберите пункт выдачи Boxberry'; ]]></add>
  90.         </operation>
  91.     </file>
  92.     <file path="catalog/controller/checkout/checkout.php">
  93.         <operation>
  94.             <search><![CDATA[
  95.            $this->document->setTitle($this->language->get('heading_title'));
  96.            ]]></search>
  97.             <add position="after"><![CDATA[
  98. $this->document->addScript('https://api-maps.yandex.ru/2.1/?lang=ru_RU');
  99. $this->document->addScript('catalog/view/javascript/bb.js');
  100. ]]></add>
  101.         </operation>
  102.     </file>
  103.     <file path="catalog/controller/checkout/simplecheckout.php">
  104.         <operation>
  105.             <search><![CDATA[
  106.            $this->document->setTitle($this->language->get('heading_title'));
  107.            ]]></search>
  108.             <add position="after"><![CDATA[
  109. $this->document->addScript('https://api-maps.yandex.ru/2.1/?lang=ru_RU');
  110. $this->document->addScript('catalog/view/javascript/bb.js');
  111. ]]></add>
  112.         </operation>
  113.     </file>
  114.     <file path="catalog/controller/checkout/fastorder/fastorder.php">
  115.         <operation>
  116.             <search><![CDATA[
  117.            $this->document->setTitle($this->language->get('heading_title'));
  118.            ]]></search>
  119.             <add position="after"><![CDATA[
  120. $this->document->addScript('https://api-maps.yandex.ru/2.1/?lang=ru_RU');
  121. $this->document->addScript('catalog/view/javascript/bb.js');
  122. ]]></add>
  123.         </operation>
  124.     </file>
  125.  
  126.  
  127.  
  128. <!--- Simple 4.5 + -->
  129.     <file path="catalog/controller/checkout/simplecheckout_shipping.php">
  130.         <operation>
  131.             <search><![CDATA[
  132.            $this->setOutputContent($this->renderPage('checkout/simplecheckout_shipping', $this->_templateData));
  133.            ]]></search>
  134.             <add position="before"><![CDATA[
  135.        if (!$this->simplecheckout->hasError('shipping') && isset($this->_templateData['shipping_method'])) {
  136.  
  137.            if ($this->_templateData['shipping_method']['code'] == 'fake.pickup') {
  138.                $this->_templateData['display_error']         = true;
  139.                $this->_templateData['has_error_shipping']    = true;
  140.                $this->_templateData['error_shipping']     = $this->language->get('text_pickup_denied');
  141.                $this->simplecheckout->addError('shipping');
  142.            }
  143.  
  144.            if ($this->_templateData['shipping_method']['code'] == 'bb.pickup') {
  145.         if (!isset($this->session->data['bb_shipping_pvz_id'])) {
  146.                $this->_templateData['display_error']         = true;
  147.                $this->_templateData['has_error_shipping']    = true;
  148.                $this->_templateData['error_shipping']     = $this->language->get('error_bb_pvz');
  149.                $this->simplecheckout->addError('shipping');
  150.                }
  151.            }
  152.            if ($this->_templateData['shipping_method']['code'] == 'bb.kd') {
  153.         if (isset($this->session->data['bb_shipping_wrong_kd_index'])) {
  154.                $this->_templateData['display_error']         = true;
  155.                $this->_templateData['has_error_shipping']    = true;
  156.                $this->_templateData['error_shipping']     = $this->session->data['bb_shipping_wrong_kd_index'];
  157.                $this->simplecheckout->addError('shipping');
  158.                }
  159.            }
  160.        }
  161.            ]]></add>
  162.         </operation>
  163.     </file>
  164. <!--- Simple 4.1 - 4.4 -->
  165.     <file path="catalog/controller/checkout/simplecheckout_shipping.php">
  166.         <operation>
  167.             <search><![CDATA[
  168.            $this->simplecheckout->resetCurrentBlock();
  169.            ]]></search>
  170.             <add position="before"><![CDATA[
  171.        if (!$this->simplecheckout->hasError() && isset($this->_templateData['shipping_method'])) {
  172.  
  173.            if ($this->_templateData['shipping_method']['code'] == 'fake.pickup') {
  174.                $this->_templateData['display_error']         = true;
  175.                $this->_templateData['has_error_shipping']    = true;
  176.                $this->_templateData['error_shipping']     = $this->language->get('text_pickup_denied');
  177.                $this->simplecheckout->addError();
  178.            }
  179.  
  180.            if ($this->_templateData['shipping_method']['code'] == 'bb.pickup') {
  181.         if (!isset($this->session->data['bb_shipping_pvz_id'])) {
  182.                $this->_templateData['display_error']         = true;
  183.                $this->_templateData['has_error_shipping']    = true;
  184.                $this->_templateData['error_shipping']     = $this->language->get('error_bb_pvz');
  185.                $this->simplecheckout->addError();
  186.                }
  187.            }
  188.            if ($this->_templateData['shipping_method']['code'] == 'bb.kd') {
  189.         if (isset($this->session->data['bb_shipping_wrong_kd_index'])) {
  190.                $this->_templateData['display_error']         = true;
  191.                $this->_templateData['has_error_shipping']    = true;
  192.                $this->_templateData['error_shipping']     = $this->session->data['bb_shipping_wrong_kd_index'];
  193.                $this->simplecheckout->addError();
  194.                }
  195.            }
  196.        }
  197.            ]]></add>
  198.         </operation>
  199.     </file>
  200. <!--- Simple 3.8.3 -->
  201.     <file path="catalog/controller/checkout/simplecheckout_shipping.php">
  202.         <operation>
  203.             <search><![CDATA[
  204.        if ($error) {
  205.            $this->simple->add_error('shipping');
  206.        }
  207.            ]]></search>
  208.             <add position="after"><![CDATA[
  209.        if (!$error && (!empty($this->data['shipping_method']))) {
  210.  
  211.            if ($this->data['shipping_method']['code'] == 'fake.pickup') {
  212.                $error = true;
  213.                $this->data['error_warning'] = $this->language->get('text_pickup_denied');
  214.                $this->simple->add_error('shipping');
  215.            }
  216.  
  217.            if ($this->data['shipping_method']['code'] == 'bb.pickup') {
  218.         if (!isset($this->session->data['bb_shipping_pvz_id'])) {
  219.                   $error = true;
  220.                   $this->data['error_warning'] = $this->language->get('error_bb_pvz');
  221.                   $this->simple->add_error('shipping');
  222.                }
  223.            }
  224.            if ($this->data['shipping_method']['code'] == 'bb.kd') {
  225.         if (isset($this->session->data['bb_shipping_wrong_kd_index'])) {
  226.                   $error = true;
  227.                   $this->data['error_warning'] = $this->session->data['bb_shipping_wrong_kd_index'];
  228.                   $this->simple->add_error('shipping');
  229.                }
  230.            }
  231.        }
  232.            ]]></add>
  233.         </operation>
  234.     </file>
  235.  
  236.     <file path="catalog/controller/checkout/shipping_method.php">
  237.         <operation>
  238.             <search><![CDATA[$this->session->data['comment'] = strip_tags($this->request->post['comment']);]]></search>
  239.             <add position="after"><![CDATA[  
  240.                if ($shipping[0] == 'fake' && $shipping[1] == 'pickup') {
  241.                    $json['error']['warning'] = $this->language->get('text_pickup_denied');
  242.                }
  243.                if ($shipping[0] == 'bb' && $shipping[1] == 'pickup') {
  244.                    if (!isset($this->session->data['bb_shipping_pvz_id'])) {
  245.                        $json['error']['warning'] = $this->language->get('error_bb_pvz');
  246.                    }
  247.                }
  248.                if ($shipping[0] == 'bb' && $shipping[1] == 'kd') {
  249.                    if (isset($this->session->data['bb_shipping_wrong_kd_index'])) {
  250.                        $json['error']['warning'] = $this->session->data['bb_shipping_wrong_kd_index'];
  251.                    }
  252.                }
  253.             ]]></add>
  254.         </operation>
  255.     </file>
  256.     <file path="catalog/view/theme/sstore/template/checkout/fastorder/fastorder.tpl">
  257.         <operation>
  258.             <search><![CDATA[type="radio" name="payment_method"]]></search>
  259.             <add position="replace"><![CDATA[name="payment_method" onchange="$.ajax({url: 'index.php?route=checkout/bb/fastorder_fix', data: $('#payment-method input[type=\'radio\']:checked, #payment-method input[type=\'hidden\']'), type: 'post', dataType: 'json', success: function(json) {updateBBTotal();} });" type="radio"]]></add>
  260.         </operation>
  261.         <operation>
  262.             <search><![CDATA[function shipping_save() {]]></search>
  263.             <add position="after"><![CDATA[
  264. var flagBBCallPaymentChange = 1;
  265. ]]></add>
  266.         </operation>
  267.         <operation>
  268.             <search><![CDATA[success: function(data) {]]></search>
  269.             <add position="after"><![CDATA[
  270. if (typeof flagBBCallPaymentChange !== 'undefined') {
  271.          $('#payment-method').html( $( data ).find( '#payment-method > *' ) );
  272.  
  273. }
  274. ]]></add>
  275.         </operation>
  276.         <operation>
  277.             <search><![CDATA[$(document).delegate('#checkout-order', 'click', function() {]]></search>
  278.             <add position="before"><![CDATA[
  279. function updateBBTotal() {
  280.        $.ajax({
  281.          url: 'index.php?route=checkout/fastorder/fastorder',
  282.          dataType: 'html',
  283.          success: function(data) {
  284.            $('#shipping-method').html( $( data ).find( '#shipping-method > *' ) );
  285.            $('#checkout-cart').html( $( data ).find( '#checkout-cart > *' ) );
  286.            $('#payment-method').html( $( data ).find( '#payment-method > *' ) );
  287.            masked('#shipping-method', false);
  288.            masked('#checkout-cart', false);
  289.          },
  290.          error: function(xhr, ajaxOptions, thrownError) {
  291.            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
  292.          }
  293.        });
  294. }
  295. ]]></add>
  296.         </operation>
  297.     </file>
  298.     <file path="catalog/controller/checkout/fastorder/fastorder.php">
  299.         <operation>
  300.             <search><![CDATA[$this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];]]></search>
  301.             <add position="after"><![CDATA[  
  302.                if ($shipping[0] == 'bb' && $shipping[1] == 'pickup') {
  303.                    if (!isset($this->session->data['bb_shipping_pvz_id'])) {
  304.                        $json['error']['warning'] = $this->language->get('error_bb_pvz');
  305.                    }
  306.                }
  307.                if ($shipping[0] == 'bb' && $shipping[1] == 'kd') {
  308.                    if (isset($this->session->data['bb_shipping_wrong_kd_index'])) {
  309.                        $json['error']['warning'] = $this->session->data['bb_shipping_wrong_kd_index'];
  310.                    }
  311.                }
  312.             ]]></add>
  313.         </operation>
  314.     </file>
  315.  
  316. </modification>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement