Question: Add Products To Add Ico

Add Products To Add Ico

Hello Mian. Friend, I'm trying to place some buttons on the add products tab to add the Brand, Category, SubCategory and Unit from there in order not to have to leave the tab, the link work

HR

Hector Rojas

Asked
Hello Mian.

Friend, I'm trying to place some buttons on the add products tab to add the Brand, Category, SubCategory and Unit from there in order not to have to leave the tab, the link works perfect for me, open the modal and they are added without problem but when I return to the product file, delete everything, I'm changing
"admin_redirect ('system_settings / brands');" by redirect ($ _ SERVER ['HTTP_REFERER']); so that it stays on the page from where it opens but reloads the entire page and deletes everything that has been added to the product, as I can do.


PD: Excuse me for my English.


Thank you very much for your time and help.


Kind regards.
  • MS

    Mian Saleem

    Answered
    Hello,

    Yes, redirect will result in loss of form data. If you are using modal, you should save the data with ajax call and then close the modal. It will not redirect or refresh so the data will not be changed in the page.

    Thank you
  • MS

    Mian Saleem

    Answered
    Hello,

    I don't understand what are you doing. Can you take screenshots?

    Thank you
  • MS

    Mian Saleem

    Answered
    Hello,

    To open modal, you can add `data-toggle="modal" data-target="#myModal"` to anchor as follow

    ```
    <a href="<?= admin_url('system_settings/add_brand'); ?>" data-toggle="modal" data-target="#myModal">
    <i class="fa fa-plus"></i> <?= lang('add_brand') ?>
    </a>
    ```

    You can change the `href` to any pas that has modal code.

    Thank you
  • Login to Reply