Hi there,
I have a dev store using Magento ver. 2.3.0 running on CentOS 7, under nginx and php-fpm.
I have done an import of config and products from my legacy 1.9.x Magento store and am trying to create a new theme.
I followed the steps in https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/theme-create.html to create a basic theme with the structure as follows:
├── a1 │ └── lws │ ├── composer.json │ ├── etc │ │ └── view.xml │ ├── registation.php │ ├── theme.xml │ └── web │ ├── css │ ├── fonts │ └── images │ └── logo.svg
composer.json
{
"name": "magento/theme-frontend-lws",
"description": "N/A",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/theme-frontend-blank": "*"
},
"type": "magento2-theme",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
]
}
}theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>A1:LWS</title>
<parent>Magento/blank</parent>
</theme>registration.php
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/a1/lws',
__DIR__
);However when I clean and flush the cache and reload the themes page in the admin it still only shows the existing Blank and Luma themes. Also I notice the content of app/design/frontend/Magento is empty, although I can apply those themes to my store and they work.
Any ideas please?
Hello @A1Ben
Run below commands once:
php bin/magento setup:upgrade php bin/magento setup:static-content:deploy -f php bin/magento cache:flush sudo chmod -R 0777 var/ pub/ generated/
Hello @A1Ben
So you have created theme under the Magento namespace ? what's your theme path ?
it should be like app/design/frontend/VendorName/ThemeName - so here in your case it should be like this - app/design/frontend/a1/lws
Also after creating new theme, you will also require to run upgrade command !
so run below command in the sequence :
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento cache:clean php bin/magento cache:flush
Then check from the admin panel - you will able to see your theme on theme list !
hope it helps !
Thank you @Manthan Dave and @Manish Mittal
My theme install path is app/design/frontend/a1/lws
I tried the superset of you suggestions, however it's not worked, I still don't see my new theme?
i.e.
$ bin/magento setup:upgrade Cache cleared successfully File system cleanup: [... etc... ] Nothing to import. $ bin/magento setup:di:compile Compilation was started. Interception cache generation... 7/7 [============================] 100% 2 mins 327.0 MiB Generated code and dependency injection configuration successfully. [root@Unknown-08-00-27-c8-bc-a6 magento2]# bin/magento setup:static-content:deploy -f Deploy using quick strategy frontend/Magento/blank/en_US 2245/2245 ============================ 100% % 28 secs adminhtml/Magento/backend/en_US 2315/2315 ============================ 100% % 28 secs frontend/Magento/luma/en_US 2261/2261 ============================ 100% % 34 secs Execution time: 147.5245950222 $ bin/magento cache:clean Cleaned cache types: config layout block_html collections reflection db_ddl compiled_config eav customer_notification config_integration config_integration_api full_page config_webservice translate vertex $ bin/magento cache:flush Flushed cache types: config layout block_html collections reflection db_ddl compiled_config eav customer_notification config_integration config_integration_api full_page config_webservice translate vertex $ sudo chmod -R 0777 var/ pub/ generated/
Refreshed and logged back in but still not there.
I note that after running
bin/magento setup:static-content:deploy -f
...my theme isn't being seen.
Any more ideas?
Hello @A1Ben
Then i think there might be a naming convention issue, below i am posting code with directory structure of theme - kindly replace with your once and then check !
Directory Structure should be like below :
app/design/frontend/Atest/lws
Registration code like below :
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/Atest/lws',
__DIR__
);
theme.xml file code like below :
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Atest:LWS</title>
<parent>Magento/blank</parent>
</theme>
Then again run all those command and then check !
Also to debug more check in core_config_data table as well - your theme entry is showing or not - after doing all the changes check there as well !
Hope it helps !
Hey @Manthan Dave
Sorry for the slow response - I thought I'd replied but it got lost somehow ![]()
I tried renaming the vendor dir plus the registration & theme changes as you suggested (although I have used this vendor name before on another project so I think it is OK...) and a complete re- upgrade/compile/deploy/clean/flush but still not showing.
Here's my db:
mysql> select * from theme \G;
*************************** 1. row ***************************
theme_id: 1
parent_id: NULL
theme_path: Magento/blank
theme_title: Magento Blank
preview_image: preview_image_5c4f60de86268.jpeg
is_featured: 0
area: frontend
type: 0
code: Magento/blank
*************************** 2. row ***************************
theme_id: 2
parent_id: NULL
theme_path: Magento/backend
theme_title: Magento 2 backend
preview_image: NULL
is_featured: 0
area: adminhtml
type: 0
code: Magento/backend
*************************** 3. row ***************************
theme_id: 3
parent_id: 1
theme_path: Magento/luma
theme_title: Magento Luma
preview_image: preview_image_5c4f60de95d54.jpeg
is_featured: 0
area: frontend
type: 0
code: Magento/luma
3 rows in set (0.00 sec)
mysql> select * from core_config_data where path='design/theme/theme_id';
+-----------+--------+----------+-----------------------+-------+
| config_id | scope | scope_id | path | value |
+-----------+--------+----------+-----------------------+-------+
| 770 | stores | 1 | design/theme/theme_id | 1 |
+-----------+--------+----------+-----------------------+-------+
1 row in set (0.01 sec)
Weird huh? Any other ideas how I can debug it please?
hi,
I am not sure what you did miss here. but you following tutorial for create basic theme.
https://blog.qaisarsatti.com/magento_2/magento-2-create-simple-theme/
i thinks you have spelling mistake or miss the command
php bin/magento setup:upgrade
to install the theme.
in M23 4 the theme is not working . May I ask wkat u ised for forums ?