Jump to content

How do I show variable text depending on what product client buys?


paperweight

Recommended Posts

Hello,

I want to display different text and links on my Client Area depending on the types of services a client has purchased.

 

How is the best way to create an if/if/else statement in the manner such as:

 

If productA, show textA

If productB, show textB

If productC, show textC

If otherproducts or anything else, show textD

 

Tks for your help~

Link to comment
Share on other sites

+1 for this, more specifically, I am trying to edit the "configureproduct.tpl" template in my Cart theme directory to show certain text if the PID is equal to a certain value...

 

** UPDATE ** - Sort of figured this out. After looking into my WHMCS database via phpMyAdmin, I was able to set the conditional via:

 

{if $productinfo.name eq "YOUR PRODUCT NAME AS IN THE DATABASE"}<h1>TESTING</h1>{/if}

 

I was looking to do this via the product ID, however I couldn't quite figure that out. It would be great to have some sort of Wiki with all of the Smarty Template Variables that we can work with...

 

Hope this helps, but if anyone has a better solution, please provide it!

Edited by scar45
Sort of figured it out
Link to comment
Share on other sites

Here's another way to use conditionals to list the group name:

 

{if $gid}{$groupname}{/if}

 

I know this is probably rookie compared to what the WHMCS pros know, but I'm a noob at it, and trying to give some feedback whenever I can to help anyone else out :)

 

Again, a complete listing somewhere of how these variables relate to their database counterparts would be great! (Did some searching, but couldn't find anything...)

Link to comment
Share on other sites

I was looking to do this via the product ID, however I couldn't quite figure that out. It would be great to have some sort of Wiki with all of the Smarty Template Variables that we can work with...

 

Hope this helps, but if anyone has a better solution, please provide it!

 

Wow, excellent! :D

 

Yes, this product name a good place to start. I too would rather find a way to use the product ID, since my product names may change from time to time and we also are using multiple languages -- the better I can hardcode the ID into the template, the less I have to worry about changing multiple files in the future.

 

I will take your advice and start searching for a product ID method and post it here if I find a solution.

 

Many thanks for your hard work and I hope to repay with a solution soon.

Link to comment
Share on other sites

 

Again, a complete listing somewhere of how these variables relate to their database counterparts would be great! (Did some searching, but couldn't find anything...)

 

I found this on some threads:

 

{debug} 

 

Add the above to any page and it will output a pop-up window when you load the page. That pop-up will contain a very long list of possible variables. I'm still uncertain though if that list is ALL the possibilities, or just the ones for those pages it is loaded on....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated