I've create a custom Store route inside Shopware 6 as a plugin.
It shows up in the store-api/_info/swagger.html url.
What is does is it return an array with static text for now.
Now is my question, how would i call this url inside the pwa with vuestorefront.
I created a page inside src/pages but i cant wrap my mind around how to call the url to ge the data.
Do i need to specify the whole url in the axios? I cant find any documentation about this.
Thanks in advance!
You approach so far is correct.
Create a new Store API route to fetch data from Shopware
Create a new Nuxt page by creating a page in src/pages.
Now we only need to connect the dots.
Nuxt pages are simply Vue components, so you can use the invokePost or invokeGet methods from the shopware-6-client package to call your custom endpoint.
You could also use axios to do it, but then you'll need to handle additional parameters (e.g. passing the correct sw-context-token or sw-access-key manually.
Related
I have a laravel project with a raw (. php) page. On this page is a form. I would like to post this form from the raw php page to a controller I have. How, if possible can I achieve this?
So after looking around online, I found the answer to be that I needed to use API routes. The file is located in Routes/api.php. One can add their routes there so requests from outside the Laravel application can be sent in. Simply add your route there and corresponding action for said route.
I've found a number of plugins for wordpress that add a link to the table in the backend to clone or duplicate a post or page (Duplicate Post, Clone Post, and Post Duplicator). This is nice, but I'm building a bit of an app on wordpress where I'm using a custom post type as an entry and would like to be able to quickly copy an entry with a link from the frontend of the site (similar to how edit_post_link works but without jumping into the backend).
I'm using Gravity Forms for the create and edit functionality for entries on the frontend, but I can't quite figure out the best approach for a secure way to submit a request, execute the clone query, and the return to the same page I was on before (i.e. not jumping into the backend). Gravity Forms Post Updates plugin does something similar with a do_action call to generate a link. I've looked through this function and generally get what's happening, but I'm not sure if I need all of the extra plugin class structure.
I was hoping to find an example of a function that could create a secure url with a nonce and then another function we validate the url and execute the query and return to the previous page. Is this the right way to go or am I barking up the wrong tree? If so, any code samples or examples that might be able to help get me started?
Much appreciated!
I found this post (http://rudrastyh.com/wordpress/duplicate-post.html) and was able to figure out what I needed to. Instead of adding a filter to include the link in the backend, I instead created an action that can be called with do_action and generates the link. I also have a page and page template that is solely for executing the call and then redirecting back to the referring url.
I have a laravel 4.2 app. And I have filters on many of the routes.
I am trying to display navigation and I would like to be able to check that a link can be accessed before displaying it.
I can't see a way to check that a routes before filters would pass given a URL.
Is this possible?
I have tried to get the route using the method in this question
But calling callRouteBefore() on it doesn't seem to give the expected results. I think it is due to the session not being right.
I've just started using Slim and Twig and getting to grips with it all.
I am building a small site and will have a Twitter feed on every page. So, I want to put this in my layout template (base.html.twig). The only way I can see to do it is to pass it in to every route and then use an include that can access the details.
Seems like there must be a way to set it in the layout template once without passing it in through every route?
Any help or a related link would be great.
you can extend twig with user defined functions, just make a call inside template and you will not need for passing it every time http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
I'm working on updating my Slim API and wanted to add the ability to define the type of response for a route within the routes url. Similar to how Reddit or Rails does it where you can add a .html,.json, or .xml to a route and have that route return the proper formatted data. Below is a Reddit example of one route being able to return a json,xml, or html response by changing the ending to whatever response type.
http://www.reddit.com/r/ObjectiveC.json
Is this something I will have to do manually with middleware parsing every route or does Slim have this built in? Any help would be greatly appreciated.
Thanks
What you're looking for isn't natively available, but you might want to look at the ContentTypes Middleware in the Slim-Middleware repo. I think that'll get you close to where you need to go, although the type is detected via the content type header via \Slim\Http\Request::getMediaType.