Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Если нет товара в наличии в конец и сделать цвет карточки серым


Recommended Posts

Здравствуйте всем! Помогите с товарами. 

На сайте товары в наличии и нет в наличии в разброс, нужно актуальные товары чтобы были в начале, а которых нет в наличии в конец и чтобы были серые на фото, либо приглушенные...

Link to comment
Share on other sites


Это довольно большой объём правок в файлах.

И это больше для раздела услуг, а не "помощь программистам".

Ну или описывайте, что делали и что не получилось.

Link to comment
Share on other sites

Додати сортування в моделі товарів у виборці: ORDER BY (p.quantity>0)

Додати у контролерах модулів та каталогу у виборку даних по товарах змінну quantity

Відштовхуючись від кількості міняти стиль ескізу зображення і робити сірим

 

Але да, то краще до розділу послуг мабуть :)

 

Link to comment
Share on other sites

  • 4 months later...
  • 7 months later...
   <file path="catalog/view/theme/*/template/product/{category,manufacturer_info}.twig">
        <operation>
            <search><![CDATA[<div class="product-thumb">]]></search>
            <add position="replace"><![CDATA[<div class="product-thumb{{ product.quantity <= 0 ? ' out-of-stock' }}">]]></add>
        </operation>
    </file> 

и добвить 

.out-of-stock {filter: grayscale(100%);}
в CSS темы

Link to comment
Share on other sites

      <file path="catalog/controller/product/{category,search,special,manufacturer}.php">
        <operation>
            <search><![CDATA[$data['products'][] = array(]]></search>
            <add position="after"><![CDATA[ 'quantity' => $result['quantity'],]]></add>
        </operation>
    </file> 
    <file path="catalog/view/theme/*/template/product/{category,search,special,manufacturer_info}.twig">
        <operation>
            <search><![CDATA[class="image"]]></search>
            <add position="replace"><![CDATA[class="image {% if product.quantity <= 0 %} out-of-stock" style="filter: grayscale(100%);{% endif %}"]]></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.