Subscription system works perfect in this web site : www.doctorbet.gr
There are over 400 users since August 2007 and over 100 subscriptions since September 2007.
How it works :
It is based on downloads module.
There are some option names with option values.
In the attribute controller for example we have an option name Subscription for 1 month.
We add a "virtual" file for download, so we can count the 31 days for this subscription.
Some core files have changed.
So, this way we check if a subscription is not expired and we "load" a spesific page.
All this was conected with Auto Menou Pages module which was based on another module. Now we have made some specific pages to load.
This way we control the content for subscribers.
Also there are some more restrictions in the product_info_display page for those who try to see "restricted" content.
Some of the code written:
tpl_product_info_display :
########################################___
Code:
<?php
$pid = $_GET[products_id];
$cid = $_SESSION['customer_id'];
$get_referal = $db->Execute("SELECT customers_referral FROM ".TABLE_CUSTOMERS." WHERE customers_id = '".$cid."'");
$referal = $get_referal->fields['customers_referral'];
if(!$_SESSION['customer_id'] and $pid == '9'
or !$_SESSION['customer_id'] and $pid == '10'
or !$_SESSION['customer_id'] and $pid == '11'
or !$_SESSION['customer_id'] and $pid == '12'
or !$_SESSION['customer_id'] and $pid == '13'
or !$_SESSION['customer_id'] and $pid == '14') { ?>
<SCRIPT language="JavaScript">
window.location.replace("http://www.doctorbet.gr/gr/index.php?main_page=page&id=9&chapter=0");
</SCRIPT>
<?php }
if($cid != "" and $referal <> '1' and $pid == '9'
or $cid != "" and $referal <> '1' and $pid == '10'
or $cid != "" and $referal <> '1' and $pid == '11'
or $cid != "" and $referal <> '1' and $pid == '12'
or $cid != "" and $referal <> '1' and $pid == '13'
or $cid != "" and $referal <> '1' and $pid == '14') { ?>
<SCRIPT language="JavaScript">
window.location.replace("http://www.doctorbet.gr/gr/index.php?main_page=product_info&products_id=7");
</SCRIPT>
<?php } ?>
################################################################################___
tpl_modules_downloads :
##################################################___
Code:
<?php require(DIR_WS_MODULES . zen_get_module_directory('downloads_ms001.php')); ?>
<?php if ($downloads->RecordCount() > 0) { ?>
<frameset>
<?php
while (!$downloads->EOF) {
list($dt_year, $dt_month, $dt_day) = explode('-', $downloads->fields['date_purchased_day']);
$download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads->fields['download_maxdays'], $dt_year);
$download_expiry = date('Y-m-d H:i:s', $download_timestamp);
?>
<!-- left box -->
<?php
// if ( ($downloads->fields['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename'])) && ( ($downloads->fields['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
if ( (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']) && (($downloads->fields['download_count'] > 0 && $download_timestamp > time()) || $downloads->fields['download_maxdays'] == 0)) ) {
$zv_filesize = filesize (DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']);
if ($zv_filesize >= 1024) {
$zv_filesize = number_format($zv_filesize/1024/1000,2);
$zv_filesize_units = TEXT_FILESIZE_MEGS;
} else {
$zv_filesize = number_format($zv_filesize);
$zv_filesize_units = TEXT_FILESIZE_BYTES;
}
?>
<br><font color="#FF0000"><b><?php echo "και λήγει : "?><?php echo ($downloads->fields['download_maxdays'] == 0 ? TEXT_DOWNLOADS_UNLIMITED : zen_date_long($download_expiry)); ?></font></b>
<br><?php require(DIR_WS_SYNDROMITES . 'diades.php'); ?>
<?php } else { ?>
<?php echo IMERES_SYNDROMIS; ?>
<?php echo $downloads->fields['download_maxdays']; ?>
<?php echo IMERES; ?>
<?php echo "και έληξε την "?><?php echo ($downloads->fields['download_maxdays'] == 0 ? TEXT_DOWNLOADS_UNLIMITED : zen_date_long($download_expiry)); ?>
<br>
<br>
<?php echo SUBSCRIPTION_EXPIRED;?>
<?php
}
?>
<?php
$downloads->MoveNext();
}
?>
</frameset>
<?php
// old way
// if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
// new way
if (!($_GET['main_page']==FILENAME_MS001)) {
?>
<p><?php printf(FOOTER_DOWNLOAD, '<a href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p>
<?php } else { ?>
<?php
// other pages if needed
}
?>
<?php
} // $downloads->RecordCount() > 0
?>
<?php
// download is not available yet
if ($downloads_check_query->RecordCount() > 0 and $downloads->RecordCount() < 1) {
?>
<fieldset><?php echo DOWNLOADS_CONTROLLER_ON_HOLD_MSG ?></fieldset>
<?php
}
?>
##############################################################################################################___
A custom page with custom menu :
(We load this page ( require ) from inside of one of our tpl_modules_download pages )
Code:
<body bgcolor="#F5FBEE">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#E3F1CD" width="100%" id="AutoNumber1" height="839" align="left">
<tr>
<td width="20%" align="center" height="24" bgcolor="#598725"><b>
<font face="Tahoma" size="1" color="#FFFFFF"><span lang="el">
<?php echo '<a href="' . zen_href_link(FILENAME_MS001, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">Μηνύματα</a>'; ?>
</span></font></b></td>
<td width="20%" align="center" height="24" bgcolor="#598725"><b>
<font face="Tahoma" size="1" color="#F5FBEE"><span lang="el">
<?php echo '<a href="' . zen_href_link(FILENAME_PRIMERAS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">Προγνωστικά Ημέρας</a>'; ?>
</span></font></b></td>
<td width="20%" align="center" height="24" bgcolor="#598725"><b>
<font face="Tahoma" size="1" color="#F5FBEE"><span lang="el">
<?php echo '<a href="' . zen_href_link(FILENAME_KOUPONI, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">Το Κουπόνι σε 1΄</a>'; ?>
</span></font></b></td>
<td width="20%" align="center" height="24" bgcolor="#598725"><b>
<font face="Tahoma" size="1" color="#F5FBEE"><span lang="el">
<?php echo '<a href="' . zen_href_link(FILENAME_EPIMERAS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">Επιλογή Ημέρας</a>'; ?>
</span></font></b></td>
##############################################################################################################__
This is the old way to construct the menu :
Code:
<?php
require(DIR_WS_SYNDROMITES . 'am_pages_query_simerina.php');
?>
<?php
define("TELIKO_MENOU_SYNDROMITWN", '' . $start_text . '
<!--%' . $bt_1 . '%-->' . $pg_1 . '<!--%' . $bt_2 . '%-->' . $pg_2 . '
<!--%' . $bt_3 . '%-->' . $pg_3 . '<!--%' . $bt_4 . '%-->' . $pg_4 . '
<!--%' . $bt_5 . '%-->' . $pg_5 . '<!--%' . $bt_6 . '%-->' . $pg_6 . '
<!--%' . $bt_7 . '%-->' . $pg_7 . '<!--%' . $bt_8 . '%-->' . $pg_8 . '
<!--%' . $bt_9 . '%-->' . $pg_9 . '<!--%' . $bt_10 . '%-->' . $pg_10 . '
<!--%' . $bt_11 . '%-->' . $pg_11 . '<!--%' . $bt_12 . '%-->' . $pg_12 . '
<!--%' . $bt_13 . '%-->' . $pg_13 . '
');
$products_description = TELIKO_MENOU_SYNDROMITWN;
?>
<?php
require(DIR_WS_MODULES . 'metavlites_yposystimatos_epanelegxou.php');
?>
####################################################################################################___
The above page is using this :
##################################################__
Code:
<?php
// QUERY "START TEXT" - Use variable $start_text for the main button content
$start_text_query = "
SELECT am_page_html_text
FROM ".TABLE_AM_PAGES."
WHERE am_page_menu_group = 200
";
$start_text_result = $db->Execute($start_text_query);
$start_text = $start_text_result->fields['am_page_html_text'];
// QUERY 1 - Use variables : $bt_1 as Button 1 title and $pg_1 as Page 1 content
$button_1_query = "
SELECT am_page_button_title, am_page_html_text
FROM ".TABLE_AM_PAGES."
WHERE am_page_id = 1 AND am_page_status_id = 1
";
$button_1_result = $db->Execute($button_1_query);
$bt_1 = $button_1_result->fields['am_page_button_title'];
$pg_1 = $button_1_result->fields['am_page_html_text'];
// QUERY 2 - Use variables : $bt_2 as Button 2 title and $pg_2 as Page 2 content
$button_2_query = "
SELECT am_page_button_title, am_page_html_text
FROM ".TABLE_AM_PAGES."
WHERE am_page_id = 2 AND am_page_status_id = 1
";
$button_2_result = $db->Execute($button_2_query);
$bt_2 = $button_2_result->fields['am_page_button_title'];
$pg_2 = $button_2_result->fields['am_page_html_text'];
...................
.......................
##############################################################################################################____
This is a custom login sidebox :
Code:
<?php
//require(DIR_WS_CLASSES . 'currencies.php');
//$currencies = new currencies();
$vres_to_synolo_agorwn = "select c.customers_id, sum(op.products_quantity * op.final_price)+sum(op.onetime_charges)
as poso from " . TABLE_CUSTOMERS . " c,
" . TABLE_ORDERS_PRODUCTS . " op,
" . TABLE_ORDERS . " o
where o.customers_id = '" . $customer_id . "'
and o.orders_id = op.orders_id
group by c.customers_id ";
$synolo_agorwn = $db->Execute($vres_to_synolo_agorwn);
$poso_syndromiti = $currencies->format($synolo_agorwn->fields['poso']);
define("TELPOSO", '' . $poso_syndromiti . '');
$content = "<!--testloginbox-->";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
if(!$_SESSION['customer_id']) {
$content .=zen_draw_form('login_box', zen_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));
$content .=LOGIN_BOX_EMAIL_ADDRESS . '<br />' . zen_draw_input_field('email_address', '', 'size="24"').'<br />';
$content .=LOGIN_BOX_PASSWORD . '<br />' . zen_draw_password_field('password', '', 'size="24"') . '<br />';
$content .=''.zen_image_submit(BUTTON_IMAGE_LOGIN, BUTTON_LOGIN_ALT).'<br />';
$content .='<a href="' . zen_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . LOGIN_BOX_PASSWORD_FORGOTTEN . '</a>' . '<br />';
$content .='<a href="' . zen_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '"><b>Εγγραφή νέου χρήστη</b></a><br />';
$content .='<a href="http://www.doctorbet.gr/gr/index.php"><b>ΑΡΧΙΚΗ ΣΕΛΙΔΑ</b></a><br />';
$content .='</form>';
} else {
$content .= '<ul>';
$content .= '<b>' . ESYN . ' ' . OSYN . '</b><br />';
$content .= '<b>ID Συνδρομητή : ' . CUSTIDS . '</b><br /><br />';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=page&id=6&chapter=0">Οδηγίες Χρήσης</a></li>';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=account_history">ΜΕΝΟΥ ΣΥΝΔΡΟΜΗΤΩΝ</a></li>';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=menu001">ΝΕΟ ΜΕΝΟΥ</a></li>';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=shopping_cart">Επιλεγμένες Συνδρομές</a></li>';
$content .= '<b>Αγορές : ' . TELPOSO . '</b>';
$content .= '</ul>';
}
$content .= '</div>';
?>
####################################################################################################_
This is the tpl_account_history_default : modified too !!!
Code:
<div class="centerColumn" id="accountHistoryDefault">
<h1 id="accountHistoryDefaultHeading"><?php echo HEADING_TITLE; ?></h1>
<?php
if ($accountHasHistory === true) {
foreach ($accountHistory as $history) {
?>
<fieldset>
<legend><?php echo TEXT_ORDER_NUMBER . $history['orders_id']; ?></legend>
<br class="clearBoth" />
<div class="content">
<?php echo "Πατήστε "?>
<?php echo '<a href="' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $history['orders_id'], 'SSL') . '"><strong>Ε Δ Ω</strong></a>'; ?>
<?php echo "για να δείτε το Μενού Συνδρομητών"?>
</div><br>
<div class="content back"><?php echo '<strong>Ημερομηνία Έναρξης Συνδρομής:</strong> ' . zen_date_long($history['date_purchased']); ?></div><br><br>
<div class="content"><?php echo '<strong>Κόστος Συνδρομής:</strong> ' . strip_tags($history['order_total']); ?></div>
<br class="clearBoth" />
</fieldset>
<?php
}
?>
<<div class="centerColumn" id="noAcctHistoryDefault">
<?php echo TEXT_NO_PURCHASES; ?>
</div>
<?php
}
?>
</div>
####################################################################################################__
This is the template for a new custom page :
Code:
<b><?php
define('MS001HEADING_ORDER_DATE', 'Η Αγορά της Συνδρομής σας έγινε :');
echo MS001HEADING_ORDER_DATE . ' ' . zen_date_long($order->info['date_purchased']); ?></b>
<?php
if (DOWNLOAD_ENABLED == 'true') require($template->get_template_dir('tpl_modules_downloads_kouponi.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_downloads_kouponi.php');
?>
############################################################____
You can see above that we are loading a different tpl_modules page
We use one tpl_module_download for every page, to control the content
We first load this tpl_modules_download and then we check if content is available for the subscriber, so we include the content through this tpl_module_download.
Works perfect for my client !!!!!!!
There are many many changes and modifications, and also many settings in admin area that I do not remember right now.
This is because I have not been able in this forum to make a team and work together.
Unfortunatelly 
If anyone want a subscription system, he can hire me
[email protected]
www.lebrand.gr