We have a block for recently viewed products in magento 2.2.5 with custom attributes.
<block class="Magento\Reports\Block\Product\Widget\Viewed" after="-" name="recently_viewed" cacheable="false" template="Kinex_ProductWidget::product/recently_viewed.phtml">
<action method="setPageSize">
<argument name="page_size" xsi:type="number">15</argument>
</action>
To make functional, we made this block non-cacheable as cacheable="false", which in turn make the full page non-cacheable. Due to this, Fastly caching conflicts with this page. Please suggest.
Related
I realized smart field is not working properly in versions 1.38-1.48.
If you have a big model with ca 30 fields, then smart field instantiation fails.
As a result only some of the smart fields do instantiate and has values.
(By every application refresh these are different fields).
Have you faced such issue already and how did you proceed?
SAP Support seems to be overwhelmed with fiori issues, so I stopped reporting issues there.
Update for SAP Fiori Crew:
I just tested the issue using Stable Ids, the same error is present.
Here is the example of our xml file:
<core:FragmentDefinition xmlns="sap.m" xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core"
xmlns:smartField="sap.ui.comp.smartfield" xmlns:smartForm="sap.ui.comp.smartform">
<smartForm:SmartForm
id="smartForm"
editTogglable="false"
editable="{LockInformation>/locked}"
flexEnabled="false">
<smartForm:Group>
<smartForm:GroupElement>
<smartField:SmartField
id="stableId1"
value="{main>description}"
editable="true"
/>
</smartForm:GroupElement>
</smartForm:Group>
</smartForm:SmartForm>
</core:FragmentDefinition>
And then this fragment is used inside of our xml view.
This is quite a simple case and can be reproduced easily, as there is no additional javascript for it.
Just remember to have model with around 20 fields declared same way as here in the fragment, add them to fragment too (I didn't do it to keep it small and simple) and use slow backend.
Update 2: a colleague found that there is a asynchronous execution of methods initialize and some other one which update the bindings. Depending on which one finishes first, smart field is either working or not. As every time I start application a random set of fields is broken/ working, we consider it to be a timing issue..
PD. Please let me know if you have found this issue and in which version it can be fixed..
I made some template changes to Magento's New Order transactional email template in the backend. The textual changes at the top of the email (in the "thanks for your order..." section) worked fine. But when I change the templates for the order details, they are not appearing in my email.
I have created two files within my template which I thought would override the email:
app/design/frontend/default/mythemehere/template/email/order/items.phtml
app/design/frontend/default/mythemehere/template/email/order/items/order/default.phtml
These are referenced in my sales.xml file in app/design/frontend/default/mythemehere/layout
<sales_email_order_items>
<block type="sales/order_email_items" name="items" template="email/order/items.phtml">
<action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
<block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
<action method="setLabelProperties"><value>colspan="2" align="right" style="padding:3px 9px"</value></action>
<action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
<block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
<action method="setIsPlaneMode"><value>1</value></action>
</block>
</block>
</block>
<block type="core/text_list" name="additional.product.info" />
</sales_email_order_items>
However, when I place my order, I get the base template in the email.
If I commit the Cardinal Sin in Magento of overriding base template files (app/design/frontend/base/default/template/email/order ...), lo and behold, I see my changes! Seems Magento is very keen to use its base template.
I have overridden other templates in the sales section (eg: sales/order/view.phtml, sales/order/print.phtml), and various posts on Magento's forums indicate I'm doing the right thing in concept. But alas! It's just not working for me.
To use your custom theme file for order email "app/design/frontend/default/mythemehere/template/email/order/items.phtml"
In the admin go to System->configuration->design
Select your website from the top left
Now in the themes template uncheck the checkbok and add the theme name.
I had the same problem. I discovered that the emails will use the /app/design/frontend/default/default templates before the 'base' templates. So if you copy the base templates into the default/default folder your files will not be overwritten on update.
However it is still not ideal as this is still outside your theme folder, however it is better than using 'base' files. I still haven't found a true solution.
This kind of situation happens because if we mention wrong values under System>Configuration>General -> Design section
We can have following two scenarios.
1) Default package with custom design
2) Custom package
If we do not fill correct values under Current Package Name field then issue mentioned in the question will occur.
It happened with me when I was using a custom package but had given value as
default under Current Package Name field.
We should configure the theme properly so that Magento can follow theme fallback properly.
Overwriting templates in base/default and default/default is strongly discouraged, because updating Magento will overwrite those directories.
What worked for me (with emails) is to put the modified files under app/design/frontend/your_design_package/default/templates/.
I'm trying to get some automated UI testing going on a GWT application and I'm having trouble finding a way to track UI elements.
For example, I have the following:
<g:Button text="Submit" ui:field="submitButton" enabled="true" />
which generates:
<button class="gwt-Button" type="button">Submit</button>
Its a compiler error to set both ui:field and id (id is considered deprecated anyway) so the problem is that I have no easy way to select my submit button using something like selenium.
Is anyone aware of a way I can map the
ui:field="sumbitButton"
to the generated HTML?
After further investigation I've discovered that you can enable debugIds which are ment for testing purposes. If you add:
<inherits name="com.google.gwt.user.Debug"/>
to your *.gwt.xml file you can then set debugId on your ui elements as such:
<g:Button text="Submit" ui:field="submitButton" enabled="true" debugId="submitButton"/>
and also in the codebehind by using the ensure debug id method
submitButton.ensureDebugId("submitButton");
I am using struts2 (2.1.6) and want to redirect to Action2 from Action1.
struts.xml:
<action name="Action1" class="Action1">
<result name="success" type="redirectAction">Action2</result>
</action>
<action name="Action2" class="Action2">
<result name="success">/demo.jsp</result>
</action>
This works as expected: http://myserver:9064/demo/Action1 redirects to http://myserver:9064/demo/Action2 (tested on tomcat and websphere).
But when I put my app behind BigIP, redirectAction no longer behaves as expected.
http://mybigip/demo/Action1 is expected to redirect to http://mybigip/demo/Action2, instead it redirects to http://mybigip:9064/demo/Action2 (note that my app's port number gets appended) which gives a 404 error. I got same result for type="redirect" also.
Any pointer to solve this issue would be much appreciated.
I found the solution for this problem. In fact this is not happening just for Struts. It happens in general with any Response.sendRedirect or RequestDispatcher.forward. Also, this behavior is noticed when the app is deployed in WebSphere and not when in Tomcat.
The links below has more details:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rweb_custom_props.html
(look for the custom property httpsIndicatorHeader)
Also:
http://support.f5.com/kb/en-us/solutions/public/1000/800/sol1871.html
Connecting to http://www.manage-us.com on an iPad under 3G [used to] result in a JavaScript error which can be seen if the developer console has been enabled. If the same page is accessed using the same iPad under a WiFi connection no error is displayed. [The error has now gone because I applied the fix below!].
Why is this?
I've tried simulating low bandwidth (using dummynet) on Safari on Mac and on the iPad simulator on Mac. This does not reproduce the problem.
I am currently suspecting this is a problem being introduced by my mobile operator in the UK (O2) which is known to modify some content through a proxy cache such as downgrading image files. If you can confirm that you don't experience this problem when connecting by 3G on iPad or iPhone through another mobile operator that would be helpful.
I've investigated this further and discovered that the problem is that the UK mobile operator O2 (the original exclusive iPhone operator for Apple), modifies web content before sending it to iPhones and iPads. Probably before sending it to any device running a mobile browser.
They non-deterministically inline some of the CSS and JavaScript into the main source files of the web pages. This can create errors either because of mistakes in their algorithm or the consequence of stripping white space from source files with syntactic mistakes in the source files which were otherwise benign.
These modifications also strip copyright messages from copyrighted javascript libraries and css libraries and play havoc with delivery optimisations.
For example, imagine if a user is visiting a sequence of pages on your site which all link to jQuery libraries. Instead of letting your mobile browser locally cache the library, O2 inline the library on every page, forcing your phone to load the entire library over and over again for every page.
I've written a blog about the issue here in the hope if drawing a bit more attention to this: http://stuartroebuck.blogspot.com/2010/07/mobile-proxy-cache-content-modification.html
My workaround is to use document.write() to insert the JavaScript library dependencies at load time and prevent O2 from inlining them. This seems to work quite well. e.g.:
<script type="text/javascript">
// <![CDATA[
// Using document.write to load JavaScript dependencies to bypass O2 network inlining of JavaScript.
function loadJS(file){document.write("<" + "script type='text/javascript' src='" + file + "'></" + "script>")}
loadJS("/js/jquery-1.4.2.min.js");
loadJS("/js/myJSLibrary.js");
// ]]>
</script>
Note that, as ever, document.write will not work if the page is served as XHTML.
For anyone needing a solution to this in ASP.NET, this sets the Cache-Control header as per http://stuartroebuck.blogspot.com/2010/08/official-way-to-bypassing-data.html for javascript files using URL Rewrite Module 2.0 http://learn.iis.net/page.aspx/665/url-rewrite-module-20-configuration-reference.
<system.webServer>
<rewrite>
<outboundRules>
<rule name="Compression header" preCondition="Match JS Files">
<match serverVariable="RESPONSE_Cache-Control" pattern="(.*)" />
<action type="Rewrite" value="no-transform" />
</rule>
<preConditions>
<preCondition name="Match JS Files">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="(javascript)$" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
Alternatively can be done using a HttpModule
public class AddHeaderModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.EndRequest += OnEndRequest;
}
void OnEndRequest(object sender, System.EventArgs e)
{
if(HttpContext.Current.Response.ContentType.Contains("javascript"))
HttpContext.Current.Response.Headers.AddHeader("Cache-Control", "no-transform");
}
}
and
<configuration>
<system.web>
<httpModules>
<add name="AddHeaderModule" type="your.namespace.AddHeaderModule" />
</httpModules>
</system.web>
</configuration>