View Single Post
  #11  
Old 07-01-2009, 11:16 AM
 
Momtreprenuer Momtreprenuer is offline
 

Member
  
Join Date: Jan 2008
Posts: 19
 

Smile Re: Subscription Status If/Then

Awww gb, thanks!! See I knew there was some help out there. Actually I was just about to post some good news. As is customary to my stubborn, relentless goal orientation, I finally figured out what to do! Here's what works:

I added:
Code:
$smarty->assign("user_subscription",$user_account["subscription"]);
to the end of check_useraccount.php

Then on product.tpl (where I have previously place a hidden instant download link), I wrapped the link like this:

Code:
{if $user_subscription ne ""} <table width=100%><tr><td align=center><br><a href=my_download.php?f={$product.productcode}.zip>Download me!</a><td></tr></table> {else} subscribe to download me free! {/if}

But then I wasn't satisfied so I kept going. I wanted to be able to check if the member was logged in and had a subscription and the subscription was current. So the final code looks like this:

Code:
{if $login ne "" and $user_subscription ne "" and $sub_status ne "Active"} <table width=100%><tr><td align=center><br><a href=my_download.php?f={$product.productcode}.zip>Download me!</a><td></tr></table> {elseif $login ne "" and $user_subscription ne "Unsubscribed"} <table width=100%><tr><td align=center><br>Renew to download me free!<td></tr></table> {elseif $login ne ""} <table width=100%><tr><td align=center><br>Subscribe to download me free!<td></tr></table> {else} {/if}

Yay me!! Take that boys!

I wish that I could've figured out how to distinguish between what subs a user has, but I've already spent too much energy on this so I just dropped one of my subs.

Quote:
Since a subscription is probably not like a membership - it is associated with a product and an order - which is then associated with a customer - you are going to have to understand how all this is organized in the db in order to write a query to get the information.

Yes, this is my next task at hand. I'm trying to figure out how to associate my current subscribers (from another software) with x-cart. I managed to import all of the subscriptions into the database via Mysql but even though the correct number of subs shows, they don't appear within the sub module page. The correct number of subs is there but none of the info. So I suspect that I'm going to have to do something with importing old orders into the database, to get the subs to show. Only thing I keep running into is Mysql doesn't like the repeat sub number (identifier), so I have to figure out something there.

But I wanted to post the remedy that I found so that someone else wouldn't have to spend weeks trying to figure it out like me. Hope it helps!

Momtrepreneur
__________________
Version 4.1.12
Reply With Quote