Jump to content

Display Credit Balance In Six Template


sentq

Recommended Posts

  • 3 weeks later...
  • 1 month later...
  • 4 weeks later...
On 1/15/2018 at 5:22 PM, Sri said:

Hi,

Is there a way to enable clients to view their fund transactions? Admin can view on the backend from Manage Credits section. Can client view it from their client area? Is there an addon for it?

Thanks

I'm not aware of one, but you can search WHMCS Marketplace and use "credit" as the keyword.

Link to comment
Share on other sites

  • 1 month later...
5 hours ago, brian! said:

isn't it the same issue you asked about (and solved) on the previous page?
https://community.whmcs.com/showthread.php?106891-Display-Credit-Balance-In-Six-Template&p=448314#post448314

It is! Totally forgot I had this issue before and it seems that the custom.css file was overwritten since it was empty. This seems to be a common problem in the future.

From time to time, I usually replace ALL files under WHMCS to make sure I am not using outdated files and to have a sense of  a clean system. Isn't  there a way to add this in some sort of a hook that will never change?

Many thanks and sorry to bring it back again. It is a great add-on.

Link to comment
Share on other sites

4 minutes ago, sitesme said:

It is! Totally forgot I had this issue before and it seems that the custom.css file was overwritten since it was empty. This seems to be a common problem in the future.

custom.css gets overwritten by the auto-updater whether it's empty or not... it's crazy... there is talk of this not occurring in the future, let's wait and see on that one... alternatively, just update manually and learn not to overwrite the file. :idea:

5 minutes ago, sitesme said:

Isn't  there a way to add this in some sort of a hook that will never change?

you could - but that's sort of over-engineering the problem in my eyes... besides which, if you're replacing all files under WHMCS periodically, wouldn't that also erase any hook solution too ??

Link to comment
Share on other sites

2 minutes ago, brian! said:

if you're replacing all files under WHMCS periodically, wouldn't that also erase any hook solution too ??

I didn't explain well, sorry.

I usually do manual upgrades and I overwrite all existing files. Hooks are usually new files so they are never overwritten. This custom.css seems to be part of the theme itself so it will get overwritten.

Quote

alternatively, just update manually and learn not to overwrite the file. :idea:

Are you serious? There are too many things to remember, even if it is a single file. With the hectic day life, I will never remember to not replace file A or file B. There were a few modules where I had to do this, guess what... I quit and I don't use any. This is not only on WHMCS by the way but for many other scripts. I even tried to separate a folder with customizations to be replaced every time there is an update but I I will totally forget about this in 3-6 months. It is my nature and it sucks... but well... what to do?

I will keep a text note to update this file and I will clone a custom-backup.css file now so at least I have it there all the time.

Thanks for your help as usual :)

Link to comment
Share on other sites

14 minutes ago, sitesme said:

This custom.css seems to be part of the theme itself so it will get overwritten.

ironically, the auto-updater would give you a warning about that file when updating, e.g back it up before updating.

15 minutes ago, sitesme said:

Are you serious?

actually, I was - but then again, I can recall even the most trivial things easily... like your question already being answered previously... it's a curse! :twisted:

18 minutes ago, sitesme said:

but well... what to do?

get WHMCS not to include custom.css in their update files - if it's empty, it doesn't need to be there. :)

you could write a simple hook to link to an external css file (located outside of WHMCS if necessary), but whether that's really necessarily I don't know... there's only about a half dozen updates a year, so it's not like there's a weekly need for an update.

Link to comment
Share on other sites

@sitesme if you need it as a hook file here it is

<?php

# Fix Six Template's Content Area
add_hook("ClientAreaHeadOutput", 1, function($vars){
	return '<style type="text/css">.main-content {min-height: 600px;}</style>';
});

create new php file inside /includes/hooks/ directory called "FixSixTemplateContentArea.php" or anything else as you prefer and place the previous code inside it, now you can forget about fixing this issue again

Link to comment
Share on other sites

11 minutes ago, brian! said:
36 minutes ago, sitesme said:

This custom.css seems to be part of the theme itself so it will get overwritten.

ironically, the auto-updater would give you a warning about that file when updating, e.g back it up before updating.

Hmmm... I do take backups, but my point is that I don't want to restore files manually every time there is an update. The file will get overwritten no matter what, right? I don't see what the backup has to do with it.

 

10 minutes ago, sentq said:

create new php file inside /includes/hooks/ directory called "FixSixTemplateContentArea.php" or anything else as you prefer and place the previous code inside it, now you can forget about fixing this issue again

Ok! Now we are talking :) Thank you @sentq

I was just about to create a new file inside the hooks directory but... I realised that there was already the file "WHMCS_SixTemplateCreditBalance.php" and I just added your code at the end of this file. It seems to work!

I am now wondering why this code wasn't added since the beginning since it seems a common problem reported by some others as well.
In an attempt to help, here is my final file with the last code added: https://gist.github.com/anonymous/e5a36f9db07440e260df1c0493931f83

Thank you all once again.

Link to comment
Share on other sites

2 hours ago, sitesme said:

I am now wondering why this code wasn't added since the beginning since it seems a common problem reported by some others as well.

I could include it before, but as not every website affected by this I thought pointing to the fix would be enough

Link to comment
Share on other sites

3 hours ago, sitesme said:

Hmmm... I do take backups, but my point is that I don't want to restore files manually every time there is an update. The file will get overwritten no matter what, right? I don't see what the backup has to do with it.

I was merely pointing out the irony that the automatic updater would warn you about overwriting these css files - manually, you wouldn't get such a specific warning.

3 hours ago, sitesme said:

Ok! Now we are talking :) Thank you

I told you it was a simple hook. :idea:

3 hours ago, sitesme said:

I am now wondering why this code wasn't added since the beginning since it seems a common problem reported by some others as well.

I think it's only a "common" problem if you have a lot, or lengthy, sidebars - ultimately, i'd agree with @sentq on this to leave it out of the core code... in reality, this is really a bug in the cart design that should have been fixed a long time ago by WHMCS.

3 hours ago, sitesme said:

In an attempt to help, here is my final file with the last code added.

thanks for posting your flavour of the hook - it will handy to point to for others who hit the layout problem.

Link to comment
Share on other sites

8 hours ago, sentq said:

I could include it before, but as not every website affected by this I thought pointing to the fix would be enough

It makes a lot of sense. I thought this was happening to all users using Six theme. Thank you so much for this tweak @sentq. It will certainly not get overwritten now :) 

7 hours ago, brian! said:

I told you it was a simple hook. :idea:

Well... since I am not a programmer, I would need the hook itself but it is all sorted out.

Thank you all

Link to comment
Share on other sites

  • 3 months later...

Hi everyone

Using this and its great, however i want to display it a different way in the custom theme im creating and i'm a bit stuck. 

 

Basically instead of having this in the sidebar i've created a custom area in the header on my theme and i want to display this as a dropdown item.  What way can i add this to the required section of my theme?

 

Link to comment
Share on other sites

Hi Matt,

21 hours ago, mwndesign said:

Basically instead of having this in the sidebar i've created a custom area in the header on my theme and i want to display this as a dropdown item.  What way can i add this to the required section of my theme?

it's difficult to tell without knowing exactly where you mean, e.g by theme do you mean WHMCS or WordPress... :?:

  • if it were in the navbar of a WHMCS page, you could use a navbar hook (primary or secondary) to display a balance.
  • if you wanted it as a panel on the homepage when the client is logged in...
  • if this header is within WHMCS, when the client is logged in, there will be a Smarty variable available - {$clientsdetails.credit} that stores the numeric balance (e.g with no currency prefix/suffix) of that client - though if they're logged in, you can access their currency too and add that to the output.
  • you could write an action hook (basically stripping out the sidebar code from sentq's hook) that could assign the credit balance, with the correct currency formatting already in it, to a new variable and that could be accessible in every WHMCS page.
  • if the header is outside of WHMCS (e.g WordPress), then you could use a data feed to get the balance, though there would be complications in verifying the user...
Link to comment
Share on other sites

Hi Brian

 

Thanks for the reply, i figured it out very late last night / early hours of this morning. 

The way i've got it set is within WHMCS.  I have created a custom theme and placed a button that shows a popover next to where the notifications area is displayed within the Six theme. 

I added debug into clientareahome and looked through the hooks that are found within the debug window.  This is what i am using now to display the clients account balance: {$clientsstats.creditbalance}

This displays the currency and also the amount within their account.

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.

×
×
  • 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