OroCommerce 1.6 overload/override customer dashboard - symfony-2.8

I followed this link and this link to override or add new controller and methods in it. It wouldn't just work at all. There seem to be very less documentation or forum support. Can anyone help me please what is the proper way to overload the customer dashboard controller ?
It is giving me No route found for "GET /customer/documents/" error message.

There is no route "/customer/documents/" in OroCommerce, so there is nothing to "override".
The customer dashboard ("My Account") page route is "/customer/profile/", see routing.yml in OroCustomerBundle:
oro_customer_frontend_customer_user_profile:
resource: "#OroCustomerBundle/Controller/Frontend/CustomerUserProfileController.php"
type: annotation
prefix: /customer/profile
options:
frontend: true
which is served by CustomerUserProfileController.php#L17-L31
If you are trying to create a new controller for "/customer/documents/" route, then simply create your controller, and define this new route in Resources/config/oro/routing.yml of your custom bundle.

Related

How can I set up a vue-router navigation guard?

I have a Laravel + Vue site that allows users to book on to training courses. A typical course URL might be www.mysite.com/courses/a-great-course. This is set up in my router.js file in the usual way:
path: '/courses/:slug',
component: Course,
name: 'course'
with the slug naturally being pulled from the database.
I have a standard vue-router catch all route defined that works fine for the first level of the URL and diverts to a Not Found page, but if I ask for a course that doesn't exist - www.mysite.com/courses/wrong-course - it still loads the page and just sits on the loading animation.
As I understand it I need to implement a navigation guard but I'm completely confused as to how to do that - it seems all the online examples deal with situations like checking if a user is authenticated in the Store.
Can anyone give me some pointers?

NopCommerce 3.3 Add link for custom Plugin Action in ProductTemplate.Simple.cshtml, unable to find Controller and model of same view

We had created a Custom Plugin , The Nop.Web Site provided to us by our Client did not had Controller, models, Nop.Web.cs project. Initially We did not require to access much of the Nop.Web project as everything was managed through Plugin
But now there was need to add a custom Link on the ProductTemplate.Simple.cshtml view of Nop.Web/Themes/Motion/View/Catalog
Link was to add the product into a custom registry Cart.
The link access ActionResult from "Catalog" Controller supposed to be in Nop.Web Controller.
I need to pass it our Custom Plugin Controller and Action Result. But it throws error as it cannot find the controller nor "Our Custom Plugin Controller" neither the "Catalog" controller.
Can anyone suggest us solution to achieve this in better way.
Any help will be appreciated.
Can you open your controller action in a separate window? Are you sure it's valid?
Have you looked at widgets which are supported by nopCommerce? This way you won't need to edit the cshtml file

How do I set push-state in durandaljs 2.0 the works on refresh?

I'm using durandaljs 2.0. I've installed the durandal starter-kit as suggested and explained here. In the shell I'm returning router.activate({ pushState: true } ); as explained in the relevant documentation (see the bottom of the page).
Happily, the URL is indeed in a 'push state' format, e.g. http://localhost:61285/flickr - the problem is that when I refresh the page I get a 404 error telling me "the resource cannot be found". If I set push-state to false ({pushState: false} above) I get a hashed URL, e.g. http://localhost:61285/#flickr - and now a refresh does work. So, how do I set up a push state mode in durandaljs 2.0 that will work with refresh?
Thanks,
Elior
Maybe to late...but
just change the routes config.
simple as this :
routes.MapRoute(
name: "Default",
url: "{*url}",
defaults: new { controller = "Home", action = "Index" }
);
When you refresh the page, the browser will make a request to the server with that URL http://localhost:61285/flickr.
What's probably happening is that if you are using ASP.NET MVC, the server is trying to locate a Controller called flickr and it throws an exception because obviously there isn't any resource with that name.
In order to get rid of this exception you should configure the server to serve the same HTML of the APP but for unknown URL's. This can be achieved using IIS URL Rewrite in ASP.NET.
So after setting up properly the server, by requesting an unknown URL it would return the initial view for the app plus whatever you pass in the query string parameters so the router can do its job at client side.
In this blog post you will find more information about how to configure ASP.NET to handle this scenarios. In the article the author uses AngularJS, however it will be the same for Durandal.
RainerAtSpirit and margabit, you're both right, thank you. Here is how I implemented the server side:
First I should note that all the interaction with the server is done via WebApi controllers.
so, for example, if the URL is:
http://localhost:61285/home/category2/subCategory22 (for a localhost), the server tries to look for a controller called 'home' and an action in it called 'category2'. Since there's no such action, I get a 404 error.
What I wanted is that the server WILL call the 'home' controller, but send the rest of the URL as parameters to the client. My solution was to add a hash after the controller's name, so that the URL will look like this: http://localhost:61285/home/#/category2/subCategory22. If this would happen then the client will take care of the hashed part with no 404 error.
For this to happen:
I added the following to 'web.config':
<customErrors mode="On" defaultRedirect="Error">
<error statusCode="404" redirect="Error" />
</customErrors>
Then I create a controller named 'ErrorController' with the following class in it:
public class ErrorController : ApiController
{
[HttpGet, HttpPost, HttpPut, HttpDelete, HttpHead, HttpOptions, AcceptVerbs("PATCH"), AllowAnonymous]
public HttpResponseMessage Handle404()
{
string [] parts = Request.RequestUri.OriginalString.Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries);
string parameters = parts[ 1 ].Replace("aspxerrorpath=","");
var response = Request.CreateResponse(HttpStatusCode.Redirect);
response.Headers.Location = new Uri(parts[0].Replace("Error","") + string.Format("#{0}", parameters));
return response;
}
}
what happens is that when the server get a URL with no relevant action as I mentioned above, it redirects it to this controller in the following format: http://localhost:61285/Error?aspxerrorpath=home/category2/subCategory22
as you can see, I manipulate this to add the hash and remove the unnecessary info: http://localhost:61285/home/#/category2/subCategory22 and the redirect the server to the 'home' controller.
You might wonder why I do all of this - the reason is that Durandal, a wonderful platform, enables me to use push state, but in order for that to happen I have to work-around the server getting a non-hashed URL and pass it to the client despite the fact there's no relevant controller/action; Durandal get's a hashed URL but removes the hash automatically and the user eventually sees a hash-less URL while Durandal provides all the necessary push state functionality.
Elior

how to redirect one area to another area

I have two controllers in my MVC4 Project.
One controller is in default controller name called Login.
another controller is in area .area name called HR.inside controller name called AddNewHire.
inside AddNewHire i written AddNewEmployee method.
in Login controller i am having one method .that name is LoginButton
inside LoginButton method i written
return RedirectToAction("AddNewEmployee","AddNewHire",new {area="HR"});
am getting Error Like
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /AddNewHireController/AddNewEmployee
Try using RedirectToRoute instead of RedirectToAction. What you would have to do is to define a route. Have a look at this MSDN link (Walkthrough: Creating an ASP.NET MVC Areas Application Using Multiple Projects

adding more functions in refinery controller and getting error

I am new Refinerycms. I create my own engine called "foodfind" (FoodFinder\vendor\extensions\foodfinds). to become flexible I want to add more functions in client side controller (app\controllers\refinery\foodfinds\foodfinds_controller.rb) and their view pages.
I am trying to do this but getting an error No route matches {:controller=>"refinery/foodfinds/foodfinds", :action=>"new", :locale=>:en}
help
Use rake routes to check if you have a route for that action. If not, then you have to add it to the routes file.