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

Объясните логику кода


jack930
 Share

Recommended Posts

Объясните пожалуйси, для чайника
OC3, admin/controller/catalog/product.php

Для редактирования товара вызывается функция edit.
Если метод вызова POST, зналит это вызов "изнутри" формы редактирования, для сохранения изменений. Изменения сохраняются, форма закрывается.
Зачем в этом случае еещё раз вызывается метод $this->getForm() ?
Или из-за $this->response->redirect() он не выполняется?

    public function edit() {
         ...
        if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) 
        {
            $this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);
            ...
            $this->response->redirect($this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . $url, true));
        }
        $this->getForm();
    }

 

Edited by jack930
Link to comment
Share on other sites


10 минут назад, jack930 сказал:

Или из-за $this->response->redirect() он не выполняется?

не выполняется.

посмотрите

 

public function redirect($url, $status = 302) {
   header('Location: ' . str_replace(array('&', "\n", "\r"), array('&', '', ''), $url), true, $status);
   exit();
}

вот exit

 

  • +1 2
Link to comment
Share on other sites

3 минуты назад, warezinspector сказал:

Чет поплохело сразу )))

Это зря. Редирект без обратного билеи намного лучше циклического :D

  • +1 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.