Jump to content
thirty bees forum
  • 0

MailAlerts Module Mod for BackOffice


Obi

Question

Not sure where to post this, but if anyone needs to see the product reference (aka Stock Code) of products for product notifications (MailAlerts) in the back office, this is what I did to add the column to the display:

Find in /modules/mailalerts/mailalerts.php beginning around line 479 within the renderList() function:

        } else {
            $listFields = [
                'id_product' => [
                    'title' => $this->l('Product ID'),
                    'type' => 'text',
                ],

and right after that insert the following code:

                'reference' => [
                    'title' => $this->l('Stock Code'),
                    'type' => 'text',
                    'callback_object' => $this,
                    'callback' => 'renderProduct'
                ],

Then within the function getProductsSubscribers() - around line 588 find the following code:

            ->leftJoin('product_lang', 'pl', 'pl.id_lang = '.$langId.' AND pl.id_product = oos.id_product AND pl.id_shop = oos.id_shop')

and right after that insert the following code:

            ->leftJoin('product', 'p', 'p.id_product = oos.id_product')

Save, Upload, Clear Cache, Voila!

I would think this could be created in an override, because updated the module will likely overwrite this file, but I'm still kinda green at extending module classes.

Hope someone finds this useful.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
7 hours ago, datakick said:

Nice one, this should be part of the module.

You can create pull request here, and we'll merge it: https://github.com/thirtybees/mailalerts

 

Pull Request and commit (I think) have been made...

On a related note:
The above code is missing something.

In the function getProductsSubscribers() - around line 583 find the following code:

            ->select('oos.id_product')

and just below it - insert this line:

            ->select('p.reference')

That should take care of my omission above.

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
×
×
  • Create New...