Неправильно определяется количество товара во вкладке рекомендуемые

Тема в разделе "OpenCart", создана пользователем KuEdA, 6 июл 2015.

  1. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    Здравствуйте. Помогите, пожалуйста, разобраться. Я загружаю товары с помощью модуля Автоматическая обработка прайс-листов. Количество товара у меня установлено 1. Также на сайте у меня стоит модуль табы с измененной кнопкой "купить", т.е. когда количество товара 0, то кнопка "купить" изменяется на "уточнить наличие". Сделано это таким образом:

    product_tab.php

    Код:
    <?php
    class ControllerModuleProductTab extends Controller {
      
        protected function index($setting) {
    
            if(!isset($this->request->get['route']) || $this->request->get['route'] != 'product/product'){
            $this->document->addScript('catalog/view/javascript/jquery/tabs.js');
            }
    
            static $module = 0;
    
            $this->language->load('module/product_tab');
          
              $this->data['heading_title'] = $this->language->get('heading_title');
    
              $this->data['tab_latest'] = $this->language->get('tab_latest');
              $this->data['tab_featured'] = $this->language->get('tab_featured');
              $this->data['tab_bestseller'] = $this->language->get('tab_bestseller');
              $this->data['tab_special'] = $this->language->get('tab_special');
    
          
            $this->data['button_cart'] = $this->language->get('button_cart');
                  
            $this->load->model('catalog/product');
          
            // bestseller
              
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
              
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
              
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
          
            $this->load->model('tool/image');
    
            //Latest Products
          
            $this->data['latest_products'] = array();
          
            $latest_results = $this->model_catalog_product->getLatestProducts($setting['limit']);
    
            foreach ($latest_results as $result) {
                if ($result['image']) {
    $results_img = $this->model_catalog_product->getProductImages($result['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                }
                          
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                      
                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }
              
                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }
              
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
                                      
                $this->data['latest_products'][] = array(
                                    'quantity'    => $result['quantity'],
                                    'labels' => $labels,
                    'product_id' => $result['product_id'],
                                    'dop_img' => $dop_img,
                    'thumb'        => $image,
                    'name'         => $result['name'],
                    'price'        => $price,
                    'special'      => $special,
                    'saving'     => ((float)$result['price'] ? round((($result['price'] - $result['special'])/$result['price'])*100, 0) : 0),
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'         => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
            }
    
            //Specials product
    
            $this->data['special_products'] = array();
    
                $special_data = array(
                'sort'  => 'pd.name',
                'order' => 'ASC',
                'start' => 0,
                'limit' => $setting['limit']
            );
    
    
          
            $special_results = $this->model_catalog_product->getProductSpecials($special_data);
    
            foreach ($special_results as $result) {
                if ($result['image']) {
    $results_img = $this->model_catalog_product->getProductImages($result['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                }
                          
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                      
                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }
              
                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }
              
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
              
                $this->data['special_products'][] = array(
                      'quantity'    => $result['quantity'],
                    'labels' => $labels,
                    'product_id' => $result['product_id'],
                    'dop_img' => $dop_img,
                    'thumb'        => $image,
                    'name'         => $result['name'],
                    'price'        => $price,
                    'special'      => $special,
                    'saving'     => ((float)$result['price'] ? round((($result['price'] - $result['special'])/$result['price'])*100, 0) : 0),
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'         => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
            }
    
            //BestSeller
            $this->data['bestseller_products'] = array();
    
            $bestseller_results = $this->model_catalog_product->getBestSellerProducts($setting['limit']);
          
            foreach ($bestseller_results as $result) {
                if ($result['image']) {
    $results_img = $this->model_catalog_product->getProductImages($result['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                }
              
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                      
                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }  
              
                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }
              
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
                              
                $this->data['bestseller_products'][] = array(
                    'quantity'    => $result['quantity'],
                    'labels' => $labels,
                    'product_id' => $result['product_id'],
                    'dop_img' => $dop_img,
                    'thumb'        => $image,
                    'name'         => $result['name'],
                    'price'        => $price,
                    'special'      => $special,
                    'saving'     => ((float)$result['price'] ? round((($result['price'] - $result['special'])/$result['price'])*100, 0) : 0),
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'         => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
            }
    
    
            //Featured
            $this->data['featured_products'] = array();
    
            $products = explode(',', $this->config->get('featured_product'));      
    
            if (empty($setting['limit'])) {
                $setting['limit'] = 5;
            }
          
            $products = array_slice($products, 0, (int)$setting['limit']);
          
            foreach ($products as $product_id) {
                $product_info = $this->model_catalog_product->getProduct($product_id);
              
                if ($product_info) {
    $results_img = $this->model_catalog_product->getProductImages($product_info['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $setting['image_width'], $setting['image_height']);
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    if ($product_info['image']) {
                        $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']);
                    } else {
                        $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                    }
    
                    if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                        $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
                    } else {
                        $price = false;
                    }
                          
                    if ((float)$product_info['special']) {
                        $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
                    } else {
                        $special = false;
                    }
                  
                    if ($this->config->get('config_review_status')) {
                        $rating = $product_info['rating'];
                    } else {
                        $rating = false;
                    }
                  
                    $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
                      
                    $this->data['featured_products'][] = array(
                        'quantity'    => $result['quantity'],
                        'labels' => $labels,
                        'product_id' => $product_info['product_id'],
                        'dop_img' => $dop_img,
                        'thumb'        => $image,
                        'name'         => $product_info['name'],
                        'price'        => $price,
                        'special'      => $special,
                        'saving'     => ((float)$product_info['price'] ? round((($product_info['price'] - $product_info['special'])/$product_info['price'])*100, 0) : 0),
                        'rating'     => $rating,
                        'reviews'    => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
                        'href'         => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
                    );
                }
            }
    
            $this->data['module'] = $module++;
    
            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/product_tab.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/module/product_tab.tpl';
            } else {
                $this->template = 'ava/template/module/product_tab.tpl';
            }
    
            $this->render();
        }
    }
    ?>
    product_tab.tpl

    Код:
      <div id="tabs-<?php echo $module; ?>">
        <?php if($latest_products){ ?>
        <span class="tab-latest"><a href="#tab-latest-<?php echo $module; ?>" style="display: inline;"><?php echo $tab_latest; ?></a></span>
        <?php } ?>
        <?php if($featured_products){ ?>
            <span class="tab-featured"><a href="#tab-featured-<?php echo $module; ?>" style="display: inline;"><?php echo $tab_featured; ?></a></span>
        <?php } ?>
        <?php if($bestseller_products){ ?>
        <span class="tab-bestseller"><a href="#tab-bestseller-<?php echo $module; ?>" style="display: inline;"><?php echo $tab_bestseller; ?></a></span>
        <?php } ?>
        <?php if($special_products){ ?>
        <span class="tab-special"><a href="#tab-special-<?php echo $module; ?>" style="display: inline;"><?php echo $tab_special; ?></a></span>
        <?php } ?>
    </div>
    
    <link rel="stylesheet" type="text/css" href="catalog/view/theme/stylishjewel/stylesheet/tab-owl.css" />
    
    
    <?php if($latest_products){ ?>
    <div id="tab-latest-<?php echo $module; ?>" style="padding: 20px 10px 10px;" class="tab-content">
        <div id="owl-example7" class="owl-carousel owl-theme" style="display: block; opacity: 1;">
          <?php foreach ($latest_products as $product) { ?>
          <div class="item">
            <?php if ($product['thumb']) { ?>
    <div class="fotorama" data-width="250" data-ratio="250/250" data-nav="none" data-arrows="true">
            <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                    <?php foreach ($product['dop_img'] as $img) { ?>
                      <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $img;?>" alt="<?php echo $product['name']; ?>"></a></div>
                      <?php } ?>
            <?php } ?>
            </div>
            <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
            <?php if ($product['price']) { ?>
            <div class="price">
              <?php if (!$product['special']) { ?>
              <?php echo $product['price']; ?>
              <?php } else { ?>
              <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span>
              <?php } ?>
            </div>
            <?php } ?>
            <div class="rating">
              <?php for ($i = 1; $i <= 5; $i++) { ?>
              <?php if ($product['rating'] < $i) { ?>
              <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } else { ?>
              <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } ?>
              <?php } ?>
            </div>
        <?php if ($product['quantity'] > 0) { ?>
                <div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button-prod" title="<?php echo $button_cart; ?>"><i class="fa fa-shopping-cart"></i>&nbsp;<?php echo $button_cart; ?></a></div>
      <?php } else { ?>
               <a class="callme_viewform" title="Уточнить наличие"><i class="fa fa-check-square-o"> Уточнить наличие</i></a>
    <?php } ?>           
          </div>
          <?php } ?>
        </div>
    </div>
    <?php } ?>
    <script>
    $(document).ready(function() {
      $("#owl-example7").owlCarousel({
    // ϲ᧥
    items: 3,
    itemsCustom : false,
    singleItem: false,
        itemsDesktop : [1199, 3],
        itemsDesktopSmall : [980, 3],//Ҫﱮ뱳
        slideSpeed : 500,
        paginationSpeed : 800,
        rewindSpeed : 1000,
    //bﬨᮨ㋊    autoPlay : false,
        stopOnHover : false,
    // ˭ﰪ桭ᣨ䡶馠< >
        navigation : true,
        //navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
    pagination : false,
        rewindNav : true,
        scrollPerPage : false,  // 믭洠鬨 ᬮ
      });
    });
    </script>
    
    
    
    <?php if($featured_products){ ?>
      <div id="tab-featured-<?php echo $module; ?>" style="padding: 20px 10px 10px;" class="tab-content">
        <div id="owl-example8" class="owl-carousel owl-theme" style="display: block; opacity: 1;">
          <?php foreach ($featured_products as $product) { ?>
          <div class="item">
            <?php if ($product['thumb']) { ?>
    <div class="fotorama" data-width="250" data-ratio="250/250" data-nav="none" data-arrows="true">
            <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                    <?php foreach ($product['dop_img'] as $img) { ?>
                      <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $img;?>" alt="<?php echo $product['name']; ?>"></a></div>
                      <?php } ?>
            <?php } ?>
            </div>
            <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
            <?php if ($product['price']) { ?>
            <div class="price">
              <?php if (!$product['special']) { ?>
              <?php echo $product['price']; ?>
              <?php } else { ?>
              <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span>
              <?php } ?>
            </div>
            <?php } ?>
            <div class="rating">
              <?php for ($i = 1; $i <= 5; $i++) { ?>
              <?php if ($product['rating'] < $i) { ?>
              <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } else { ?>
              <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } ?>
              <?php } ?>
            </div>
        <?php if ($product['quantity'] > 0) { ?>
                <div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button-prod" title="<?php echo $button_cart; ?>"><i class="fa fa-shopping-cart"></i>&nbsp;<?php echo $button_cart; ?></a></div>
      <?php } else { ?>
               <a class="callme_viewform" title="Уточнить наличие"><i class="fa fa-check-square-o"> Уточнить наличие</i></a>
    <?php } ?>          
          </div>
          <?php } ?>
        </div>
    </div>
    <?php } ?>
    
    <script>
    $(document).ready(function() {
      $("#owl-example8").owlCarousel({
    // ϲ᧥
    items: 3,
    itemsCustom : false,
    singleItem: false,
        itemsDesktop : [1199, 3],
        itemsDesktopSmall : [980, 3],//Ҫﱮ뱳
        slideSpeed : 500,
        paginationSpeed : 800,
        rewindSpeed : 1000,
    //bﬨᮨ㋊    autoPlay : false,
        stopOnHover : false,
    // ˭ﰪ桭ᣨ䡶馠< >
        navigation : true,
    //navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
    pagination : false,
        rewindNav : true,
        scrollPerPage : false,  // 믭洠鬨 ᬮ
      });
    });
    </script>
    
    
    <?php if($bestseller_products){ ?>
    <div id="tab-bestseller-<?php echo $module; ?>" style="padding: 20px 10px 10px;" class="tab-content">
        <div id="owl-example9" class="owl-carousel owl-theme" style="display: block; opacity: 1;">
          <?php foreach ($bestseller_products as $product) { ?>
          <div class="item">
            <?php if ($product['thumb']) { ?>
    <div class="fotorama" data-width="250" data-ratio="250/250" data-nav="none" data-arrows="true">
            <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                    <?php foreach ($product['dop_img'] as $img) { ?>
                      <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $img;?>" alt="<?php echo $product['name']; ?>"></a></div>
                      <?php } ?>
            <?php } ?>
            </div>
            <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
            <?php if ($product['price']) { ?>
            <div class="price">
              <?php if (!$product['special']) { ?>
              <?php echo $product['price']; ?>
              <?php } else { ?>
              <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span>
              <?php } ?>
            </div>
            <?php } ?>
            <div class="rating">
              <?php for ($i = 1; $i <= 5; $i++) { ?>
              <?php if ($product['rating'] < $i) { ?>
              <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } else { ?>
              <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } ?>
              <?php } ?>
            </div>
        <?php if ($product['quantity'] > 0) { ?>
                <div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button-prod" title="<?php echo $button_cart; ?>"><i class="fa fa-shopping-cart"></i>&nbsp;<?php echo $button_cart; ?></a></div>
      <?php } else { ?>
               <a class="callme_viewform" title="Уточнить наличие"><i class="fa fa-check-square-o"> Уточнить наличие</i></a>
    <?php } ?>           
          </div>
          <?php } ?>
        </div>
    </div>
    <?php } ?>
    
    <script>
    $(document).ready(function() {
      $("#owl-example9").owlCarousel({
    // ϲ᧥
    items: 3,
    itemsCustom : false,
    singleItem: false,
        itemsDesktop : [1199, 3],
        itemsDesktopSmall : [980, 3],//Ҫﱮ뱳
        slideSpeed : 500,
        paginationSpeed : 800,
        rewindSpeed : 1000,
    //bﬨᮨ㋊    autoPlay : false,
        stopOnHover : false,
    // ˭ﰪ桭ᣨ䡶馠< >
        navigation : true,
    //navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
    pagination : false,
        rewindNav : true,
        scrollPerPage : false,  // 믭洠鬨 ᬮ
      });
    });
    </script>
    
    <?php if($special_products){ ?>
    <div id="tab-special-<?php echo $module; ?>" style="padding: 20px 10px 10px;" class="tab-content">
        <div id="owl-example10" class="owl-carousel owl-theme" style="display: block; opacity: 1;">
          <?php foreach ($special_products as $product) { ?>
          <div class="item">
            <?php if ($product['thumb']) { ?>
    <div class="fotorama" data-width="250" data-ratio="250/250" data-nav="none" data-arrows="true">
            <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                    <?php foreach ($product['dop_img'] as $img) { ?>
                      <div class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $img;?>" alt="<?php echo $product['name']; ?>"></a></div>
                      <?php } ?>
            <?php } ?>
            </div>
            <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
            <?php if ($product['price']) { ?>
            <div class="price">
              <?php if (!$product['special']) { ?>
              <?php echo $product['price']; ?>
              <?php } else { ?>
              <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span>
              <?php } ?>
            </div>
            <?php } ?>
            <div class="rating">
              <?php for ($i = 1; $i <= 5; $i++) { ?>
              <?php if ($product['rating'] < $i) { ?>
              <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } else { ?>
              <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
              <?php } ?>
              <?php } ?>
            </div>
        <?php if ($product['quantity'] > 0) { ?>
                <div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button-prod" title="<?php echo $button_cart; ?>"><i class="fa fa-shopping-cart"></i>&nbsp;<?php echo $button_cart; ?></a></div>
      <?php } else { ?>
               <a class="callme_viewform" title="Уточнить наличие"><i class="fa fa-check-square-o"> Уточнить наличие</i></a>
    <?php } ?>           
          </div>
          <?php } ?>
        </div>
    </div>
    <?php } ?>
    
    <script>
    $(document).ready(function() {
      $("#owl-example10").owlCarousel({
    // ϲ᧥
    items: 3,
    itemsCustom : false,
    singleItem: false,
        itemsDesktop : [1199, 3],
        itemsDesktopSmall : [980, 3],//Ҫﱮ뱳
        slideSpeed : 500,
        paginationSpeed : 800,
        rewindSpeed : 1000,
    //bﬨᮨ㋊    autoPlay : false,
        stopOnHover : false,
    // ˭ﰪ桭ᣨ䡶馠< >
        navigation : true,
    //navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
    pagination : false,
        rewindNav : true,
        scrollPerPage : false,  // 믭洠鬨 ᬮ
      });
    });
    </script>
    
    <script type="text/javascript">
    $('#tabs-<?php echo $module; ?> a').tabs();
    </script> 
    Все работает, но стоит мне купить хотя бы один товар, как во вкладке рекомендуемые у всех товаров кнопка "купить" меняется на "уточнить наличие". Во вкладке новинки, в категориях, в поиске, в карточках товаров все отображается, как и должно. У купленного товара кнопка меняется на "уточнить наличие", у остальных так и остается "купить". Т.е. получается, что во вкладке рекомендуемые все добавляемые товары определяются в количестве 0, хотя в админке их количество = 1. Подскажите, пожалуйста, в чем может быть дело, никак не могу разобраться, всю голову сломал уже.
     
    Последнее редактирование: 6 июл 2015
  2. adnext

    adnext

    Регистрация:
    13 апр 2015
    Сообщения:
    18
    Симпатии:
    2
    Если это ocShop то похоже, что переменная кол-ва сохраняется и распростряняется на все товары.
    Попробуйте выключить кеширование, возможно кеш.
     
    KuEdA нравится это.
  3. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    У меня ocstore 1.5.5.2. А как можно выключить кэширование, подскажите, пожалуйста.
     
  4. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    Поменял в контроллере блоки местами: //Featured поместил под //Latest Products таким образом
    Код:
     //Latest Products
         
            $this->data['latest_products'] = array();
         
            $latest_results = $this->model_catalog_product->getLatestProducts($setting['limit']);
    
            foreach ($latest_results as $result) {
                if ($result['image']) {
    $results_img = $this->model_catalog_product->getProductImages($result['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                }
                         
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                     
                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }
             
                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }
             
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
                                     
                $this->data['latest_products'][] = array(
                                    'quantity'    => $result['quantity'],
                                    'labels' => $labels,
                    'product_id' => $result['product_id'],
                                    'dop_img' => $dop_img,
                    'thumb'        => $image,
                    'name'         => $result['name'],
                    'price'        => $price,
                    'special'      => $special,
                    'saving'     => ((float)$result['price'] ? round((($result['price'] - $result['special'])/$result['price'])*100, 0) : 0),
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'         => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
            }
    
            //Featured
            $this->data['featured_products'] = array();
    
            $products = explode(',', $this->config->get('featured_product'));     
    
            if (empty($setting['limit'])) {
                $setting['limit'] = 5;
            }
         
            $products = array_slice($products, 0, (int)$setting['limit']);
         
            foreach ($products as $product_id) {
                $product_info = $this->model_catalog_product->getProduct($product_id);
             
                if ($product_info) {
    $results_img = $this->model_catalog_product->getProductImages($product_info['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $setting['image_width'], $setting['image_height']);
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    if ($product_info['image']) {
                        $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']);
                    } else {
                        $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                    }
    
                    if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                        $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
                    } else {
                        $price = false;
                    }
                         
                    if ((float)$product_info['special']) {
                        $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
                    } else {
                        $special = false;
                    }
                 
                    if ($this->config->get('config_review_status')) {
                        $rating = $product_info['rating'];
                    } else {
                        $rating = false;
                    }
                 
                    $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
                     
                    $this->data['featured_products'][] = array(
                        'quantity'    => $result['quantity'],
                        'labels' => $labels,
                        'product_id' => $product_info['product_id'],
                        'dop_img' => $dop_img,
                        'thumb'        => $image,
                        'name'         => $product_info['name'],
                        'price'        => $price,
                        'special'      => $special,
                        'saving'     => ((float)$product_info['price'] ? round((($product_info['price'] - $product_info['special'])/$product_info['price'])*100, 0) : 0),
                        'rating'     => $rating,
                        'reviews'    => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
                        'href'         => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
                    );
                }
            }
    
            //Specials product
    
            $this->data['special_products'] = array();
    
                $special_data = array(
                'sort'  => 'pd.name',
                'order' => 'ASC',
                'start' => 0,
                'limit' => $setting['limit']
            );
    
    
         
            $special_results = $this->model_catalog_product->getProductSpecials($special_data);
    
            foreach ($special_results as $result) {
                if ($result['image']) {
    $results_img = $this->model_catalog_product->getProductImages($result['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                }
                         
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                     
                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }
             
                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }
             
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
             
                $this->data['special_products'][] = array(
                      'quantity'    => $result['quantity'],
                    'labels' => $labels,
                    'product_id' => $result['product_id'],
                    'dop_img' => $dop_img,
                    'thumb'        => $image,
                    'name'         => $result['name'],
                    'price'        => $price,
                    'special'      => $special,
                    'saving'     => ((float)$result['price'] ? round((($result['price'] - $result['special'])/$result['price'])*100, 0) : 0),
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'         => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
            }
    
            //BestSeller
            $this->data['bestseller_products'] = array();
    
            $bestseller_results = $this->model_catalog_product->getBestSellerProducts($setting['limit']);
         
            foreach ($bestseller_results as $result) {
                if ($result['image']) {
    $results_img = $this->model_catalog_product->getProductImages($result['product_id']);
                    $dop_img = array();
                    foreach ($results_img as $result_img) {
                    if ($result_img['image']) {
                    $image_dop = $this->model_tool_image->resize($result_img['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
                    } else {
                    $image_dop = false;
                    }
                     $dop_img[] = $image_dop;
                    }
                    $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
                }
             
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                     
                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                } 
             
                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }
             
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
                             
                $this->data['bestseller_products'][] = array(
                    'quantity'    => $result['quantity'],
                    'labels' => $labels,
                    'product_id' => $result['product_id'],
                    'dop_img' => $dop_img,
                    'thumb'        => $image,
                    'name'         => $result['name'],
                    'price'        => $price,
                    'special'      => $special,
                    'saving'     => ((float)$result['price'] ? round((($result['price'] - $result['special'])/$result['price'])*100, 0) : 0),
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'         => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
            }
    Теперь у всех рекомендуемых товаров кнопки "уточнить наличие" поменялись на "купить" в том числе и на проданных, количество которых равно 0. Помогите, пожалуйста, разобраться. Нужно сделать, чтобы в рекомендуемых было, как в новинках. Не могу никак понять откуда в рекомендуемых товарах берется переменная количества товаров и почему она некорректно работает.
     
  5. Dotrox

    Dotrox Команда форума

    Регистрация:
    27 ноя 2012
    Сообщения:
    2.037
    Симпатии:
    774
    PHP:
    'quantity'    => $result['quantity'],
    Вы подставляете в количество для рекомендуемых количество товара, страница которого открыта или из другого блока (в зависимости от позиции этого куска кода). Там должно быть $product_info['quantity'].

    И вы уверены, что вот этот кусок кода должен повторяться для каждого блока отдельно:
    PHP:
    $mylabels = new Label($this->registry);

                
    $mylabels->labels $config_labels;
                
    $mylabels->product_info stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          
    stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          
    stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          
    stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          
    stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          
    stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          
    stripos($current_layout,'ControllerModulePreorders')!== false $product_info $result;
                
    $mylabels->current_layout $current_layout;
                
    $mylabels->current_layout_position $setting['position'];
                
    $mylabels->products_featured $products_featured;
                
    $mylabels->bestsellers $bestsellers;
                
    $labels $mylabels->RenderLabels();
     
    KuEdA нравится это.
  6. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    Т.е. вместо 'quantity' => $result['quantity'] в каждом блоке должно быть 'quantity' => $product_info['quantity']? Я правильно понял?

    Насчет этого куска

    Код:
    $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModuledealoftheday')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    я совсем в этом не уверен, сделал по аналогии, искал похожие строки из xml, который в vqmod модуля и вставлял после них этот код. Просто без него стикеры вообще не выводились. Подскажите, пожалуйста, если можно, как правильно сделать.
     
  7. Dotrox

    Dotrox Команда форума

    Регистрация:
    27 ноя 2012
    Сообщения:
    2.037
    Симпатии:
    774
    Нет. Так должно быть только для рекомендуемых, у остальных блоков правильно в нынешнем варианте.

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

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    Спасибо за уточнение. Сегодня попробую этот вариант,

    dbassa_adca_intelligent_product_labels.xml

    Код:
    <modification>
        <id>Intelligent Product Labels</id>
        <version>2.7.7.7</version>
        <vqmver>2.3.0</vqmver>
        <author>dbassa - [email protected]</author>
    
        <!-- SYSTEM -->
    
        <file name="system/startup.php">
    
            <operation info="we load label library">
                <search position="after"><![CDATA[
                require_once(DIR_SYSTEM . 'library/template.php')
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                require_once(DIR_SYSTEM . 'library/label.php');
               
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>   
    
        <!--  ADMIN  -->
    
        <file name="admin/view/template/common/header.tpl">
    
            <operation info="we add style">
                <search position="after"><![CDATA[
                stylesheet.css
                ]]></search>
                <add><![CDATA[
                <!-- start - ipl extension - dbassa -->
               
                <link rel="stylesheet" type="text/css" href="view/stylesheet/dbassa_intelligent_product_labels.css" />
                <link rel="stylesheet" type="text/css" href="view/stylesheet/dbassa_intelligent_product_labels_preview.css" />
                <link rel="stylesheet" type="text/css" href="view/stylesheet/jquery.validity.css" />
    
                <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
            <operation info="we change jquery if its 1.5.1.3" error="skip">
                <search position="after"><![CDATA[
                    <script type="text/javascript" src="view/javascript/jquery/jquery-1.6.1.min.js"></script>
                ]]></search>
                <add><![CDATA[
                    <!-- start - ipl extension - dbassa -->
                   
                    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    
                    <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
            <operation info="we add style">
                <search position="before"><![CDATA[
                </head>
                ]]></search>
                <add><![CDATA[
                <!-- start - ipl extension - dbassa -->
               
                <script type="text/javascript" src="view/javascript/jscolor/jscolor.js"></script>
                <script type="text/javascript" src="view/javascript/validity/jquery.validity.min.js"></script>
    
                <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
        </file>
    
        <file name="admin/controller/catalog/category.php">
    
            <operation info="we add autocomplete function for category if it's an opencart version lower than 1.5.5">
                <ignoreif><![CDATA[
                public function autocomplete() {
                ]]></ignoreif>
                <search position="before"><![CDATA[
                public function index() {
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                public function autocomplete() {
                    $json = array();
                   
                    if (isset($this->request->get['filter_name'])) {
                        $this->load->model('module/intelligent_product_labels');
                       
                        $data = array(
                            'filter_name' => $this->request->get['filter_name'],
                            'start'       => 0,
                            'limit'       => 20
                        );
                       
                        $results = $this->model_module_intelligent_product_labels->getCategoriesAutocomplete($data);
                           
                        foreach ($results as $result) {
                            $json[] = array(
                                'category_id' => $result['category_id'],
                                'name'        => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
                            );
                        }       
                    }
    
                    $sort_order = array();
                 
                    foreach ($json as $key => $value) {
                        $sort_order[$key] = $value['name'];
                    }
    
                    array_multisort($sort_order, SORT_ASC, $json);
    
                    $this->response->setOutput(json_encode($json));
                }
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>   
    
        <!-- CATALOG -->
    
        <file name="catalog/view/theme/stylishjewel/template/common/header.tpl">
    
            <operation info="we add css style for our icons (default)" error="skip">
                <search position="before"><![CDATA[
                stylesheet.css
                ]]></search>
                <add><![CDATA[
                <!-- start - ipl extension - dbassa -->
               
                <link rel="stylesheet" type="text/css" href="catalog/view/theme/stylishjewel/stylesheet/dbassa_intelligent_product_labels.css" />
    
                <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
            <operation info="we add css style for our icons (other themes)" error="skip">
                <ignoreif><![CDATA[
                dbassa_intelligent_product_labels.css
                ]]></ignoreif>
                <search position="before"><![CDATA[
                $styles as $style
                ]]></search>
                <add><![CDATA[
                <!-- start - ipl extension - dbassa -->
               
                <link rel="stylesheet" type="text/css" href="catalog/view/theme/stylishjewel/stylesheet/dbassa_intelligent_product_labels.css" />
    
                <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
            <operation info="we add css style for our icons (other themes)">
                <ignoreif><![CDATA[
                dbassa_intelligent_product_labels.css
                ]]></ignoreif>
                <search position="before"><![CDATA[
                styles.css
                ]]></search>
                <add><![CDATA[
                <!-- start - ipl extension - dbassa -->
               
                <link rel="stylesheet" type="text/css" href="catalog/view/theme/stylishjewel/stylesheet/dbassa_intelligent_product_labels.css" />
    
                <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
            <operation info="we add css3 properties for ie8">
                <search position="before"><![CDATA[
                </head>
                ]]></search>
                <add><![CDATA[
                <!-- start - ipl extension - dbassa -->
    
                <script type="text/javascript" src="catalog/view/javascript/modernizr/modernizr.custom.10918.js"></script>
    
                <!--[if lt IE 9]>
                  <script type="text/javascript" src="catalog/view/javascript/PIE-1.0.0/PIE.js"></script>
                <![endif]-->
    
                <!-- end - ipl extension - dbassa -->
                ]]></add>
            </operation>
    
        </file>
    
        <file name="catalog/model/catalog/product.php">
    
            <operation info="we add shipping field in query to know if product has shipping" error="skip">
                <search position="after"><![CDATA[
                => $query->row['product_id'],
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'shipping' => $query->row['shipping'],
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <file name="catalog/controller/product/product.php">
    
            <operation info="we get info we will need and we set labels for product">
                <search position="after"><![CDATA[
                if ($product_info) {
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                // set labels for the product
    
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $product_info;
                $mylabels->current_layout = $current_layout;
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                $this->data['labels'] = $labels;
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>       
    
            <operation info="we set labels for related products">
                <search position="before"><![CDATA[
                $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we add info to related products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <file name="catalog/view/theme/stylishjewel/template/product/product.tpl">
           
            <operation info="we try to add the span html to the image div replace way (shoppica2)" error="skip">
                <search position="after"><![CDATA[
                 <a id="product_image_preview"
                ]]></search>
                <add><![CDATA[
                <?php echo $labels; ?>
                ]]></add>
            </operation>
    
            <operation info="we try to add the span html to the image div replace way (fftheme)" error="skip">
                <ignoreif><![CDATA[
                <?php echo $labels; ?>
                ]]></ignoreif>
                <search position="before"><![CDATA[
                 ; ?>" alt="<?php echo $heading_title; ?>" width="420" />
                ]]></search>
                <add trim="true"><![CDATA[
                <?php echo $labels; ?>
                ]]></add>
            </operation>
    
            <operation info="we try to add the span html to the image div replace way (rushika)" error="skip">
                <ignoreif><![CDATA[
                <?php echo $labels; ?>
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <a href="<?php echo $popup; ?>" class="jqzoom" rel='gal1'
                ]]></search>
                <add trim="true"><![CDATA[
                <?php echo $labels; ?>
                ]]></add>
            </operation>
    
            <operation info="we try to add the span html to the image div replace way (default)" error="skip">
                <ignoreif><![CDATA[
                <?php echo $labels; ?>
                ]]></ignoreif>
                <search position="replace" index="1" regex="true"><![CDATA[
                 /id=\"image\"\s*\/>\s*<\/a>/s
                ]]></search>
                <add trim="true"><![CDATA[
                id="image" /><?php echo $labels; ?></a>
                ]]></add>
            </operation>
    
            <operation info="If it doesn't work the above operation, we try to add the span html to the image div with jquery" error="skip">
                <ignoreif><![CDATA[
                <?php echo $labels; ?>
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 $content_bottom
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl -->
    
                <script type="text/javascript"><!--
    
                    $(document).on('ready', function(){
                        $('.product-info .image a:first').prepend('<?php echo $labels; ?>');
                    });
    
                //--></script>
    
                <!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div" error="skip">
                <search position="replace" index="2" regex="true"><![CDATA[
                 /class=\"image\">\s*<a.*?>.*?>/s
                ]]></search>
                <add trim="true"><![CDATA[
                class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
        </file>
    
        <file path="catalog/controller/product/" name="category.php,search.php,special.php,manufacturer.php,asearch.php" error="skip">
    
            <operation info="we get needed info out of the loop (asearch)" error="skip">
                <search position="after"><![CDATA[
                 $results= $this->model_catalog_asearch->getProducts($pagination_filters);
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
    
                $this->load->model('catalog/product');
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get needed info out of the loop (default)">
                <ignoreif><![CDATA[
                $current_layout = get_class($this);
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 $results = $this->model_catalog_product->getProduct
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = 'content_top';
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <file path="catalog/view/theme/stylishjewel/template/product/" name="category.tpl,search.tpl,special.tpl,manufacturer_info.tpl,asearch.tpl" error="skip">
           
            <operation info="we add the span html (icon) to the image div (shoppica2)" error="skip">
                <search position="after"><![CDATA[
                 <a class="s_thumb" href="<?php echo $product['href']; ?>">
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (shoppica1)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <a class="s_thumb" href="<?php echo $products[$i]['href']; ?>">
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $products[$i]['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (shoppica1)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <a class="s_thumb" href="<?php echo $products[$j]['href']; ?>">
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $products[$j]['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
               
            <operation info="we add the span html (icon) to the image div (leisure)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 class="product_image"><img
                ]]></search>
                <add trim="true"><![CDATA[
                class="product_image"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (fftheme)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <a class="ff-imgstyle" href="<?php echo $product['href']; ?>"></a>
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (journal)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                  <div class="product-over"></div>
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (shop by category extension)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace" offset="8"><![CDATA[
                 <div class="image" style="height:180px;"><a
                ]]></search>
                <add trim="true"><![CDATA[
                <div class="image" style="height:180px;"><a
                href="<?php echo $product['href']; ?>"><img src="<?php
                echo $product['thumb']; ?>" title="<?php echo
                $product['name']; ?>" alt="<?php echo $product
                ['name']; ?>" /><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --></a></div>
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (others themes)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 <a href="<?php echo $product['href']; ?>"><img
                ]]></search>
                <add trim="true"><![CDATA[
                <a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (others themes)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 <img src="<?php echo $product['thumb']
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $product['thumb']
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (default)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace" index="1" regex="true"><![CDATA[
                 /class=\"image\">\s*<a.*?>.*?>/s
                ]]></search>
                <add trim="true"><![CDATA[
                class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (gazal)" error="skip">
                <search position="before"><![CDATA[
                 <img oversrc="<?php echo $product['thumb_swap']
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
        </file>
    
        <file path="catalog/controller/module/" name="latest.php,special.php,bestseller.php,featured.php,products_category.php,random.php,related.php,featuredplus.php,fakelatest.php,fakebestseller.php,fakemostviewed.php,anylist.php,preorders.php,bookoftheweek.php,boss_bestseller.php,randprod.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $this->load->model('catalog/product')
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = stripos($current_layout,'ControllerModuleFeatured') !== false ||
                                          stripos($current_layout,'ControllerModuleFakelatest') !== false ||
                                          stripos($current_layout,'ControllerModuleFakemostviewed') !== false ||
                                          stripos($current_layout,'ControllerModuleFakebestseller')!== false ||
                                          stripos($current_layout,'ControllerModuleBookoftheweek')!== false ||
                                          stripos($current_layout,'ControllerModulePreorders')!== false ? $product_info : $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <file path="catalog/view/theme/stylishjewel/template/module/" name="latest.tpl,special.tpl,bestseller.tpl,featured.tpl,products_category.tpl,filterpro_products.tpl,random.tpl,boss_homefilter.tpl,related.tpl,proscroller.tpl,lpbc.tpl,fakelatest.tpl,fakebestseller.tpl,fakemostviewed.tpl,ocaapd.tpl,anylist.tpl,bpbc.tpl,product_tabs.tpl,preorders.tpl,bookoftheweek.tpl,boss_homecategory.tpl,boss_bestseller.tpl,randprod.tpl" error="skip">
    
            <operation info="we add the span html (icon) to the image div (shoppica2)" error="skip">
                <search position="after"><![CDATA[
                 <a class="s_thumb" href="<?php echo $product['href']; ?>">
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (leisure)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 class="product_image"><img
                ]]></search>
                <add trim="true"><![CDATA[
                class="product_image"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (shoppica1)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <a class="s_thumb" href="<?php echo $products[$i]['href']; ?>">
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $products[$i]['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (shoppica1)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <a class="s_thumb" href="<?php echo $products[$j]['href']; ?>">
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $products[$j]['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
               
            <operation info="we add the span html (icon) to the image div (fftheme)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 <a class="ff-imgstyle" href="<?php echo $product['href']; ?>"></a>
                ]]></search>
                <add trim="true"><![CDATA[
                <a class="ff-imgstyle" href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --></a>
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (journal)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="after"><![CDATA[
                 <div class="product-over"></div>
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (others themes)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 <a href="<?php echo $product['href']; ?>"><img
                ]]></search>
                <add trim="true"><![CDATA[
                <a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (others themes)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace"><![CDATA[
                 <img src="<?php echo $product['thumb']
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl --><img src="<?php echo $product['thumb']
                ]]></add>
            </operation>
    
            <operation info="we add the span html (icon) to the image div (default)" error="skip">
                <ignoreif><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></ignoreif>
                <search position="replace" regex="true"><![CDATA[
                 /class=\"image\">\s*<a.*?>.*?>/s
                ]]></search>
                <add trim="true"><![CDATA[
                class="image"><a href="<?php echo $product['href']; ?>"><!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
               
            <operation info="we add the span html (icon) to the image div (gazal)" error="skip">
                <search position="before"><![CDATA[
                 <img oversrc="<?php echo $product['thumb_swap']
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl --><?php echo $product['labels']; ?><!-- end ipl -->
                ]]></add>
            </operation>
    
        </file>
    
        <file name="catalog/view/theme/stylishjewel/template/common/footer.tpl" error="skip">
           
            <operation info="we change rotated to horizontal and support round labels for old browser" error="skip">
    
                <search position="before"><![CDATA[
                 </body>
                ]]></search>
                <add trim="true"><![CDATA[
                <!-- star ipl -->
    
                <script type="text/javascript"><!--
    
                    $(document).on('ready', function(){
                        if (!Modernizr.csstransforms) {
                            $('.cut_rotated span').removeClass('rotated');
                            $('.cut_rotated span').addClass('horizontal');
                        }
    
                        if (!Modernizr.borderradius) {
                            if (window.PIE) {
                                $('.round').each(function() {
                                    PIE.attach(this);
                                });
                            }
                        }
                    });
    
                //--></script>
    
                <!-- end ipl -->
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: boss_homefilter  #####################
        -->
    
        <file path="catalog/controller/module/" name="boss_homefilter.php,boss_homecategory.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $this->load->model('catalog/product')
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product">
                <search position="before"><![CDATA[
                 $products[] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $current_layout != 'ControllerModuleFeatured' ? $result : $product_info;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $products[] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: proscroller  #####################
        -->
    
        <file path="catalog/controller/module/" name="proscroller.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $products = $this->model_module_proscroller->getProducts($data);
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $products = array_slice($products, 0, (int)$setting['count']);
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $product;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: filterpro 2.4.2  #####################
        -->
    
        <file path="catalog/controller/module/" name="filterpro.php" error="skip">
    
            <operation info="we work out of loop">
                <search position="after"><![CDATA[
                 private function getHtmlProducts($results, $product_total) {
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we work inside loop">
    
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $current_layout != 'ControllerModuleFeatured' ? $result : $product_info;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = 'content_top';
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: lates products by category lpbc  #####################
        -->
    
        <file path="catalog/controller/module/" name="lpbc.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $this->load->model('catalog/product')
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $subproducts[] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $subresult;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array" error="skip">
                <search position="after"><![CDATA[
                 $subproducts[] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: Advanced Product Display  #####################
        -->
       
        <file path="catalog/controller/module/" name="ocaapd.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $this->load->model('catalog/product')
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $product;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: Bestsellers by category (bpbc)  #####################
        -->
       
        <file path="catalog/controller/module/" name="bpbc.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $this->load->model('catalog/category')
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $this->data['products'][] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
        <!--
        ##################  EXTRAS: Products Tabs or Modules  #####################
        -->
       
        <file path="catalog/controller/module/" name="product_tabs.php" error="skip">
    
            <operation info="we get needed info out of the loop">
                <search position="after"><![CDATA[
                 $this->load->model('catalog/product')
                ]]></search>
                <add trim="true"><![CDATA[
                /* start - ipl extension - dbassa */
    
                // bestseller
               
                $bestseller_products = $this->model_catalog_product->getBestSellerProducts(25);
                $bestsellers = array();
               
                foreach ($bestseller_products as $bestseller_product) {
                    $bestsellers[] = $bestseller_product['product_id'];
                }
               
                // featured
    
                $products_featured = explode(',', $this->config->get('featured_product'));
    
                // labels config
    
                $config_labels = $this->config->get('intelligent_product_labels_module');
                if ( empty($config_labels) ) { $config_labels = array(); }
    
                // current class name
    
                $current_layout = get_class($this);
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
            <operation info="we get labels for each product" error="skip">
                <search position="before"><![CDATA[
                 $products[] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
               
                $mylabels = new Label($this->registry);
    
                $mylabels->labels = $config_labels;
                $mylabels->product_info = $result;
                $mylabels->current_layout = $current_layout;
                $mylabels->current_layout_position = $setting['position'];
                $mylabels->products_featured = $products_featured;
                $mylabels->bestsellers = $bestsellers;
                $labels = $mylabels->RenderLabels();
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
           
            <operation info="we add info to products array">
                <search position="after"><![CDATA[
                 $products[] = array(
                ]]></search>
                <add><![CDATA[
                /* start - ipl extension - dbassa */
    
                'labels' => $labels,
    
                /* end - ipl extension - dbassa */
                ]]></add>
            </operation>
    
        </file>
    
    </modification>
    
     
  9. Dotrox

    Dotrox Команда форума

    Регистрация:
    27 ноя 2012
    Сообщения:
    2.037
    Симпатии:
    774
    Два раза на странице товара (для самого товара и для рекомендуемых), по одному разу на групповых страницах (категория, акции, поиск и т.д.), по одному разу в каждом из модулей вывода товаров (новинки, акции, популярные, рекомендуемые) и других модулях, код для которых отмечен EXTRAS.

    Я только сейчас обратил внимание, что у вас код из Product tab, там действительно должно быть отдельно для каждого модуля.
     
    KuEdA нравится это.
  10. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    На странице товара тоже не получается с выводом стикеров. При загрузке изображение стикера появляется в верхнем левом углу и тут же пропадает. Скорее всего из за того, что у меня установлена галерея fotorama, хотя перед этим пробовал автоматические стикеры, они в карточке товара выводились нормально на фотографиях.
     
  11. Dotrox

    Dotrox Команда форума

    Регистрация:
    27 ноя 2012
    Сообщения:
    2.037
    Симпатии:
    774
    Дайте ссылку на сайт.
     
    KuEdA нравится это.
  12. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
  13. Dotrox

    Dotrox Команда форума

    Регистрация:
    27 ноя 2012
    Сообщения:
    2.037
    Симпатии:
    774
    У меня на странице товара стикеры вообще не появляются, но, насколько я вижу, эта фоторама полностью заменяет собой стандартный блок вывода изображений, так что, вероятно, стикерам не за что зацепиться.
     
    KuEdA нравится это.
  14. KuEdA

    KuEdA

    Регистрация:
    20 сен 2014
    Сообщения:
    177
    Симпатии:
    34
    Ну что ж, придется обойтись без стикеров в карточке. В конце-концов это не критично...