Hello from GREECE everybody !
I am trying to find out how it is possible for a logged in user to see content in his account page IF order satus is "DELIVERED" ( or any other name ).
This is for handling subscriptions; I set up a Zen Cart store 1.3.7 - fresh install - (www.doctorbet.gr/gr) - many modifications has to be done yet - and I set up 2 products :
1. document with an option name and some option values ( 4 the desired subscription ) and
2. one free product for subscription "ACTIVATION".
Customer can not see the products !
When a customer log in he can see this menu :
#################################################################################################### ####################___
<?php
$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 .='<a href="' . zen_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . LOGIN_BOX_PASSWORD_FORGOTTEN . '</a>' . '<br />' . '<a href="' . zen_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . LOGIN_BOX_CREATE_ACCOUNT . '</a>' . '<br />';
$content .='<div class="centeredContent">'.zen_image_submit(BUTTON_ IMAGE_LOGIN, BUTTON_LOGIN_ALT).'</div>';
$content .='</form>';
} else {
$content .= '<ul>';
$content .= '<li><a class="loginBoxLinks" href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . LOGIN_BOX_ACCOUNT . '</a></li>';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=shopping_cart">Επιλεγμένες Συνδρομές</a></li>';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=document_product_info&cPath=1& products_id=1">Αγορά Συνδρομής</a></li>';
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=account_password">Αλλαγή Password</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=account_edit">Τα Στοιχεία μου</a></li>';
$content .= '<li><a class="loginBoxLinks" href="' . zen_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . LOGIN_BOX_LOGOFF . '</a></li>';
$content .= '</ul>';
}
$content .= '</div>';
?>
#################################################################################################### ####################____
So, this way he can use this link :
$content .= '<li><a href="http://www.doctorbet.gr/gr/index.php?main_page=document_product_info&cPath=1& products_id=1">Αγορά Συνδρομής</a></li>';
to buy a subscription.
Well, the MODIFICATION I made is in tpl_account_default.php :
I just changed the number 0 to 1 in the following line of code :
if (zen_count_customer_orders() > 1) {
and below it i just put the "PROTECTED" content (can be any) :
<center>
<object id="banner_automove" width="577" height="120"
classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">
<param name="movie" value="testmembers.swf" />
<param name="quality" value="high" />
<param name="scale" value="noscale"/>
<param name="bgcolor" value="#FFFFFF" /><param name="wmode" value="transparent" /><embed name="banner_automove" src="testmembers.swf" quality="high" scale="noscale"
bgcolor="#FFFFFF" wmode="transparent" width="577" height="120"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>
</center>
This way, customer buys a subscription and has one order in his account, so "PROTECTED" content won't show in his account page; only if there are 2 or more orders, the content above (or any other content) will show.
Next step was to "force" the "subscriber !" to buy another product ( when payment is done ) so the "PROTECTED" content show in his account page.
So, when admin update his status order to "DELIVERED" ( or any other name ) he also sends the link for the free product ( http://www.doctorbet.gr/gr/g4v56ds7g...5g4xz3bv1.htm).
This way customer can see the "PROTECTED" content in his account page, but there are a lot of 'but' !
BUT :
1. What happens with next subscription ?
2. Why should customer do all this to be a subscriber ?
3. WHY NOT TO SHOW "PROTECTED" CONTENT , by checking order status ?
Well, my question is VERY SIMPLE :
I want to change ( modify ) this line ( in tpl_account_default.php ):
############################################################___
if (zen_count_customer_orders() > 1) {
############################################################___
so i can check a specific order status ( LAST ORDER ).
HOW THIS CAN BE DONE ?
Is there any other way, to handle protected pages by checking order status ?
Thanks
Bookmarks