### Example Environment Variables Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Illustrates environment variables that can be set in a .env file for production setup. ```bash SRC_DIR=./pub STATIC_DIR=./static BASE_URL=https://frontend.example.com/ ADMIN_URL=https://backend.exmaple.com/ ``` -------------------------------- ### Install OpenMage Sample Data Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Installs OpenMage sample data using the 'ddev openmage-install' command. Flags can be used to customize the installation process. ```bash ddev openmage-install -d -s -k -q ``` -------------------------------- ### Run Fresh Installation Script Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Copies and executes a script to set up a fresh OpenMage installation. ```bash cp dev/openmage/install.sh . ./install.sh ``` -------------------------------- ### DDEV Project Configuration and Installation Source: https://github.com/openmage/magento-lts/blob/main/docs/content/blog/posts/guides/2024-02-17-ddev-windows-10.md Commands to configure a DDEV project, install Composer dependencies, and install OpenMage with sample data. ```bash ddev config ddev composer install ddev openmage-install -s -k ``` -------------------------------- ### Start MkDocs Development Server Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/mkdocs.md Starts the MkDocs live-reloading documentation server for local development. ```bash mkdocs serve ``` -------------------------------- ### Install phpMyAdmin Add-on Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Installs the phpMyAdmin add-on for DDEV. Restart DDEV after installation. ```bash ddev get ddev/ddev-phpmyadmin ``` -------------------------------- ### Install openmage-turpentine-varnish Cache Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/cache.md Install the Varnish connector for OpenMage using Composer. ```bash composer require luigifab/openmage-turpentine-varnish ``` -------------------------------- ### Install Browsersync Add-on Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Installs the Browsersync add-on for DDEV to enable live reloads and other features. Restart DDEV after installation. ```bash ddev get ddev/ddev-browsersync ddev restart ddev browsersync ``` -------------------------------- ### Start and Launch DDEV Project Source: https://github.com/openmage/magento-lts/blob/main/docs/content/blog/posts/guides/2024-02-17-ddev-windows-10.md Commands to start the DDEV environment and launch the OpenMage project in the browser. ```bash ddev start ddev launch ``` -------------------------------- ### Install Legacy Frontend Themes Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/changelog/index.md Use this Composer command to install legacy frontend themes. ```bash composer require openmage/legacy-frontend-themes ``` -------------------------------- ### Install OpenMage Ignition Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/log-debug.md Install the spatie/ignition integration for OpenMage using Composer. ```bash composer require empiricompany/openmage_ignition ``` -------------------------------- ### Install OpenMage with Docker Compose Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Clones the repository, sets up a Docker Compose environment, and installs OpenMage. Visit http://openmage-7f000001.nip.io/ to access your site. ```bash git clone https://github.com/OpenMage/magento-lts.git && cd magento-lts && dev/openmage/install.sh ``` -------------------------------- ### Install Defer JavaScripts Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/frontend.md Use this command to install the defer JavaScripts module for OpenMage. ```bash composer require fballiano/openmage-defer-javascripts ``` -------------------------------- ### Install MkDocs and Plugins Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/mkdocs.md Installs MkDocs and essential plugins like mkdocs-material, mkdocs-minify-plugin, and mkdocs-redirects using pip3. ```bash pip3 install mkdocs mkdocs-material mkdocs-minify-plugin mkdocs-redirects ``` -------------------------------- ### Install empiricompany/openmage-paypal-pay-later-banner-info Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/payment.md Use this command to install the PayPal Pay Later Messages module for OpenMage. ```bash composer require empiricompany/openmage-paypal-pay-later-banner-info ``` -------------------------------- ### Install CSS/JS Versioning Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/frontend.md Use this command to install the CSS/JS versioning module for OpenMage. ```bash composer require fballiano/openmage-cssjs-versioning ``` -------------------------------- ### Initialize New Composer Project Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/install/use-composer.md Use this command to start a new project with Composer. ```bash composer init ``` -------------------------------- ### Launch Production Environment Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Starts the production Docker environment with all configured services. ```bash docker compose up -d ``` -------------------------------- ### Retrieving Product Information Example (PHP) Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/index.md A PHP code example showing how to retrieve product information using the `catalog_product.info` method after obtaining a session ID. ```APIDOC ## Retrieving Product Information ```php '2.0', 'method' => 'call', 'params' => [ $sessionId, 'catalog_product.info', 'product_sku_123' ], 'id' => 2 ); $ch = curl_init($jsonRpcUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result['result']); ?> ``` ``` -------------------------------- ### Install empiricompany/openmage-mm_monacoeditor Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/backend.md Installs the Monaco Editor integration module for CMS Static Blocks and Pages. ```bash composer require empiricompany/openmage-mm_monacoeditor ``` -------------------------------- ### Authentication Example (PHP) Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/index.md A PHP code example demonstrating how to authenticate with the OpenMage API to obtain a session ID. ```APIDOC ## Authentication ```php '2.0', 'method' => 'login', 'params' => ['apiuser', 'apikey123'], 'id' => 1 ); $ch = curl_init($jsonRpcUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); $sessionId = $result['result']; echo "Session ID: " . $sessionId; ?> ``` ``` -------------------------------- ### Install flagbit/magento-changeattributeset Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/backend.md Installs a module that allows switching the attribute set for products in Magento. ```bash composer require firegento/logger ``` -------------------------------- ### Install openmage-lesti-fpc Cache Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/cache.md Install the simple Magento Full Page Cache module using Composer. ```bash composer require fballiano/openmage-lesti-fpc ``` -------------------------------- ### Get DDEV Add-ons Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md List available DDEV add-ons or get a specific add-on. ```bash ddev get --list ``` ```bash ddev get drud/ddev/cron ``` -------------------------------- ### Install OpenMage with Docker Compose and Sample Data Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Installs OpenMage using Docker Compose and includes the Magento Sample Data. Set the SAMPLE_DATA environment variable to 1. ```bash git clone https://github.com/OpenMage/magento-lts.git && cd magento-lts && SAMPLE_DATA=1 dev/openmage/install.sh ``` -------------------------------- ### Install HoneySpam Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/captcha.md Use this command to install the HoneySpam module for OpenMage, which provides spam protection using honey pots. ```bash composer require magento-hackathon/honeyspam ``` -------------------------------- ### Example Stock Item Response Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/resources/cataloginventory_stock_item.md This is an example of the structured data returned when retrieving stock information for products. ```json { "jsonrpc": "2.0", "result": [ { "product_id": 1, "sku": "product1", "qty": 100.0000, "is_in_stock": 1, "manage_stock": 1, "use_config_manage_stock": 0, "min_qty": 0.0000, "use_config_min_qty": 1, "min_sale_qty": 1.0000, "use_config_min_sale_qty": 1, "max_sale_qty": 10000.0000, "use_config_max_sale_qty": 1, "is_qty_decimal": 0, "backorders": 0, "use_config_backorders": 1, "notify_stock_qty": 1.0000, "use_config_notify_stock_qty": 1 }, { "product_id": 2, "sku": "product2", "qty": 50.0000, "is_in_stock": 1, "manage_stock": 1, "use_config_manage_stock": 0, "min_qty": 0.0000, "use_config_min_qty": 1, "min_sale_qty": 1.0000, "use_config_min_sale_qty": 1, "max_sale_qty": 10000.0000, "use_config_max_sale_qty": 1, "is_qty_decimal": 0, "backorders": 0, "use_config_backorders": 1, "notify_stock_qty": 1.0000, "use_config_notify_stock_qty": 1 } ], "id": 1 } ``` -------------------------------- ### Install Cloudflare Turnstile Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/captcha.md Use this command to install the Cloudflare Turnstile module for OpenMage. ```bash composer require fballiano/cloudflare-turnstile ``` -------------------------------- ### OpenMage Database Connection Details Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Configuration details for connecting to the database when installing OpenMage. ```text Host: db Database Name: db User Name: db User Password: db ``` -------------------------------- ### Install Cm_Diehard Cache Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/cache.md Install the Cm_Diehard Full Page Cache module using Composer. ```bash composer require colinmollenhour/cm_diehard ``` -------------------------------- ### Install mkcert for Local HTTPS Source: https://github.com/openmage/magento-lts/blob/main/docs/content/blog/posts/guides/2024-02-17-ddev-windows-10.md Command to install mkcert, a tool for creating locally trusted certificates, on Windows. Ensure you are in the download directory and run as administrator. ```bash mkcert-vX.X.X-windows-amd64.exe --install ``` -------------------------------- ### Install and Update WSL Source: https://github.com/openmage/magento-lts/blob/main/docs/content/blog/posts/guides/2024-02-17-ddev-windows-10.md Commands to install, check version, update, and list available Linux distributions for Windows Subsystem for Linux 2. ```bash wsl --install wsl --version wsl --update wsl --list --online wsl --install -d DISTRO-NAME wsl --set-version 2 ``` -------------------------------- ### Install SCSS Compiler Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/phpstorm.md Install the Sass compiler globally using npm. This is a prerequisite for the SCSS file watcher. ```bash npm install -g sass ``` -------------------------------- ### Install FireGento AdminMonitoring Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/log-debug.md Install the FireGento AdminMonitoring module to log backend save and delete operations using Composer. ```bash composer require firegento/adminmonitoring ``` -------------------------------- ### Describe DDEV Project Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Get a detailed description of a running DDEV project. ```bash ddev describe ``` -------------------------------- ### Install Python 3.8 and Pip Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/mkdocs.md Installs Python 3.8 and pip using apt-get. Ensure your system's package list is up-to-date before running. ```bash sudo apt-get update sudo apt-get install python3.8 python3-pip ``` -------------------------------- ### Sales Order List Response Example Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/resources/sales_order.md This is an example of a successful response when retrieving a list of orders using the `sales_order.list` method. It includes details like increment ID, creation date, status, and totals. ```json { "jsonrpc": "2.0", "result": [ { "increment_id": "100000001", "order_id": 1, "created_at": "2023-01-15 14:30:12", "updated_at": "2023-01-15 14:30:12", "status": "pending", "state": "new", "customer_id": 1, "base_grand_total": 150.00, "grand_total": 150.00, "store_id": 1 }, { "increment_id": "100000002", "order_id": 2, "created_at": "2023-01-16 09:45:23", "updated_at": "2023-01-16 09:45:23", "status": "pending", "state": "new", "customer_id": 2, "base_grand_total": 75.50, "grand_total": 75.50, "store_id": 1 } ], "id": 1 } ``` -------------------------------- ### Stop and Remove Docker Compose Services and Volumes Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Wipes out the Docker Compose installation, including volumes, to start fresh. Ensure you are in the dev/openmage directory. ```bash docker compose down --volumes && rm -f ../../app/etc/local.xml ``` -------------------------------- ### Require Magento Core Composer Installer for PHP 7 Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/install/use-composer.md Install the Magento core composer installer package for projects using PHP 7. ```bash composer require "aydin-hassan/magento-core-composer-installer":"^2.0.0" ``` -------------------------------- ### Require Magento Core Composer Installer for PHP 8 Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/install/use-composer.md Install the Magento core composer installer package for projects using PHP 8. ```bash composer require "aydin-hassan/magento-core-composer-installer":"~2.1.0" ``` -------------------------------- ### Create a New MkDocs Project Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/mkdocs.md Initializes a new MkDocs project in the specified directory. ```bash mkdocs new [dir-name] ``` -------------------------------- ### Require Magento Core Composer Installer for PHP 7/8 Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/install/use-composer.md Install the Magento core composer installer package compatible with both PHP 7 and PHP 8. ```bash composer require "aydin-hassan/magento-core-composer-installer":"~2.0.0 || ^2.1.0" ``` -------------------------------- ### Build MkDocs Documentation Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/mkdocs.md Builds the static documentation site for deployment. ```bash mkdocs build ``` -------------------------------- ### Install mollie/magento Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/payment.md Use this command to install the Mollie payment gateway module for Magento. ```bash composer require mollie/magento ``` -------------------------------- ### Launch phpMyAdmin Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Launches phpMyAdmin in the browser using DDEV. ```bash ddev phpmyadmin ``` -------------------------------- ### Install vianetz/matomo-magento1 Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/analytics.md Use Composer to install the vianetz/matomo-magento1 Magento 1 extension. ```bash composer require vianetz/matomo-magento1 ``` -------------------------------- ### Login Authentication Example Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/index.md Demonstrates how to authenticate with the API using a username and API key to obtain a session ID. ```APIDOC ## Login Authentication Example ### Description This example shows a JSON-RPC request to the `login` method to obtain a session ID. ### Method `login` ### Parameters - **username** (string) - Required - The API username. - **apiKey** (string) - Required - The API key associated with the user. ### Request Example ```json { "jsonrpc": "2.0", "method": "login", "params": ["apiuser", "apikey123"], "id": 1 } ``` ### Response #### Success Response (200) - **result** (string) - The session ID for subsequent authenticated requests. #### Response Example ```json { "jsonrpc": "2.0", "result": "8b98a77a37f50d3d472302981e86aab2", "id": 1 } ``` ``` -------------------------------- ### Create a New Product via JSON-RPC Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/index.md Example demonstrating how to create a new simple product using the catalog_product.create method via JSON-RPC. Ensure you have a valid session ID and the correct API endpoint. ```php 'simple', 'attribute_set_id' => 4, 'sku' => 'new_product_123', 'name' => 'New Test Product', 'price' => 99.99, 'status' => 1, 'weight' => 1.0, 'visibility' => 4, 'description' => 'Product description here', 'short_description' => 'Short description', 'stock_data' => array( 'qty' => 100, 'is_in_stock' => 1 ) ); $requestData = array( 'jsonrpc' => '2.0', 'method' => 'call', 'params' => [ $sessionId, 'catalog_product.create', ['simple', 4, 'new_product_123', $productData] ], 'id' => 3 ); $ch = curl_init($jsonRpcUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); echo "Product ID: " . $result['result']; ?> ``` -------------------------------- ### Configure WSL2 Global Settings Source: https://github.com/openmage/magento-lts/blob/main/docs/content/blog/posts/guides/2024-02-17-ddev-windows-10.md Example of a .wslconfig file to set memory and processor limits for WSL 2. Place this file in C:\Users\. ```ini [wsl2] memory=4GB # Limits VM memory in WSL 2 up to 4 GB processors=6 ``` -------------------------------- ### mkcert Certificate File Paths Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md Example paths for mkcert certificate files on Windows and Linux, used for copying between systems. ```bash C:\Users\\AppData\Local\mkcert ``` ```bash /home//.local/share/mkcert ``` -------------------------------- ### Copy Sample Caddyfile Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/oneline.md Copies the sample Caddy configuration file to be customized for your domain names and store codes. ```bash cp Caddyfile-sample Caddyfile ``` -------------------------------- ### Install Magneto Debug Toolbar Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/log-debug.md Install the Magneto Debug Toolbar for development debugging in Magento 1.x using Composer. ```bash composer require madalinoprea/magneto-debug ``` -------------------------------- ### Install OpenMage Image Cleaner Module Source: https://github.com/openmage/magento-lts/blob/main/docs/content/users/modules/images.md Install the image cleaner module for OpenMage and Magento 1.9 using Composer. ```bash composer require fballiano/openmage-image-cleaner ``` -------------------------------- ### PHP Retrieve Product Information Example Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/index.md Shows how to retrieve product information using a session ID and the `catalog_product.info` method in PHP with cURL. Requires a valid session ID and product identifier. ```php '2.0', 'method' => 'call', 'params' => [ $sessionId, 'catalog_product.info', 'product_sku_123' ], 'id' => 2 ); $ch = curl_init($jsonRpcUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result['result']); ?> ``` -------------------------------- ### GET - Retrieving Resources Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/rest/http_methods.md The GET method is used to retrieve a representation of a resource by specifying its URL. It is defined in RFC2616 section 9.3. ```APIDOC ## GET /customers/{customerId} ### Description Retrieves information about a specific customer. ### Method GET ### Endpoint /customers/{customerId} ### Parameters #### Path Parameters - **customerId** (string) - Required - The unique identifier of the customer. ### Response #### Success Response (200) - **customer data** (object) - The representation of the customer resource. ``` -------------------------------- ### List DDEV Projects Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/tools/ddev.md List all available DDEV projects. ```bash ddev list ``` -------------------------------- ### Retrieve Customer Information with GET Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/rest/http_methods.md Use the GET method to retrieve specific customer data by providing the customer ID in the URL. ```http GET https://om.ddev.site/rest/customers/123 ``` -------------------------------- ### HTTP Basic Authentication Example Source: https://github.com/openmage/magento-lts/blob/main/docs/content/api/jsonrpc/index.md Illustrates how to use HTTP Basic Authentication for API requests, bypassing the need for a separate login call. ```APIDOC ## HTTP Basic Authentication Example ### Description This example demonstrates making an API call using HTTP Basic Authentication with PHP and cURL. The session ID is set to `null` when using this method. ### Method `call` (with HTTP Basic Auth) ### Endpoint `https://your-magento-store.com/api/jsonrpc` ### Parameters - **session_id** (string|null) - `null` when using HTTP Basic Authentication. - **method** (string) - The API method to call (e.g., `catalog_product.info`). - **params** (array) - Parameters for the API method. ### Request Example (PHP cURL) ```php '2.0', 'method' => 'call', 'params' => [ null, // Null session ID when using HTTP Basic Authorization 'catalog_product.info', 'product_sku_123' ], 'id' => 1 ); $ch = curl_init($jsonRpcUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_USERPWD, "$apiUser:$apiKey"); // HTTP Basic Authorization curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); print_r($result['result']); ?> ``` ### Response #### Success Response (200) - **result** (mixed) - The result of the API method call. #### Response Example (Depends on the method called, e.g., product information) ``` -------------------------------- ### Example .env File Configuration Source: https://github.com/openmage/magento-lts/blob/main/docs/content/developers/samples/env.md This snippet shows how to set environment variables in a .env file for OpenMage. It includes enabling developer mode, allowing configuration overrides, and setting a custom configuration value. ```ini MAGE_IS_DEVELOPER_MODE=1 OPENMAGE_CONFIG_OVERRIDE_ALLOWED=1 OPENMAGE_CONFIG__DEFAULT__GENERAL__STORE_INFORMATION__NAME="My OpenMage Store" ```