Create a Frontend Form

Read: https://magento.stackexchange.com/questions/222423/how-to-create-a-form-and-save-that-data-in-database-in-magento-2/222427
Create a directory Advcha/MyForm in your magento root project/app/code
Then create a new file registration.php:

Then in etc/module.xml:

Then do this to make sure it’s okay.

Create a frontend router in etc/frontend/routes.xml:

I want the url to show the form is /myform/myform/index
So create a dir and file in Controller/MyForm/Index.php. But I need to create a layout first in view/frontend/layout/myform_myform_index.xml:

Then create a block in Block/MyForm.php:

Then create the template in view/frontend/templates/myform.phtml:

Then here is the controller in Controller/MyForm/Index.php:

DONE! PLS RUN

CHECK THE PAGE IN URL LIKE: http://scm.test/myform/myform/index
PLS TRY TO FILL THE FORM THEN PRESS THE SUBMIT BUTTON!

MacOS Mojave Nginx

Run ‘brew doctor’. BUT I GOT SOME WARNINGS:

SOLVE THE WARNINGS

MODIFY nginx CONFIG IN /usr/local/etc/nginx/nginx.conf:

HERE IS THE CONTENT

RESTART nginx SERVICE

CHECK THE CONFIG. BUT I GOT SOME ERROR AND MANAGE TO SOLVE IT

 

Install Akeneo 3.1 Community Ed.

Ref: https://docs.akeneo.com/2.0/install_pim/installation_ce_archive.html
Download from https://www.akeneo.com/download/
Extract the files (composer.phar is included) in root web/akeneo31
Go to the dir

and run TO INSTALL DEPENDENCIES

Then install with ‘yarn’
NOTE:BUT MAKE SURE node version > 8.10.0

THEN INSTALL FRONTEND. CLEAR CACHE BUT GOT THIS:

SOLUTION:
READ: https://stackoverflow.com/questions/36129259/php7-with-apcu-call-to-undefined-function-apc-fetch
SO INSTALL php-apcu

THEN ENABLE THE EXTENSION. IF YOU CAN’T FIND THE APCU SETTING, PLS DO

SO ‘apc.enable_cli’ IS OFF. SO MODIFIED THE INI FILE

THEN ADD ONE LINE:

SAVE THEN RESTART THE SERVICES

CHECK AGAIN

THEN RUN AGAIN:

THEN CONTINUE TO RUN ‘php bin/console pim:installer:assets –symlink –clean –env=prod’

THEN THE INSTALLATION. BUT I GOT AN ERROR

SOLUTION:
READ https://docs.akeneo.com/2.0/install_pim/system_requirements/system_install_ubuntu_1604.html
Creating a MySQL database and a user for the application

THEN RUN AGAIN. BUT GOT ANOTHER ERROR:

SOLUTION:
INSTALL ELASTIC SEARCH FROM https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-key

START ELASTICSEARCH SERVICE

CHECK ON THE BROWSER: http://localhost:9200/
SHOULD SHOW

THEN RUN AGAIN. BUT GOT ANOTHER ERROR:

SETUP NGINX CONF

CONTENT

THEN

Then

Then

Then

 

 

Magento 2 – Create Module API

CREATE A MODULE TO USE API TO PULL PRODUCTS DATA FROM SINOGOODIES (SG) WEBSITE
I PUT THE CODE IN app/code/advcha/SGApi DIRECTORY
Create registration.php

Create etc/module.xml

ENABLE THE MODULE

Create etc/webapi.xml

Create the API interface Api/SGInterface.php

Create a dependency injection di.xml for the SGInterface to the implementation in Model directory.
etc/di.xml

Create the implementation in Model/SG.php (FOR EXAMPLE)

SETUP UPGRADE AND COMPILE DI

TEST THE API CALL: http://ayoimport-dev.test/rest/V1/sgapi/getproduct
THE CORRECT RESPONSE WILL BE LIKE THIS:

 

Install Kubernetes On Ubuntu 16.04

ref: https://matthewpalmer.net/kubernetes-app-developer/articles/install-kubernetes-ubuntu-tutorial.html

NOTE: Make sure ‘virtualbox’ already installed!!!
Install kubectl

Install minikube (the newest 1.2.0) –> replace below ‘v0.28.2’ with ‘v1.2.0’!

We’re Done!
Now start up Minikube and use kubectl to find what version of Kubernetes you’re running on Ubuntu.
Minikube is a Kubernetes-specific package that runs a local development Kubernetes cluster on VirtualBox.
kubectl is the command line tool that lets you interact with your Minikube Kubernetes cluster.

 

Developing ASP.NET Core Project With VS Code – Razor Pages

ref: https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-2.2&tabs=visual-studio-code

Create a Razor Pages web app
Type in the terminal

Open it on VSCode

After the status bar’s OmniSharp flame icon turns green, a dialog asks Required assets to build and debug are missing from ‘RazorPagesMovie’. Add them? Select Yes.

A .vscode directory, containing launch.json and tasks.json files, is added to the project’s root directory.

Run the app
On the VSCode, open the terminal by pressing CTRL + ~
then type

NOTE: I FOUND THIS COMMAND: ‘dotnet dev-certs https –trust’ IS NOT WORKING
Then Press Ctrl-F5 to run without the debugger. It’ll open the browser automatically with this url: https://localhost:5001/

Add a data model
Add a folder named Models.
Add a class to the Models folder named Movie.cs.
Add the following properties to the Movie class:

Add a database context class
Add the following RazorPagesMovieContext class to the Data folder:

Add a database connection string
Add a connection string to the appsettings.json file as shown in the following highlighted code:

Add required NuGet packages
Run the following .NET Core CLI command to add SQLite and CodeGeneration.Design to the project:

The Microsoft.VisualStudio.Web.CodeGeneration.Design package is required for scaffolding.

Register the database context
Add the following using statements at the top of Startup.cs:

Register the database context with the dependency injection container in Startup.cs in ConfigureServices function:

Build the project (‘dotnet build’) to verify there are no compilation errors.

 

Scaffold the movie model
In this section, the movie model is scaffolded. That is, the scaffolding tool produces pages for Create, Read, Update, and Delete (CRUD) operations for the movie model.
Install the scaffolding tool:

Run the scaffolding tool to create CRUD for model ‘Movie’:

The scaffold process creates and updates the following files:

Files created
Pages/Movies: Create, Delete, Details, Edit, and Index.
Data/RazorPagesMovieContext.cs
File updated
Startup.cs
The created and updated files are explained in the next section.

 

Install MonoDevelop On Ubuntu 16.04

ref: https://www.monodevelop.com/download/

Add the Mono repository to your system (Ubuntu 16.04)

Install MonoDevelop

It’ll take a some time.
Open MonoDevelop (from terminal)

 

 

Install GrandNode On Ubuntu 16.04

ref: https://grandnode.com/how-to-install-grandnode-on-linux-ubuntu-1604

Install GrandNode eCommerce Platform on Ubuntu 16.04 | 18.04 | 18.10

Note: Make sure nginx, dotnet core 2.2 and mongodb 4.0 already installed!

Get and Clone it from github

Deploy and publish GrandNode. Publishing a .NET Core application bundles all the required run-time libraries (in the form of DLL’s) and copies across appsettings.json file as well as any public assets. We need to go to our application’s root directory. We will be able to pull in/download all the required NuGet packages, let’s do that now.

After a while, when it’s completed we can build plugins and publish our application. It compiles our code and bundles all the required dependencies to specific directory.

OR IT’D BE BETTER TO USE SINGLE LINE COMMAND (sudo dotnet build Plugins/Grand.Plugin.ExchangeRate.McExchange && sudo dotnet build Plugins/Grand.Plugin.ExternalAuth.Facebook && sudo dotnet build Plugins/Grand.Plugin.Feed.GoogleShopping && sudo dotnet build Plugins/Grand.Plugin.Payments.CashOnDelivery && sudo dotnet build Plugins/Grand.Plugin.Payments.CheckMoneyOrder && sudo dotnet build Plugins/Grand.Plugin.Payments.PayInStore && sudo dotnet build Plugins/Grand.Plugin.Payments.PayPalStandard && sudo dotnet build Plugins/Grand.Plugin.Shipping.ByWeight && sudo dotnet build Plugins/Grand.Plugin.Shipping.FixedRateShipping && sudo dotnet build Plugins/Grand.Plugin.Shipping.ShippingPoint && sudo dotnet build Plugins/Grand.Plugin.Tax.CountryStateZip && sudo dotnet build Plugins/Grand.Plugin.Tax.FixedRate && sudo dotnet build Plugins/Grand.Plugin.Widgets.GoogleAnalytics && sudo dotnet build Plugins/Grand.Plugin.Widgets.Slider)

Then publish the compiled Grand.Web in /home/teddy/Documents/works/grandnode (NOTE: BE CAREFULL WITH THE COMMAND FROM THE WEBSITE LIKE: sudo dotnet publish Grand.Web –c Release –o /var/webapps/GrandNode. THIS IS BECAUSE  –c AND –o ARE NOT PROPER FONT. IT SHOULD BE -c AND -o ). IF YOU GET THIS ERROR:

IT MEANS THE FONT IS NOT CORRECT (ref: https://github.com/grandnode/grandnode/issues/356). SO HERE IS THE CORRECT ONE:

In the next step we need to set the permissions so that the user that our service is running under (by default this will be www-data in this tutorial) can have the required access rights, we do this by running:

Test locally (https://docs.microsoft.com/en-US/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2)! Go to the root /home/teddy/Documents/works/grandnode. then run ‘dotnet Grand.Web.dll’
(NOTE: NEED TO USE ‘sudo ..’):

Then when I open it on my browser: http://localhost:5000/
I got this error:

SOLUTION: use ‘sudo dotnet Grand.Web.dll’ INSTEAD OF ‘dotnet Grand.Web.dll’

Open it again in my browser: http://localhost:5000
OKAY. The first time it’ll be redirected to install page (http://localhost:5000/install)Here is the install setting:
Admin user email: admin@yourstore.com
Admin user password: teddy
MongoDB Server name: localhost
Database name: grandnode
MongoDB Server Username: grandnodeuser
MongoDB Server Password: grandnode
Then click ‘Install’ button.
wait until the installation is finished with this message

Then shutdown the process in the terminal (CTRL + C) then start again with the above command ‘sudo dotnet Grand.Web.dll’
Then open again in your browser: http://localhost:5000/

Configure NGINX with GrandNode
Everything works fine, but we are not able to connect with our GrandNode from our computer. The reason is simple, GrandNode is running locally on our machine on port 5000. In thix example, we will present the simplest way of reverse-proxy traffic to your application. It will forward traffic from port 80 to your local machine on port 5000.
Create the config file:

Here is the content:

NOTE: IF THIS APP IS NOT RUNNING, PLS COMMENT ‘proxy_pass’ COMMAND ABOVE (OR BETTER ALL ‘proxy_*’). BECAUSE IT’D MAKE NGINX CAN’T EXECUTE THE OTHER LOCAL WEBSITES (BECAUSE OF THE PROXY TO PORT 5000)!!!
then create a symbolic link:

then register the host on my system:

Add this:

Then test: Test: http://grandnode.test/
NOTE: MAKE SURE THE DOTNET APP IS ALREADY STARTED (‘sudo dotnet Grand.Web.dll’). IN THE PROD SERVER, TO MAKE SURE THIS APP ALWAYS START, I CAN CREATE THE SERVICE (SEE: https://docs.microsoft.com/en-US/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2)
Here is the look: http://grandnode.test/apple-macbook-pro-13-inchThe admin page: http://grandnode.test/adminInstall missing package:
he last touches. We need to update packages and install libgdiplus.

 

Install MongoDb for Ubuntu 16.04

Ref: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04

Install MongoDB on Ubuntu: 5 Easy Steps

Install GrandNode eCommerce Platform on Ubuntu 16.04 | 18.04 | 18.10

This tutorial installs MongoDB 4.0 Community Edition . For other versions of MongoDB, refer to the corresponding version of the manual.
1. Import the public key used by the package management system.
The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import theMongoDB public GPG Key:

2. Create a list file for MongoDB.
Create the list file /etc/apt/sources.list.d/mongodb-org-4.0.list for your version of Ubuntu.

Click on the appropriate tab for your version of Ubuntu. If you are unsure of what Ubuntu version the host is running, open a terminal or shell on the host and execute lsb_release -dc.

3. Reload local package database.
Issue the following command to reload the local package database:

4. Install the MongoDB packages.
You can install either the latest stable version of MongoDB or a specific version of MongoDB.

Start MongoDb service

Check MongoDb status

Verify that the mongod process has started successfully by checking the contents of the log file at/var/log/mongodb/mongod.log for a line reading

27017 is the default port the standalone mongod listens on.

Create a database
NOTE: Make sure mongodb already start or start it

then run ‘sudo mongo’:

type in the terminal this script

it will look:

 

Install DotNet Core SDK 2.2 For Ubuntu 16.04

Ref: https://dotnet.microsoft.com/download/linux-package-manager/ubuntu16-04/sdk-current

Register Microsoft key and feed
Before installing .NET, you’ll need to register the Microsoft key, register the product repository, and install required dependencies. This only needs to be done once per machine.

Open a terminal and run the following commands:

Install the .NET SDK
Update the products available for installation, then install the .NET SDK.

In your terminal, run the following commands:

OK. Check the dotnet version (dotnet –version) or more complete info (dotnet –info):

 

Create First DotNet App
ref: https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/create

The dotnet command creates a new application of type console for you. The -o parameter creates a directory named myFirstApp where your app is stored, and populates it with the required files. The cd myFirstApp command puts you into the newly created app directory.

The main file in the myFirstApp folder is Program.cs. By default, it already contains the necessary code to write “Hello World!” to the Console.

Run your app
In your terminal, run the following command:

Congratulations, you’ve built and run your first .NET app!

Edit your code
Open Program.cs in any text editor (e.g. Notepad) and add a new line of code below the one that prints “Hello World!”, like the following:

Save the Program.cs file, and run your code again.

Create First ASP.Net App
ref: https://dotnet.microsoft.com/learn/web/aspnet-hello-world-tutorial/create
Create your app
In your terminal, run the following commands:

Run your app
In your terminal, run the following command:

Then open it on your web browser: http://localhost:5000/Edit your code
Open Pages/Index.cshtml in any text editor and replace all of the code with the following:

Save the file then refresh the browser to see the change: