PrestaShop - calling module methods from Vue.js back office application - prestashop

I'm working on PrestaShop module. I have Vue.js app which is running in the backoffice, and I want to make an http request to my module class in order to populate some data. How can this be achieved?
I want to be able to simply expose some kind of API, or call php method in some way.
I was able to expose some API endpoints to FrontEnd of module using custom fronts controllers, but I have no idea how to make this work in backoffice. Any help would highly valuable for me, thanks!

Like for the Front office, you can create controllers inside the Back office. Here's a page from the developer documentation:
https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/
Make sure to check some of the examples from the native modules:
https://github.com/PrestaShop/blockwishlist/blob/dev/src/Controller/WishlistConfigurationAdminController.php
https://github.com/PrestaShop/example-modules/tree/master/democontrollertabs

Related

How can I possibly implement a VueJS app to Odoo?

I have to integrate a VueJS app in Odoo. I don't exactly know how I can achieve that?
I found this https://www.odooinvue.org/ (not my app, but an example app) . Still no idea on how can I implement odoo in Vue. Login gives me a Failed to Login error message in this example app.
Any idea how to implement odoo in vue??
Actually, odooinvue works fine. Read carefully the instructions, in development it shows how to start a traefik docker container in order to serve both odoo and Vue.js.
Note: If I am not wrong, the purpose is to use odooinvue as a pure frontend, so it's not really an integration, basically you build vuejs (quasar, specifically) apps with odoo used as a pure backend.
See also this answer, by odooinvue's author
I am the author of that project. Its really impossible to answer you without knowing what steps you have taken to setup the project, but for that error, make sure of the following:
The Odoo server is up and running in the backend and you can login.
When you login with the front-end Vue app, you are using credentials that you know are working.
If that fails, open the dev console of your browser and check the network log. Make sure that the authentication request is returning status code 200.
I know others that are using the project just fine without any issue, so I am going to assume that you need some technical help. Perhaps hire a software developer to assist you.

Directus api and app on same server as front-end

I'm attempting to create a small website using Directus as a back end, since it has a nice interface for managing a database. The front end will be coded in VueJS, and I'd like them both on the same site. I'm using Apache. For example:
www.example.com = VueJS frontend that pulls information from the Directus backend
www.example.com/admin = Directus admin link
www.example.com/api/[whatever] = RESTful api access
I've messed around with virtualhosts a bit but I can only move the entire directus app to a different port, which I don't want to do since I don't want admins to have to type the port number in manually if they want to access the example.com/admin interface.
I think you can put the API on sub-domain like api.example.com that way both will be available on the same server.
I am just starting with the Directus and met with the same issue of putting both components and thought to put as written above.
If you followed some other approach, pls post here so that it can help people like me.
I have created a small mixin library for Vue.JS 3 and Directus API that makes it easier for developers to make API calls quicker and with almost no code needed.
It supports fetchCollection, fetchBtId, Sort, Filter and Search API endpoints.
Check it out. Hope it helps anybody in the future.
https://github.com/Slaveworx/api-rabbit

Add Function to Existing Angular Controller in VirtoCommerce Storefront

I would like to add a function to the cartController (angular) in the storefront.
I could fork the storefront and then make my change and start loading only "my" storefront.
Is there a way to build my own module with the purpose of extending or overriding the controller so I can still use the base storefront module and just extend with my changes.
To extending storefront you should adhere to the following rules to be able to update to the latest storefront version without 'merging hell':
Try to avoid direct exist storefront controller changes, create own
controllers in separated solution folders with using prefixes for class and file names. e.g
VirtoCommerce.Storefront/MyExtension/myCartController
Register new routes and dependencies by modifying Startup.cs (it
is exception)
All storefront model classes marked as partial and will be easily
to split the definition over two or more source files within
VirtoCommerce.Model and VirtoCommerce.LiquidThemeEngine projects. e.g
VirtoCommerce.Storefront.Model/MyExtension/ShoppingCart.cs
About theme customization please read my answer on Starting VirtoCommerce Storefront Theme Development stackoverflow question
How to use new modules API in the storefront described in this article How to generate module API C# client using AutoRest
In this article you can see the overall solution development process.

How To Remotely Change the Content In umbraco using Apis

Hello EveryOne I'm New To Umbraco I did Some Simple Umbraco Sites and Im good with so far Based on my Humble .Net background My Question is : How can i Remotely Change the Content of My umbraco form Other Pc or Something like that using Web service or APIs or what ever Im Looking foreword For a Good answer
Thanks In Advance
Depending on your needs, you can create a webapi on top of your Umbraco instance. You'll have to implement the actions yourself.
See this reference on how to implement it
Another option is installing Umbraco Rest API. This will add functionality for managing content and media through a rest service. Haven't tried this plugin myself, so no clue if works in the current version.
Some additional information can be found here

How do I create my own API in Yii2?

I want to create API methods which you can access form another platform. Just see the following diagram.
In the above image you can see how to fetch data from Yii2 app using another application, I wanna use same procedure when I going to push data into Yii2 application from the another application. That's means Yii2 just provides api methods to clint to push/pull data.
Give me some suggestion?
Yii2 provides ready to use RESTful Web Service API. http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html
First of all, you will need separate module for API.
If you use Advanced template (with backend, frontend), you'll need to create api directory in root level of your project. If your project is big, and API will changes in future and your API is for many clients, you should make versioning API. Create directory "modules" in api directory, then create directory "v1" in "modules". In future, if you'll need make a huge changes, create second directory, like "v2".
If you use Basic template, just create modules directory, then create API module.