Saya mencoba menambahkan tautan khusus dalam navigasi akun pelanggan. Tautan kustom saya ditampilkan di navigasi akun dan berfungsi juga, tetapi tidak ditampilkan sebagai aktif / terkini saat klik.
Di bawah ini adalah kode yang saya miliki:
/app/code/Namespace/Support/view/frontend/layout/customer_account.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_account_navigation">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-suppport-ticket-link" after="-">
<arguments>
<argument name="path" xsi:type="string">support/customer/index</argument>
<argument name="label" xsi:type="string">Support Ticket</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
/app/code/Namespace/Support/Controller/Customer/Index.php
<?php
namespace Namespace\Support\Controller\Customer;
use Magento\Framework\App\Action;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\Controller\ResultFactory;
class Index extends \Namespace\Support\Controller\Index
{
/**
* Show customer tickets
*
* @return \Magento\Framework\View\Result\Page
* @throws NotFoundException
*/
public function execute()
{
/** @var \Magento\Framework\View\Result\Page resultPage */
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
return $resultPage;
}
}
/app/code/Namespace/Support/view/frontend/layout/support_customer_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<head>
<title>Support Ticket</title>
<css src="Namespace_Support::css/styles.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="Namespace\Support\Block\TicketList" name="ticketViewList" template="Namespace_Support::list.phtml" />
</referenceContainer>
</body>
</page>
<argument name="path" xsi:type="string">support/customer/index</argument>
ke<argument name="path" xsi:type="string">support/customer</argument>