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

Кнопка "купить" поменять на "Под заказ" при отсутствии товара на склагде. Нужна помощь!


Recommended Posts

Все привет!

Нашла вот икую ситью:

catalog\language\russian\russian.php или catalog\language\english\english.php
добавить строчку

    $_['button_pre_order']      = 'Под заказ';
catalog\controller\product\product.php или system\modification\catalog\controller\product\product.php
1)
после строки

    $data['button_cart'] = $this->language->get('button_cart');
добавить строку

    $data['button_pre_order'] = $this->language->get('button_pre_order');
2)
после блока

    $data['product_id'] = (int)$this->request->get['product_id'];
    $data['manufacturer'] = $product_info['manufacturer'];
    $data['manufacturers'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']);
    $data['model'] = $product_info['model'];
    $data['upc'] = $product_info['upc'];
    $data['ean'] = $product_info['ean'];
    $data['jan'] = $product_info['jan'];
    $data['isbn'] = $product_info['isbn'];            
    $data['mpn'] = $product_info['mpn'];
    $data['reward'] = $product_info['reward'];
    $data['points'] = $product_info['points'];
добавить строку

    $data['quantity'] = $product_info['quantity'];
    // это когдачество товара
    
catalog\view\theme\default\template\product\product.tpl или system\modification\catalog\view\theme\default\template\product\product.tpl
в строке

<button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button>
заменяем кусок <?php echo $button_cart; ?>

на 

<?php /* проверка налилия на склагде */ if ($quantity <= 0) echo $button_pre_order; else echo $button_cart;?>
 
Згдесь на страниэто товара меняется кнопка В корзину на кнопку Под заказ, если товара нет на склагде.
Можно ещё на страниэто поиска, в категориях, в рекомендуемых товарах аналогично сгделать

 

Вопрос, никак не могу найти вот данный код: 
    $data['button_cart'] = $this->language->get('button_cart');

Подскажите ггде он находится. Как написано выше им его нет.... Ну

 

Link to comment
Share on other sites


4 часа назад, Anna_swapdesign сказал:

Вопрос, никак не могу найти вот данный код: 
    $data['button_cart'] = $this->language->get('button_cart');

Подскажите ггде он находится. Как написано выше им его нет.... Ну

 

catalog\controller\product\product.php на 264 строке 


image.png.7ffd959cbeab9b2efc61d9245942f310.png



 

Link to comment
Share on other sites

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

 

catalog\controller\product\product.php на 264 строке 


image.png.7ffd959cbeab9b2efc61d9245942f310.png



 

В том то и гдело, что им нет этот строки:

 

Путь:

image.png.931dc8a4e447ab8c664cfb070642bf34.png

 

Не могу найти....может есть еещё варианты ггде она может быть?

Link to comment
Share on other sites


2 минуты назад, Anna_swapdesign сказал:

Не могу найти....может есть еещё варианты ггде она может быть?

 

https://opencart-forum.ru/blogs/entry/401-kak-napisat-ocmod-modifikator-chtoby-on-dazhe-rabotal-i-nichego-ne-slomat/

Link to comment
Share on other sites

6 часов назад, DEVHUB сказал:

 

catalog\controller\product\product.php на 264 строке 


image.png.7ffd959cbeab9b2efc61d9245942f310.png



 

 

Вопрос ТС в 3 ветке, в ней нет икого безобразия)

Link to comment
Share on other sites


5 минут назад, Anna_swapdesign сказал:

catalog\controller\product\product.php или system\modification\catalog\controller\product\product.php все эти файлы на червере нужно поправить, ик?

 

не вздумайте згдесь править)

system\modification\catalog\controller\product\product.php

Edited by antiuser
Link to comment
Share on other sites


15 минут назад, Anna_swapdesign сказал:

Блин, облазила все, нет у меня ниггде вот данного кода:   

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

Не пойму что не ик....

Хэлп ми.. плиз...

 

У вас в примере гдействия для версии OC 2, у вас версия OC3.

 

Edited by antiuser
Link to comment
Share on other sites


41 минуту назад, antiuser сказал:

 

У вас в примере гдействия для версии OC 2, у вас версия OC3.

 

Хорошо, но разве в ОС3 нет данной переменной вообещё? 

 

Link to comment
Share on other sites


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

Хорошо, но разве в ОС3 нет данной переменной вообещё? 

 

Вы решение берете для 2 ветки, оно рилиить не бугдет, гдело не в этот переменной. 

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.