Skip to content

Commit

Permalink
add the phone to the subscribers grid #1834 for magento 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Oct 5, 2023
1 parent 7f18269 commit c4bd65c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Model/ResourceModel/Newsletter/Collection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Ebizmarts\MailChimp\Model\ResourceModel\Newsletter;

class Collection extends \Magento\Newsletter\Model\ResourceModel\Subscriber\Collection
{
protected function _initSelect()
{
parent::_initSelect();
$this->showCustomerInfo(true)->addSubscriberTypeField()->showStoreInfo();
$this->_map['fields']['phone'] = 'main_table.phone';
return $this;
}
}
15 changes: 15 additions & 0 deletions etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!--
/**
* Ebizmarts_MailChimp Magento JS component
*
* @category Ebizmarts
* @package Ebizmarts_MailChimp
* @author Ebizmarts Team <[email protected]>
* @copyright Ebizmarts (http://ebizmarts.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Newsletter\Model\ResourceModel\Subscriber\Grid\Collection" type="Ebizmarts\MailChimp\Model\ResourceModel\Newsletter\Collection" />
</config>
15 changes: 15 additions & 0 deletions view/adminhtml/layout/newsletter_subscriber_block.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="adminhtml.newslettrer.subscriber.grid.columnSet">
<block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.newslettrer.subscriber.grid.columnSet.name" as="name">
<arguments>
<argument name="header" xsi:type="string" translate="true">Phone</argument>
<argument name="index" xsi:type="string">phone</argument>
<argument name="header_css_class" xsi:type="string">phone</argument>
<argument name="column_css_class" xsi:type="string">phone</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>

0 comments on commit c4bd65c

Please sign in to comment.