October 3, 20233 yr 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.
October 3, 20233 yr 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
October 3, 20233 yr Author 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.
Create an account or sign in to comment