I've been looking and I can't find the exact answer to my question. I've created a custom view.phtml file on my site and stored it in my "customchanges" folder located at /app/design/frontend/argento/default/template/customchanges/catalog/product/view.phtml
I've also created a local.xml file which I store in /app/design/frontend/argento/default/layout/local.xml
My code in my local.xml file is:
<?xml version="1.0"?>
<layout>
<default>
<reference name="product.info">
<action method="setTemplate"><template>customchanges/catalog/product/view.phtml</template></action>
</reference>
</default>
</layout>
But when I refresh the page (and use hints) I still get the default page. Please could someone help?
Thanks
Chris
I managed to fix this, if it's helpful here's the solution:
<layout version="0.1.0">
<catalog_product_view>
<reference name="product.info">
<action method="setTemplate">
<template>customchanges/catalog/product/view.phtml</template>
</action>
</reference>
</catalog_product_view>
</layout>
Related
I have been learning Angular2. The routing works just fine when running on the nodejs lite-server. I can go to the main (localhost:3000) page and move through the application. I can also type localhost:3000/employee and it will go to the requested page.
The app will eventually live on an Windows IIS 7.5 server. The routing works fine if I start at the main page (localhost:2500), I am able to move through application with out any problems. Where I run into a problem is when trying to go directly to an page other then the main landing page (localhost:2500/employee). I get a HTTP Error 404.0.
Here is my app.component file that handles the routing.
import { Component } from '#angular/core';
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '#angular/router-deprecated';
import { HTTP_PROVIDERS } from '#angular/http';
import { UserService } from './services/users/user.service';
import { LogonComponent } from './components/logon/logon.component';
import { EmployeeComponent } from './components/employee/employee.component';
#Component({
selector : 'opi-app',
templateUrl : 'app/app.component.html',
directives: [ROUTER_DIRECTIVES],
providers: [ROUTER_PROVIDERS, UserService, HTTP_PROVIDERS]
})
#RouteConfig([
{
path: '/',
name: 'Logon',
component: LogonComponent,
useAsDefault: true
},
{
path: '/employee',
name: 'Employee',
component: EmployeeComponent
}
])
export class AppComponent { }
I would like to say I understand the issue. IIS is looking for a direcotry of /employee but it does not exist. I just do not know how to make IIS aware of the routing.
(For angular 2, angular 4)
Create a web.config file as in mentioned article.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Place it in the root directory (same as index.html) of your site. Mine is in the dist folder (angular-cli project).
After deploying, go to IIS if you have the access and you can click on the rewrite-rules icon and see that it read this config. If you do not see and icon for rewrite rules, you will need to enable the module under "modules" icon. This code snippet was not written by be but I wanted to share better implementation details.
You should be using URL rewrite module to achieve this. A very detailed info on how to use it is provided here
And a sample web.config snippet which worked for me on IIS 8 is here.
Using URL rewrite module will kill routing path inside application. I've changed Error page for 404 Not Found response to my index.html file. This will not change the URL in browser, but server returns the whole application.
HowTo: Site->Application->Error Pages from context menu on Status Code 404 choose Edit... and choose option Execute URL on this site. Enter /index.html and press OK. Note the path is from site root so you may need to include your app path.
My angular 6 app is running in a subfolder and I had problems with the appoach to redirect into the subfolder. Instead I redirect directly to the index.html
Step 1.) Build angular app with the --base-href flag like this: ng build --prod --base-href /ng/
Step 2.) Create a web.config in this folder with the redirct to the index.html like this:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="./index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
If you use a Core 2.1 project, you can skip the web.config rewrite rules and accomplish Angular deep linking by putting this code at the bottom of your Startup.cs.
app.Use(async (context, next) =>
{
context.Response.ContentType = "text/html";
await context.Response.SendFileAsync(Path.Combine(env.WebRootPath, "index.html"));
});
Source
If you are having url other than root of the application you can try this:
<rule name="AngularJS Routes" stopProcessing="true">
<match url="(.*)mypath/myangularapp/dashboard(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/mypath/myangularapp/dashboard/index.html" />
</rule>
Make sure you have built your Angular app via the following command:
ng build --base-href=/mypath/myangularapp/dashboard/
I'm using an angular directive to pull an html file from my IIS7 classic mode server (classic required due to SSO). To satisfy CORS I need read the ORGIN from the request and add a header to the response of the html file. That bit doesn't really matter. My problem is hooking in my code to actually do this for a static HTML file.
So with classic mode my handlers/module are defined in system.web, not system.webSever. Therefore I can't use the runAllManagedModulesForAllRequests="true" flag which isn't part of the schema for system.web.
In system.web I have:
<httpHandlers>
<!--<add path="*.html" verb="GET,HEAD" type="System.Web.StaticFileHandler" />-->
<add path="*.html" verb="GET,HEAD" type="My.Namespace.CrossOriginHandler, My.DLL.Name" />
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
</httpHandlers>
<httpModules>
<add name="CrossOriginModule" type="My.Namespace.CrossOriginModule, My.Dll.name" />
</httpModules>
This executes fine for a MVC pages or webapi calls. It does not execute for my static HTML file.
I'm starting to fear I'm going to need to write a custom ISAPI filter. Is there any other way to hook in my code? A configuration I'm missing or hook inbetween ISAPI filter and HttpModule?
There are a couple of options you have and definitely you should not need to write an ISAPI for that.
One option if you can set it for everyone blindly is to just use the httpProtocol section to add the header:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
however, a much better option is to use URL Rewrite to set the headers and still have all the control to check for origins, and rewrite them appropriately.
I wrote a quick article on how to do that here:
http://www.carlosag.net/articles/enable-cors-access-control-allow-origin.cshtml
At a high level it means adding a URL Rewrite inbound rule to capture the Origin header and set it in a server variable. Then you can use that server variable later in an outbound rule to set it in a header. Optionally I used a Rewrite Map to condition the origins that you wanted to allow that.
<outboundRules>
<rule name="Set-Access-Control-Allow-Origin for known origins">
<match serverVariable="RESPONSE_Access-Control-Allow-Origin" pattern=".+" negate="true" />
<conditions>
<add input="{AllowedOrigins:{CAPTURED_ORIGIN}}" pattern=".+" />
</conditions>
<action type="Rewrite" value="{C:0}" />
</rule>
</outboundRules>
see full explanation here: http://www.carlosag.net/articles/enable-cors-access-control-allow-origin.cshtml
I'm trying to edit the Magento Admin Products Grid Page - Need to edit the Store Switcher Block that shows there, But I'm not able to.
Have created a class in my module in a blocks folder:
[Name]_[Module]_Block_Store_Switcher
and my config.xml file has:
<blocks>
<adminhtml>
<store>
<rewrite>
<switcher>[Name]_[Module]_Block_Store_Switcher</switcher>
</rewrite>
</store>
</adminhtml>
</blocks>
Not able to identify what I'm doing wrong here - any help is much appreciated!
Correct code would look like this:
<blocks>
<[Name]_[Module]>
<class>[Name]_[Module]_Block</class>
</[Name]_[Module]>
<adminhtml>
<rewrite>
<store_switcher>[Name]_[Module]_Block_Switcher</store_switcher>
</rewrite>
</adminhtml>
</blocks>
A bit basic, but I have tried some of the methods to tackle the following error but could not get the right solution.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form method="post">
<input type="text" name="query1"></input>
<input type="text" name="query2"></input>
<input type="submit"></input>
</form>
</body>
</html>
Error on running :
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
In the mappings of IIS, I have added the POST method but that did not work!
Suggestions please!
The following code has solved the problem for me(it's for php on iis).
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Execute, Script">
<remove name="PHP55_via_FastCGI" />
<add name="PHP55_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
<add name="HTML_via_FastCGI" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
<add name="HTM_via_FastCGI" path="*.htm" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".php" allowed="true" />
</fileExtensions>
<verbs>
<add verb="POST" allowed="true" />
<add verb="GET" allowed="true" />
<add verb="HEAD" allowed="true" />
<add verb="DELETE" allowed="true" />
<add verb="PUT" allowed="true" />
</verbs>
</requestFiltering>
</security>
</system.webServer>
Without seeing more, this could be a variety of problems. With that in mind, here is a list of possible fixes for your issue:
Cause 1
This problem occurs because the client makes an HTTP request by using
an HTTP method that does not comply with the HTTP specifications.
To resolve this problem, see resolution 1.
Cause 2
This problem occurs because a client makes an HTTP request by sending
the POST method to a page that is configured to be handled by the
StaticFile handler. For example, a client sends the POST method to a
static HTML page. However, pages that are configured for the
StaticFile handler do not support the POST method.
To resolve this problem, see resolution 2.
Resolution 1
Make sure that the client sends a request that contains a valid HTTP
method. To do this, follow these steps:
Click Start, type Notepad in
the Start Search box, right-click Notepad, and then click Run as
administrator.
Note If you are prompted for an administrator password or for a
confirmation, type the password, or provide confirmation. On the File
menu, click Open. In the File name box, type
%windir%\system32\inetsrv\config\applicationhost.config, and then
click Open.
In the ApplicationHost.config file, locate the
tag.
Make sure that all the handlers use valid HTTP methods.
Save the ApplicationHost.config file.
Resolution 2
Send the POST request to a page that is configured to be handled by a
handler other than the StaticFile handler (for example, the ASPClassic
handler). Or, change the request that is being handled by the
StaticFile handler so that it is a GET request instead of a POST
request.
MSDN Source
In my opinion you have 2 errors:
1) If your file extension is *.html change it to for example *.asp, *.php and it will work.
2)The input tag doesn't have closing tag.
I have two activities, ListViewActivity and MapViewActivity which both run within a TabHost; everything is working fine and I am able to view my list, add POIs to the map, change between tabs etc.
What I have also done is to 'extend' my ListViewActivity so that when an item in the List is clicked, the view is switched (via ViewSwitcher) to show more detail (note: this happens within the same tab); again this all works okay and I am able to flip between the list view and the detailed view which contains text elements, buttons etc.
But, since I've only been programming in Android/JAVA for a few weeks, I've hit a brick wall... and need some pointers/high level examples to get me going again.
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="150dp"
android:layout_height="150dp"
android:apiKey="0sQLOXF5j7iM03sd-IyVldoGjh0voa5-qqFRRlw"
android:clickable="false"
android:enabled="true" />
Specifically, I want the 'extended/detailed' view within the ListViewActivity to include a detailed/zoomed map. However, when I try to include the map definition in my XML code (see above), it causes the application to crash - I am assuming because there is already a map defined in MapViewActivity (i.e. this code appears in both my ListViewActivity.xml and my MapViewActivity.xml files)?
I've read found other pages such as this, which recommend using the android:process attribute in the manifest to assign acitivites, for example:
activity android:name=".activity.directory.MapView1" android:process=":MapView1"
activity android:name=".activity.directory.MapView2" android:process=":MapView2"
However, I am uncertain how to implement this - i.e. how do I call the process from either the ListViewActivity or MapViewActivity class such that either a detailed or high-level map is displayed?
Currrently my AndroidManifest.XML file is as shown below; I know this is incorrect, but like I said, I'm stuck in figuring out how to have a map both in my ListViewActivity and in my MapViewActivity:
<application
android:icon="#drawable/launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".DummyAppName" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ListViewActivity"/>
<activity android:name=".MapViewActivity"/>
<activity android:name=".FavouritesActivity"/>
<activity android:name=".SettingsActivity"/>
<activity android:name=".activity.directory.MapView1" android:process=":MapView1"/>
<activity android:name=".activity.directory.MapView2" android:process=":MapView2"/>
Sorry for the long post. I hope it makes sense and I hope someone is able to offer some ideas/suggestions on how to fix my problem (is it even possible?).
Thank you!