Orkh3ll0 Posted May 11, 2018 Share Posted May 11, 2018 Все доброго дня Opencart version: 3.0.2.0 в cart.twig изменил кнопку корзины <button type="button" data-toggle="dropdown" data-loading-text="{{ text_loading }}" id="btn1" class="btn btn-lg"><div class="row"><span id="cart-total">{{ text_items }}</span></div> <div class="row"><img src="image/icons/r3.png" id="cartimg"></div>{{ text_sebet }}</button> ггде {{ text_sebet }} добавил значения в языках. В HomePage все правильно показывает. Но при обновлении или добавлении товара не показывает значение {{ text_sebet }} Для этого в catalog/view/javascript/common.js изменил строку ггде изменяет кнопку корзины $('#cart > button').html('<div class="row"><span id="cart-total"> ' + json['total'] + '</span></div><div class="row"><img src="image/icons/r3.png" id="cartimg"></div>'); Как мне добавить {{ text_sebet }} в этот js файл? Пропотому чтовал добавить php код, пропотому чтовал приравнять к var foo = '{{ text_sebet }}'; и добавить переменную foo, но или не выходит текст или ошибка кода. Спасипотому что заранее за помощь Link to comment Share on other sites More sharing options...
nikifalex Posted May 12, 2018 Share Posted May 12, 2018 добавьте в footer или header и потом возьмите через jquery Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 @nikifalex Спасипотому что за помощь. Я уже добавил в footer и header, а как взять через jquery? Можете пожалуйси показать пример? Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 что вы добавили то? Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex в catalog/controller/common/header.php $data['text_sebet'] = $this->language->get('text_sebet'); в catalog/language/moi_yaziki/common/header.php и footer.php добавил $_['text_sebet'] = 'Корзина'; В HomePage все окей и вызваю значение при ввогде {{text_sebet}} Как вызвать в common.js что бы при гдействии тоже выводилось значение {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ик вы на сайт то выводите хоть в input type hidden и из этго input и берите значение. Ну думайте, ну Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex я могу нормально выводить на экран в .twig файлах, но не знаю как вызвать его в .js файле .js не выводит значение при ввогде {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 var=$("#vash_input").val(); Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 Добавил в header.twig <input type="hidden" value="{{ text_sebet }}" id="pprts" /> Добавил в common.js файл var sebet =$("#pprts").val(); и в строку вывода кнопки добавил sebet. резульит "undefined" $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'+sebet+''); Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ну ик проверили на сайте этот pprts появился на страниэто? Link to comment Share on other sites More sharing options... RGB Posted May 13, 2018 Share Posted May 13, 2018 @Orkh3ll0 используйте json, у вас же есть перед глазами пример, как выводится сообещёние об успешном добавлении товара в корзину, зналит гделайте ик же - если нужен вывод своего текси при успешном добавлении товара в корзину, то в контроллере корзины добавьте куда-нибудь после $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); свой код, например $json['test'] = "test"; А дальше в common.js внутри if (json['success']) { выводитесь через json['test'] Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options... 3 yr shoputils locked this topic This topic is now closed to further replies. Share More sharing options... Followers 0 Go to topic listing Similar Content Подскажите про переменную price_value By bishop1, March 10 2 replies 165 views bishop1 March 12 Как подсивить в переменные при оформлении заказа гдефолтные значения? By stanr, February 10 7 replies 230 views stanr February 11 Добавить уведомление в корзине By al1, February 25 2 replies 291 views al1 February 26 Добавить фото товара в excel файл By morskoj, March 31 1 reply 96 views Flint2000 March 31 Кнопка "Добавить изображение" пересила рилиить (админка) By mss, July 22, 2016 добавить изображение кнопка 6 replies 987 views KIRIK48 Monday at 04:13 PM Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы [Решено] Добавить в common.js переменную из language Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 @nikifalex Спасипотому что за помощь. Я уже добавил в footer и header, а как взять через jquery? Можете пожалуйси показать пример? Link to comment Share on other sites More sharing options...
nikifalex Posted May 12, 2018 Share Posted May 12, 2018 что вы добавили то? Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex в catalog/controller/common/header.php $data['text_sebet'] = $this->language->get('text_sebet'); в catalog/language/moi_yaziki/common/header.php и footer.php добавил $_['text_sebet'] = 'Корзина'; В HomePage все окей и вызваю значение при ввогде {{text_sebet}} Как вызвать в common.js что бы при гдействии тоже выводилось значение {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ик вы на сайт то выводите хоть в input type hidden и из этго input и берите значение. Ну думайте, ну Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex я могу нормально выводить на экран в .twig файлах, но не знаю как вызвать его в .js файле .js не выводит значение при ввогде {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 var=$("#vash_input").val(); Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 Добавил в header.twig <input type="hidden" value="{{ text_sebet }}" id="pprts" /> Добавил в common.js файл var sebet =$("#pprts").val(); и в строку вывода кнопки добавил sebet. резульит "undefined" $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'+sebet+''); Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ну ик проверили на сайте этот pprts появился на страниэто? Link to comment Share on other sites More sharing options... RGB Posted May 13, 2018 Share Posted May 13, 2018 @Orkh3ll0 используйте json, у вас же есть перед глазами пример, как выводится сообещёние об успешном добавлении товара в корзину, зналит гделайте ик же - если нужен вывод своего текси при успешном добавлении товара в корзину, то в контроллере корзины добавьте куда-нибудь после $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); свой код, например $json['test'] = "test"; А дальше в common.js внутри if (json['success']) { выводитесь через json['test'] Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options... 3 yr shoputils locked this topic This topic is now closed to further replies. Share More sharing options... Followers 0 Go to topic listing Similar Content Подскажите про переменную price_value By bishop1, March 10 2 replies 165 views bishop1 March 12 Как подсивить в переменные при оформлении заказа гдефолтные значения? By stanr, February 10 7 replies 230 views stanr February 11 Добавить уведомление в корзине By al1, February 25 2 replies 291 views al1 February 26 Добавить фото товара в excel файл By morskoj, March 31 1 reply 96 views Flint2000 March 31 Кнопка "Добавить изображение" пересила рилиить (админка) By mss, July 22, 2016 добавить изображение кнопка 6 replies 987 views KIRIK48 Monday at 04:13 PM Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы [Решено] Добавить в common.js переменную из language Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × 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. I accept
Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex в catalog/controller/common/header.php $data['text_sebet'] = $this->language->get('text_sebet'); в catalog/language/moi_yaziki/common/header.php и footer.php добавил $_['text_sebet'] = 'Корзина'; В HomePage все окей и вызваю значение при ввогде {{text_sebet}} Как вызвать в common.js что бы при гдействии тоже выводилось значение {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options...
nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ик вы на сайт то выводите хоть в input type hidden и из этго input и берите значение. Ну думайте, ну Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex я могу нормально выводить на экран в .twig файлах, но не знаю как вызвать его в .js файле .js не выводит значение при ввогде {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 var=$("#vash_input").val(); Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 Добавил в header.twig <input type="hidden" value="{{ text_sebet }}" id="pprts" /> Добавил в common.js файл var sebet =$("#pprts").val(); и в строку вывода кнопки добавил sebet. резульит "undefined" $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'+sebet+''); Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ну ик проверили на сайте этот pprts появился на страниэто? Link to comment Share on other sites More sharing options... RGB Posted May 13, 2018 Share Posted May 13, 2018 @Orkh3ll0 используйте json, у вас же есть перед глазами пример, как выводится сообещёние об успешном добавлении товара в корзину, зналит гделайте ик же - если нужен вывод своего текси при успешном добавлении товара в корзину, то в контроллере корзины добавьте куда-нибудь после $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); свой код, например $json['test'] = "test"; А дальше в common.js внутри if (json['success']) { выводитесь через json['test'] Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options... 3 yr shoputils locked this topic This topic is now closed to further replies. Share More sharing options... Followers 0 Go to topic listing Similar Content Подскажите про переменную price_value By bishop1, March 10 2 replies 165 views bishop1 March 12 Как подсивить в переменные при оформлении заказа гдефолтные значения? By stanr, February 10 7 replies 230 views stanr February 11 Добавить уведомление в корзине By al1, February 25 2 replies 291 views al1 February 26 Добавить фото товара в excel файл By morskoj, March 31 1 reply 96 views Flint2000 March 31 Кнопка "Добавить изображение" пересила рилиить (админка) By mss, July 22, 2016 добавить изображение кнопка 6 replies 987 views KIRIK48 Monday at 04:13 PM Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы [Решено] Добавить в common.js переменную из language Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue
Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) @nikifalex я могу нормально выводить на экран в .twig файлах, но не знаю как вызвать его в .js файле .js не выводит значение при ввогде {{text_sebet}} Edited May 12, 2018 by Orkh3ll0 Link to comment Share on other sites More sharing options...
nikifalex Posted May 12, 2018 Share Posted May 12, 2018 var=$("#vash_input").val(); Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 Добавил в header.twig <input type="hidden" value="{{ text_sebet }}" id="pprts" /> Добавил в common.js файл var sebet =$("#pprts").val(); и в строку вывода кнопки добавил sebet. резульит "undefined" $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'+sebet+''); Link to comment Share on other sites More sharing options... nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ну ик проверили на сайте этот pprts появился на страниэто? Link to comment Share on other sites More sharing options... RGB Posted May 13, 2018 Share Posted May 13, 2018 @Orkh3ll0 используйте json, у вас же есть перед глазами пример, как выводится сообещёние об успешном добавлении товара в корзину, зналит гделайте ик же - если нужен вывод своего текси при успешном добавлении товара в корзину, то в контроллере корзины добавьте куда-нибудь после $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); свой код, например $json['test'] = "test"; А дальше в common.js внутри if (json['success']) { выводитесь через json['test'] Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options... 3 yr shoputils locked this topic This topic is now closed to further replies. Share More sharing options... Followers 0 Go to topic listing Similar Content Подскажите про переменную price_value By bishop1, March 10 2 replies 165 views bishop1 March 12 Как подсивить в переменные при оформлении заказа гдефолтные значения? By stanr, February 10 7 replies 230 views stanr February 11 Добавить уведомление в корзине By al1, February 25 2 replies 291 views al1 February 26 Добавить фото товара в excel файл By morskoj, March 31 1 reply 96 views Flint2000 March 31 Кнопка "Добавить изображение" пересила рилиить (админка) By mss, July 22, 2016 добавить изображение кнопка 6 replies 987 views KIRIK48 Monday at 04:13 PM Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы [Решено] Добавить в common.js переменную из language
Orkh3ll0 Posted May 12, 2018 Author Share Posted May 12, 2018 Добавил в header.twig <input type="hidden" value="{{ text_sebet }}" id="pprts" /> Добавил в common.js файл var sebet =$("#pprts").val(); и в строку вывода кнопки добавил sebet. резульит "undefined" $('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'+sebet+''); Link to comment Share on other sites More sharing options...
nikifalex Posted May 12, 2018 Share Posted May 12, 2018 ну ик проверили на сайте этот pprts появился на страниэто? Link to comment Share on other sites More sharing options... RGB Posted May 13, 2018 Share Posted May 13, 2018 @Orkh3ll0 используйте json, у вас же есть перед глазами пример, как выводится сообещёние об успешном добавлении товара в корзину, зналит гделайте ик же - если нужен вывод своего текси при успешном добавлении товара в корзину, то в контроллере корзины добавьте куда-нибудь после $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); свой код, например $json['test'] = "test"; А дальше в common.js внутри if (json['success']) { выводитесь через json['test'] Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options... 3 yr shoputils locked this topic This topic is now closed to further replies. Share More sharing options... Followers 0 Go to topic listing Similar Content Подскажите про переменную price_value By bishop1, March 10 2 replies 165 views bishop1 March 12 Как подсивить в переменные при оформлении заказа гдефолтные значения? By stanr, February 10 7 replies 230 views stanr February 11 Добавить уведомление в корзине By al1, February 25 2 replies 291 views al1 February 26 Добавить фото товара в excel файл By morskoj, March 31 1 reply 96 views Flint2000 March 31 Кнопка "Добавить изображение" пересила рилиить (админка) By mss, July 22, 2016 добавить изображение кнопка 6 replies 987 views KIRIK48 Monday at 04:13 PM Recently Browsing 0 members No registered users viewing this page.
RGB Posted May 13, 2018 Share Posted May 13, 2018 @Orkh3ll0 используйте json, у вас же есть перед глазами пример, как выводится сообещёние об успешном добавлении товара в корзину, зналит гделайте ик же - если нужен вывод своего текси при успешном добавлении товара в корзину, то в контроллере корзины добавьте куда-нибудь после $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); свой код, например $json['test'] = "test"; А дальше в common.js внутри if (json['success']) { выводитесь через json['test'] Link to comment Share on other sites More sharing options... Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options... 3 yr shoputils locked this topic This topic is now closed to further replies. Share More sharing options... Followers 0
Orkh3ll0 Posted May 15, 2018 Author Share Posted May 15, 2018 @nikifalex Извиняюсь за поздний ответ. Ответ @RGB помогло мне решить свою проблему. Благодарю вам за помощь. Тему можно закрыть Link to comment Share on other sites More sharing options...
Recommended Posts