Jump to content

Delete item in admin controller not working


Recommended Posts

Hello,

I created my own module, working with a specific table that I created. 

I have an admin controller working almost fine. 

I can add new items, edit them but I'm not able to delete them.

When I click on the delete item button, nothing happens.

Here's my construct function:

public function __construct()
{

    // Set variables
    $this->table = 'ki_auteur';
    $this->className = 'KiModAuteurs';

    // Call of the parent constructor method
    parent::__construct();

    $this->fields_list = array(
        'id_auteur' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
        'auteur_lastname' => array('title' => $this->l('Lastname'), 'width' => 140),
        'auteur_firstname' => array('title' => $this->l('Firstname'), 'width' => 140),
        'date_add' => array('title' => $this->l('Date added'), 'type' => 'date'),
    );

    $this->_defaultOrderBy = 'auteur_lastname';
    $this->_defaultOrderWay = 'ASC';

    // Set fields form for form view
    $this->context = Context::getContext();
    $this->context->controller = $this;

    $this->addRowAction('view');
    $this->addRowAction('edit');
    $this->addRowAction('delete');
    $this->bulk_actions = array(
        'delete' => array(
            'text' => $this->l('Delete selected'),
            'confirm' => $this->l('Would you like to delete the selected items?'),
        )
    );

    // Enable bootstrap
    $this->bootstrap = true;
}

Is there something else I need to do ?

Is there another function that I must create to take care of the deletion ?

Thanks for your help.

Share this post


Link to post
Share on other sites

Hello Pierre,

I set up _PS_MOD_DEV_ to true but when I click on the delete button, it asks me for confimation, then I click on "yes" (to confirm that I want to delete the item) and then it reloads the page but nothing was deleted and no error message...

Any idea of where to look and how to debug this, as I have no error message ?

I really appreciate your help, thank you Pierre.

Share this post


Link to post
Share on other sites

Hi, I was referring to a PHP debugger. I have a local development environment with a Ubuntu server. On the client, I use Netbeans IDE. I've installed XDebug on the server. When I start the debugger, I can follow the PHP execution step-by-step in the source code and see what happens. This is by far the best way to find your way within PHP in general and Prestashop.

Are you familiar with this kind of debugger ? This is a must have!

 

Share this post


Link to post
Share on other sites

Hello Pierre,

I personnaly use phpstorm as IDE.

I have xampp as local server but I don't use Xdebug, I think i heard it doesn't work with xampp. 

I think I should install another local server instead of xampp, to be able to debug.

Thanks

Share this post


Link to post
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

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More