1. Thêm Email mặc định
<script>$zopim(function() {$zopim.livechat.setEmail(‘www.luu.vn@gmail.com’);}); </script>
2. Nút bật khung chat
<button onclick=”f1()” type=”button” name=”” class=”dathang”>Mua ngay → </button>
js
function f1(){ $zopim(function() { $zopim.livechat.window.show(); });}
css
.dathang { width: 100%; color: #FFF !important; background: none repeat scroll 0% 0% #7dbc00; border: medium none; text-shadow: none; font-size: 14px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;line-height:2; padding: 3px 0; display: block; text-align: center;}
3. Form liên hệ:
<div id=”contact-form-761″>
<form method=”post” name=”contactform” class=”wpcf7-form”>
<div class=”column one”><span class=”wpcf7-form-control-wrap your-name”><input type=”text” name=”name” id=”name” value=”” class=”wpcf7-form-control wpcf7-text wpcf7-validates-as-required” required=”” aria-required=”true” placeholder=”Tên của bạn”></span></div><div class=”column one-second”><span class=”wpcf7-form-control-wrap your-email”> <input type=”text” name=”phone” id=”phone” value=”” class=”wpcf7-form-control wpcf7-text wpcf7-validates-as-required” required=”” size=”40″ aria-required=”true” placeholder=”Điện thoại”></span> </div><div class=”column one-second”><span class=”wpcf7-form-control-wrap your-email”><input type=”email” name=”email” id=”email” value=”” class=”wpcf7-form-control wpcf7-text wpcf7-validates-as-required” required=”” aria-required=”true” placeholder=”Email”></span></div><span class=”wpcf7-form-control-wrap your-message”><textarea name=”comment” id=”contact-form-comment-g761-comment” cols=”40″ rows=”5″ class=”wpcf7-form-control wpcf7-textarea textarea” required=”” aria-required=”true” placeholder=”Tin nhắn”></textarea></span>
</form>
<button onclick=”myFunction()” class=”wpcf7-form-control wpcf7-submit button_full_width”>Gửi</button>
</div>
JS:
<script>
function myFunction() {
$zopim(function() {
$zopim.livechat.set({
name: document.contactform.name.value,
email: document.contactform.email.value,
phone: document.contactform.phone.value
});
$zopim.livechat.say(document.contactform.comment.value);
});
alert(‘Gửi thành công!’);
$zopim.livechat.window.hide();
$zopim.livechat.endChat();
$zopim.livechat.clearAll();
}
</script>
4. Form đăng ký:
<div class=”register-form”>
<h3>Đăng ký tham gia khóa học ngay</h3>
<form id=”contact-form” name=”contactform”>
<div class=”row-fluid”>
<div class=”span12″><input name=”ten” required=”” type=”text” placeholder=”Tên của bạn” /></div>
</div>
<div class=”row-fluid”>
<div class=”span12″><input name=”email” required=”” type=”email” placeholder=”Địa chỉ email (*)” /></div>
</div>
<div class=”row-fluid”>
<div class=”span12″><input name=”sdt” required=”” type=”text” placeholder=”Số điện thoại (*)” /></div></div>
</form><button class=”btncont”>Đăng ký ngay</button>
</div>
JS:
<script>
function myFunction() {
$zopim(function() {
$zopim.livechat.clearAll();
$zopim.livechat.setStatus(“offline”);
$zopim.livechat.set({
name: document.contactform.ten.value,
email: document.contactform.email.value,
phone: document.contactform.sdt.value
});
$zopim.livechat.say(‘Đăng ký khóa học “triệu phú nội dung”’);
$zopim.livechat.window.hide();
});
alert(‘Gửi thành công!’); }
</script>
Zopim Live Chat API : Link