My intention is to send the sku as a hidden variable when applying for the contact form but only after having visited a product.
It works fine with localhost, where the cache is disabled, but not with the online website because it only gets the information the first time I access to the contact page and when I access from another product it maintains the previous sku. It only works when I refresh the cache but it's really strange in my opinion.
Here is the code I have for form.phtml
<?php
if(isset($_GET['sku']))
{
$print_text = $_GET['sku'];
}
else
{
$print_text = "";
}
?>
<input type="hidden" value="<?php echo $print_text ?>" name="sku" id="sku" title="<?php echo Mage::helper('contacts')->__('Sku') ?>"/>
And this for view.phtml
<p>Para cantidades inferiores o información <a href="http://example.com/contacto/?sku=<?php echo $_product->getSku() ?>">consultar</a></p>
And I get the information from the admin panel, transactional emails. Adding this at the end of the contact form:
<p>Sku: {{var data.sku}}</p>
How can I get the information without having to refresh cache the whole time?