Tùy biến Yahoo! Messenger extension opencart

Yahoo! Messenger extension là phần mở rộng hiển thị box hỗ trợ trực tuyến hỗ trợ nhiều Yahoo!ID. Download và cài đặt extension này tại đây:

http://www.opencart.com/index.php?route=extension/extension/info&extension_id=70#.USpMlTfQIa9

Demo:

Extension yahoo messenger demo
Extension yahoo messenger demo

Mình sẽ hướng dẫn các bạn tùy chỉnh extension này để có thêm tiêu đề và số điện thoại giống như thế này:

Yahoo support custom opencart
Yahoo support custom opencart

Sau khi cài đặt extension các bạn sửa các file sau:
+ /catalog/controller/module/yahoo_messenger.php

[php]
<?php
class ControllerModuleYahooMessenger extends Controller {
protected function index($setting) {
//print_r($setting);
$this->language->load(‘module/yahoo_messenger’);
$this->data[‘heading_title’] = $this->language->get(‘heading_title’);
$tmp_array = explode("|", $this->config->get(‘yahoo_messenger_code’));
$ymarray = explode(",", $tmp_array[0]);
$ymtext_array = explode(",", $tmp_array[1]);
$ymtel_array = explode(",", $tmp_array[2]);
$this->data[‘ymcode’] = ‘<ul class="block-support">’;
for($i=0; $i<=count($ymarray) – 1; $i++){
$this->data[‘ymcode’] .= ‘<li>’;
$this->data[‘ymcode’] .= ‘<span class="ymtext">’. $ymtext_array[$i].'</span><br />’;
$this->data[‘ymcode’] .= ‘<div class="ymid"><img alt="Yahoo Online Status" src="’.$this->status_check(trim($ymarray[$i])).’" border="0"><a href="ymsgr:sendim?’.trim($ymarray[$i]).’">’.trim($ymarray[$i]).'</a></div>’;
$this->data[‘ymcode’] .= ‘<div class="ymtel">’. $ymtel_array[$i].'</div>’;
if($setting[‘listview’]=="0")
$this->data[‘ymcode’] .= "<br />";
else
$this->data[‘ymcode’] .= "&nbsp;&nbsp;";
$this->data[‘ymcode’] .= ‘</li>’;
}
//$this->id = ‘yahoo_messenger’;
$this->data[‘ymcode’] .= "</ul>";
if (file_exists(DIR_TEMPLATE . $this->config->get(‘config_template’) . ‘/template/module/yahoo_messenger.tpl’)) {
$this->template = $this->config->get(‘config_template’) . ‘/template/module/yahoo_messenger.tpl’;
} else {
$this->template = ‘default/template/module/yahoo_messenger.tpl’;
}

$this->render();
}
function status_check($yid)
{
$url=’http://opi.yahoo.com/online?u=’.$yid.’&m=t’;

$not_online = strpos(implode(”,file($url)),"NOT ONLINE");

if ($not_online) {
//NOT ONLINE;
$status=’catalog/view/theme/default/image/offline.gif’;
}
else {
//ON LINE
$status=’catalog/view/theme/default/image/online.gif’;
}
return $status;
}
}
?>
[/php]

+ Thêm các class sau vào css theme bạn đang sử dụng:
[css]
.ymid, .ymtext, .ymtel {
font-weight: bold;
width: 100%;
}
.ymtext {
text-transform: uppercase;
}
.ymtel {
background: url("../image/note-phone.png") no-repeat scroll 0 0 transparent;
color: #FF0000;
margin-top: 5px;
padding-left: 25px;
}
.ymid a {
margin-left: 5px;
}
[/css]
Thế là xong rồi. Demo các bạn xem tại website http://milanplaza.com.vn/