Loading the content... Loading depends on your connection speed!

Magento Multistore Website Configuration

Publicado el por admin / Publicado en Magento 2 | Dejar un Comentario

Magento Multistore Website Configuration

This article will explain how to configure your Magento store to use as Magento Multistore Website.

For explanation purpose, I’ll use two domain setup. You can use the same structure to create more websites for your Magento Multistore Website.

MAGENTO MULTISTORE STORES SETUP

First step to configure your Magento Multistore site, is to add two websites for your domains. Login to your administrator panel and go to

Stores -> Settings -> All Stores

Let’s look at each of three options

Web site

We need to focus on web site section of all stores. In default Magento comes with one web site (base). If you need more domains you need to create more web sites.

Websites not sharing cart, user sessions, payment gateways, shipping etc.

Store

Each website have at lease one store. Stores share cart, payment gateways etc.
Typically used in different product selections, menu structure etc.

Store View

Stores can have one or several store views. Store views typically used in layouts and lanugages

Click on Create Website. Create New website and note the code.

Magento multistore website

For my article I’ll use my base web site for first domain and Australian Web Site for second domain.

Magento Multistore

CONFIGURATION TWO DOMAINS

Next step is to configure our domains for our Magento site. Go to Stores -> Configuration -> Web -> General tab

Setup your Base URLs and Base URLs (secure)  to your default site, I’ve use multisite.fc5.forge.co.nz as our default store front.

Magento Multistore base url

While you still in Stores -> Configuration,  Select Australian web site from Store view on top of the configuration page.

Multistore select store view

Change Base URLs and Base URLs (secure) to your second web site(australian.fc5.forge.co.nz).

Multistore Base URL

BOOTSTRAPPING YOUR MAGENTO MULTISTORE

Open your index.php file and replace following line.

1
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $server);

With following 4 lines of code

1
2
3
4
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

 

Note:

If you have install mod_rewrite make sure enviorenment vairables are not prepending. If that is the case in your index page use as follows

1
2
3
4
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $_SERVER["REDIRECT_MAGE_RUN_CODE"];
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = $_SERVER["REDIRECT_MAGE_RUN_TYPE"];
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

.htaccess changes

Open your root .htaccess file and add following lines

1
2
3
4
SetEnvIf Host .*multidomain.fc5.forge.co.nz.* MAGE_RUN_CODE=base
SetEnvIf Host .*multidomain.fc5.forge.co.nz.* MAGE_RUN_TYPE=website
SetEnvIf Host .*australian.fc5.forge.co.nz.* MAGE_RUN_CODE=australia
SetEnvIf Host .*australian.fc5.forge.co.nz.* MAGE_RUN_TYPE=website

below

# SetEnv MAGE_MODE developer

Make sure to use correct MAGE_RUN_CODE for given url.

 

Go to #RewriteBase /magento/ and include following lines of code

1
2
3
4
RewriteCond %{HTTP_HOST} ^(.*)multidomain\.fc5\.forge\.co\.nz
RewriteRule .* – [E=MAGE_RUN_CODE:base]
RewriteCond %{HTTP_HOST} ^(.*)multidomain\.fc5\.forge\.co\.nz
RewriteRule .* – [E=MAGE_RUN_TYPE:website]</code>
1
2
3
4
RewriteCond %{HTTP_HOST} ^(.*)australian\.fc5\.forge\.co\.nz
RewriteRule .* – [E=MAGE_RUN_CODE:australia]
RewriteCond %{HTTP_HOST} ^(.*)australian\.fc5\.forge\.co\.nz
RewriteRule .* – [E=MAGE_RUN_TYPE:website]

Due to spamming we are not allow comment in this article. However if you have any Questions or Queries please send to nuwinda(at)forgeonline(dot)co(dot)nz.  For more information please refer Magento documentation .

Diferencias entre el modo development y production en Magento 2

Publicado el por admin / Publicado en Magento 2 | Dejar un Comentario
Modos de funcionamiento existentes en Magento 2: default, development y production

Modo default

El modo default es un modo que mezcla características del modo development y production, pero en general no lo utilizaremos. Es el modo activo por defecto cuando instalamos Magento 2.

Modo production

En modo production no muestra ningún error o excepción a través del navegador, y únicamente genera el report correspondiente en la carpeta var/report. Con este modo dotamos a nuestra instalación de mayor seguridad, ya que no se mostrarán rutas de archivos o información que pueda servir de base para ataques.

En modo production, Magento 2 realiza una recopilación de todos los archivos de recursos (archivos estáticos como css, js, imágenes y templates) dentro de la carpeta pub, lo que hace la ejecución más rápida.

A su vez la carpeta raíz de la instalación de Magento 2, puede tener únicamente permisos de lectura, para de esta forma aumentar el nivel de seguridad.

Modo desarrollo

En modo desarrollo, cualquier error o excepción en la ejecución del código, es visible directamente desde el navegador, además de guardarse en la carpeta var/reportcomo es habitual.

No es necesario que los archivos estáticos de la web se encuentren dentro de la carpeta pub.

Por el contrario, si un archivo css, js o de imagen no se encuentra dentro de la carpeta pub, Magento dispone de un sistema de fallback mediante el cual irá a buscarlo al módulo necesario.

Cambio a modo producción en Magento 2

Podemos pasar a modo producción en Magento 2, utilizando la línea de comandos y el nuevo interfaz de comandos.

/bin/magento deploy:mode:set production

De forma similar, para volver a modo desarrollo, utilizaremos:

/bin/magento deploy:mode:set developer

custom-styles.css fatstest

Publicado el por admin / Publicado en Sin categoría | Dejar un Comentario

You can create custom-styles.css by:

step 1: create custom-styles.css file at app/design/frontend/Codazon/fastest/fashion/web/css

step 2: You need to call custom-styles.css file on default_head_blocks.xml file path app/design/frontend/Codazon/fastest/fashion/Magento_Theme/layout (You can view this images https://postimg.org/image/kobx74ezn/)

After you change custom-styles.css file please remove all Magento cache in : System > Cache Management > Press all Flush cache button

magento2translations/language_es_es

Publicado el por admin / Publicado en Magento 2 | Dejar un Comentario

 

README

This is a Language Pack generated from the official Magento2 translations project at Crowdin. The European Spanish (español de España) translations used can be found here. This translation is usefull for people living in the Spain (España).

For our other language packs look at the Magento2Translations page.

Instalation

Via composer

To install this translation package with composer you need access to the command line of your server and you need to have Composer.

cd <your magento path>
composer require magento2translations/language_es_es:dev-master
php bin/magento cache:clean

Manually

To install this language package manually you need access to your server file system.

  • Download the zip file here.
  • Upload the contents to <your magento path>/app/i18n/magento2translations/language_es_es.
  • The composer files should then be located like this <your magento path>/app/i18n/magento2translations/es_ES/es_ES.csv.
  • Go to your Magento admin panel and clear the caches.

#Usage To use this language pack login to your admin panel and goto Stores -> Configuration -> General > General -> Locale options and set the ‘locale‘ option as ‘European Spanish (Spain)

Contribute

To help push the ‘European Spanish (español de España) Magento2 Language Pack (es_ES)‘ forward please goto this crowdin page and translate the lines.

Authors

The translations are done by the official Magento2 translations project.

Code generation is sponsored by Wijzijn.Guru.

How to upgrade Magento 2 with composer

Publicado el por admin / Publicado en Magento 2 | Dejar un Comentario

Introduction

Ugrading your Magento 2 version is very important to get newest features and security fixes. With newer versions you usually also get better performance from time to time and fixed bugs. Nowadays security is one of the most important topic for every web application but especially for e-commerce websites like Magento 2 because you have sensitive data in your database. Not upgrading Magento 2 means you are an easy target for potential attackers. We love open source but it also comes with some disadvantages. The code of Magento 2 is public available and can be viewed and analysed by everyone. The potential attacker just need to read about known security holes in a specific version in order to develop an exploit.

Preparations

Before you start upgrading your magento 2 version we recommend to follow these steps.

1. Download and install your Magento 2 installation on your local development or on a test environment. It’s highly recommended to do the upgrade first on a test environment before you apply the same commands on production.

2. Create a checklist with all functions and extensions to test. Testing the Magento 2 upgrade is the most time consuming part which can take some days.

3. Create a file system and database backup in case something goes wrong.

To backup the file system you can create a tarball. You can use the following command to create a tarball.

tar cfvhz file_system_backup.tar /home/cloudpanel/htdocs/magento2.mgtcommerce.com/

To backup the database we recommend to use mysqldump.

mysqldump -h127.0.0.1 -umagento2 -p --opt --single-transaction --quick magento2 > magento2_dump.sql

Magento 2 upgrade with composer – the right way

In this example we are going upgrade Magento 2 from version 2.1.1 to 2.1.2.

1. Login into your Magento 2 Server with SSH

ssh your-username@$your-server-ip

2. Navigate to the Magento 2 installation directory

/home/cloudpanel/htdocs/magento2.mgtcommerce.com/

3. By upgrading through composer, you can choose the version to upgrade. In our example we are upgrading to Magento2.1.2: ( Of course it will work also for any higher Magento Version in the future )

composer require magento/product-community-edition 2.1.2 --no-update

4. Run composer update command

composer update

5. Delete all generated di, view processes and cache files

rm -rf var/*

6. When composer update has been finished, upgrade your database by running the Magento 2 CLI command:

php bin/magento setup:upgrade

7. Flush magento cache

php bin/magento cache:flush

8. Deploy static files

php bin/magento setup:static-content:deploy

9. Generate Dependency Injection (DI) files

php bin/magento setup:di:compile

10. Run indexers

php bin/magento indexer:reindex

11. Verify the Magento 2 version upgrade

When you run the Magento 2 CLI you see the new version in the first line

php bin/magento

COMPILAR, ERROR 500 PERMISOS

Publicado el por admin / Publicado en Sin categoría | Dejar un Comentario

php -d set_time_limit=3600 -d memory_limit=1024M bin/magento setup:di:compile

Magento2 : An error has happened during application run. See exception log for details.

In Magento2 when we remove the modules from the directory, It will show the blank page with the below error message.

An error has happened during application run. See exception log for details

To solve this issue we need to follow the below steps.

1.Change it to developer mode if you are in different mode.

Php magento deploy:mode:set developer

2. Give write permission to var/ pub/ directory

chmod -R 777 var/ pub/

3. Deploy static content

Php magento Setup:static-content:deply

Now the site will be up and run without any issues.

Hope it helps for someone who starts to work on Magento2

BigDump: Solución para importar grandes archivos SQL sin las limitaciones de phpMyAdmin

Publicado el por admin / Publicado en Herramientas | Tagged , | Dejar un Comentario

En ocasiones surge la necesidad de importar una base de datos de gran tamaño, quizá debido a una migración de nuestra aplicación de un servidor a otro.

Al intentar restaurar un archivo muy pesado mediante phpMyAdmin obtendremos un aviso de error transcurrido un tiempo tras el intento de importación de datos.

Una solución en estos casos es utilizar un script PHP escrito por Alexey Ozerov y que está disponible gratuitamente en la página de su autor.

Para instalar BigDump debemos seguir los siguientes pasos:

  • Descargar el script desde la web del autor (inglés).
  • Subir el script a una carpeta del Hosting /tmp u otra.
  • Editar el archivo del script para incorporar los datos de la base de datos, usuario, contraseña y nombre del archivo sql a importar.
  • Desde el navegador llamar al script para su ejecución: http://www.dominio.com/tmp/bigdump.php
  • Para comenzar la importación hacer clic en “Iniciar Importación” (Start Import).
Magento | Prestashop | Aplicaciones Web | Posicionamiento Web (SEO) | Marketing Motores Búsqueda (SEM) | Optimización Redes Sociales (SMO)