I'm trying to override the COA-search.phtml file found in vendor/magento/module-newsletter/view/frontend/templates
<div>
<p style="font-weight:bold;">Search for a Certificate of Analysis by Lot Number below:</p>
<div>
<form action="/technical-support/certificate-of-analysis.html" method="get" name="search">
<input type="text" name="keyword" id="keyword" />
<div class="actions" style="margin-top:10px;">
<button class="action primary" title="Search" type="submit" aria-label="Search">Search</button>
</div>
</form>
<br/>
<?php
if(isset($_GET['keyword'])){
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('\Magento\Customer\Model\Session');
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
$filename = $_GET['keyword'];
$filepath = $documentRoot."/COA/".$filename.".pdf";
if(file_exists($filepath)){
if($customerSession->isLoggedIn()){
echo "<p><img src='/pub/media/images/etc/pdf.jpg' alt='PDF'><a href='/COA/$filename.pdf' title='Certificate of Analysis' target='_blank'>$filename</a></p>";
}else{
echo "Certificate of Analysis found, please <a href='/customer/account/login/' title='login'>login</a> or <a href='/customer/account/create/' title='register'>register</a> to access the Certificate of Analysis.";
}
}else{
echo "<p>Certificate of Analysis for Lot Number $filename does not exist or not available at this time. Please contact <a href='mailto:[email protected]' title='Email sales'>[email protected]</a> for further assistance.</p>";
}
}
?>
</div>
</div>
In my app/code folder I have place this newer phtml file in the app/code/Sciencell/COAs/view/frontend/templates
I have a registration.php file app/code/Sciencell/COAs
<?php /**
* Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Sciencell_COAs',
__DIR__
);
I have a module.xml in app/code/Sciencell/COAs/etc
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Sciencell_COAs" setup_version="0.0.1">
<sequence>
<module name="Magento_Newsletter"/>
</sequence>
</module>
</config>
And finally a newsletter_manage_index.xml in my app/code/Sciencell/COAs/view/frontend/layout
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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"/>
<body>
<referenceContainer name="content">
<block class="Magento\Customer\Block\Newsletter" name="customer_newsletter" cacheable="false" template="Sciencell_COAs::COA_search.phtml">
<container name="customer.newsletter.form.before" as="form_before" label="Newsletter Subscription Form Before" htmlTag="div" htmlClass="rewards"/>
</block>
</referenceContainer>
</body>
</page>
I can see the module is enabled in the config.php file. So what am I missing? Why are the changes not being reflected. I've tried it all. bin/magento setup:upgrade, compile, deploy, reindex, cache. I've also tried deleting folders rm -rf pub/static/adminhtml pub/static/frontend var/cache var/composer_home/ var/page_cache/ var/view_preprocessed/ generated/ generated/*