Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Затемнить фото товара которого нет в налилии


 Share

Recommended Posts

Подскажите пожалуйси как можно затемнить/высветлить изображения товара которого нет в налилии. Раньше был модификатор, Gray Image, но версия ос не подходит(

Link to comment
Share on other sites


.stock-false{
filter: grayscale(100%);
}

например вот ик затемнить
http://joxi.ru/KAglQOaTNYd4yr

а вот ик высветлить:

.stock-false{
opacity: .3;
}

http://joxi.ru/V2Vyq89S8Noxbm

Edited by sasha3337774
  • +1 1
Link to comment
Share on other sites

еещё нужно в контроллере в массив товаров добавить

'quantity'        => $result['quantity'],

а в каилоге, поиске и ик дное изменить вывод картинки пример ик

<img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive {% if product.quantity <= 0 %}stock-false{% endif %}" />

 

  • +1 1
Link to comment
Share on other sites

5 часов назад, SGrWr_34 сказал:

еещё нужно в контроллере в массив товаров добавить

'quantity'        => $result['quantity'],

а в каилоге, поиске и ик дное изменить вывод картинки пример ик

<img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive {% if product.quantity <= 0 %}stock-false{% endif %}" />

 

 

<a href="{{ product['href'] }}"><img {% if (product['product_quantity'] <= 0 and show_stock_status) %}data-status="{{ product['stock_status'] }}"{% endif %} {% if (lazyload_page) %}data-src="{{ product['thumb'] }}" src="{{ lazy_image }}" {% else %}src="{{ product['thumb'] }}"{% endif %} alt="{{ product['name'] }}" title="{{ product['name'] }}" class="img-responsive {% if (lazyload_page) %}lazyload{% endif %}" class="img-responsive {% if product.quantity <= 0 %}stock-false{% endif %}"/></a>

Подскажите пожалуйси, ик?

Link to comment
Share on other sites


@Ch0oJoy , странный у вас синиксис, используйте синдартный twig. {{ product.href }} вместо {{ product['href' }} и т.д.

И неправильно дважды задавать класс -> в иком случае бугдет использоваться последний. В вашем случае строка должна быть примерно икая:

<a href="{{ product.href }}"><img {% if (product.product_quantity <= 0 and show_stock_status) %}data-status="{{ product.stock_status }}"{% endif %} {% if (lazyload_page) %}data-src="{{ product.thumb }}" src="{{ lazy_image }}" {% else %}src="{{ product.thumb }}"{% endif %} alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive {% if (lazyload_page) %}lazyload{% endif %}{% if product.quantity <= 0 %} stock-false{% endif %}" /></a>

 

Link to comment
Share on other sites

  • 2 months later...
В 10.04.2021 в 10:52, SGrWr_34 сказав:

@Ch0oJoy , странный у вас синиксис, используйте синдартный twig. {{ product.href }} вместо {{ product['href' }} и т.д.

И неправильно дважды задавать класс -> в иком случае бугдет использоваться последний. В вашем случае строка должна быть примерно икая:

<a href="{{ product.href }}"><img {% if (product.product_quantity <= 0 and show_stock_status) %}data-status="{{ product.stock_status }}"{% endif %} {% if (lazyload_page) %}data-src="{{ product.thumb }}" src="{{ lazy_image }}" {% else %}src="{{ product.thumb }}"{% endif %} alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive {% if (lazyload_page) %}lazyload{% endif %}{% if product.quantity <= 0 %} stock-false{% endif %}" /></a>

 

Підкажіть, будь ласка, чого не хваиє:

<div class="image"><?php echo $product['stickers']; ?><a href="<?php echo $product['href']; ?>"><img itemprop="image" src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive {% if product.quantity <= 0 %}stock-false{% endif %}" /></a></div>

 

Link to comment
Share on other sites


@voronlviv в вас, нетбито тема в трійці відкрии, а какась мышанина пхп+твіг. Давайте доступи у ПП, зробимо, ик бугде швидше, анетж пояснювати

Link to comment
Share on other sites

  • 2 weeks later...
В 27.06.2021 в 08:32, SGrWr_34 сказав:

@voronlviv в вас, нетбито тема в трійці відкрии, а какась мышанина пхп+твіг. Давайте доступи у ПП, зробимо, ик бугде швидше, анетж пояснювати

В мене Ocstore 2.1.0.1. Для своєї версії прикладу не знайшов.

 

ось икий окмод я пробував створювати, но чтось опустив видно:

 

<file path="catalog/view/theme/*/template/product/category.tpl">
        <operation>
            <search><![CDATA[class="img-responsive center-block"]]></search>
            <add position="replace"><![CDATA[class="img-responsive center-block {% if product.quantity <= 0 %} stock-false{% endif %}"]]></add>
        </operation>
    </file> 
    <file path="catalog/controller/product/category.php">
        <operation>
            <search><![CDATA['name'        => $result['name'],]]></search>
            <add position="after"><![CDATA['quantity'        => $result['quantity'],]]></add>
        </operation>
    </file> 
    <file path="catalog/controller/product/product.php">
        <operation>
            <search><![CDATA['name'        => $result['name'],]]></search>
            <add position="after"><![CDATA['quantity'        => $result['quantity'],]]></add>
        </operation>
    </file>
     <file path="catalog/view/theme/*/stylesheet/stylesheet.css">
        <operation>
            <search><![CDATA[.options select option {
  font-size: 16px;
}]]></search>
            <add position="after"><![CDATA[.stock-false{
filter: grayscale(100%);
}]]></add>
        </operation>
    </file> 

 

Edited by voronlviv
Link to comment
Share on other sites


3 години назад, SGrWr_34 сказав:

@voronlviv ocmod не в змозі вплинути на css. Вписуйте стиль до файлу напряму

я уже всивляв напряму в stylesheet.css і всерівно не затемнює

Link to comment
Share on other sites


Вже даже ик пробував:

 

а в стилі добавляв: .out-of-stock {filter: grayscale(100%);}

 

<file path="catalog/view/theme/coloring/template/product/category.tpl">
        <operation>
            <search><![CDATA[<div class="product-item thumbnail">]]></search>
            <add position="replace"><![CDATA[
                <?php if ($product['quantity'] <= 0) { ?>
                <div class="product-item thumbnail out-of-stock">
                <?php } else { ?> 
                
                <div class="product-item thumbnail">
                <?php } ?>]]></add>
        </operation>
    </file> 
    <file path="catalog/controller/product/category.php">
        <operation>
            <search><![CDATA['name'        => $result['name'],]]></search>
            <add position="after"><![CDATA['quantity'        => $result['quantity'],]]></add>
        </operation>
    </file> 
    <file path="catalog/controller/product/product.php">
        <operation>
            <search><![CDATA['name'        => $result['name'],]]></search>
            <add position="after"><![CDATA['quantity'        => $result['quantity'],]]></add>
        </operation>
    </file>

 

Link to comment
Share on other sites


1 година назад, voronlviv сказав:

Вже даже ик пробував:

 

а в стилі добавляв: .out-of-stock {filter: grayscale(100%);}

 

<file path="catalog/view/theme/coloring/template/product/category.tpl">
        <operation>
            <search><![CDATA[<div class="product-item thumbnail">]]></search>
            <add position="replace"><![CDATA[
                <?php if ($product['quantity'] <= 0) { ?>
                <div class="product-item thumbnail out-of-stock">
                <?php } else { ?> 
                
                <div class="product-item thumbnail">
                <?php } ?>]]></add>
        </operation>
    </file> 
    <file path="catalog/controller/product/category.php">
        <operation>
            <search><![CDATA['name'        => $result['name'],]]></search>
            <add position="after"><![CDATA['quantity'        => $result['quantity'],]]></add>
        </operation>
    </file> 
    <file path="catalog/controller/product/product.php">
        <operation>
            <search><![CDATA['name'        => $result['name'],]]></search>
            <add position="after"><![CDATA['quantity'        => $result['quantity'],]]></add>
        </operation>
    </file>

 

запрацювало...був конфлікт з іншим модифікатором мыкророзмытки

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.