Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Motchanyy

Новачок
  
  • Публікації

    25
  • З нами

  • Відвідування

Усі публікації користувача Motchanyy

  1. Я писал что если у кого то есть приме кода то скиньте. Я никого не просил лично мне написать код.
  2. Я искал примеры по запросу. Ничего не нашел что бы мне допомогло.
  3. Я как бы другое указывал. Ну ладно. Возможно кто то другой ответит. Я попросил пример простого рабочего кода.
  4. Я разные модули перебирал. Так своего кода с 0 нет. https://github.com/search?l=PHP&q=opencart+2.3+addOrder&type=Code По примерах у других модулях смотрел. Так и не понял как сделать. Это набросок кода который по идее должен просто отправить email если есть заказ новый на сайте. <?php /** * Webkul Software. * * @category Webkul * @package Opencart Module Tutorial * @author Webkul * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com) * @license https://store.webkul.com/license.html */ /** * The controller class must extend the parent class i.e. Controller * The controller name must be like Controller + directory path (with first character of each folder in capital) + file name (with first character in capital) * For version 2.3.0.0 and upper, the name of the controller must be ControllerExtensionModuleFirstModule */ class ControllerModuleASD extends Controller { /** * property named $error is defined to put errors * @var array */ private $error = array(); public function install() { // подключаем модель checkout/order $this->load->model('checkout/order'); // меняем статус заказа на Processing (т.е. статус с ID == 2) $this->model_checkout_order->addOrderHistory(2, 2); } /** * Basic function of the controller. This can be called using route=module/123 */ public function index() { /** * Loads the language file. Path of the file along with file name must be given */ $this->load->language('module/123'); /** * Sets the title to the html page */ $this->document->setTitle($this->language->get('heading_title')); // Order //$this->load->model('checkout/order'); //$this->model_checkout_order->confirm($order_id, $order_status_id, $comment, $notify); # Данная функция запускается в контроллере модулей оплаты при подтверждении заказа. Вам же, достаточно добавить после функции //$this->model_checkout_order->addOrder($data); // END Order $this->load->model('setting/setting'); /** * Checks whether the request type is post. If yes, then calls the validate function. */ if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { /** * The function named 'editSetting' of a model is called in this way * The first argument is the code of the module and the second argument contains all the post values * The code must be same as your file name */ $this->model_setting_setting->editSetting('123', $this->request->post); /** * The success message is kept in the session */ $this->session->data['success'] = $this->language->get('text_success'); /** * The redirection works in this way. * After insertion of data, it will redirect to extension/module file along with the token * The success message will be shown there */ $this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], true)); } /** * Putting the language into the '$data' array * This is the way how you get the language from the language file */ $data['heading_title'] = $this->language->get('heading_title'); $data['text_edit'] = $this->language->get('text_edit'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['entry_status'] = $this->language->get('entry_status'); $data['button_save'] = $this->language->get('button_save'); $data['button_cancel'] = $this->language->get('button_cancel'); /** * If there is any warning in the private property '$error', then it will be put into '$data' array */ if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } /** * Breadcrumbs are declared as array */ $data['breadcrumbs'] = array(); /** * Breadcrumbs are defined */ $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_module'), 'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('module/123', 'token=' . $this->session->data['token'], true) ); /** * Form action url is created and defined to $data['action'] */ $data['action'] = $this->url->link('module/123', 'token=' . $this->session->data['token'], true); /** * Cancel/back button url which will lead you to module list */ $data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], true); /** * checks whether the value exists in the post request */ if (isset($this->request->post['asd_status'])) { $data['asd_status'] = $this->request->post['asd_status']; } else { /** * if the value do not exists in the post request then value is taken from the config i.e. setting table */ $data['asd_status'] = $this->config->get('asd_status'); } /** * Header data is loaded */ $data['header'] = $this->load->controller('common/header'); /** * Column left part is loaded */ $data['column_left'] = $this->load->controller('common/column_left'); /** * Footer data is loaded */ $data['footer'] = $this->load->controller('common/footer'); /** * Using this function tpl file is called and all the data of controller is passed through '$data' array * This is for Opencart 2.2.0.0 version. There will be minor changes as per the version. */ $this->response->setOutput($this->load->view('module/123', $data)); } public function order() { //$this->load->model('checkout/order'); $to = ""; $subject = "Заголовок письма"; $message = ' <p>Текст письма</p> </br> <b>1-ая строчка </b> </br><i>2-ая строчка </i> </br>'; $headers = "Content-type: text/html; charset=windows-1251 \r\n"; $headers .= "From: От кого письмо <[email protected]>\r\n"; $headers .= "Reply-To: [email protected]\r\n"; mail($to, $subject, $message, $headers); } protected function validate() { /** * Check whether the current user has the permissions to modify the settings of the module * The permissions are set in System->Users->User groups */ if (!$this->user->hasPermission('modify', 'module/123')) { $this->error['warning'] = $this->language->get('error_permission'); } return !$this->error; } }
  5. Можете скинуть пример простого кода который срабатывает если приходит новый заказ. Допустим если пришел заказ пишем в консоль текст. Если можно. Я уже все перепробовал. Ни*** не работает)
  6. А можете набросать пример кода. Например когда пользователь что то заказывает код записывает какой то текст в файл. Спасибо заранее.
  7. Подскажите, кто знает. Как на php получить события, когда происходит заказ на сайте. Есть ли у кого-нибудь пример кода или ссылка на пример. Нужен простой пример, который будет срабатывать, когда покупатель будет что-то заказывать на сайте. Если можно пример под версии 2.3, 3 и 4.
  8. Подскажите кто знает. Почему при установке модуля в разделе "Производители" в низу форма скрывается. Как видно по html там одинаковые id="language" в tabs.
  9. Это не баг кода. Я проверил. Это что то в базе. Только куда смотреть, вот тут нужна помощь знатоков.
  10. Хотел для начала уточнить на форуме. Возможно кто то +- знает куда копать и что смотреть.
  11. Я все перепробовал. Не помогает. А где и по каким параметрам искать в базе?
  12. А как вообще найти товар в базе не зная ничего что это за товар и как его найти.
  13. Проверил. Ничего нет. Когда то уже было такое на этом сайте. Спустя время товар сам пропал.
  14. Выводится несуществующий товар без фото и ID. В каталоге данного товара нет. И найти невозможно так как ID просто нет. При наведении на товар вот такая ссылка: /index.php?route=product/product&product_id= Подскажите, кто сталкивался, как это пофиксить.
  15. Привет всем. Кто знает как выправить вот такую ошибку Эта ошибка появляется когда я на вкладке "Настройки парсинга" пробую загрузить страницу для просмотра. https://i2.paste.pics/383c43ca1a7276954a7e534be0008c27.png
  16. Ну что непонятно в моем вопросе? В админке есть описание. Но почему то в header выводится только стандартное описание, а не модуля которое сгенерировано.
  17. В 2 словах. Был изменен файл modification.xml после чего скинут кеш. Сайт перестал работать. Вернул содержимое файла, но сайт так и не заработал. Как можно его вернуть к жизни или скинуть кеш когда не можешь зайти в админку.
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.