Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

odorlega

Користувачі
  
  • Публікації

    113
  • З нами

  • Відвідування

Повідомлення, опубліковані користувачем odorlega

  1. Здравствуйте. 

    Помогите сориентироваться, пожалуйста. 

     

    Есть собственно сайт. 

    И вот карточка одного и товаров на нем. 

    http://dalimax-grup.ru/vhodnii-dveri/vhodnii-dveri-labirint/202vkhodnaya-dver-classic-antik-mednyj-05---vengelab-0205
     

    Хочется чтобы на этой карточке товара присутствовала возможность так же кидать в корзину сопутствующие погонажные изделия 

    Пример тут http://www.dveriregionov.ru/fusion-art-line

     

    И хочется возможность менять цвета как вот тут, без перехода на страницу другого товара:

    Как нужно: https://mebeloptom.com/catalog/kukhni/valeriya-m/valeriya-m-01-seryj-metallik-dozhd-svetlyj

    Как уже есть http://dalimax-grup.ru/24450112-sh-belaya-emal112-sh?search= 112 Ш Белая эмаль

     

     

    И если с фронтом у меня никаких проблем не будет, на бекенде я не совсем понимаю как нужные данные подтягивать и как это организовать.

    Я на опенкарте 2.0 я находил очень много инструкций на тему, где что отредактировать для нужного эффекта. 

    С 3-им, я еще не разобрался. 

     

    Как я думаю, мне нужно добавить новые поля в настройки карточки товара, чтобы была возможность грузить картинки с другими цветами. Если это делать по аналогии, как я это делал на втором, то проблем быть не должно. 

    Как это я делал на 2м...

     

    А вот как выводить погонажные изделия (магазин о дверях) я наверное забуксую на чуточку подольше. 

    А именно мне скорее всего нужно будет продублировать поле Рекомендуемы товары, или (модуль есть) Варианты товаров. 

     

    Возможно я совсем индюк, ткните пальцем в "как нужно правильно все это организовывать". Спасибо. 

  2. Чекнул f12 нашел по пути tpl view/catalog/product_form

     

    Там такой допил нашел

    Спойлер
    
                  <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-product-type">Тип товара</label>
                    <div class="col-sm-10">
                      <select id="input-product-type" name="product_type" class="form-control">
                        <option value="">---</option>
                        <option value="scroll" <?php echo ($product_type == 'scroll') ? 'selected="selected"' : '' ; ?> >Свиток</option>
                        <option value="book" <?php echo ($product_type == 'book') ? 'selected="selected"' : '' ; ?>>Книга</option>
                      </select>
                    </div> 
                  </div>
                  <div class="form-group scroll-type" <?php echo($product_type != 'scroll') ? 'style="display: none"' : '' ; ?>>
                    <label class="col-sm-2 control-label" for="input-scroll-type">Тип свитка</label>
                    <div class="col-sm-10">
                      <select id="input-scroll-type" name="scroll_type" class="form-control">
                        <option value="">---</option>
                        <option value="vertical" <?php echo ($scroll_type == 'vertical') ? 'selected="selected"' : '' ; ?> >Вертикальный</option>
                        <option value="horizontal" <?php echo ($scroll_type == 'horizontal') ? 'selected="selected"' : '' ; ?>>Горизонтальный</option>
                      </select>
                    </div> 
                  </div>

     

     

    Лезу дальше... в controller/catalog/product

    По name="product_type" ищу... нахожу.

    Спойлер
    
    if(isset($this->request->post['product_type'])) {
    			$data['product_type'] = $this->request->post['product_type'];
    		} elseif (!empty($product_info)) {
    			$data['product_type'] = $product_info['product_type'];
    		} else {
    			$data['product_type'] = '';
    		}

     

     

    Лезем в модель по $this->request->post['product_type']

    Там нашел раз:

    Спойлер
    
    <?php
    class ModelCatalogProduct extends Model {
    	public function addProduct($data) {
    		$this->event->trigger('pre.admin.product.add', $data);
    
    		$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']). "', product_type = '" . $this->db->escape($data['product_type']). "', scroll_type = '" . $this->db->escape($data['scroll_type']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
    
    		$product_id = $this->db->getLastId();
          
          
          //...код продолжается...

     

     

    И два:

    Спойлер
    
    //.. вырезано из кода
    public function editProduct($product_id, $data) {
    		$this->event->trigger('pre.admin.product.edit', $data);
    
    		$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']). "', product_type = '" . $this->db->escape($data['product_type']). "', scroll_type = '" . $this->db->escape($data['scroll_type']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
    
    //...вырезано из кода

     

     

     

     

    Как я из всего этого понимаю, мне наверное даже дописывать ничего нового не нужно, достаточно будет в product_form.tpl дописать новые значения? Или не правильно понял?

  3. Ясно, хотя бы на это свет пролили. 

     

     

    Автора допила нет, не будет, и никто не знает где он))

    Где примерно искать допил? Можете подсказать? 

  4. Я вообщем не понял что произошло, но!

    Хостинг сменил какие-то свои настройки и меня не пускало ftp к файлам.

    Сменился адрес хоста. 

    Дальше... 

    Слетел News Blog - на нем висели все посадочные страницы. 

    Из-за него по цепочке полетело дальше. 

    В итоге каким-то мистическим способом все работает. (Включил выключил модуль - Сбросил весь имеющийся кеш). 

    Но! Теперь не работает кнопочка "Добавить в корзину" на карточке товара, но тут уже я и сам исправить смогу) 

    Все чудесатее и чудесатее. 

  5. 11 минут назад, spectre сказал:

    почитать про сеопро, про htaccess, про newsblog

    он вроде кстати нормально с сеопро работает

    Хорошо. 

    Да оно все нормально работало. 

    =_= 

    Сайт не я разрабатывал, но приходится разгребать. 

    Видимо стер где-то какой-то кастыль вчера. 

  6. https://usvitok.ru/index.php?route=product/category&amp;path=271

    Добрый день. 

    Отвалились ЧПУ. 

    Можете подсказать как быть и что делать? 

    И если с каталогом все более или менее нормально, то! 

     

    https://usvitok.ru/zakazchikam/?newsblog_category_id=7

    Левые статьи отвалились и не реагируют.

     

    Подскажите куда капнуть и что почитать? 

     

    Капнул форум, выяснил что у меня ЧПУ через SeoPro стоит. 

     

    Ужасающий .htaccess - Можете с ним помочь? 

    Спойлер
    
    
    
    # 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
    
    # 2. In your opencart directory rename htaccess.txt to .htaccess.
    
    # For any support issues please visit: https://www.opencart.com
    
    Options +FollowSymlinks
    
    # Prevent Directoy listing
    Options -Indexes
    
    # Prevent Direct Access to files
    <FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
     Order deny,allow
     Deny from all
    </FilesMatch>
    
    # SEO URL Settings
    RewriteEngine On
    Options +FollowSymLinks
    
    RewriteCond %{QUERY_STRING} post_id=13
    RewriteRule ^.*$ https://usvitok.apanshin-dev.ru/vystavka-konsum-ekspo-2016.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=12
    RewriteRule ^.*$ https://usvitok.ru/universalnyj_svitok_uchastvuet_v_vystavke_podarkiosen_.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=11
    RewriteRule ^.*$ https://usvitok.ru/foto-reportazh-ipsa-osen-2016.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=10
    RewriteRule ^.*$ https://usvitok.ru/universalnyj_svitok_uchastvuet_v_ipsa.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=8
    RewriteRule ^.*$ https://usvitok.ru/magazin-russkogo-doma.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=9
    RewriteRule ^.*$ https://usvitok.ru/hristianskie_podarki_ot_universalnogo_svitka.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=7
    RewriteRule ^.*$ https://usvitok.ru/mi-v-magazine-roscvettorg.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=6
    RewriteRule ^.*$ https://usvitok.ru/nashi_suveniry_v_magazinah_kazachya_lavka.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=5
    RewriteRule ^.*$ https://usvitok.ru/nashi-suveniry.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=4
    RewriteRule ^.*$ https://usvitok.apanshin-dev.ru/uchastie-v-vystavke.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} post_id=3
    RewriteRule ^.*$ https://usvitok.ru/my_rodilis.html/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} information_id=23
    RewriteRule ^.*$ https://usvitok.ru/oplata-i-dostavka/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} information_id=22
    RewriteRule ^.*$ https://usvitok.ru/faq/? [R=301,L]
    
    
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/about_us.html$
        RewriteRule ^.*$ https://usvitok.ru/o-nas/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/customers.html$
        RewriteRule ^.*$ https://usvitok.ru/zakazchikam/? [R=301,L]
    
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/armiya-patriotizm/$
        RewriteRule ^.*$ https://usvitok.ru/armiya/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/den-rozhdeniya-i-yubiley/$
        RewriteRule ^.*$ https://usvitok.ru/den-rozhdeniya/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/detstvo/$
        RewriteRule ^.*$ https://usvitok.ru/detstvo/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/dlya-bani/$
        RewriteRule ^.*$ https://usvitok.ru/dlya-bani/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/dlya-bani/$
        RewriteRule ^.*$ https://usvitok.ru/dlya-bani/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/dlya-dachi/$
        RewriteRule ^.*$ https://usvitok.ru/dlya-dachi/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/zhivotnye/$
        RewriteRule ^.*$ https://usvitok.ru/zhivotnyye/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/goroda/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/kalendari/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/lyubimomu-cheloveku/$
        RewriteRule ^.*$ https://usvitok.ru/lyubov/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/motivaciya-v-zhizni-i-biznese/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/novyy-god-i-rozhdestvo/$
        RewriteRule ^.*$ https://usvitok.ru/novyy-god-i-rozhdestvo/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/ohota/$
        RewriteRule ^.*$ https://usvitok.ru/okhota/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/peyzazhi-prirody-i-arhitektury/$
        RewriteRule ^.*$ https://usvitok.ru/peyzazhi/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/podarki-muzhchinam/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/professii/$
        RewriteRule ^.*$ https://usvitok.ru/professii/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/roditelyam/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/rusichi/$
        RewriteRule ^.*$ https://usvitok.ru/shop/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/rybalka/$
        RewriteRule ^.*$ https://usvitok.ru/rybalka/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/svadba/$
        RewriteRule ^.*$ https://usvitok.ru/svadba/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/semya/$
        RewriteRule ^.*$ https://usvitok.ru/semya/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/katalog/hristianskie/$
        RewriteRule ^.*$ https://usvitok.ru/khristianstvo/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/scroll_with_logo.html$
        RewriteRule ^.*$ https://usvitok.ru/individualnyy-zakaz/? [R=301,L]
    
        RewriteCond %{REQUEST_URI} ^/ru/contact-us/$
        RewriteRule ^.*$ https://usvitok.ru/contacts//? [R=301,L]
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
    
    RewriteBase /
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
    RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
    
    ### Additional Settings that may need to be enabled for some servers
    ### Uncomment the commands by removing the # sign in front of it.
    ### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
    
    # 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
    # php_flag register_globals off
    
    # 2. If your cart has magic quotes enabled, This may work to disable it:
    # php_flag magic_quotes_gpc Off
    
    # 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
    # php_value upload_max_filesize 999M
    
    # 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value post_max_size 999M
    
    # 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value max_execution_time 200
    
    # 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value max_input_time 200
    
    # 7. disable open_basedir limitations
    # php_admin_value open_basedir none
    
    RewriteCond %{HTTP:Authorization} ^Basic.*
    RewriteRule .* — [E=REMOTE_USER:%{HTTP:Authorization},L]
    php_value default_charset utf-8
    AddType 'text/html; charset=utf-8' .html .htm .shtml
    

     

    Подсказать как его переписать, что тут лишнее, и вообще. 

  7. 21 минуту назад, freelancer сказал:

    xdebug, XHprof

    хотя за вас уже нашли проблемное место

    Спасибо. 

    Все равно нужно посмотреть на эту порнографию. 

    К слову этот сайт делал не я. Я его уже получил в обслуживание в таком виде) 

  8. Пытаюсь открыть корзину (385 товаров по 1 шт). 

    Выдает 502. 

    Жму f12 -> Network

    Вижу там:

    simplecheckout/ 502 document Other 811 B 18.69 s

     

    Лезу в файлы....

    simplecheckout.php

    Спойлер
    
    <?php
    /*
    @author Dmitriy Kubarev
    @link   http://www.simpleopencart.com
    @link   http://www.opencart.com/index.php?route=extension/extension/info&extension_id=4811
    */
    
    include_once(DIR_SYSTEM . 'library/simple/simple_controller.php');
    
    class ControllerCheckoutSimpleCheckout extends SimpleController {
        private $_templateData = array();
    
        public function index($args = null) {
            $this->loadLibrary('simple/simplecheckout');
    
            $settingsGroup = !empty($args['group']) ? $args['group'] : (!empty($this->request->get['group']) ? $this->request->get['group'] : $this->config->get('simple_default_checkout_group'));
    
            $this->simplecheckout = SimpleCheckout::getInstance($this->registry, $settingsGroup);
    
            if (!$this->customer->isLogged() && $this->simplecheckout->isGuestCheckoutDisabled()) {
                $this->session->data['redirect'] = $this->url->link('checkout/simplecheckout', '', 'SSL');
                $this->simplecheckout->redirect($this->url->link('account/login','','SSL'));
            }
    
            $this->language->load('checkout/checkout');
            $this->language->load('checkout/simplecheckout');
    
            if (empty($args)) {
                $this->document->setTitle($this->language->get('heading_title'));
            }
    
            $this->_templateData['breadcrumbs'] = array();
    
            $this->_templateData['breadcrumbs'][] = array(
                'text'      => $this->language->get('text_home'),
                'href'      => $this->url->link('common/home'),
                'separator' => false
            );
    
            $this->_templateData['breadcrumbs'][] = array(
                'text'      => $this->language->get('heading_title'),
                'href'      => $this->url->link('checkout/simplecheckout', '', 'SSL'),
                'separator' => $this->language->get('text_separator')
            );
    
            $this->_templateData['action'] = 'index.php?'.$this->simplecheckout->getAdditionalParams().'route=checkout/simplecheckout&group='.$settingsGroup;
    
            $this->_templateData['heading_title'] = $this->language->get('heading_title');
    
            $this->simplecheckout->clearPreventDeleteFlag();
            $this->simplecheckout->clearSimpleSession();
    
            $this->_templateData['error_warning'] = '';
    
            $this->simplecheckout->initBlocks();
    
            $this->getChildController('checkout/simplecheckout_customer/update_session');
            $this->getChildController('checkout/simplecheckout_payment_address/update_session');
            $this->getChildController('checkout/simplecheckout_shipping_address/update_session');
            $this->getChildController('checkout/simplecheckout_cart/update');
    
            if ($this->cart->hasProducts() || !empty($this->session->data['vouchers'])) {
                $this->_templateData['simple_blocks'] = array(
                    'customer'         => '',
                    'payment_address'  => '',
                    'shipping_address' => '',
                    'cart'             => '',
                    'shipping'         => '',
                    'payment'          => '',
                    'agreement'        => '',
                    'help'             => '',
                    'summary'          => '',
                    'comment'          => '',
                    'payment_form'     => ''
                );
    
                // stupid hack for opencart > 2.0
                if ($this->simplecheckout->getOpencartVersion() >= 200) {
                    if ($this->simplecheckout->getOpencartVersion() < 220) {
                        $this->tax = new Tax($this->registry);
                        $this->cart = new Cart($this->registry);
                    } else {
                        //$this->tax = new Cart\Tax($this->registry);
                        //$this->cart = new Cart\Cart($this->registry);
                    }
                }
                // end
    
                if ($this->simplecheckout->isPaymentBeforeShipping()) {
                    $this->_templateData['simple_blocks']['payment']  = $this->getChildController('checkout/simplecheckout_payment');
                    $this->_templateData['simple_blocks']['shipping'] = $this->getChildController('checkout/simplecheckout_shipping');
                } else {
                    $this->_templateData['simple_blocks']['shipping'] = $this->getChildController('checkout/simplecheckout_shipping');
                    $this->_templateData['simple_blocks']['payment']  = $this->getChildController('checkout/simplecheckout_payment');
                }
    
                $this->_templateData['simple_blocks']['cart']             = $this->getChildController('checkout/simplecheckout_cart');
                $this->_templateData['simple_blocks']['customer']         = $this->getChildController('checkout/simplecheckout_customer');
                $this->_templateData['simple_blocks']['payment_address']  = $this->getChildController('checkout/simplecheckout_payment_address');
                $this->_templateData['simple_blocks']['shipping_address'] = $this->getChildController('checkout/simplecheckout_shipping_address');
    
                if ($this->simplecheckout->hasBlock('agreement') && $this->simplecheckout->getSettingValue('agreementId')) {
                    $this->_templateData['simple_blocks']['agreement'] = $this->getChildController('checkout/simplecheckout_text', array('type' => 'agreement', 'id' => $this->simplecheckout->getSettingValue('agreementId')));
                }
    
                if ($this->simplecheckout->hasBlock('help') && $this->simplecheckout->getSettingValue('helpId')) {
                    $this->_templateData['simple_blocks']['help'] = $this->getChildController('checkout/simplecheckout_text', array('type' => 'help', 'id' => $this->simplecheckout->getSettingValue('helpId')));
                }
    
                if ($this->simplecheckout->hasBlock('comment')) {
                    $this->_templateData['simple_blocks']['comment'] = $this->getChildController('checkout/simplecheckout_comment');
                }
    
                $modules = $this->simplecheckout->getModules();
    
                foreach ($modules as $m) {
                    $modulesPath = 'controller/module/';
                    if ($this->simplecheckout->getOpencartVersion() >= 230) {
                        $modulesPath = 'controller/extension/module/';
                    }
    
                    if ($m != 'payment_simple' && file_exists(DIR_APPLICATION . $modulesPath . $m . '.php')) {
                        $defaultSettings = array('limit' => 5, 'width' => 100, 'height' => 100, 'banner_id' => 6, 'position' => 'top', 'layout_id' => 0);
    
                        $allSettings = $this->config->get($m . '_module');
    
                        $this->load->model('design/layout');
                        $currentLayoutId = $this->model_design_layout->getLayout('checkout/simplecheckout');
    
                        if (!empty($allSettings) && is_array($allSettings)) {
                            $found = false;
                            foreach ($allSettings as $s) {
                                if ($s['layout_id'] == $currentLayoutId) {
                                    $defaultSettings = $s;
                                    $found = true;
                                    break;
                                }
                            }
                            if (!$found) {
                                $defaultSettings = reset($allSettings);
                            }
                        }
    
                        $this->_templateData['simple_blocks'][$m] = $this->getChildController('module/'.$m, $defaultSettings);
                    } elseif ($m == 'payment_simple') {
                        $payment_method = $this->session->data['payment_method'];
    
                        $additonal_path = '';
                        
                        if ($this->simplecheckout->getOpencartVersion() >= 230) {
                            $additonal_path = 'extension/';
                        }
    
                        if (!empty($payment_method['code']) && file_exists(DIR_APPLICATION . 'controller/' . $additonal_path . 'module/' . $payment_method['code'] . '.php')) {
                            $this->_templateData['simple_blocks'][$m] = $this->getChildController($additonal_path . 'module/'.$payment_method['code']);
                        } elseif (!empty($payment_method['code']) && file_exists(DIR_APPLICATION . 'controller/' . $additonal_path . 'module/' . $payment_method['code'] . '_simple.php')) {
                            $this->_templateData['simple_blocks'][$m] = $this->getChildController($additonal_path . 'module/'.$payment_method['code'].'_simple');
                        } else {
                            $this->_templateData['simple_blocks'][$m] = '';
                        }
                    }
                }
    
                if ($this->simplecheckout->hasBlock('summary')) {
                    $this->_templateData['simple_blocks']['summary'] = $this->getChildController('checkout/simplecheckout_summary');
                }
    
                $this->_templateData['block_order'] = $this->simplecheckout->isOrderBlocked();
    
                if ($this->request->server['REQUEST_METHOD'] == 'POST') {
                    $this->_templateData['agreement'] = !empty($this->request->post['agreement']) ? true : false;
                } else {
                    $this->_templateData['agreement'] = $this->simplecheckout->getSettingValue('agreementCheckboxInit');
                }
    
                $stateChanged = false;
    
                if ($this->validate() && !$this->simplecheckout->isOrderBlocked() && $this->simplecheckout->canCreateOrder()) {
                    if (!$this->customer->isLogged()) {
                        $this->simplecheckout->clearUnusedFields();
                    }
    
                    $stateChanged = $this->saveCustomerInfo();
                    $order_id = $this->order();
    
                    $payment_method = $this->session->data['payment_method'];
    
                    $requestMethod = $this->request->server['REQUEST_METHOD'];
                    $this->request->server['REQUEST_METHOD'] = 'GET';
    
                    $paymentCode = explode('.', $payment_method['code']);
    
                    $this->_templateData['simple_blocks']['payment_form'] = $this->getChildController('payment/' . $paymentCode[0]);
    
                    $this->request->server['REQUEST_METHOD'] = $requestMethod;
                }
    
                if ($stateChanged) {
                    $this->simplecheckout->initBlocks(true);
    
                    $this->getChildController('checkout/simplecheckout_customer/update_session');
                    $this->getChildController('checkout/simplecheckout_payment_address/update_session');
                    $this->getChildController('checkout/simplecheckout_shipping_address/update_session');
    
                    $this->_templateData['simple_blocks']['customer']         = $this->getChildController('checkout/simplecheckout_customer');
                    $this->_templateData['simple_blocks']['payment_address']  = $this->getChildController('checkout/simplecheckout_payment_address');
                    $this->_templateData['simple_blocks']['shipping_address'] = $this->getChildController('checkout/simplecheckout_shipping_address');
                }
            }
    
            $this->_templateData['ajax']                             = $this->simplecheckout->isAjaxRequest();
            $this->_templateData['weight']                           = $this->simplecheckout->displayWeight() ? $this->weight->format($this->cart->getWeight(), $this->config->get('config_weight_class_id'), $this->language->get('decimal_point'), $this->language->get('thousand_point')) : '';
            $this->_templateData['additional_path']                  = $this->simplecheckout->getAdditionalPath();
            $this->_templateData['additional_params']                = $this->simplecheckout->getAdditionalParams();
            $this->_templateData['login_type']                       = $this->simplecheckout->getSettingValue('loginType');
            $this->_templateData['current_theme']                    = $this->config->get('config_template');
            $this->_templateData['simple_template']                  = $this->simplecheckout->getTemplate();
            $this->_templateData['logged']                           = $this->customer->isLogged();
            $this->_templateData['steps_count']                      = $this->simplecheckout->getStepsCount();
            $this->_templateData['step_names']                       = $this->simplecheckout->getStepsNames();
            $this->_templateData['display_agreement_checkbox']       = $this->simplecheckout->getSettingValue('displayAgreementCheckbox');
            $this->_templateData['agreement_checkbox_step']          = $this->simplecheckout->getSettingValue('agreementCheckboxStep');
    
            $this->_templateData['order_blocked']                    = $this->simplecheckout->isOrderBlocked();
            $this->_templateData['javascript_callback']              = $this->simplecheckout->getJavascriptCallback();
    
            $this->_templateData['display_error']                    = $this->simplecheckout->displayError();
            $this->_templateData['has_error']                        = $this->simplecheckout->hasError('agreement');
            $this->_templateData['display_weight']                   = $this->simplecheckout->displayWeight();
            $this->_templateData['display_back_button']              = $this->simplecheckout->getSettingValue('displayBackButton');
            $this->_templateData['display_proceed_text']             = $this->simplecheckout->getSettingValue('displayProceedText');
            $this->_templateData['scroll_to_error']                  = $this->simplecheckout->getSettingValue('scrollToError');
            $this->_templateData['scroll_to_payment_form']           = $this->simplecheckout->getSettingValue('scrollToPaymentForm');
            $this->_templateData['left_column_width']                = $this->simplecheckout->getSettingValue('leftColumnWidth');
            $this->_templateData['right_column_width']               = $this->simplecheckout->getSettingValue('rightColumnWidth');
            $this->_templateData['use_autocomplete']                 = $this->simplecheckout->getCommonSetting('useAutocomplete');
            $this->_templateData['use_google_api']                   = $this->simplecheckout->getCommonSetting('useGoogleApi');
            $this->_templateData['enable_reloading_of_payment_form'] = $this->simplecheckout->getSettingValue('enableAutoReloaingOfPaymentFrom');
            $this->_templateData['error_warning_agreement']          = sprintf($this->language->get('error_agree'), $this->simplecheckout->getInformationTitle($this->simplecheckout->getSettingValue('agreementId')));
    
            $this->_templateData['errors'] = '';
    
            $errors = $this->simplecheckout->getErrors();
    
            if (!empty($errors) && is_array($errors)) {
                $this->_templateData['errors'] = implode(',', $errors);
            }
    
            $this->_templateData['popup']                   = !empty($args['popup']) ? true : (isset($this->request->get['popup']) ? true : false);
            $this->_templateData['as_module']               = !empty($args['module']) ? true : (isset($this->request->get['module']) ? true : false);
    
            $this->_templateData['text_proceed_payment']    = $this->language->get('text_proceed_payment');
            $this->_templateData['text_payment_form_title'] = $this->language->get('text_payment_form_title');
            $this->_templateData['text_need_save_changes']  = $this->language->get('text_need_save_changes');
            $this->_templateData['text_saving_changes']     = $this->language->get('text_saving_changes');
            $this->_templateData['text_cart']               = $this->language->get('text_cart');
            $this->_templateData['text_please_confirm']     = $this->language->get('text_please_confirm');
            $this->_templateData['button_save_changes']     = $this->language->get('button_save_changes');
            $this->_templateData['button_order']            = $this->language->get('button_order');
            $this->_templateData['button_back']             = $this->language->get('button_back');
            $this->_templateData['button_prev']             = $this->language->get('button_prev');
            $this->_templateData['button_next']             = $this->language->get('button_next');
            $this->_templateData['group']                   = $settingsGroup;
            $this->_templateData['cart_empty']              = !$this->cart->hasProducts() && empty($this->session->data['vouchers']);
            $this->_templateData['text_error']              = $this->language->get('text_empty');
            $this->_templateData['button_continue']         = $this->language->get('button_continue');
            $this->_templateData['continue']                = $this->url->link('common/home');
            $this->_templateData['use_storage']             = !$this->customer->isLogged() && !$this->simplecheckout->getSettingValue('useCookies') && $this->simplecheckout->getSettingValue('useStorage');
            
            $minicart = $this->simplecheckout->getSettingValue('minicartText', 'cart');
                
            $text_items = '';
            $language_code = $this->simplecheckout->getCurrentLanguageCode();
    
            if ($minicart && !empty($minicart[$language_code])) {
                $text_items = $minicart[$language_code];
            }
    
            if (!$text_items) {
                $this->language->load('checkout/cart');
                $text_items = $this->language->get('text_items');
                $this->language->load('checkout/simplecheckout');
            }
    
            $this->_templateData['cart_total'] = sprintf($text_items, 0, $this->simplecheckout->formatCurrency(0));
    
            $this->_templateData['customer_with_payment_address']  = $this->simplecheckout->isCustomerCombinedWithPaymentAddress();
            $this->_templateData['customer_with_shipping_address'] = $this->simplecheckout->isCustomerCombinedWithShippingAddress();
    
            $langId = ($this->config->get('config_template') == 'shoppica' || $this->config->get('config_template') == 'shoppica2') ? 'text_agree_shoppica' : 'text_agree';
            $title = $this->simplecheckout->getInformationTitle($this->simplecheckout->getSettingValue('agreementId'));
            $this->_templateData['text_agreement'] = sprintf($this->language->get($langId), $this->url->link($this->simplecheckout->getInformationRoute(), $this->simplecheckout->getAdditionalParams() . 'information_id=' . $this->simplecheckout->getSettingValue('agreementId'), 'SSL'), $title, $title);
    
            $childrens = array();
    
            if (!$this->simplecheckout->isAjaxRequest() && !$this->_templateData['popup'] && !$this->_templateData['as_module']) {
                $childrens = array(
                    'common/column_left',
                    'common/column_right',
                    'common/content_top',
                    'common/content_bottom',
                    'common/footer',
                    'common/header',
                );
    
                $this->_templateData['simple_header'] = $this->simplecheckout->getLinkToHeaderTpl();
                $this->_templateData['simple_footer'] = $this->simplecheckout->getLinkToFooterTpl();
            }
    
            $this->setOutputContent(trim($this->renderPage('checkout/simplecheckout', $this->_templateData, $childrens)));
        }
    
        private function validate() {
            $error = false;
    
            if ($this->simplecheckout->getSettingValue('displayAgreementCheckbox') && !$this->_templateData['agreement']) {
                $this->simplecheckout->addError('agreement');
                $error = true;
            }
    
            $errors = $this->simplecheckout->getErrors();
    
            if (!empty($errors)) {
                $error = true;
            }
    
            if (!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) {
                $error = true;
            }
    
            return !$error;
        }
    
        public function prevent_delete() {
            $this->loadLibrary('simple/simplecheckout');
    
            $this->simplecheckout = SimpleCheckout::getInstance($this->registry);
    
            $this->simplecheckout->setPreventDeleteFlag();
        }
    
        private function saveCustomerInfo() {
            $stateChanged = false;
    
            if (isset($this->request->post['ignore_post'])) {
                return $stateChanged;
            }
    
            if (!$this->customer->isLogged()) {
                if ($this->session->data['simple']['customer']['register'] && !empty($this->session->data['simple']['customer']['email'])) {
                    $this->load->model('account/customer');
                    $this->load->model('account/address');
    
                    // fix for old versions
                    $tmpCustomerGroupId = $this->config->get('config_customer_group_id');
                    $this->config->set('config_customer_group_id', $this->session->data['simple']['customer']['customer_group_id']);
    
                    $info = array_merge($this->session->data['simple']['payment_address'], $this->session->data['simple']['customer']);
    
                    $info['custom_field'] = array(
                        'account' => isset($this->session->data['simple']['customer']['custom_field']) ? $this->session->data['simple']['customer']['custom_field'] : array(),
                        'address' => isset($this->session->data['simple']['payment_address']['custom_field']) ? $this->session->data['simple']['payment_address']['custom_field'] : array()
                    );
    
                    if (empty($info['password'])) {
                        $this->load->model('tool/simpleapimain');
    
                        if (method_exists($this->model_tool_simpleapimain, 'getRandomPassword') || property_exists($this->model_tool_simpleapimain, 'getRandomPassword') || (method_exists($this->model_tool_simpleapimain, 'isExistForSimple') && $this->model_tool_simpleapimain->isExistForSimple('getRandomPassword'))) {
                            $info['password'] = $this->model_tool_simpleapimain->getRandomPassword();
                        }
                    }
    
                    $this->model_account_customer->addCustomer($info);
    
                    $this->config->set('config_customer_group_id', $tmpCustomerGroupId);
    
                    $this->session->data['simple']['registered'] = true;
    
                    $this->customer->login($this->session->data['simple']['customer']['email'], $info['password']);
    
                    $customerId = 0;
                    $addressId = 0;
    
                    if ($this->customer->isLogged()) {
                        $customerId = $this->customer->getId();
                        $addressId = $this->customer->getAddressId();
    
                        // stupid hack for opencart > 2.1
                        if ($this->simplecheckout->getOpencartVersion() >= 210) {
                            if ($this->simplecheckout->getOpencartVersion() < 220) {
                                $this->cart = new Cart($this->registry);
                            } else {
                                $this->cart = new Cart\Cart($this->registry);
                            }
                        }
                        // end
    
                        $stateChanged = true;
                    } else {
                        $customerInfo = $this->simplecheckout->getCustomerInfoByEmail($info['email']);
                        $customerId = $customerInfo['customer_id'];
                        $addressId = $customerInfo['address_id'];
                    }
    
                    if (($this->simplecheckout->getOpencartVersion() > 200 && $this->simplecheckout->getOpencartVersion() < 230) || ($this->simplecheckout->getOpencartVersion() >= 230 && $this->config->get('config_customer_activity'))) {
                        // Add to activity log
                        $this->load->model('account/activity');
    
                        $activity_data = array(
                            'customer_id' => $customerId,
                            'name'        => $info['firstname'] . ' ' . $info['lastname']
                        );
    
                        $this->model_account_activity->addActivity('register', $activity_data);
                    }
    
                    $this->session->data['simple']['customer']['customer_id'] = $customerId;
                    $this->session->data['simple']['payment_address']['address_id'] = $addressId;
    
                    $this->simplecheckout->replaceAddressIdInPostRequest('payment_address', $this->session->data['simple']['payment_address']['address_id']);
    
                    $this->simplecheckout->saveCustomFields(array('customer'), 'customer', $customerId);
                    $this->simplecheckout->saveCustomFields(array('payment_address', 'payment'), 'address', $this->session->data['simple']['payment_address']['address_id']);
    
                    if (!$this->simplecheckout->isBlockHidden('shipping_address') && !$this->simplecheckout->isAddressSame()) {
                        $this->session->data['simple']['shipping_address']['address_id'] = $this->model_account_address->addAddress($this->session->data['simple']['shipping_address']);
                        $this->simplecheckout->replaceAddressIdInPostRequest('shipping_address', $this->session->data['simple']['shipping_address']['address_id']);
                        $this->simplecheckout->saveCustomFields(array('shipping_address', 'shipping'), 'address', $this->session->data['simple']['shipping_address']['address_id']);
                    }
                }
            } else {
                $this->load->model('account/customer');
                $this->load->model('account/address');
    
                if (!$this->simplecheckout->isBlockHidden('customer')) {
                    unset($this->session->data['simple']['customer']['password']);
    
                    $this->model_account_customer->editCustomer($this->session->data['simple']['customer']);
                    $this->simplecheckout->saveCustomFields(array('customer'), 'customer', $this->customer->getId());
    
                    if ($this->simplecheckout->isFieldUsed('customer_group_id', 'customer')) {
                        $this->simplecheckout->editCustomerGroupId($this->session->data['simple']['customer']['customer_group_id']);
                    }
                }
    
                if ((!$this->simplecheckout->isBlockHidden('payment_address') || !empty($this->session->data['simple']['payment'])) && !isset($this->request->post['payment_address']['ignore_post'])) {
                    if ($this->session->data['simple']['payment_address']['address_id']) {
                        $this->model_account_address->editAddress($this->session->data['simple']['payment_address']['address_id'], $this->session->data['simple']['payment_address']);
                        $this->simplecheckout->saveCustomFields(array('payment_address', 'payment'), 'address', $this->session->data['simple']['payment_address']['address_id']);
                    } else {
                        $this->session->data['simple']['payment_address']['address_id'] = $this->model_account_address->addAddress($this->session->data['simple']['payment_address']);
                        $this->simplecheckout->replaceAddressIdInPostRequest('payment_address', $this->session->data['simple']['payment_address']['address_id']);
                        $this->simplecheckout->saveCustomFields(array('payment_address', 'payment'), 'address', $this->session->data['simple']['payment_address']['address_id']);
                    }
    
                    $stateChanged = true;
                }
    
                if ((!$this->simplecheckout->isBlockHidden('shipping_address') || !empty($this->session->data['simple']['shipping'])) && !isset($this->request->post['shipping_address']['ignore_post']) && ($this->simplecheckout->isBlockHidden('payment_address') || (!$this->simplecheckout->isBlockHidden('payment_address') && !$this->simplecheckout->isAddressSame()))) {
                    if ($this->session->data['simple']['shipping_address']['address_id']) {
                        $this->model_account_address->editAddress($this->session->data['simple']['shipping_address']['address_id'], $this->session->data['simple']['shipping_address']);
                        $this->simplecheckout->saveCustomFields(array('shipping_address', 'shipping'), 'address', $this->session->data['simple']['shipping_address']['address_id']);
                    } else {
                        $this->session->data['simple']['shipping_address']['address_id'] = $this->model_account_address->addAddress($this->session->data['simple']['shipping_address']);
                        $this->simplecheckout->replaceAddressIdInPostRequest('shipping_address', $this->session->data['simple']['shipping_address']['address_id']);
                        $this->simplecheckout->saveCustomFields(array('shipping_address', 'shipping'), 'address', $this->session->data['simple']['shipping_address']['address_id']);
                    }
    
                    $stateChanged = true;
                }
            }
    
            return $stateChanged;
        }
    
        private function order() {
            $this->simplecheckout->clearOrder();
    
            $customer_info    = $this->session->data['simple']['customer'];
            $payment_address  = $this->session->data['simple']['payment_address'];
            $payment_method   = $this->session->data['payment_method'];
            $shipping_address = $this->session->data['simple']['shipping_address'];
            $comment          = $this->simplecheckout->getComment();
            $version          = $this->simplecheckout->getOpencartVersion();
    
            if (empty($customer_info['email'])) {
                $emptyEmail = $this->simplecheckout->getSettingValue('emptyEmail', 'customer');
    
                if (!empty($emptyEmail)) {
                    $customer_info['email'] = $emptyEmail;
                } else {
                    $customer_info['email'] = 'empty'.time().'@localhost.net';
                }            
            }
    
            $totals = array();
            $total = 0;
            $taxes = $this->cart->getTaxes();
    
            $total_data = array(
                'totals' => &$totals,
                'taxes'  => &$taxes,
                'total'  => &$total
            );
    
            $sort_order = array();
    
            if ($this->simplecheckout->getOpencartVersion() < 200) {
                $this->load->model('setting/extension');
    
                $results = $this->model_setting_extension->getExtensions('total');
            } else {
                $this->load->model('extension/extension');
    
                $results = $this->model_extension_extension->getExtensions('total');
            }
    
            foreach ($results as $key => $value) {
                $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
            }
    
            array_multisort($sort_order, SORT_ASC, $results);
    
            foreach ($results as $result) {
                if ($this->config->get($result['code'] . '_status')) {
                    $this->simplecheckout->loadModel('total/' . $result['code']);
    
                    if ($this->simplecheckout->getOpencartVersion() < 220) {
                        $this->{'model_total_' . $result['code']}->getTotal($totals, $total, $taxes);
                    } else {
                        $this->{'model_total_' . $result['code']}->getTotal($total_data);
                    }
                }
            }
    
            $sort_order = array();
    
            foreach ($totals as $key => $value) {
                $sort_order[$key] = $value['sort_order'];
            }
    
            array_multisort($sort_order, SORT_ASC, $totals);
    
            $data = array();
    
            $data['invoice_prefix'] = $this->config->get('config_invoice_prefix');
            $data['store_id'] = $this->config->get('config_store_id');
            $data['store_name'] = $this->config->get('config_name');
    
            if ($data['store_id']) {
                $data['store_url'] = $this->config->get('config_url');
            } else {
                $data['store_url'] = HTTP_SERVER;
            }
    
            $data['customer_id']            = $customer_info['customer_id'];
            $data['customer_group_id']      = $customer_info['customer_group_id'];
            $data['firstname']              = $customer_info['firstname'];
            $data['lastname']               = $customer_info['lastname'];
            $data['email']                  = $customer_info['email'];
            $data['telephone']              = $customer_info['telephone'];
            $data['fax']                    = $customer_info['fax'];
            $data['custom_field']           = isset($customer_info['custom_field']) ? $customer_info['custom_field'] : array();
    
            $data['payment_firstname']      = $payment_address['firstname'];
            $data['payment_lastname']       = $payment_address['lastname'];
            $data['payment_company']        = $payment_address['company'];
            $data['payment_address_1']      = $payment_address['address_1'];
            $data['payment_address_2']      = $payment_address['address_2'];
            $data['payment_city']           = $payment_address['city'];
            $data['payment_postcode']       = $payment_address['postcode'];
            $data['payment_zone']           = $payment_address['zone'];
            $data['payment_zone_id']        = $payment_address['zone_id'];
            $data['payment_country']        = $payment_address['country'];
            $data['payment_country_id']     = $payment_address['country_id'];
            $data['payment_address_format'] = $payment_address['address_format'];
            $data['payment_company_id']     = isset($payment_address['company_id']) ? $payment_address['company_id'] : '';
            $data['payment_tax_id']         = isset($payment_address['tax_id']) ? $payment_address['tax_id'] : '';
            $data['payment_custom_field']   = isset($payment_address['custom_field']) ? $payment_address['custom_field'] : array();
    
            if (isset($payment_method['title'])) {
                $data['payment_method'] = $payment_method['title'];
            } else {
                $data['payment_method'] = '';
            }
    
            if (isset($payment_method['code'])) {
                $data['payment_code'] = $payment_method['code'];
            } else {
                $data['payment_code'] = '';
            }
    
            if ($this->cart->hasShipping()) {
                $data['shipping_firstname']      = $shipping_address['firstname'];
                $data['shipping_lastname']       = $shipping_address['lastname'];
                $data['shipping_company']        = $shipping_address['company'];
                $data['shipping_address_1']      = $shipping_address['address_1'];
                $data['shipping_address_2']      = $shipping_address['address_2'];
                $data['shipping_city']           = $shipping_address['city'];
                $data['shipping_postcode']       = $shipping_address['postcode'];
                $data['shipping_zone']           = $shipping_address['zone'];
                $data['shipping_zone_id']        = $shipping_address['zone_id'];
                $data['shipping_country']        = $shipping_address['country'];
                $data['shipping_country_id']     = $shipping_address['country_id'];
                $data['shipping_address_format'] = $shipping_address['address_format'];
                $data['shipping_custom_field']   = isset($shipping_address['custom_field']) ? $shipping_address['custom_field'] : array();
    
                if (isset($this->session->data['shipping_method']['title'])) {
                    $data['shipping_method'] = $this->session->data['shipping_method']['title'];
                } else {
                    $data['shipping_method'] = '';
                }
    
                if (isset($this->session->data['shipping_method']['code'])) {
                    $data['shipping_code'] = $this->session->data['shipping_method']['code'];
                } else {
                    $data['shipping_code'] = '';
                }
            } else {
                $data['shipping_firstname']      = '';
                $data['shipping_lastname']       = '';
                $data['shipping_company']        = '';
                $data['shipping_address_1']      = '';
                $data['shipping_address_2']      = '';
                $data['shipping_city']           = '';
                $data['shipping_postcode']       = '';
                $data['shipping_zone']           = '';
                $data['shipping_zone_id']        = '';
                $data['shipping_country']        = '';
                $data['shipping_country_id']     = '';
                $data['shipping_address_format'] = '';
                $data['shipping_method']         = '';
                $data['shipping_code']           = '';
                $data['shipping_custom_field']   = array();
            }
    
            $data['payment_address_format'] = $this->simplecheckout->getAddressFormat($data, 'payment');
            $data['shipping_address_format'] = $this->simplecheckout->getAddressFormat($data, 'shipping');
    
            $product_data = array();
    
            if ($version < 152) {
    
                if (method_exists($this->tax,'setZone')) {
                    if ($this->cart->hasShipping()) {
                        $this->tax->setZone($data['shipping_country_id'], $data['shipping_zone_id']);
                    } else {
                        $this->tax->setZone($data['payment_country_id'], $data['payment_zone_id']);
                    }
                }
    
                $this->loadLibrary('encryption');
    
                foreach ($this->cart->getProducts() as $product) {
                    $option_data = array();
    
                    foreach ($product['option'] as $option) {
                        if ($option['type'] != 'file') {
                            $option_data[] = array(
                                'product_option_id'       => $option['product_option_id'],
                                'product_option_value_id' => $option['product_option_value_id'],
                                'product_option_id'       => $option['product_option_id'],
                                'product_option_value_id' => $option['product_option_value_id'],
                                'option_id'               => $option['option_id'],
                                'option_value_id'         => $option['option_value_id'],
                                'name'                    => $option['name'],
                                'value'                   => $option['option_value'],
                                'type'                    => $option['type']
                            );
                        } else {
                            $encryption = new Encryption($this->config->get('config_encryption'));
    
                            $option_data[] = array(
                                'product_option_id'       => $option['product_option_id'],
                                'product_option_value_id' => $option['product_option_value_id'],
                                'product_option_id'       => $option['product_option_id'],
                                'product_option_value_id' => $option['product_option_value_id'],
                                'option_id'               => $option['option_id'],
                                'option_value_id'         => $option['option_value_id'],
                                'name'                    => $option['name'],
                                'value'                   => $encryption->decrypt($option['option_value']),
                                'type'                    => $option['type']
                            );
                        }
                    }
    
                    $product_data[] = array(
                        'product_id' => $product['product_id'],
                        'name'       => $product['name'],
                        'model'      => $product['model'],
                        'option'     => $option_data,
                        'download'   => $product['download'],
                        'quantity'   => $product['quantity'],
                        'subtract'   => $product['subtract'],
                        'price'      => $product['price'],
                        'total'      => $product['total'],
                        'tax'        => method_exists($this->tax,'getRate') ? $this->tax->getRate($product['tax_class_id']) : $this->tax->getTax($product['price'], $product['tax_class_id'])
                    );
                }
    
                // Gift Voucher
                if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
                    foreach ($this->session->data['vouchers'] as $voucher) {
                        $product_data[] = array(
                            'product_id' => 0,
                            'name'       => $voucher['description'],
                            'model'      => '',
                            'option'     => array(),
                            'download'   => array(),
                            'quantity'   => 1,
                            'subtract'   => false,
                            'price'      => $voucher['amount'],
                            'total'      => $voucher['amount'],
                            'tax'        => 0
                        );
                    }
                }
    
                $data['products'] = $product_data;
                $data['totals'] = $totals;
                $data['comment'] = $comment;
                $data['total'] = $total;
                $data['reward'] = $this->cart->getTotalRewardPoints();
            } elseif ($version >= 152) {
                foreach ($this->cart->getProducts() as $product) {
                    $option_data = array();
    
                    foreach ($product['option'] as $option) {
                        if ($version >= 200) {
                            $value = $option['value'];
                        } else {
                            if ($option['type'] != 'file') {
                                $value = $option['option_value'];
                            } else {
                                $value = $this->encryption->decrypt($option['option_value']);
                            }
                        }
    
                        $option_data[] = array(
                            'product_option_id'       => $option['product_option_id'],
                            'product_option_value_id' => $option['product_option_value_id'],
                            'option_id'               => $option['option_id'],
                            'option_value_id'         => $option['option_value_id'],
                            'name'                    => $option['name'],
                            'value'                   => $value,
                            'type'                    => $option['type']
                        );
                    }
    
                    $product_data[] = array(
                        'product_id' => $product['product_id'],
                        'name'       => $product['name'],
                        'model'      => $product['model'],
                        'option'     => $option_data,
                        'download'   => $product['download'],
                        'quantity'   => $product['quantity'],
                        'subtract'   => $product['subtract'],
                        'price'      => $product['price'],
                        'total'      => $product['total'],
                        'tax'        => $this->tax->getTax($product['price'], $product['tax_class_id']),
                        'reward'     => $product['reward']
                    );
                }
    
                // Gift Voucher
                $voucher_data = array();
    
                if (!empty($this->session->data['vouchers'])) {
                    foreach ($this->session->data['vouchers'] as $voucher) {
                        $voucher_data[] = array(
                            'description'      => $voucher['description'],
                            'code'             => substr(md5(rand()), 0, 10),
                            'to_name'          => $voucher['to_name'],
                            'to_email'         => $voucher['to_email'],
                            'from_name'        => $voucher['from_name'],
                            'from_email'       => $voucher['from_email'],
                            'voucher_theme_id' => $voucher['voucher_theme_id'],
                            'message'          => $voucher['message'],
                            'amount'           => $voucher['amount']
    
                        );
                    }
                }
    
                $data['products'] = $product_data;
                $data['vouchers'] = $voucher_data;
                $data['totals'] = $totals;
                $data['comment'] = $comment;
                $data['total'] = $total;
            }
    
            if (isset($this->request->cookie['tracking'])) {
                $this->load->model('affiliate/affiliate');
    
                $data['tracking'] = $this->request->cookie['tracking'];
    
                $affiliate_info = $this->model_affiliate_affiliate->getAffiliateByCode($this->request->cookie['tracking']);
                $subtotal = $this->cart->getSubTotal();
    
                if ($affiliate_info) {
                    $data['affiliate_id'] = $affiliate_info['affiliate_id'];
                    $data['commission'] = ($subtotal / 100) * $affiliate_info['commission'];
                } else {
                    $data['affiliate_id'] = 0;
                    $data['commission'] = 0;
                }
    
                if ($this->simplecheckout->getOpencartVersion() >= 200) {
                    $this->load->model('checkout/marketing');
    
                    $marketing_info = $this->model_checkout_marketing->getMarketingByCode($this->request->cookie['tracking']);
    
                    if ($marketing_info) {
                        $data['marketing_id'] = $marketing_info['marketing_id'];
                    } else {
                        $data['marketing_id'] = 0;
                    }
                }
            } else {
                $data['affiliate_id'] = 0;
                $data['commission'] = 0;
                $data['marketing_id'] = 0;
                $data['tracking'] = '';
            }
    
            $data['language_id']    = $this->config->get('config_language_id');
    
            if ($version < 220) {
                $data['currency_id']    = $this->currency->getId();
                $data['currency_code']  = $this->currency->getCode();
                $data['currency_value'] = $this->currency->getValue($this->currency->getCode());
            } else {
                $data['currency_id']    = $this->currency->getId($this->session->data['currency']);
                $data['currency_code']  = $this->session->data['currency'];
                $data['currency_value'] = $this->currency->getValue($this->session->data['currency']);
            }
    
            $data['ip'] = $this->request->server['REMOTE_ADDR'];
    
            if (!empty($this->request->server['HTTP_X_FORWARDED_FOR'])) {
                $data['forwarded_ip'] = $this->request->server['HTTP_X_FORWARDED_FOR'];
            } elseif(!empty($this->request->server['HTTP_CLIENT_IP'])) {
                $data['forwarded_ip'] = $this->request->server['HTTP_CLIENT_IP'];
            } else {
                $data['forwarded_ip'] = '';
            }
    
            if (isset($this->request->server['HTTP_USER_AGENT'])) {
                $data['user_agent'] = $this->request->server['HTTP_USER_AGENT'];
            } else {
                $data['user_agent'] = '';
            }
    
            if (isset($this->request->server['HTTP_ACCEPT_LANGUAGE'])) {
                $data['accept_language'] = $this->request->server['HTTP_ACCEPT_LANGUAGE'];
            } else {
                $data['accept_language'] = '';
            }
    
            $this->load->model('checkout/order');
    
            $order_id = 0;
    
            $customInfo = $this->simplecheckout->getCustomFields(array('customer', 'payment_address', 'payment', 'shipping_address', 'shipping'), 'order');
    
            $data = array_merge($customInfo, $data);
    
            if ($version < 152) {
                $order_id = $this->model_checkout_order->create($data);
    
                // Gift Voucher
                if (isset($this->session->data['vouchers']) && is_array($this->session->data['vouchers'])) {
                    $this->load->model('checkout/voucher');
    
                    foreach ($this->session->data['vouchers'] as $voucher) {
                        $this->model_checkout_voucher->addVoucher($order_id, $voucher);
                    }
                }
            } elseif ($version >= 152) {
                $order_id = $this->model_checkout_order->addOrder($data);
            }
    
            $this->session->data['order_id'] = $order_id;
    
            $this->simplecheckout->saveCustomFields(array('customer', 'payment_address', 'payment', 'shipping_address', 'shipping'), 'order', $order_id);
    
            return $order_id;
        }
    }

     

     

  9. 11 часов назад, AWARO сказал:

    и симпл и без тупит как только более 50 товаров в корзине разных
    нужно перепилить корзину, вырезать лишнее

    Да там вроде бы все по минимуму уже стоит.

    Список товаров (обязательно), список способов доставки (обязательно), форма - адрес, имя, телефон(обязательно).

  10. 7 минут назад, thentru сказал:

    в дефолтном оформлении будет то же самое


    посмотрите как работает метод $this->cart->getProducts();

    на каждый товар делается запрос, а еще опции, акции, скидки...
    при этом getProducts может вызываться несколько раз (для расчета доставки, для итогов и тд)

    Есть какой-нибудь вариант эту часть подкорректировать для корзины?

     

    Сейчас нет возможности заглянуть, но спасибо. Будем посмотреть, как можно будет оптимизировать. 

  11. 21 минуту назад, freelancer сказал:

    может simple и тупит?

    Да черт его знает. 

    Без него теряется весь смысл в сайте. Ибо клиент просил чтобы регистрация была обязательной, но упрощенной до максимума. Плюс упрощенная корзина.

  12. Здравствуйте. 

    Вот какая проблема появилась на сайте. 

    Некий клиент забил корзину 300 товарами по 1шт. 

    И! У него корзина не может открыться. А если расходятся тучи над ночным костром по ритмичные удары в бубен, то кнопка - Отправить в корзину. Ну никак не отрабатывает. 

    Она что-то усиленно пытается грузить, по всем нужным местам вертятся кружочки о загрузке. Но пшик... И снова 502 на весь экран. 

     

     

    Я даже не знаю как с этим бороться. 

  13. На сайте https://usvitok.ru/ на главной странице, две из трех форм обратной связи не работают. 

    У меня вопрос. 

    Как это может быть связано с Simple и выставленными настройками там насчет что корзина доступна только для зарегистрированных пользователей. 

    Так как я заметил, что формы не работают вообще если пользователь не авторизован.

     

    Есть ли какой-то параметр в настройках на этот счет?

    Или (простите за наглость) мыли на этот счет? 

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.