Skip to content

Instantly share code, notes, and snippets.

@asterion
Last active April 18, 2022 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asterion/946df345ae9a3d1bcee5ca73254daf95 to your computer and use it in GitHub Desktop.
Save asterion/946df345ae9a3d1bcee5ca73254daf95 to your computer and use it in GitHub Desktop.
Magento

Magento en modo mantenimiento

bin/magento maintenance:enable
bin/magento c:c
bin/magento c:f
bin/magento maintenance:disable
bin/magento c:c
bin/magento c:f

fastly:maintenance

Cambiar URL base para HTTP y HTTPS

bin/magento setup:store-config:set --base-url="https://www.your-domain.com/"
bin/magento setup:store-config:set --base-url-secure="https://www.your-domain.com/"

Definir URL path al admin

bin/magento setup:config:set --backend-frontname=admin

Listar URL con caracteres especiales

SELECT p.sku, u.request_path FROM url_rewrite u, catalog_product_entity p WHERE u.entity_id = p.entity_id AND u.request_path REGEXP '[^a-zA-Z0-9\-\.\/\(\)]' ORDER BY p.sku, u.request_path;

Eliminar preferencias de usuario en admin

Buscar id de usuario
SELECT user_id, email FROM admin_user;
Eliminar preferencias
DELETE FROM ui_bookmark WHERE namespace = 'product_listing' AND user_id = [ID] AND identifier = 'current';
DELETE FROM ui_bookmark WHERE namespace = 'sales_order_grid' AND user_id = [ID] AND identifier = 'current';
Eliminar todas las preferencias de usuario
DELETE FROM ui_bookmark WHERE user_id = [ID];

Crear proyecto community para version especifica

php -d memory_limit=8G /usr/bin/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.5p2 --ignore-platform-reqs

Recompilar estaticos

bin/magento setup:static-content:deploy -f en_US
bin/magento setup:static-content:deploy -f es_CL

Configurar conección con Rabbitmq

bin/magento setup:config:set --amqp-host=rabbitmq.magento235p2.develop --amqp-user=guest --amqp-password=guest --amqp-virtualhost="/" --amqp-port=5672

Listar colas de consumers

bin/magento queue:consumer:list

Ejecutar consumer

bin/magento queue:consumer:start async.operations.all

Establecer modo developer

bin/magento deploy:mode:set developer

Desahabilitar modulos

bin/magento module:disable Nombre_Modulo

Desahabilitar Magento_TwoFactorAuth

  • recomendaod solo para local.
bin/magento module:disable Magento_TwoFactorAuth

Instalación desde consola

  • versión 2.4 necesita elasticsearch
bin/magento setup:install \
--base-url=http://localhost \
--db-host=localhost \
--db-name=magento2 \
--db-user=magento2 \
--db-password=magento2 \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=correo@example.com \
--admin-user=admin \
--admin-password=admin123 \
--language=es_ES \
--currency=CLP \
--timezone=America/Santiago \
--use-rewrites=1 \
--backend-frontname=admin \
--elasticsearch-host=elasticsearch
php bin/magento setup:install \
  --admin-firstname=Juan \
  --admin-lastname=Perez \
  --admin-email=example@gmail.com \
  --admin-user=admin \
  --admin-password='password1234' \
  --base-url=https://magento244.local \
  --base-url-secure=https://magento244.local \
  --backend-frontname=admin \
  --db-host=db_magento244_m2 \
  --db-name=magento \
  --db-user=magento \
  --db-password=magento \
  --use-rewrites=1 \
  --language=en_US \
  --currency=CLP \
  --timezone=America/Santiago \
  --use-secure-admin=0 \
  --admin-use-security-key=0 \
  --session-save=files \
  --use-sample-data \
  --elasticsearch-host=elasticsearch_magento244_m2

Eliminar registros de theme en base de datos

delete from <dbname>.theme where theme_path ='<Vendor>/<theme>' AND area ='frontend' limit 1"

Cambiar language

bin/magento setup:store-config:set --language=en_US
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment