Помощь Аjах Shорріng Саrt РRО v1.3.1

я день проигрался, но так и не смог увидеть этой корзины ни на своем шаблоне, ни на дефолте( Да, проверки нету.. но почему-то не работает. Тестировал на 4 купленных шаблонах..
 
там есть часть файлов, которые должны быть в вашей теме, насколько я помню. у вас ошибки вылезают? или просто ничего не происходит?
Просто не вылазит окно с корзиной. Товар добавляется в корзину, но сообщения об этом нет.
 
Просто не вылазит окно с корзиной. Товар добавляется в корзину, но сообщения об этом нет.
Для того что бы всё заработало прочитайте все мои сообщения перед тем как вносить изменения (так как я делал пошагово и исправлял все ошибки налету и писал инструкцию). То же нашел этот модуль. Заменил на файл который здесь раскодировали. Удалил строки
Код:
$tukey = $this->config->get('config_ukey_sc');

        $this->ukeygen();
        if ($tukey !== $this->ukeygen()) die('<div id="lcer">license error</div>');
И заменил: это
Код:
        $this->template = 'default/template/common/ocjoyajaxcart.tpl';
         
        $this->response->setOutput($this->render()); 
    }
    protected function ukeygen() {
        $str = str_split(DIR_SYSTEM.':'.$_SERVER['SERVER_NAME']);
        $ukey = '';
        foreach ($str as $chr){
            $ukey = md5($chr.$ukey.$chr.'sc');
        }
        return $ukey;
    }
}
На это:
Код:
$this->template = 'default/template/common/ocjoyajaxcart.tpl';
         
        $this->response->setOutput($this->render()); 

        $this->render();
    }
}
?>

На этом этапе у меня тоже не было всплывающей корзины
Оказалось что в архиве есть readme.txt там в нем написано что нужно делать что бы заработало.
Код:
[ RUS ]
1) скопируйте содержимое папок в корень файлов вашего магазина
2) на вашем магазине должен быть установлен vQmod
3) откройте файл catalog/view/javascript/common.js и замените всю функцию, но исходный вариант рекомендую закоментировать или сохранить:

function addToCart(product_id,quantity){
    quantity = typeof(quantity) != 'undefined' ? quantity : 1;

    $.ajax({
        url: 'index.php?route=checkout/cart/add',
        type: 'post',
        data: 'product_id=' + product_id + '&quantity=' + quantity,
        dataType: 'json',
        success: function(json) {
            $('.success, .warning, .attention, .information, .error').remove();
       
            if (json['redirect']) {
                location = json['redirect'];
            }
       
            if (json['success']) {
                $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
           
                $('.success').fadeIn('slow');
           
                $('#cart-total').html(json['total']);
           
                $('html, body').animate({ scrollTop: 0 }, 'slow');
            }
        }
    });
}

на =>

$(".carousel-button-right-ajcart").live('click',function(){
      right_carusel();
});

$(".carousel-button-left-ajcart").live('click',function(){
      left_carusel();
});

function left_carusel(){
    var block_width = $('.carousel-block-ajcart').width() + 20;
    $(".carousel-items-ajcart .carousel-block-ajcart").eq(-1).clone().prependTo(".carousel-items-ajcart");
    $(".carousel-items-ajcart").css({"left":"-"+block_width+"px"});
    $(".carousel-items-ajcart").animate({left: "0px"}, 200);
    $(".carousel-items-ajcart .carousel-block-ajcart").eq(-1).remove();
}

function right_carusel(){
    var block_width = $('.carousel-block-ajcart').width() + 20;
    $(".carousel-items-ajcart").animate({left: "-"+ block_width +"px"}, 200);
    setTimeout(function () {
        $(".carousel-items-ajcart .carousel-block-ajcart").eq(0).clone().appendTo(".carousel-items-ajcart");
        $(".carousel-items-ajcart .carousel-block-ajcart").eq(0).remove();
        $(".carousel-items-ajcart").css({"left":"0px"});
    }, 300);
}

$(document).ready(function() {
    $(".ajaxcart").colorbox({
          onLoad    : function() { $(this).colorbox.resize(); },
          onComplete : function() { $(this).colorbox.resize(); },
          fastIframe: false,
        scrolling: false,
        initialWidth: false,
        innerWidth: false,
        maxWidth: false,
        height: false,
        initialHeight: false,
        innerHeight: false
    });
    $("#colorbox").draggable({
          cursor: "crosshair",
          containment: "parent"
    });
});

$('html').append('<div style="display:none;"><a class="ajaxcart" id="showcart" href="index.php?route=common/ocjoyajaxcart">&nbsp;</a></div>');
$('head').prepend('<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ocjoyajaxcart/ocjoyajaxcart.css"/>');

function addToCart(product_id, quantity) {
    quantity = typeof(quantity) != 'undefined' ? quantity : 1;
    $.ajax({
        url: 'index.php?route=checkout/cart/add',
        type: 'post',
        data: 'product_id=' + product_id + '&quantity=' + quantity,
        dataType: 'json',
        success: function(json) {
            $('.success, .warning, .attention, .information, .error').remove();
            if (json['redirect']) {
                location = json['redirect'];
            }

            if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 8)) {
                if (json['success']) {
                    $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
               
                    $('.success').fadeIn('slow');
               
                    $('#cart-total').html(json['total']);
               
                    $('html, body').animate({ scrollTop: 0 }, 'slow');
                }
            } else {
                if (json['success']) {
                        $('#showcart').trigger('click');
                    $('#cart-total').html(json['total']);
                }
            }
        }
    });
}

4) откройте файл catalog/view/theme/default/template/product/product.tpl и замините всю функцию:

if (json['success']) {
    $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt=""

class="close" /></div>');       
    $('.success').fadeIn('slow');       
    $('#cart-total').html(json['total']);   
    $('html, body').animate({ scrollTop: 0 }, 'slow');
}

на =>

if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 8)) {
                if (json['success']) {
                    $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
               
                    $('.success').fadeIn('slow');
               
                    $('#cart-total').html(json['total']);
               
                    $('html, body').animate({ scrollTop: 0 }, 'slow');
                }
            } else {
                if (json['success']) {
                        $('#showcart').trigger('click');
                    $('#cart-total').html(json['total']);
                }
            }
(внёс изменения) и вуаля запустилась всплывающее окно, только с ошибкой.
Залез в catalog\controller\common\ocjoyajaxcart.php файл

в самом верху написано
error_reporting(0);
Хотя обычно начинается всё с <?php
Заменил этот кусок:

error_reporting(0);

class ControllerCommonOcjoyajaxcart extends Controller {
protected $ukeygen;
public function index() {

На Это:
<?php
class ControllerCommonOcjoyajaxcart extends Controller {
protected function index($setting) {
static $module = 0;
После этих действий ошибка ушла. Но при нажатии купить выходит This content failed to load (Этот контент не удалось загрузить)
Думаю что в:
<?php
class ControllerCommonOcjoyajaxcart extends Controller {
protected function index($setting) {
static $module = 0;

$this->language->load('module/ocjoyajaxcart');


if (isset($this->request->request['remove'])) {
$this->cart->remove($this->request->request['remove']);
unset($this->session->data['vouchers'][$this->request->request['remove']]);

После $this->language->load('module/ocjoyajaxcart'); что то нужно дописать
Может кто поможет добиться результата???
 
Последнее редактирование:
Да вот ещё что делал в catalog/model/catalog/product.php
Код:
public function getTotalProductSpecials() {
        if ($this->customer->isLogged()) {
            $customer_group_id = $this->customer->getCustomerGroupId();
        } else {
            $customer_group_id = $this->config->get('config_customer_group_id');
        }       
       
        $query = $this->db->query("SELECT COUNT(DISTINCT ps.product_id) AS total FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW()))");
       
        if (isset($query->row['total'])) {
            return $query->row['total'];
        } else {
            return 0;   
        }
    }
}
Заменил на
Код:
public function getAjaxcartProducts($data = array()) {
        $type_pr = (int)$this->config->get('config_type_ap');
               
        if ($type_pr == 1) {

                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }   
               
                $product_data = array();
               
                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE category_id = '" . (int)$this->config->get('config_parent_id') . "'");
               
                foreach ($query->rows as $result) {       
                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                }
                                         
                return $product_data;
           
        } elseif ($type_pr == 2) {
           
                $product_data = array();
               
                $query = $this->db->query("SELECT p.product_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY p.viewed, p.date_added DESC LIMIT 50");
               
                foreach ($query->rows as $result) {       
                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                }
                                         
                return $product_data;
           
        } elseif ($type_pr == 3) {
           
                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }   
                       
                $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";

                $sort_data = array(
                    'pd.name',
                    'p.model',
                    'ps.price',
                    'rating',
                    'p.sort_order'
                );
               
                if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
                    if ($data['sort'] == 'pd.name' || $data['sort'] == 'p.model') {
                        $sql .= " ORDER BY LCASE(" . $data['sort'] . ")";
                    } else {
                        $sql .= " ORDER BY " . $data['sort'];
                    }
                } else {
                    $sql .= " ORDER BY p.sort_order";   
                }
               
                if (isset($data['order']) && ($data['order'] == 'DESC')) {
                    $sql .= " DESC, LCASE(pd.name) DESC";
                } else {
                    $sql .= " ASC, LCASE(pd.name) ASC";
                }
           
               
                $sql .= " LIMIT 0, 50";
               

                $product_data = array();
               
                $query = $this->db->query($sql);
               
                foreach ($query->rows as $result) {       
                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                }
               
                return $product_data;
           
        } elseif ($type_pr == 4) {
           
                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }   
                       
                $product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . '50');

                if (!$product_data) {
                    $product_data = array();
                   
                    $query = $this->db->query("SELECT op.product_id, COUNT(*) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT 50");
                   
                    foreach ($query->rows as $result) {       
                        $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                    }
                   
                    $this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . '50', $product_data);
                }
               
                return $product_data;
           
        } elseif ($type_pr == 5) {
           
                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }   
                       
                $product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . '50');

                if (!$product_data) {
                    $query = $this->db->query("SELECT p.product_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY p.date_added DESC LIMIT 50");
                     
                    foreach ($query->rows as $result) {
                        $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                    }
                   
                    $this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . '50', $product_data);
                }
               
                return $product_data;
        }
        }
}

 
Вот пишу далее: Методом пальцем в небо )) Полез в структуру подобного модуля "kw flycart" и вот что получилось (текст выкладываю) У меня запустилась корзина и товар добавился только в слайдере ошибка 79 а так всё работает. И ещё когда заходишь в карточку товара там функция корзины не работает. Работает только в категориях. Буду копать дальше.
ФОТО: Для просмотра ссылки Войди или Зарегистрируйся

Меняем полностью текст скрипта в \catalog\controller\common\ocjoyajaxcart.php
На это
Код:
<?php
header("Content-type: text/html; charset=utf-8");

class ControllerCommonOcjoyajaxcart extends Controller {

        private $_path = HTTPS_SERVER;
            private $_name = 'Ocjoyajaxcart';

                public function index() {
        $this->language->load('module/ocjoyajaxcart');
                $this->language->load('module/' . $this->_name);

        $this->data['type']        = $this->config->get( $this->_name . '_type');
        $this->data['position']    = $this->config->get( $this->_name . '_position');
        $this->data['topions']        = $this->config->get( $this->_name . '_topions');
        $this->data['offset_x']    = $this->config->get( $this->_name . '_offset_x');
        $this->data['offset_y']    = $this->config->get( $this->_name . '_offset_y');
        $this->data['fheight']        = $this->config->get( $this->_name . '_fheight');
        $this->data['fwidth']        = $this->config->get( $this->_name . '_fwidth');
        $this->data['postype']        = $this->config->get( $this->_name . '_postype');
        $this->data['image']        = $this->config->get( $this->_name . '_image');
        $this->data['tcolor']        = $this->config->get( $this->_name . '_tcolor');
        $this->data['tsize']        = $this->config->get( $this->_name . '_tsize');
        $this->data['tmtop']        = $this->config->get( $this->_name . '_tmtop');
        $this->data['tmright']        = $this->config->get( $this->_name . '_tmright');
        $this->data['tmbottom']    = $this->config->get( $this->_name . '_tmbottom');
        $this->data['tmleft']        = $this->config->get( $this->_name . '_tmleft');
        $this->data['color_bgp']    = $this->config->get( $this->_name . '_color_bgp');
        $this->data['head_bgp']    = $this->config->get( $this->_name . '_head_bgp');
        $this->data['bhead_bgp']    = $this->config->get( $this->_name . '_bhead_bgp');
        $this->data['chead_bgp']    = $this->config->get( $this->_name . '_chead_bgp');
        $this->data['close_bg']    = $this->config->get( $this->_name . '_close_bg');
        $this->data['remove_bg']    = $this->config->get( $this->_name . '_remove_bg');
        $this->data['color_a']        = $this->config->get( $this->_name . '_color_a');
        $this->data['color']        = $this->config->get( $this->_name . '_color');
        $this->data['border']        = $this->config->get( $this->_name . '_border');
        $this->data['scroll']        = $this->config->get( $this->_name . '_scroll');
        $this->data['color_fgp']    = $this->config->get( $this->_name . '_color_fgp');
        $this->data['color_fbgp']    = $this->config->get( $this->_name . '_color_fbgp');
        $this->data['pbutton']        = $this->config->get( $this->_name . '_pbutton');
        $this->data['empty']        = $this->config->get( $this->_name . '_empty');
        $this->data['overlay']        = $this->config->get( $this->_name . '_overlay');
        $this->data['pselect']        = $this->config->get( $this->_name . '_pselect');
        $this->data['bselect']        = $this->config->get( $this->_name . '_bselect');
        $this->data['flytype']        = $this->config->get( $this->_name . '_flytype');
        $this->data['flyimage']    = $this->config->get( $this->_name . '_flyimage');
        $this->data['color_f']        = $this->config->get( $this->_name . '_color_f');
        $this->data['frselect']    = $this->config->get( $this->_name . '_frselect');
        $this->data['size_f']        = $this->config->get( $this->_name . '_size_f');
        $this->data['speed']        = $this->config->get( $this->_name . '_speed');
        $this->data['rtselect']    = $this->config->get( $this->_name . '_rtselect');
        $this->data['radius']        = $this->config->get( $this->_name . '_radius');

        $this->data['breadcrumbs'] = array();

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url->link('common/home'),
            'separator' => false
        );

          if (isset($this->request->request['remove'])) {
              $this->cart->remove($this->request->request['remove']);
            unset($this->session->data['vouchers'][$this->request->request['remove']]);
          }
        if (isset($this->request->request['update'])) {
              $this->cart->update($this->request->request['update'],$this->request->request['qty']);
          }

        // Totals
        $this->load->model('setting/extension');

        $total_data = array();        
        $total = 0;
        $taxes = $this->cart->getTaxes();

        // Display prices
        if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
            $sort_order = array();

            $results = $this->model_setting_extension->getExtensions('total');

            foreach ($results as $key => $value) {
                $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
            }

            array_multisort($sort_order, SORT_ASC, $results);

            foreach ($results as $result) {
                if ($this->config->get($result['code'] . '_status')) {
                    $this->load->model('total/' . $result['code']);

                    $this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
                }
    
                $sort_order = array();
  
                foreach ($total_data as $key => $value) {
                    $sort_order[$key] = $value['sort_order'];
                }

                array_multisort($sort_order, SORT_ASC, $total_data);
            }
        }

        $this->data['totals'] = $total_data;

        $this->data['heading_title'] = $this->language->get('heading_title');

        $this->data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
        $this->data['text_empty'] = $this->language->get('text_empty');
        $this->data['text_cart'] = $this->language->get('text_cart');
        $this->data['text_checkout'] = $this->language->get('text_checkout');

        $this->data['config_ocjoyajaxcart_countname'] = $this->config->get('config_ocjoyajaxcart_countname');
        $this->data['config_ocjoyajaxcart_countdesc'] = $this->config->get('config_ocjoyajaxcart_countdesc');


        $this->data['button_remove'] = $this->language->get('button_remove');

        $this->load->model('tool/image');

        $this->data['products'] = array();

        foreach ($this->cart->getProducts() as $product) {
            if ($product['image']) {
                $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
            } else {
                $image = '';
            }
                
            $option_data = array();

            foreach ($product['option'] as $option) {
                if ($option['type'] != 'file') {
                    $value = $option['option_value'];
                } else {
                    $filename = $this->encryption->decrypt($option['option_value']);
        
                    $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
                }    
    
                $option_data[] = array(                      
                    'name'  => $option['name'],
                    'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value),
                    'type'  => $option['type']
                );
            }

            // Display prices
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $price = false;
            }

            // Display prices
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $total = $this->currency->format($this->tax->calculate($product['total'], $product['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $total = false;
            }
                                        
            $this->data['products'][] = array(
                'key'      => $product['key'],
                'thumb'    => $image,
                'name'    => $product['name'],
                'model'    => $product['model'],
                'reward'  => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
                'option'  => $option_data,
                'quantity' => $product['quantity'],
                'price'    => $price,
                'total'    => $total,
                'href'    => $this->url->link('product/product', 'product_id=' . $product['product_id'])
            );
        }

        // Gift Voucher
        $this->data['vouchers'] = array();

        if (!empty($this->session->data['vouchers'])) {
            foreach ($this->session->data['vouchers'] as $key => $voucher) {
                $this->data['vouchers'][] = array(
                    'key'        => $key,
                    'description' => $voucher['description'],
                    'amount'      => $this->currency->format($voucher['amount'])
                );
            }
        }
        
        $this->data['cart'] = $this->url->link('checkout/cart');
            
        $this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');

        $this->load->model('catalog/product');
        $this->data['ajaxcartproducts'] = array();

        $data = array(
            'sort'  => 'p.date_added',
            'order' => 'DESC',
            'start' => 0
        );

        $this->data['button_cart'] = $this->language->get('button_cart');
        $this->data['button_wishlist'] = $this->language->get('button_wishlist');
        $this->data['button_compare'] = $this->language->get('button_compare');

        $this->data['text_ajaxcart_head'] = $this->language->get('text_ajaxcart_head');
        $this->data['text_ajaxcart_empty'] = $this->language->get('text_ajaxcart_empty');
        $this->data['text_ajaxcart_continue'] = $this->language->get('text_ajaxcart_continue');
        $this->data['text_gotoorder'] = $this->language->get('text_gotoorder');
        $this->data['text_gotoshipping'] = $this->language->get('text_gotoshipping');

        $this->data['column_image'] = $this->language->get('column_image');
          $this->data['column_name'] = $this->language->get('column_name');
          $this->data['column_delete'] = $this->language->get('column_delete');
          $this->data['column_quantity'] = $this->language->get('column_quantity');
        $this->data['column_price'] = $this->language->get('column_price');
          $this->data['column_subtotal'] = $this->language->get('column_subtotal');

        $results = $this->model_catalog_product->getAjaxcartProducts($data);

        if (!empty($results)) {
        foreach ($results as $result) {
            if ($result['image']) {
                $image = $this->model_tool_image->resize($result['image'], 80, 80);
            } else {$image = $this->model_tool_image->resize('no_image.jpg', 80, 80);

            }
            
            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;
            }

            $this->data['ajaxcartproducts'][] = array(
                'product_id'  => $result['product_id'],
                'thumb'        => $image,
                'name'          => $result['name'],
                'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
                'price'        => $price,
                'special'      => $special,
                'rating'      => $rating,
                'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                'href'          => $this->url->link('product/product', 'product_id=' . $result['product_id']),
            );
        }
        }

        $this->template = 'default/template/common/ocjoyajaxcart.tpl';
    
        $this->response->setOutput($this->render());

        $this->render();
    }
}
?>

Разбираю дальше.
что бы убрать ошибку в 79 строке
заходим в catalog\view\theme\default\template\common\ocjoyajaxcart.tpl
находим
Код:
div class="name"><a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>"><?php $pname = mb_substr(strip_tags(html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8')),0,$config_ocjoyajaxcart_countname, 'utf-8'); echo $pname . ' ...'; ?></a></div>

И меняем на
Код:
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>

После этого у меня вышла ошибка
Фото: Для просмотра ссылки Войди или Зарегистрируйся
В строке 84 (я так понимаю там должна выводиться цена, в закладки, сравнение)
Ковыряю далее.


В том же файле \view\theme\default\template\common\ocjoyajaxcart.tpl
Находим: это
Код:
<div class="description"><?php $pdesc = mb_substr(strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')),0,$config_ocjoyajaxcart_countdesc, 'utf-8'); echo $pdesc . ' ...'; ?></div>

И меняем на
Код:
<div class="description"><?php echo $product['description']; ?></a></div>
После этого все ошибки пропали.
Но осталась задача: не работает кнопка купить в карточке товара (то есть она работает но кидает в стандартную корзину) а не открывает то что нам нужно.
Исправляем:
в файле catalog\view\theme\default\template\product\product.tpl
находим
Код:
<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
и меняем на это
Код:
<input type="button" value="<?php echo $button_cart; ?> "onclick="addToCart('<?php echo $product_id; ?>');" class="button" />

Ну вроде всё. Тестируйте.
 
Последнее редактирование:
Спасибо за прокопанные траншеи и решения) Но не проще будет выложить готовые файлы с изменениями ля тестирования?
Это лучше ручками делать, так как только два файла можно заменить на новые. А всё остальное ручками дописывать в файлы opencart. Или vqmod дописывать. (хотя он там и есть, из него только js подключаются, а всё остальное не работает). И у каждого шаблоны разные. Если только vqmod нормальный написать (что бы работал на всех шаблонах). Может кто займётся этим)))
 
Изменить + -
Копируем файлы папку image в корень сайта
Открываем файл
\catalog\view\theme\default\template\common\ocjoyajaxcart.tpl
Находим
<a onclick="minus(this);" class="quantity-m">-</a>
и меняем на
<a onclick="minus(this);" class="quantity-m"><img src="image/ocjoyajaxcart/minus.png" ></a>
Находим
<a onclick="plus(this);" class="quantity-p">+</a>
и меняем на
<a onclick="plus(this);" class="quantity-p"><img src="image/ocjoyajaxcart/plus.png" ></a>

ДО:
bffd1c01edc8.jpg


После:
5b279164d45a.jpg
 

Вложения

  • +-.rar
    61 KB · Просмотры: 10
Это лучше ручками делать, так как только два файла можно заменить на новые. А всё остальное ручками дописывать в файлы opencart. Или vqmod дописывать. (хотя он там и есть, из него только js подключаются, а всё остальное не работает). И у каждого шаблоны разные. Если только vqmod нормальный написать (что бы работал на всех шаблонах). Может кто займётся этим)))
Напишите, пожалуйста, по порядку, что вы изменяли где. Будем вам очень благодарны.
 
Собрал в одну кучу.
Находим этот файл
Меняем полностью текст скрипта в \catalog\controller\common\ocjoyajaxcart.php
на:

Код:
<?php
header("Content-type: text/html; charset=utf-8");

class ControllerCommonOcjoyajaxcart extends Controller {

        private $_path = HTTPS_SERVER;
            private $_name = 'Ocjoyajaxcart';

                public function index() {
        $this->language->load('module/ocjoyajaxcart');
                $this->language->load('module/' . $this->_name);

        $this->data['type']        = $this->config->get( $this->_name . '_type');
        $this->data['position']    = $this->config->get( $this->_name . '_position');
        $this->data['topions']        = $this->config->get( $this->_name . '_topions');
        $this->data['offset_x']    = $this->config->get( $this->_name . '_offset_x');
        $this->data['offset_y']    = $this->config->get( $this->_name . '_offset_y');
        $this->data['fheight']        = $this->config->get( $this->_name . '_fheight');
        $this->data['fwidth']        = $this->config->get( $this->_name . '_fwidth');
        $this->data['postype']        = $this->config->get( $this->_name . '_postype');
        $this->data['image']        = $this->config->get( $this->_name . '_image');
        $this->data['tcolor']        = $this->config->get( $this->_name . '_tcolor');
        $this->data['tsize']        = $this->config->get( $this->_name . '_tsize');
        $this->data['tmtop']        = $this->config->get( $this->_name . '_tmtop');
        $this->data['tmright']        = $this->config->get( $this->_name . '_tmright');
        $this->data['tmbottom']    = $this->config->get( $this->_name . '_tmbottom');
        $this->data['tmleft']        = $this->config->get( $this->_name . '_tmleft');
        $this->data['color_bgp']    = $this->config->get( $this->_name . '_color_bgp');
        $this->data['head_bgp']    = $this->config->get( $this->_name . '_head_bgp');
        $this->data['bhead_bgp']    = $this->config->get( $this->_name . '_bhead_bgp');
        $this->data['chead_bgp']    = $this->config->get( $this->_name . '_chead_bgp');
        $this->data['close_bg']    = $this->config->get( $this->_name . '_close_bg');
        $this->data['remove_bg']    = $this->config->get( $this->_name . '_remove_bg');
        $this->data['color_a']        = $this->config->get( $this->_name . '_color_a');
        $this->data['color']        = $this->config->get( $this->_name . '_color');
        $this->data['border']        = $this->config->get( $this->_name . '_border');
        $this->data['scroll']        = $this->config->get( $this->_name . '_scroll');
        $this->data['color_fgp']    = $this->config->get( $this->_name . '_color_fgp');
        $this->data['color_fbgp']    = $this->config->get( $this->_name . '_color_fbgp');
        $this->data['pbutton']        = $this->config->get( $this->_name . '_pbutton');
        $this->data['empty']        = $this->config->get( $this->_name . '_empty');
        $this->data['overlay']        = $this->config->get( $this->_name . '_overlay');
        $this->data['pselect']        = $this->config->get( $this->_name . '_pselect');
        $this->data['bselect']        = $this->config->get( $this->_name . '_bselect');
        $this->data['flytype']        = $this->config->get( $this->_name . '_flytype');
        $this->data['flyimage']    = $this->config->get( $this->_name . '_flyimage');
        $this->data['color_f']        = $this->config->get( $this->_name . '_color_f');
        $this->data['frselect']    = $this->config->get( $this->_name . '_frselect');
        $this->data['size_f']        = $this->config->get( $this->_name . '_size_f');
        $this->data['speed']        = $this->config->get( $this->_name . '_speed');
        $this->data['rtselect']    = $this->config->get( $this->_name . '_rtselect');
        $this->data['radius']        = $this->config->get( $this->_name . '_radius');

        $this->data['breadcrumbs'] = array();

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url->link('common/home'),
            'separator' => false
        );

          if (isset($this->request->request['remove'])) {
              $this->cart->remove($this->request->request['remove']);
            unset($this->session->data['vouchers'][$this->request->request['remove']]);
          }
        if (isset($this->request->request['update'])) {
              $this->cart->update($this->request->request['update'],$this->request->request['qty']);
          }

        // Totals
        $this->load->model('setting/extension');

        $total_data = array();      
        $total = 0;
        $taxes = $this->cart->getTaxes();

        // Display prices
        if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
            $sort_order = array();

            $results = $this->model_setting_extension->getExtensions('total');

            foreach ($results as $key => $value) {
                $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
            }

            array_multisort($sort_order, SORT_ASC, $results);

            foreach ($results as $result) {
                if ($this->config->get($result['code'] . '_status')) {
                    $this->load->model('total/' . $result['code']);

                    $this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
                }

                $sort_order = array();
                foreach ($total_data as $key => $value) {
                    $sort_order[$key] = $value['sort_order'];
                }

                array_multisort($sort_order, SORT_ASC, $total_data);
            }
        }

        $this->data['totals'] = $total_data;

        $this->data['heading_title'] = $this->language->get('heading_title');

        $this->data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
        $this->data['text_empty'] = $this->language->get('text_empty');
        $this->data['text_cart'] = $this->language->get('text_cart');
        $this->data['text_checkout'] = $this->language->get('text_checkout');

        $this->data['config_ocjoyajaxcart_countname'] = $this->config->get('config_ocjoyajaxcart_countname');
        $this->data['config_ocjoyajaxcart_countdesc'] = $this->config->get('config_ocjoyajaxcart_countdesc');


        $this->data['button_remove'] = $this->language->get('button_remove');

        $this->load->model('tool/image');

        $this->data['products'] = array();

        foreach ($this->cart->getProducts() as $product) {
            if ($product['image']) {
                $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
            } else {
                $image = '';
            }
            
            $option_data = array();

            foreach ($product['option'] as $option) {
                if ($option['type'] != 'file') {
                    $value = $option['option_value'];
                } else {
                    $filename = $this->encryption->decrypt($option['option_value']);
    
                    $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
                }  

                $option_data[] = array(                    
                    'name'  => $option['name'],
                    'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value),
                    'type'  => $option['type']
                );
            }

            // Display prices
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $price = false;
            }

            // Display prices
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $total = $this->currency->format($this->tax->calculate($product['total'], $product['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $total = false;
            }
                                    
            $this->data['products'][] = array(
                'key'      => $product['key'],
                'thumb'    => $image,
                'name'    => $product['name'],
                'model'    => $product['model'],
                'reward'  => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
                'option'  => $option_data,
                'quantity' => $product['quantity'],
                'price'    => $price,
                'total'    => $total,
                'href'    => $this->url->link('product/product', 'product_id=' . $product['product_id'])
            );
        }

        // Gift Voucher
        $this->data['vouchers'] = array();

        if (!empty($this->session->data['vouchers'])) {
            foreach ($this->session->data['vouchers'] as $key => $voucher) {
                $this->data['vouchers'][] = array(
                    'key'        => $key,
                    'description' => $voucher['description'],
                    'amount'      => $this->currency->format($voucher['amount'])
                );
            }
        }
    
        $this->data['cart'] = $this->url->link('checkout/cart');
        
        $this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');

        $this->load->model('catalog/product');
        $this->data['ajaxcartproducts'] = array();

        $data = array(
            'sort'  => 'p.date_added',
            'order' => 'DESC',
            'start' => 0
        );

        $this->data['button_cart'] = $this->language->get('button_cart');
        $this->data['button_wishlist'] = $this->language->get('button_wishlist');
        $this->data['button_compare'] = $this->language->get('button_compare');

        $this->data['text_ajaxcart_head'] = $this->language->get('text_ajaxcart_head');
        $this->data['text_ajaxcart_empty'] = $this->language->get('text_ajaxcart_empty');
        $this->data['text_ajaxcart_continue'] = $this->language->get('text_ajaxcart_continue');
        $this->data['text_gotoorder'] = $this->language->get('text_gotoorder');
        $this->data['text_gotoshipping'] = $this->language->get('text_gotoshipping');

        $this->data['column_image'] = $this->language->get('column_image');
          $this->data['column_name'] = $this->language->get('column_name');
          $this->data['column_delete'] = $this->language->get('column_delete');
          $this->data['column_quantity'] = $this->language->get('column_quantity');
        $this->data['column_price'] = $this->language->get('column_price');
          $this->data['column_subtotal'] = $this->language->get('column_subtotal');

        $results = $this->model_catalog_product->getAjaxcartProducts($data);

        if (!empty($results)) {
        foreach ($results as $result) {
            if ($result['image']) {
                $image = $this->model_tool_image->resize($result['image'], 80, 80);
            } else {$image = $this->model_tool_image->resize('no_image.jpg', 80, 80);

            }
        
            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;
            }

            $this->data['ajaxcartproducts'][] = array(
                'product_id'  => $result['product_id'],
                'thumb'        => $image,
                'name'          => $result['name'],
                'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
                'price'        => $price,
                'special'      => $special,
                'rating'      => $rating,
                'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                'href'          => $this->url->link('product/product', 'product_id=' . $result['product_id']),
            );
        }
        }

        $this->template = 'default/template/common/ocjoyajaxcart.tpl';

        $this->response->setOutput($this->render());

        $this->render();
    }
}
?>

заходим в catalog\view\theme\default\template\common\ocjoyajaxcart.tpl
находим


Код:
div class="name"><a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>"><?php $pname = mb_substr(strip_tags(html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8')),0,$config_ocjoyajaxcart_countname, 'utf-8'); echo $pname . ' ...'; ?></a></div>

меняем на

Код:
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>

В том же файле \view\theme\default\template\common\ocjoyajaxcart.tpl
Находим: это


Код:
<div class="description"><?php $pdesc = mb_substr(strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')),0,$config_ocjoyajaxcart_countdesc, 'utf-8'); echo $pdesc . ' ...'; ?></div>

И меняем на

Код:
<div class="description"><?php echo $product['description']; ?></a></div>

Исправляем:
в файле catalog\view\theme\default\template\product\product.tpl
находим


Код:
<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />

и меняем на это

Код:
<input type="button" value="<?php echo $button_cart; ?> "onclick="addToCart('<?php echo $product_id; ?>');" class="button" />

Открываем catalog/model/catalog/product.php
и находим


Код:
public function getTotalProductSpecials() {
        if ($this->customer->isLogged()) {
            $customer_group_id = $this->customer->getCustomerGroupId();
        } else {
            $customer_group_id = $this->config->get('config_customer_group_id');
        }    
    
        $query = $this->db->query("SELECT COUNT(DISTINCT ps.product_id) AS total FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW()))");
    
        if (isset($query->row['total'])) {
            return $query->row['total'];
        } else {
            return 0;
        }
    }
}

меняем на:

Код:
public function getAjaxcartProducts($data = array()) {
        $type_pr = (int)$this->config->get('config_type_ap');
            
        if ($type_pr == 1) {

                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }
            
                $product_data = array();
            
                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE category_id = '" . (int)$this->config->get('config_parent_id') . "'");
            
                foreach ($query->rows as $result) {    
                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                }
                                      
                return $product_data;
        
        } elseif ($type_pr == 2) {
        
                $product_data = array();
            
                $query = $this->db->query("SELECT p.product_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY p.viewed, p.date_added DESC LIMIT 50");
            
                foreach ($query->rows as $result) {    
                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                }
                                      
                return $product_data;
        
        } elseif ($type_pr == 3) {
        
                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }
                    
                $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";

                $sort_data = array(
                    'pd.name',
                    'p.model',
                    'ps.price',
                    'rating',
                    'p.sort_order'
                );
            
                if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
                    if ($data['sort'] == 'pd.name' || $data['sort'] == 'p.model') {
                        $sql .= " ORDER BY LCASE(" . $data['sort'] . ")";
                    } else {
                        $sql .= " ORDER BY " . $data['sort'];
                    }
                } else {
                    $sql .= " ORDER BY p.sort_order";
                }
            
                if (isset($data['order']) && ($data['order'] == 'DESC')) {
                    $sql .= " DESC, LCASE(pd.name) DESC";
                } else {
                    $sql .= " ASC, LCASE(pd.name) ASC";
                }
        
            
                $sql .= " LIMIT 0, 50";
            

                $product_data = array();
            
                $query = $this->db->query($sql);
            
                foreach ($query->rows as $result) {    
                    $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                }
            
                return $product_data;
        
        } elseif ($type_pr == 4) {
        
                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }
                    
                $product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . '50');

                if (!$product_data) {
                    $product_data = array();
                
                    $query = $this->db->query("SELECT op.product_id, COUNT(*) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT 50");
                
                    foreach ($query->rows as $result) {    
                        $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                    }
                
                    $this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . '50', $product_data);
                }
            
                return $product_data;
        
        } elseif ($type_pr == 5) {
        
                if ($this->customer->isLogged()) {
                    $customer_group_id = $this->customer->getCustomerGroupId();
                } else {
                    $customer_group_id = $this->config->get('config_customer_group_id');
                }
                    
                $product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . '50');

                if (!$product_data) {
                    $query = $this->db->query("SELECT p.product_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY p.date_added DESC LIMIT 50");
                  
                    foreach ($query->rows as $result) {
                        $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
                    }
                
                    $this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . '50', $product_data);
                }
            
                return $product_data;
        }
        }
}


Далее Делаем это:
Откройте файл catalog/view/javascript/common.js и замените всю функцию, но исходный вариант рекомендую закоментировать или сохранить:


Код:
function addToCart(product_id,quantity){
    quantity = typeof(quantity) != 'undefined' ? quantity : 1;

    $.ajax({
        url: 'index.php?route=checkout/cart/add',
        type: 'post',
        data: 'product_id=' + product_id + '&quantity=' + quantity,
        dataType: 'json',
        success: function(json) {
            $('.success, .warning, .attention, .information, .error').remove();
    
            if (json['redirect']) {
                location = json['redirect'];
            }
    
            if (json['success']) {
                $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
        
                $('.success').fadeIn('slow');
        
                $('#cart-total').html(json['total']);
        
                $('html, body').animate({ scrollTop: 0 }, 'slow');
            }
        }
    });
}

Меняем на:

Код:
$(".carousel-button-right-ajcart").live('click',function(){
      right_carusel();
});

$(".carousel-button-left-ajcart").live('click',function(){
      left_carusel();
});

function left_carusel(){
    var block_width = $('.carousel-block-ajcart').width() + 20;
    $(".carousel-items-ajcart .carousel-block-ajcart").eq(-1).clone().prependTo(".carousel-items-ajcart");
    $(".carousel-items-ajcart").css({"left":"-"+block_width+"px"});
    $(".carousel-items-ajcart").animate({left: "0px"}, 200);
    $(".carousel-items-ajcart .carousel-block-ajcart").eq(-1).remove();
}

function right_carusel(){
    var block_width = $('.carousel-block-ajcart').width() + 20;
    $(".carousel-items-ajcart").animate({left: "-"+ block_width +"px"}, 200);
    setTimeout(function () {
        $(".carousel-items-ajcart .carousel-block-ajcart").eq(0).clone().appendTo(".carousel-items-ajcart");
        $(".carousel-items-ajcart .carousel-block-ajcart").eq(0).remove();
        $(".carousel-items-ajcart").css({"left":"0px"});
    }, 300);
}

$(document).ready(function() {
    $(".ajaxcart").colorbox({
          onLoad    : function() { $(this).colorbox.resize(); },
          onComplete : function() { $(this).colorbox.resize(); },
          fastIframe: false,
        scrolling: false,
        initialWidth: false,
        innerWidth: false,
        maxWidth: false,
        height: false,
        initialHeight: false,
        innerHeight: false
    });
    $("#colorbox").draggable({
          cursor: "crosshair",
          containment: "parent"
    });
});

$('html').append('<div style="display:none;"><a class="ajaxcart" id="showcart" href="index.php?route=common/ocjoyajaxcart">&nbsp;</a></div>');
$('head').prepend('<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ocjoyajaxcart/ocjoyajaxcart.css"/>');

function addToCart(product_id, quantity) {
    quantity = typeof(quantity) != 'undefined' ? quantity : 1;
    $.ajax({
        url: 'index.php?route=checkout/cart/add',
        type: 'post',
        data: 'product_id=' + product_id + '&quantity=' + quantity,
        dataType: 'json',
        success: function(json) {
            $('.success, .warning, .attention, .information, .error').remove();
            if (json['redirect']) {
                location = json['redirect'];
            }

            if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 8)) {
                if (json['success']) {
                    $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
            
                    $('.success').fadeIn('slow');
            
                    $('#cart-total').html(json['total']);
            
                    $('html, body').animate({ scrollTop: 0 }, 'slow');
                }
            } else {
                if (json['success']) {
                        $('#showcart').trigger('click');
                    $('#cart-total').html(json['total']);
                }
            }
        }
    });
}

Откройте файл catalog/view/theme/default/template/product/product.tpl и замините всю функцию:
Код:
if (json['success']) {
    $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt=""

class="close" /></div>');    
    $('.success').fadeIn('slow');    
    $('#cart-total').html(json['total']);
    $('html, body').animate({ scrollTop: 0 }, 'slow');
}

Заменяем на:

Код:
if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 8)) {
                if (json['success']) {
                    $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
            
                    $('.success').fadeIn('slow');
            
                    $('#cart-total').html(json['total']);
            
                    $('html, body').animate({ scrollTop: 0 }, 'slow');
                }
            } else {
                if (json['success']) {
                        $('#showcart').trigger('click');
                    $('#cart-total').html(json['total']);
                }
            }
 
Назад
Сверху