I recently installed the varnish 3.x in system (ubuntu) and configured it to 8080.
Now full page caching is enabled and its working fine. I just want to ignore some
specific dynamic blocks of the page. How can i do with magento. Also i am not
using Magentos default caching techniques so i disabled it. also tried module Terpentine
Thanks & Regard
Rajesh Ganjeer
I have done this using
Try this in local.xml inside the app/design/frontend/XXX/XXX/layout/local.xml file:
<reference name="block name">
<action method="setEsiOptions">
<params>
<access>private</access>
<flush_events>
<wishlist_item_save_after/>
<wishlist_item_delete_after/>
<sales_quote_save_after/>
</flush_events>
</params>
</action>
</reference>`
OR
<reference name="block name">
<action method="setEsiOptions">
<params>
<access>private</access>
<ttl>0</ttl>
</params>
</action>
</reference>`
OR
<reference name="block name">
<action method="setEsiOptions">
<params>
<access>private</access>
<method>ajax</method>
</params>
</action>
</reference>`
OR
Whole page will ignore cached eg. one page module checkout_onepage_index
<checkout_onepage_index>
<turpentine_cache_flag value="0"/>
</checkout_onepage_index>
I tried this using module Nexcessnet Turpentine. and it works
For your reference after Turpentine installation :
app/design/frontend/base/default/layout/turpentine_esi.xml
Thanks a lot for your feedbacks.
Reference Sites :
http://www.magentocommerce.com/magento-connect/turpentine-varnish-cache.html
https://github.com/nexcess/magento-turpentine
Thanks & Regards
Rajesh Ganjeer
Follow this to start to end solutions for varnish
http://rajeshganjeer.wordpress.com/2014/05/28/varnish-with-magento-terpentine/
Try this in layout.xml file:
<reference name="block name">
<action method="setCacheLifetime"><s>null</s></action>
</reference>
if you want to disable in phtml file then use false after block name like this:
<?php echo $this->getChildHtml('topLinks',false) ?>
and if you want to disable from php file then use this code in specific Block class:
public function getCacheLifetime() { return null; }
Hope this helps. All the best!
Using Turpentine will be the way to go.
The specific link you are looking for is to:
https://github.com/nexcess/magento-turpentine/wiki/ESI_Cache_Policy
With the detail being:
The default ttl if not specified is a little complex: If access is
private, then if method is ajax the default ttl is 0 (not cached)
otherwise the default cookie expiration time is used. If access is
global then the default page TTL is used (regardless of method).
Implemented like:
<reference name="block name">
<action method="setEsiOptions">
<params>
<access>private</access>
<ttl>0</ttl>
</params>
</action>
</reference>
Related
I'm trying to add the Google Maps Javascript API to my Magento module.
The problem I'm having is that the core/text block that I am including, that contains the external Javascript inclusion tag, only ever appears after all of the addJs actions.
This means the script I have in pvtl_stores.js that targets the google object doesn't work as the google object hasn't been initialized yet.
Here is my local.xml file:
<layout>
<default>
<reference name="head">
<block type="core/text" name="google.maps" before="root">
<action method="setText">
<text><![CDATA[<script src="//maps.googleapis.com/maps/api/js"></script>]]></text>
</action>
</block>
<action method="addItem">
<type>skin_js</type>
<name>js/pvtl_stores.js</name>
</action>
</reference>
</default>
</layout>
Is there a way to have the core/text block load before the addJs actions?
By the way, if it isn't obvious by the question, I'm new to Magento programming!
upload you Js in root\js folder. And call this code in your app\design\frontend\base\default\template\page\html\head.phtml file at top.
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)."/yourjs.js"; ?>
or just direct call that
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.js"></script>
UPDATE
You have to download the js first then
go to app\design\frontend\rwd\default\layout page.xml (if you are using default theme otherwise go to yourtheme\default\layout) and you js here
<block type="page/html_head" name="head" as="head">
<action method="addJs">
<script>yourjs/yourjs.js</script>
</action>
<action method="addJs">
<script>prototype/prototype.js</script>
</action>
I am testing magento with varnish and turpentine extesion. I installed all successfully but when i try to by pass (or flush per second) a block, it is hidden or disapear.
For Example i want to by pass product.info.media block.
My xml configuration for by pass in turpenine_esi.xml :
<catalog_product_view>
<reference name="product.info.media">
<action method="setEsiOptions">
<params>
<access>public</access>
<ttl>1</ttl>
</params>
</action>
</reference>
</catalog_product_view>
The block is:
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
<block type="core/text_list" name="product.info.media.after" as="after" />
</block>
is possible to do this? I'm doing wrong?
thanks a lot.
Can you try next:
<catalog_product_view>
<reference name="product.info.media">
<action method="setEsiOptions">
<params>
<method>esi</method>
<access>public</access>
<scope>page</scope>
<ttl>1</ttl>
</params>
</action>
</reference>
</catalog_product_view>
Also check what your block inherit from Mage_Core_Block_Template class.
You're better off putting your ESI options in the local.xml for your theme, since turpentine_esi.xml may get overwritten when you update the extension.
Turn on debugging in Turpentine and see if anything interesting shows up in your system.log. Other caching extensions or having other caches enabled can cause errors like these. Also, check for exceptions being generated from your template, those can also cause issues like this.
I want to develop multiple extensions for Magento, two extension both replace product.info.media block, so I want to active one of them according to the custom attribute is null or not.
Currently, myModule.xml is like this:
<catalog_product_view>
<reference name="head">
<action method="addItem" ifconfig="myModule/general/enabled">
<type>skin_js</type><name>js/myModule/xxx.js</name>
</action>
<action method="addItem" ifconfig="myModule/general/enabled">
<type>skin_js</type><name>js/myModule/xxx.js</name>
</action>
</reference>
<reference name="product.info.media">
<action method="setTemplate" ifconfig="myModule/general/enabled">
<template>myModule/media.phtml</template>
</action>
</reference>
</catalog_product_view>
Is it possible to add ifconfig condition to detect product custom attribute is null or not? Or other fallback mechanism to load other extension template for the same block.
Thanks in advance.
I would implement an empty container block via layout xml. Furthermore i would develop a custom block class were you can decide which template to load an add to the container.
I'm making some changes to /customer/form/register.phml but they are not showing up in the frontend. Changes that I made to login.phtml and forgotpassword.phtml do show up.
I checked if magento was using a fallback from the base/default theme but it's not. I deleted register.phtml in both my theme and in the base/default theme to check what would happen: the page showed up just fine (without the changes of course).
I looks like magento gets the file from somewhere else (maybe the core). I've got no idea on how to solve this.
Thanks in advance for your help.
My Customer.xml file looks like this, I'm using magento 1.5.1
<customer_account_create translate="label">
<label>Customer Account Registration Form</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_create>
The best way to debug this - is to turn on template path hints.
You probably need to edit template/persistent/customer/form/register.phtml.
Yes i agree with WebFlake turn on template hints that will let you know which template file the form is being pulled from, most likely you are modifying the wrong template.
Here is a link which explains how to turn on template hints: http://vimeo.com/1067069
Use the template hints. Also, with any phtml changes you make, make sure that you have caching disabled, and flush all caches (System -> Cache Management).
I used template hints and discovered a plugin replaced the file. Enabling template hints: http://vimeo.com/1067069 helped a lot
Wonder if you can help me. I have a Magento installation and when a customer selects "forgot password" the system does NOT send the reset password email.
All the other emails are working fine. I have setup the New Password template and assigned it in the admin of Magento.
I can't for the life of me figure out why only the Reset password emails are not sending and the others are.
Please help.
Thanks,
Ev
To solve the issue it is enough to delete the custom customer.xml used by your theme in app/design/frontend///layout/, so default layout shipped with base theme (in app/design/frontend/base/default/layout/customer.xml) will be used.
Or the custom customer.xml can be updated to include the following section:
<customer_account_resetpassword translate="label">
<label>Reset a Password</label>
<remove name="right"/>
<remove name="left"/>
<reference name="head">
<action method="setTitle" translate="title" module="customer">
<title>Reset a Password</title>
</action>
</reference>
<reference name="root">
<action method="setTemplate">
<template>page/1column.phtml</template>
</action>
<action method="setHeaderTitle" translate="title" module="customer">
<title>Reset a Password</title>
</action>
</reference>
<reference name="content">
<block type="customer/account_resetpassword" name="resetPassword" template="customer/form/resetforgottenpassword.phtml"/>
</reference>
</customer_account_resetpassword>
Check out the app/code/core/Mage/Customer/controllers/AccountController.php file. Look for forgotPasswordPostAction. Analyze it step by step - check if $this->getRequest()->getParams() provides you the emal addresss, check if it validates (maybe some local changes have been made to the validation code). Look at the password generation code - is the new passsword generated? Check out the Mage_Customer_Model_Customer class and the sendPasswordReminderEmail method and try to track the bug in there. Print all the values you can get there (email, names, store configs and check for exceptions and warnings - turn php error displaying!).
This should help you tracking down the problem, and gather enough data to identify it.