From 0b51db24a80dee63d1bc28eafa2be2775807cdef Mon Sep 17 00:00:00 2001
From: "@ChristelLoftus" <christel@bob.co.za>
Date: Mon, 2 Sep 2024 10:41:33 +0200
Subject: [PATCH] tracking page link working

---
 Block/{YourBlock.php => TrackingBlock.php}    |  2 +-
 .../{YourFirstLink => Tracking}/Index.php     |  2 +-
 Controller/YourSecondLink/Index.php           | 38 -------------------
 ...ink_index.xml => bobgo_tracking_index.xml} |  4 +-
 .../layout/bobgo_yoursecondlink_index.xml     | 14 -------
 view/frontend/layout/customer_account.xml     | 12 ++----
 .../frontend/templates/secondlink/index.phtml |  1 -
 .../{yourfirstlink => tracking}/index.phtml   |  0
 8 files changed, 7 insertions(+), 66 deletions(-)
 rename Block/{YourBlock.php => TrackingBlock.php} (81%)
 rename Controller/{YourFirstLink => Tracking}/Index.php (94%)
 delete mode 100644 Controller/YourSecondLink/Index.php
 rename view/frontend/layout/{bobgo_yourfirstlink_index.xml => bobgo_tracking_index.xml} (67%)
 delete mode 100644 view/frontend/layout/bobgo_yoursecondlink_index.xml
 delete mode 100644 view/frontend/templates/secondlink/index.phtml
 rename view/frontend/templates/{yourfirstlink => tracking}/index.phtml (100%)

diff --git a/Block/YourBlock.php b/Block/TrackingBlock.php
similarity index 81%
rename from Block/YourBlock.php
rename to Block/TrackingBlock.php
index c3e7e01..f77dab0 100644
--- a/Block/YourBlock.php
+++ b/Block/TrackingBlock.php
@@ -1,6 +1,6 @@
 <?php
 namespace BobGroup\BobGo\Block;
-class YourBlock extends \Magento\Framework\View\Element\Template
+class TrackingBlock extends \Magento\Framework\View\Element\Template
 {
     public function __construct(
         \Magento\Backend\Block\Template\Context $context,
diff --git a/Controller/YourFirstLink/Index.php b/Controller/Tracking/Index.php
similarity index 94%
rename from Controller/YourFirstLink/Index.php
rename to Controller/Tracking/Index.php
index 51781bc..9955e8d 100644
--- a/Controller/YourFirstLink/Index.php
+++ b/Controller/Tracking/Index.php
@@ -1,5 +1,5 @@
 <?php
-namespace BobGroup\BobGo\Controller\YourFirstLink;
+namespace BobGroup\BobGo\Controller\Tracking;
 
 use Psr\Log\LoggerInterface;
 
diff --git a/Controller/YourSecondLink/Index.php b/Controller/YourSecondLink/Index.php
deleted file mode 100644
index be38312..0000000
--- a/Controller/YourSecondLink/Index.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-namespace BobGroup\BobGo\Controller\YourSecondLink;
-
-use Psr\Log\LoggerInterface;
-class Index extends \Magento\Framework\App\Action\Action
-{
-    /**
-     * @var \Magento\Framework\View\Result\PageFactory
-     */
-    protected $resultPageFactory;
-
-    protected $logger;
-
-    /**
-     * @param \Magento\Framework\App\Action\Context $context
-     * @param \Magento\Framework\View\Result\PageFactory resultPageFactory
-     */
-    public function __construct(
-        \Magento\Framework\App\Action\Context $context,
-        LoggerInterface $logger,
-        \Magento\Framework\View\Result\PageFactory $resultPageFactory
-    )
-    {
-        $this->resultPageFactory = $resultPageFactory;
-        $this->logger = $logger;
-        parent::__construct($context);
-    }
-    /**
-     * Default customer account page
-     *
-     * @return void
-     */
-    public function execute()
-    {
-        $this->logger->info('Page2 Controller is executed.');
-        return $this->resultPageFactory->create();
-    }
-}
diff --git a/view/frontend/layout/bobgo_yourfirstlink_index.xml b/view/frontend/layout/bobgo_tracking_index.xml
similarity index 67%
rename from view/frontend/layout/bobgo_yourfirstlink_index.xml
rename to view/frontend/layout/bobgo_tracking_index.xml
index f5178ae..6e842d7 100644
--- a/view/frontend/layout/bobgo_yourfirstlink_index.xml
+++ b/view/frontend/layout/bobgo_tracking_index.xml
@@ -3,12 +3,12 @@
     <update handle="customer_account"/>
     <head>
         <title>
-            Your First Link
+            Tracking
         </title>
     </head>
     <body>
         <referenceContainer name="content">
-            <block class="BobGroup\BobGo\Block\YourBlock" name="bobgo.firstlink.index" template="BobGroup_BobGo::yourfirstlink/index.phtml" cacheable="false" />
+            <block class="BobGroup\BobGo\Block\TrackingBlock" name="bobgo.tracking.index" template="BobGroup_BobGo::tracking/index.phtml" cacheable="false" />
         </referenceContainer>
     </body>
 </page>
diff --git a/view/frontend/layout/bobgo_yoursecondlink_index.xml b/view/frontend/layout/bobgo_yoursecondlink_index.xml
deleted file mode 100644
index d456381..0000000
--- a/view/frontend/layout/bobgo_yoursecondlink_index.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
-    <update handle="customer_account"/>
-    <head>
-        <title>
-            Your Second Link
-        </title>
-    </head>
-    <body>
-        <referenceContainer name="content">
-            <block class="Magento\Framework\View\Element\Template" name="bobgo.secondlink.index" template="BobGroup_BobGo::yoursecondlink/index.phtml" cacheable="false" />
-        </referenceContainer>
-    </body>
-</page>
diff --git a/view/frontend/layout/customer_account.xml b/view/frontend/layout/customer_account.xml
index cdc2464..54c3c21 100644
--- a/view/frontend/layout/customer_account.xml
+++ b/view/frontend/layout/customer_account.xml
@@ -3,16 +3,10 @@
 <body>
     <referenceBlock name="customer_account_navigation">
         <!-- Add menu to the end of the sidebar -->
-        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-your-first-link">
+        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-tracking">
             <arguments>
-                <argument name="path" xsi:type="string">bobgo/yourfirstlink/index</argument>
-                <argument name="label" xsi:type="string">Your First Link</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-your-second-link">
-            <arguments>
-                <argument name="path" xsi:type="string">bobgo/yoursecondlink/index</argument>
-                <argument name="label" xsi:type="string">Your Second Link</argument>
+                <argument name="path" xsi:type="string">bobgo/tracking/index</argument>
+                <argument name="label" xsi:type="string">Tracking</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/view/frontend/templates/secondlink/index.phtml b/view/frontend/templates/secondlink/index.phtml
deleted file mode 100644
index c19dc87..0000000
--- a/view/frontend/templates/secondlink/index.phtml
+++ /dev/null
@@ -1 +0,0 @@
-echo 'My Second Link Page';
diff --git a/view/frontend/templates/yourfirstlink/index.phtml b/view/frontend/templates/tracking/index.phtml
similarity index 100%
rename from view/frontend/templates/yourfirstlink/index.phtml
rename to view/frontend/templates/tracking/index.phtml
-- 
GitLab