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.
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'm hosted on siteground and I have enbaled all the cache option (I'm using magento 1.9.1):
Varnish Static Cache
Varnish Dynamic Cache
Memcached
Unfortunately the second one duplicate the effect of my minicart module, this is its xml:
<layout version="0.1.0">
<default>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/hm/minicart.js</name><params/></action>
<action method="addCss"><stylesheet>css/hm/minicart.css</stylesheet></action>
</reference>
<reference name="header">
<reference name="top.links">
<remove name="checkout_cart_link"/>
<block type="minicart/view" name="minicart_toplink" template="minicart/toplink.phtml" >
<block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"/>
</block>
<action method="addLinkBlock"><blockName>minicart_toplink</blockName></action>
<block type="checkout/links" name="checkout_cart_link_minicart">
<action method="addCheckoutLink"></action>
</block>
</reference>
</reference>
</default>
</layout>
and this is the error:
I have also tried to clean all the cache that I could, but with no success...
The other problem (that I don't know to which one of the cache is related to) doesn't allow me to remove the poll sidebar block, in particular the module is disable through the admin panel and actually I can't see anything related to poll managment, but the block is still displayed in the frontend, so I had to remove all the polls from my database to avoid to show the block.
Siteground said that this problem is related to my theme, but I don't know where to put my hands, since it's default theme with some xml and css edits.
We are on Siteground as well with Magento 1.9.1
We do NOT use Varnish Dynamic cache since this creates many problems with our completely basic theme (few blocks changed). Same on previous Magento versions.
Tried tickets but it's due to our (standard) theme.... so no VDC for us either.
I suggest, just turn it to off.
Also, remember to log out of Magento and use a INCOGNITO browser (mode) to check your site, usually the header affected by VDC as well. Refresh the page even in the incognito browser to get a fresh one.
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>
I am writing a Magento Extension that is trying to hide the Discount Code section on the checkout cart page. I wrote the following code to replace the current cart.phtml with my custom template.
<layout version="0.1.0">
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setTemplate">
<template>company/module/cart.phtml</template>
</action>
</reference>
</checkout_cart_index>
</layout>
Everything looked good until I realized it even overwrote the template the cart page uses for an empty cart. I have tried many combinations for switch the "checkout_cart_index"
name to the reference name but I cannot get it to just replace that template. I further investigated and found in the default layout it sets the cart values here:
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
I tried again using "SetCartTemplate" but I cannot get it to display yet alone behave as I am intending. Any ideas?
In your layout update
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setCartTemplate"><value>path/to/your/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>path/to/your/noItems.phtml</value></action>
<action method="chooseTemplate"/>
</reference>
</checkout_cart_index>
chooseTemplate will choose the right template
Try to Rewrite this core class to hide the discount code section in your cart page
Mage_Sales_Model_Quote_Address_Total_Discount
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