I'm trying to modify Amember to show all the products that a user hasn't purchased on a left-side navigation I created. It works great on the Main page, but it doesn't work on any other page. Here's the code I'm using: $categoryProducts = Am_Di::getInstance()->productCategoryTable->getCategoryProducts(); It returns the categories only on the Main page, but not on any other page. Does anyone know why this behavior occurs and how I can fix it? Thank you, Joaquin
Sorry, I actually use the $member_products variable, but like I said it's not returning results on any page other than Main. Thanks.
I guess you modify templates. $member_products variable is defined only for dashboard. In aMember templates for logged in user you can retrieve same info the following way: Code: <?php $di->user->getActiveProducts() ?> $di is instance of Am_Di and it always exists in template scope. You may want to check that user already logged in before use this code: Code: <?php if ($di->auth->getUserId()) : ?> ..some html or php code if user is already logged in.. <?php endif; ?>
Thank you so much for your answer, it worked perfectly. Now I'm having the same issue with the $resources variable. What's the code for getting $resources in the template scope?
You can use this code to retrieve it Code: <?php $resources = $di->resourceAccessTable->getAllowedResources($di->user, ResourceAccess::USER_VISIBLE_TYPES); ?>