- Error: Call to a member function isForSaleInMarketplace() on null
- src/addons/XFA/RMMarketplace/XFRM/Pub/Controller/ResourceItem.php:322
- Generated by: Unknown account
PHP:
public function actionMove(ParameterBag $params)
{
$response = parent::actionMove($params);
if ($response instanceof \XF\Mvc\Reply\View)
{
$resource = $response->getParam('resource');
/* Need to reconstruct category list if the resource is paid */
if ($resource->isForSaleInMarketplace())
{
$categoryRepo = $this->getCategoryRepo();
$categories = $categoryRepo->getViewableCategories();
foreach($categories AS $idx => $category)
{
if ($resource->xfa_rmmp_type == 'digital')
{
if ($category->xfa_rmmp_types['digital']['active'] == 0)
{
unset($categories[$idx]);
}
}
else
{
if ($category->xfa_rmmp_types[$resource->xfa_rmmp_type] == 0)
{
unset($categories[$idx]);
}
}
}
$response->setParam('categoryTree', $categoryRepo->createCategoryTree($categories));
}
}
return $response;
}
But it is not get right resource information .so you need to change code like
from
to$resource = $response->getParam('resource');
$resource = $this->assertViewableResource($params->resource_id);