I am having a problem with a new module (upgraded from a Magento 1 module). The technical review for the Module specifies that it fails on the Varnish check:
Performing a quick search online indicates that this occurs if your view files (including blocks) have an invalid cache configuration. However, I do not have any defined block or view files. Any assistance would be appreciated.
Thanks
I do not have either of those specified in any of the module source files.
We capture the customer from session; e.g. -
$customerName = trim($this->session->getCustomer()->getName());
Everything else is loaded via config or request objects.
Hello @Freightquote
Seems like that is an issue, in varnish page coming from the cache so every time it will show some info.
So you need to add cachable false, or you need to get customer name using section method or ajax.
Hope it will help you.
If help you then mark as solution.
I am not using a block element so I cannot add cachable false. The module itself extends AbstractInterface and implements CarrierInterface.
Inside the main body of this code is where I have my session calls. I have tried to use ObjectManager to get session instance data but that also fails the varnish tests; e.g. -
/* Cart Items */ $objectManager = ObjectManager::getInstance(); $session = $objectManager->get('\Magento\Checkout\Model\Session'); $quote = $session->getQuote(); $items = $quote->getAllItems(); /* Customer */ $objectManager = ObjectManager::getInstance(); $session = $objectManager->get('\Magento\Customer\Model\Session'); $customer = $session->getCustomer();
Hello @Freightquote
This is not the right way to call object manager into phtml.
This is called from my php source. I do not have any phtml files.
Any other ideas???