My code works properly, it is display all messages and entry dates. I want to display message and entry date when I select customer name from drop down list.
Here is my controller CustomerlifecycleController
public function actionCustomerlifecycleanalytic() {
$customername = Customer::model()->findall("store_id='" . Yii::app()->session['store_id'] . "'");
$customerlifecycle = CustomerLifecycle::model()->findAll();
$this->renderPartial('customerlifecycleanalytic', array( 'customername' => $customername, 'customerlifecycle' => $customerlifecycle), false, true);
}
Here is my view file customerlifecycleanalytic.php
Dropdown list
Customer name fetch from customer model
and there is column name id
for customer
<select class="form-control selectpicker customerfilter">
<option value=''>Select Customer</option>
<?php
if (isset($customername)) {
foreach ($customername as $customernames) {
echo '<option value="' . $customernames['id'] . '" >' . $customernames['firstname'].' '. $customernames['lastname']. '</option>';
}
}
?>
</select>
Message and entry date fetch from Customerlifecycle
model there is column name is customer_id
$msg = '<li {classstr}>
<div class="tl-circ">
</div>
<div class="timeline-panel">
<div class="tl-body">
<p>
{msg} on {date}</p>
</div>
</div>
</li>';
$cnt = 0;
$htmlstring = '';
foreach ($customerlifecycle as $key => $row) {
$htmlstring .= $msg;
$classString ='';
if ($cnt % 2 == 0) {
$classString = " class='timeline-inverted' ";
}
$htmlstring = str_replace("{classstr}", "$classString", $htmlstring);
$htmlstring = str_replace("{msg}", "$row->message", $htmlstring);
$htmlstring = str_replace("{date}", "$row->entrydate", $htmlstring);
$cnt++;
}
echo $htmlstring;
?>
My code is already running completely but I want when I select customer name form drop down list at that time it will display only that customer's message and entry date.