A one-time Message

boboo

Avatar: boboo

2013-01-08 20:06

Some customers don't read the informations on your pages, they go directly to the products. And maybe you want to tell them, the shop has or will have holidays or similar.
This is a simple solution for one-time message (cookie based): if the admin has created a new message, every visitor will get this message only once. If the message will be changed, so the visitor will get the message as well, but only once.
First we create the admin-side:
in /database/config/lang_xx.php add:

$config['qcMessage'] = "";


then in /templates/admin/settings.php under:

<!-- orders_email end -->


add:

<!-- message start -->
<tr class="l0" id="message">
 <th>
  <?php echo $lang['Message']; ?>
 </th>
 <td>
  <input type="text" name="qcMessage" value="<?php echo $config['qcMessage']; ?>" size="140" class="input" />
 </td>
</tr>
<!-- message end -->


then in /database/translations/xx.php
add:

$lang['Message'] = "Message";


then in /templates/default/_footer.php over:

</body>


add:

<?php
if(isset($qcMessage))
 echo 
$qcMessage;
?>


and at the end in index.php under:

$oOrder = new Orders( );


add:

if(isset($config['qcMessage'])&&!empty($config['qcMessage'])){
 if(!isset(
$_COOKIE['qcMessage'])||(isset($_COOKIE['qcMessage'])&&$_COOKIE['qcMessage']!=$config'qcMessage'])){
  
setcookie('qcMessage',$config['qcMessage'],strtotime('+30 days'));
  
$config['qcMessage']=str_replace('<br />','\n',str_replace('<br/>','\n',$config['qcMessage']));
  
$qcMessage='<script type="text/javascript">alert("'.$config['qcMessage'].'")</script>';
 }
}



Ready.
Now you will see a new row in admin panel config under the e-mail field.
Here you can input the message. The line breaks must be done with <br/> or <br />
Now on the shop page you will get this message as a js alert. But only once on a PC.

» Quick.Cart v6.x

www.kimla.de

Back to top
about us | contact