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

Motchanyy

Newbie
  
  • Posts

    28
  • Joined

  • Last visited

1 Follower

About Motchanyy

  • Birthday 11/27/1994

Technical support

  • Status
    У відпустці

Information

  • Gender
    Чоловік
  • City:
    Кривий Ріг
  • Interests
    Різати русню

Recent Profile Visitors

6,931 profile views

Motchanyy's Achievements

Contributor

Contributor (5/14)

  • Reacting Well Rare
  • Dedicated Rare
  • Collaborator
  • First Post
  • Conversation Starter

Recent Badges

0

Reputation

  1. Доброго дня. Підкажіть такий момент. Як зробити щоб не видавало 404 якщо переходимо на https://site.com/ru/. На https://site.com/ru все нормально працює. Але треба в кінці додати / Дякую.
  2. Я писал что если у кого то есть приме кода то скиньте. Я никого не просил лично мне написать код.
  3. Я искал примеры по запросу. Ничего не нашел что бы мне допомогло.
  4. Я как бы другое указывал. Ну ладно. Возможно кто то другой ответит. Я попросил пример простого рабочего кода.
  5. Я разные модули перебирал. Так своего кода с 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; } }
  6. Можете скинуть пример простого кода который срабатывает если приходит новый заказ. Допустим если пришел заказ пишем в консоль текст. Если можно. Я уже все перепробовал. Ни*** не работает)
  7. А можете набросать пример кода. Например когда пользователь что то заказывает код записывает какой то текст в файл. Спасибо заранее.
  8. Подскажите, кто знает. Как на php получить события, когда происходит заказ на сайте. Есть ли у кого-нибудь пример кода или ссылка на пример. Нужен простой пример, который будет срабатывать, когда покупатель будет что-то заказывать на сайте. Если можно пример под версии 2.3, 3 и 4.
  9. Подскажите кто знает. Почему при установке модуля в разделе "Производители" в низу форма скрывается. Как видно по html там одинаковые id="language" в tabs.
  10. Это не баг кода. Я проверил. Это что то в базе. Только куда смотреть, вот тут нужна помощь знатоков.
×
×
  • 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.