X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Add "Customer Orders Totals" to Customer Profile Page (https://forum.x-cart.com/showthread.php?t=56288)

kmjperformance 10-30-2010 08:20 AM

Add "Customer Orders Totals" to Customer Profile Page
 
If something like this has been covered, I apologize, I searched and didn't find anything...

I'm looking for a way to add a field visible only to non-customers that shows the total number of Processed, Failed, etc... orders the customer has placed with us.

I know the SQL and I already added a function to the include/func/func.db.php file that calculates these (GetOrderCounts($CustLogin)). It returns the total count of the different types of orders.

However I can't figure out how to display this on the page!

Really scratching my head here.


Thanks in advance!

P.S. If I get this to work, I'm planning on adding a customer total YTD $, MTD $, etc...

Shamun 10-30-2010 02:36 PM

Re: Add "Customer Orders Totals" to Customer Profile Page
 
In the PHP you need to have the logic that gets the amount. It seems you have that, which is accessed by the function GetOrderCounts($CustLogin) where $CustLogin is an autopopulated variable.

If not, you will need something like this:
Code:

$TotalCustomer = GetOrderCounts($CustLogin);

Now the variable $TotalCustomer contains the amount. Next up, you need to pass that info to smarty via code similar to this:
Code:

$smarty->assign('varNameYouWantToUseInSmarty', $TotalCustomer);

kmjperformance 11-01-2010 06:24 AM

Re: Add "Customer Orders Totals" to Customer Profile Page
 
So, do I put the $smarty->assign() code in the "include/func/func.db.php" file, or in the smarty template, or do I put it in some other file?

amy2203 11-01-2010 06:32 AM

Re: Add "Customer Orders Totals" to Customer Profile Page
 
in the php file

its what makes smarty see the variable,

hth

kmjperformance 11-01-2010 07:44 AM

Re: Add "Customer Orders Totals" to Customer Profile Page
 
Got it!

Thanks everyone!

I'll be using this a lot. Once I get something I feel is useful, I'll post the code on here.

Thanks again!

amy2203 11-01-2010 10:06 AM

Re: Add "Customer Orders Totals" to Customer Profile Page
 
sounds like a good mod, love to see it completed!


All times are GMT -8. The time now is 03:20 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.