Magento 2.4 - Build Child Theme parent of theme installed via composer - themes

I need a tip.
I've installed a theme via composer and I need to create a child theme having as parent a theme installed via composer.
path of theme installed via composer: vendor/{vendor}/{theme}/
path of child theme: app/design/frontend/{vendor}/{theme}/
in the child theme folder i've created:
theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>TitleTheme</title>
<parent>{folder-name-vendor}/{folder-name-theme}</parent>
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
Composer.json
{
"name": "{my-vendor-folder}/{my-child-theme}",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/framework": "100.0.*"
},
"type": "magento2-theme",
"version": "100.0.2",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
]
}
}
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/{my-vendor-folder}/{my-child-theme}',
__DIR__
);
When I change the theme from the magento backend panel under
Content > Design > Configuration
and then run:
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
It does not load me the parent theme I have chosen, but the default magento theme.I don't know what I'm wrong.
Can someone help me?
Thank you ;)

Related

Composer set symlink path

I set up TYPO3 via composer. Some of my packages are extensions and will be added to the extension folder.
"repositories": [
{
"type": "path",
"url": "PACKAGES/*"
}
],
"require": {
"VENDOR/NAME": "^1.0",
}
That is okay. But I would like to create a folder in the packages folder which will be linked to public/fileadmin/FOLDER
Is that possible?

Unavailability of package razorpay/omnipay-razorpay

My composer.json file is as follows:
{
"name": "razorpay/razorpay",
"description": "Razorpay PHP Client Library",
"keywords": ["razorpay", "api", "php", "client"],
"authors": [
{
"name": "Abhay Rana",
"email": "nemo#razorpay.com",
"homepage": "https://captnemo.in",
"role": "Developer"
},
{
"name": "Shashank Kumar",
"email": "shashank#razorpay.com",
"role": "Developer"
}
],
"support": {
"email": "contact#razorpay.com",
"issues": "https://github.com/Razorpay/razorpay-php/issues",
"source": "https://github.com/Razorpay/razorpay-php"
},
"homepage": "https://docs.razorpay.com",
"license": "MIT",
"require": {
"php": ">=5.3.0",
"rmccue/requests": "^2.0",
"ext-json": "*",
"razorpay/omnipay-razorpay": "~2.0"
},
"require-dev": {
"raveren/kint": "1.*",
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
"Razorpay\\Api\\": "src/",
"Razorpay\\Tests\\": "tests/"
},
"files" : ["Deprecated.php"]
}
}
the error when I use
$composer update
is as follows:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires razorpay/omnipay-razorpay, it could not be found in any version, there may be a typo in the package name.
Problem 2
- phpunit/phpunit[9.0.0, ..., 9.2.6] require php ^7.3 -> your php version (5.6.40) does not satisfy that requirement.
- phpunit/phpunit[9.3.0, ..., 9.3.8] require php ^7.3 || ^8.0 -> your php version (5.6.40) does not satisfy that requirement.
- phpunit/phpunit[9.3.9, ..., 9.5.20] require php >=7.3 -> your php version (5.6.40) does not satisfy that requirement.
- Root composer.json requires phpunit/phpunit ^9 -> satisfiable by phpunit/phpunit[9.0.0, ..., 9.5.20].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
For clarification purpose where do I update
{
"require": {
"`razorpay/omnipay-razorpay`": "~2.0"
}
}
as per the instruction given in https://github.com/razorpay/omnipay-razorpay
Do we have to update it in composer.json file available in razorpay-php file (https://github.com/razorpay/razorpay-php/releases/) or create a new composer.json file and add information based on composer JSON schema.
You can inspect all packages that you can install without any custom settings on https://packagist.org. When searching for razorpay/omnipay-razorpay on that site, it does not list this package. You should contact the maintainers of that package about this, as they need to publish the package on Packagist. If it should not be available there, but in any other package repository, they need to update their documentation about this.
Anyways, their package has not seen any substantial update since years. I would assume that development on their side has ended, and you should check for any third-party connector

own typo3 Extension doesn't get shown in Extension Manager (Composer Mode)

Im trying to set up my own Extension, for having in the all kind of changes to my Site. I set up typo3 9.5.5 via. Composer. The next step was building up my own extension. I followed the official docs and also added a composer.json, but it wont show up in the Extension Manager.
ext_emconf
<?php
$EM_CONF[$_EXTKEY]=[
'title'=>'MS Site Extension',
'description'=>'TYPO3 Site Extionsion',
'category'=>'plugin',
'author'=>'-',
'author_company'=>'-',
'author_email'=>'-',
'state'=>'alpha',
'clearCacheOnLoad'=>true,
'version'=>'0.0.1',
'constraints'=>[
'depends'=>[
'typo3'=>'9.5.5-9.9.99',
],
],
'autoload'=>[
'psr-4'=>[
'Ms\\MsSite\\'=>'Classes'
],
],
];
composer.json of the extension
{
"name": "ms/ms_site",
"type": "typo3-cms-extension",
"description": "MS SITE",
"license": [
"GPL-2.0+"
],
"keywords": [
"typo3",
"cms",
"ms",
"ms_site"
],
"version": "0.0.1-dev",
"require": {
"typo3/cms": "^9.5"
},
"autoload-dev": {
"psr-4": {
"Ms\\MsSite\\": "Classes/"
},
"replace": {
"hellotypo3": "self.version",
"typo3-ter/ms_site": "self.version"
},
"extra": {
"typo3/cms": {
"extension-key": "ms_site"
}
}
}
}
I'm a bit confused what I have to do now, the only place where my extension currently is, is at: typo3conf/ext, I configured it in the ext_emconf and the composer.json of the extension.
How do I solve this problem?
Edit: Hmm my console tells me that ms_site is added to PackageStates but I still can't see my Extension in my Backend ...
I'm just tilted and dumb, after over 4 hours of searching I recognized my mistake ... I just didnt uploaded the data to my server. :) I thought that I enabled an auto upload but it wasn't.

Setup version for module 'Namespace_Modulename' is not specified : Magento 2

I am creating an module in Magento 2 ( ver. 2.0.0). I have registered my module in app/etc/config.xml
'Namespace_Modulename => 1,
My module.xml file under app/code/Namespace/Modulename/etc/module.xml
module.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Namespace_Modulename" setup_version="2.0.1"/>
</config>
When I run my module Magento 2 generate below error :
Setup version for module 'Namespace_Modulename' is not specified
My module was working fine before stable release, after upgraded to stable release I start getting this error. I searched lot on google before adding here, got some results but none of then working for me.
Kindly guide me where I am doing wrong. Thanks in advance.
Try this in module.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Namespace_Modulename" schema_version="2.0.1" setup_version="2.0.1"/>
</config>
Add registration.php and composer.json in your module.
/app/code/Namespace/Module/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Namespace_Module',
__DIR__
);
/app/code/Namespace/Module/composer.json
{
"name": "namespace/module",
"description": "namespace",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/framework": "100.0.*",
"magento/module-ui": "100.0.*",
"magento/module-config": "100.0.*",
"magento/module-contact": "100.0.*"
},
"type": "magento2-module",
"version": "100.0.0",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"extra": {
"map": [
[
"*",
"Namespace/Module"
]
]
},
"autoload": {
"files": [ "registration.php" ],
"psr-4": {
"namespace\\module\\": ""
}
}
}
Now run magento setup:upgrade and schema upgrade if applicable.
Now clear all caches and var/generation folder. Login to admin panel > Stores > Configuration > Advanced > Advanced. Your module should be listed here now.
Also Wrong file/folder permission can cause this error
chmod 775 /magento/app/code/vendorname/modulename -R

Laravel 4 package from private repository: ServiceProvider not found

I created a package for Laravel 4 that worked properly when used in development in workbench but when I install it with Composer it keeps returning me the error Class 'Myvendor\Mypackage\MypackageServiceProvider' not found.
There is a particularity with my package which is that the name of my classes sources are different from the name of my package. Usually they are the same.
vendor/
Houle/
laravel-dynamite/
src/
Fhoule/
Dynamite/
DynamiteServiceProvider.php
I know that it can work because Laravel work's this way too.
vendor/
laravel/
framework/
src/
Illuminate/
And the property PSR-0 of my package composer.json seems to be properly configured:
"name": "Houle/laravel-dynamite",
...
"require": {
"php": ">=5.3.0",
"illuminate/support": "4.0.x"
},
"autoload": {
"classmap": [
"src/migrations",
"src/controllers",
"src/models"
],
"psr-0": {
"Fhoule\\Dynamite": "src/"
}
},
...
How I created my package:
Created the package with Artisan.
Maked it work properly in workbench directory
Pushed to private Bitbucket repo
Installed new instance of Laravel
Changed composer.json configuration to install my package (from private repository)
"name": "laravel/laravel",
...
"require": {
"laravel/framework": "4.0.*",
"Houle/laravel-dynamite": "2.0.1"
},
"repositories": [{
"type": "package",
"package": {
"name": "Houle/laravel-dynamite",
"version": "2.0.1",
"source": {
"url": "git#bitbucket.org:Houle/laravel-dynamite.git",
"type": "git",
"reference": "v2.0.1"
}
}
}],
...
Added my package Service Provider to app/config/app.php:
'providers' => array(
'Fhoule\Dynamite\DynamiteServiceProvider',
)
That's where my application return the error Class 'Fhoule\Dynamite\DynamiteServiceProvider' not found.
What could be my issue?
I found my problem, it hadn't nothing to do with the way I named my vendor, package and classes.
It was that in my composer.json (root of the project), I set my repository type to package but like the Composer documentation states the type package is for packages that don't support Composer. That's why Composer wasn't updating my autoload_classmap.php file.
So if you want to use a private repository (like at Bitbucket or GitHub) you need to set the type of the repository to git:
{
"name": "laravel/laravel",
...
"require": {
"laravel/framework": "4.0.*",
"houle/laravel-dynamite": "dev-master"
},
"repositories": [{
"type": "git",
"url": "git#bitbucket.org:Houle/laravel-dynamite.git"
}],
...
}
Hope it helps someone.
The composer.json in your package (Package found in BitBucket) needs to specify the PSR-0 Autoloading component, rather than the composer.json file in your top-level Laravel project.
Can you show us the composer.json file for your repo in the private repository?

Resources