Jump to content

Own admin module - templates didn't show content


Recommended Posts

Hi,

I'm writing own admin module, I have various actions in the controller, eg indexAction. Templates are processed, but don't showed its content in admin area, I got only menu on the left.

public function indexAction(Request $request)
	{
		/** @var EntityManagerInterface $entityManager */
		$entityManager = $this->container->get('doctrine.orm.entity_manager');

		$repository = $entityManager->getRepository(Wholesales::class);

		$wholesales = array();
		foreach ($repository->findAll() as $wholesale)
			$wholesales[] = $wholesale;
                $context = Context::getContext();
                $context->smarty->assign(array('wholesales' => $wholesales));
                return $context->smarty->fetch(_PS_MODULE_DIR_. 'sstorewholesale/views/templates/admin/index.html.tpl');
		//return $this->render(_PS_MODULE_DIR_. 'sstorewholesale/views/templates/admin/index.html.twig', array('wholesales' => $wholesales));
	}

What I'm doing wrong ?

Link to comment
Share on other sites

10 hours ago, Mariusz Koniarz said:

Hi,

I'm writing own admin module, I have various actions in the controller, eg indexAction. Templates are processed, but don't showed its content in admin area, I got only menu on the left.


public function indexAction(Request $request)
	{
		/** @var EntityManagerInterface $entityManager */
		$entityManager = $this->container->get('doctrine.orm.entity_manager');

		$repository = $entityManager->getRepository(Wholesales::class);

		$wholesales = array();
		foreach ($repository->findAll() as $wholesale)
			$wholesales[] = $wholesale;
                $context = Context::getContext();
                $context->smarty->assign(array('wholesales' => $wholesales));
                return $context->smarty->fetch(_PS_MODULE_DIR_. 'sstorewholesale/views/templates/admin/index.html.tpl');
		//return $this->render(_PS_MODULE_DIR_. 'sstorewholesale/views/templates/admin/index.html.twig', array('wholesales' => $wholesales));
	}

What I'm doing wrong ?

Hello Can you please explain what type of page you are creating . If its a admin controller then you need to pass your template content in initContent method.
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...