Skip to content

Commit ab8449a

Browse files
committed
updated helper
1 parent 8ae4401 commit ab8449a

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

Block/Adminhtml/Chat/Edit/Tab/Customer.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ protected function _prepareForm()
9696
'base_fieldset',
9797
['legend' => __('Customer Information'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled]
9898
);
99+
$fieldset->addField(
100+
'session_id',
101+
'note',
102+
[
103+
'name' => 'session_id',
104+
'label' => __('Chat Key'),
105+
'title' => __('Chat Key'),
106+
'text' => $model->getSessionId()
107+
]
108+
);
99109
$fieldset->addField(
100110
'customer_name',
101111
'note',
@@ -117,6 +127,16 @@ protected function _prepareForm()
117127
['id' => $model->getCustomerId()]) . "' target='blank' title='" . __('View Customer') . "'>" . $model->getCustomerEmail() . '</a>' : __('Guest')
118128
]
119129
);
130+
$fieldset->addField(
131+
'ip',
132+
'note',
133+
[
134+
'name' => 'ip',
135+
'label' => __('IP Address'),
136+
'title' => __('IP Address'),
137+
'text' => $model->getIp()
138+
]
139+
);
120140

121141
$order_id = $this->order->getCollection()->addFieldToFilter('customer_id',
122142
$model->getCustomerId())->getLastItem()->getId();

Helper/Data.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,16 @@ public function getCoreRegistry()
202202
public function getChatId(\Lof\ChatSystem\Model\ChatFactory $chatFactory) {
203203
if (!$this->_current_chat_id) {
204204
if($this->isLoggedIn()) {
205-
$chat = $chatFactory->create()->getCollection()->addFieldToFilter('customer_email',$this->getCustomer()->getData('email'));
205+
$chat = $chatFactory->create()->getCollection()->addFieldToFilter('customer_email',$this->getCustomerEmail());
206206
if($chat->getSize() > 0) {
207207
$chat_id = $chat->getFirstItem()->getData('chat_id');
208208
}else {
209209
$chatModel = $chatFactory->create();
210210

211211
$chatModel
212212
->setCustomerId($this->getCustomerSession()->getCustomerId())
213-
->setCustomerName($this->getCustomer()->getData('firstname').' '.$this->getCustomer()->getData('lastname'))
214-
->setCustomerEmail($this->getCustomer()->getData('email'));
213+
->setCustomerName($this->getCustomerName())
214+
->setCustomerEmail($this->getCustomerEmail());
215215
$chatModel->save();
216216
$chat_id = (int)$chatModel->getData('chat_id');
217217
}

view/adminhtml/ui_component/lofchatsystem_chat_listing.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
</item>
242242
</argument>
243243
</column>
244-
<column name="ip">
244+
<column name="ip">
245245
<argument name="data" xsi:type="array">
246246
<item name="config" xsi:type="array">
247247
<item name="filter" xsi:type="string">text</item>
@@ -250,6 +250,15 @@
250250
</item>
251251
</argument>
252252
</column>
253+
<column name="session_id">
254+
<argument name="data" xsi:type="array">
255+
<item name="config" xsi:type="array">
256+
<item name="filter" xsi:type="string">text</item>
257+
<item name="sorting" xsi:type="string">asc</item>
258+
<item name="label" xsi:type="string" translate="true">Chat Key</item>
259+
</item>
260+
</argument>
261+
</column>
253262
<column name="user_id">
254263
<argument name="data" xsi:type="array">
255264
<item name="config" xsi:type="array">

0 commit comments

Comments
 (0)