News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

PHP Code to get users total spend

Started by phil147, August 31, 2019, 18:42:26 PM

Previous topic - Next topic

phil147

Hi,

I have searched for hours for help on this, I want to get the total of logged in users spend so I can allocate a coupon amount based on total.

for example, when logged in the information is available on the /order-history page , but I want to access the object from the login page /log-in

I will be placing the code in html/com_vm/user/login3.php file

I want to assign the total amount to a var within the log-in page

I need a line of code similar to $orderModel = VmModel::getModel('orders');


Thanks for reading,
Phil

Using VM 3.2 12
Joomla 3.9 11


phil147


Hello,

eventually (after 4 days searching) found the answer in the view.html file within vm/views/user folder

I placed the code in the login file, so I'm able to access logged in users history etc

see below, might save someone heartache

// Check for existing orders for this user
               
$orders = VmModel::getModel('orders');

$orderList = $orders->getOrdersList($userDetails);

Milbo

in the new core is a function for order count, it is quite easy to rewrite it for the totals.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/