Hi, I am trying to create or modify some code I had working on ameber v4 site but now want to work on v5 site. It basically printed out (just on screen) vi php script User Name Products purcahsed (active) and products purchased (expired), ptogether with info on how mush they paid. Is there any any documentation for v5 and the variable I can retrieve (asuming the details are for the current logged in user) I used to use code like $user = $this->getDi()->user; $products = $user->getActiveProductIds();
I was hoping it would work but I seem to having difficulties. Basically I'm trying to do some checks on what products (both expired and active) the current user has, and then set some variables. eg Code: $user = $this->getDi()->user; $ticketlist1 = $user->getExpiredProductIds(); $ticketlist2 = $user->getActiveProductIds(); $ticketlist = array_merge($ticketlist1, $ticketlist2); if (in_array('119', $ticketlist) || in_array('120', $ticketlist) || in_array('127', $ticketlist)) { $printtype = "Info type 1"; } if (in_array('121', $ticketlist) || in_array('141', $ticketlist) || in_array('122', $ticketlist)) { $printtype = "Info type 2"; } but it doesnt seem to be work (it did work in v4) Any ideas why?
Your code looks correct. What is file where you use it? Did you get any error with it? If so what is error message?
I get error Code: Static method [noCache] does not exists in Am_Mvc_Controller when I try to use my old code.
I need to check full code of your file. Do you mind to contact us in helpdesk? https://www.amember.com/support I will help you with it. Best Regards.
Thanks for the help. I got it working in the end, by adding new methods and constants. Next question, If I have the ID of a products, how can I retrieve the price of it (in a php script)?
Here you are: PHP: //I assume Id of your product is 1$price = Am_Di::getInstance()->productTable->load(1)->getBillingPlan()->first_price;
thats is perfect, many thanks I also used the following to get the product title from the id Am_Di::getInstance()->productTable->load($idnumber)->title;