скидки в категории, как?

Тема в разделе "OpenCart", создана пользователем blackfm, 30 ноя 2014.

  1. blackfm

    blackfm

    Регистрация:
    29 янв 2013
    Сообщения:
    182
    Симпатии:
    35
    интересует вывод скидок (discounts) в категории товаров, как в карточке товара.
    OCstore 1.5.5.1.2
    может есть уже готовый vqmod или хак?
     
  2. Baco

    Baco Антихронофаг Команда форума

    Регистрация:
    9 окт 2012
    Сообщения:
    803
    Симпатии:
    399
    Держите:
    Код:
    <?xml version="1.0" encoding="UTF-8"?>
    <modification>
        <id>disc_in_cat</id>
        <version>1.0</version>
        <vqmver>2.3.2</vqmver>
        <author>[Baco]</author>
        <id>disc_in_cat</id>
        <version>2.0</version>
        <author>special for Impreza</author>
        <file name="catalog/view/theme/*/template/product/category.tpl">
            <operation>
                <search position="after"><![CDATA[
                    <?php echo $product['description']; ?></div>
                ]]></search>
                <add><![CDATA[
                      <?php if ($product['d']) { ?>
                        <br />
                        <div class="discount">
                          <?php foreach ($product['d'] as $discount) { ?>
                          <?php echo $text_opt; ?><?php echo $discount['quantity']; echo $text_po; echo $this->currency->format($this->tax->calculate($discount['price'], $product['tax_class_id'], $this->config->get('config_tax'))); ?><br />
                          <?php } ?>
                        </div>
                    <?php } ?>
                ]]></add>
            </operation>
            <operation>
                <search position="after"><![CDATA[
                    html += '  <div class="description">' + $(element).find('.description').html() + '</div>';
                ]]></search>
                <add><![CDATA[
                    var discount = $(element).find('.discount').html();
              
                if (discount != null) {
                    html += '    <div class="discount">' + discount + '</div>';
                }
                ]]></add>
            </operation>
            <operation>
                <search position="after"><![CDATA[
                   html += '<div class="description">' + $(element).find('.description').html() + '</div>';
                ]]></search>
                <add><![CDATA[
                    var discount = $(element).find('.discount').html();
              
                if (discount != null) {
                    html += '<div class="discount">' + discount + '</div>';
                }
                ]]></add>
            </operation>
        </file>
      
        <file name="catalog/controller/product/category.php">
      
            <operation>
                <search position="after"><![CDATA[
                if (isset($product_in_cart['key'])) $key = $product_in_cart['key'];
                ]]></search>
                <add><![CDATA[
                    //discounts_st
                    $discounts = $this->model_catalog_product->getProductDiscounts($result['product_id']);
                  
                    $this->data['discounts'] = array();
                  
                    foreach ($discounts as $discount) {
                        $this->data['discounts'][] = array(
                            'quantity' => $discount['quantity'],
                            'price'    => $this->currency->format($this->tax->calculate($discount['price'], $result['tax_class_id'], $this->config->get('config_tax')))
                        );
                    }
                    //discounts_end
                ]]></add>
            </operation>
            <operation>
                <search position="after"><![CDATA[
                    'price'       => $price,
                ]]></search>
                <add><![CDATA[
                    //Discount
                        'd'       => $this->model_catalog_product->getProductDiscounts($result['product_id']),
                        'tax_class_id' => $result['tax_class_id'],
                    //Discount
                ]]></add>
            </operation>
            <operation>
                <search position="after"><![CDATA[
                    $this->data['button_continue'] = $this->language->get('button_continue');
                ]]></search>
                <add><![CDATA[
                    //Discount
                    $this->data['text_opt'] = $this->language->get('text_opt');
                    $this->data['text_po'] = $this->language->get('text_po');
                    //Discount
                ]]></add>
            </operation>
        </file>
      
        <file name="catalog/language/russian/product/category.php">
      
            <operation>
                <search position="after"><![CDATA[
                   <?php
                ]]></search>
                <add><![CDATA[
                    $_['text_opt']       = 'Опт: ';
                    $_['text_po']       = ' по ';
                ]]></add>
            </operation>
        </file>
        <file name="catalog/language/english/product/category.php">
      
            <operation>
                <search position="after"><![CDATA[
                   <?php
                ]]></search>
                <add><![CDATA[
                    $_['text_opt']       = 'Opt: ';
                    $_['text_po']       = ' for ';
                ]]></add>
            </operation>
        </file>
        <file name="catalog/language/ukrainian/product/category.php">
      
            <operation>
                <search position="after"><![CDATA[
                   <?php
                ]]></search>
                <add><![CDATA[
                    $_['text_opt']       = 'Опт: ';
                    $_['text_po']       = ' по ';
                ]]></add>
            </operation>
        </file>
    </modification>
    
     
    blackfm нравится это.