Why is my Magento2 di.xml not having any effect? - magento

I've overridden \Magento\Checkout\Block\Cart\Item\Renderer and when I add this to the end of config in /app/etc/di.xml the override works.
<preference for="Magento\Checkout\Block\Cart\Item\Renderer" type="Tls\Module\Block\Cart\Item\Renderer" />
However, when I try to use /app/code/Tls/Module/etc/di.xml there is no effect. This is the contents of my di.xml (though I've tried many things)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Checkout\Block\Cart\Item\Renderer" type="Tls\Module\Block\Cart\Item\Renderer" />
</config>
Magento 2.2.4

Related

Configure EhCache 3 to Auto Create Needed Caches With Default Template

I want EhCache to create caches using the default template. Here's my ehcache.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<config
xmlns:jsr107='http://www.ehcache.org/v3/jsr107'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://www.ehcache.org/v3'
xsi:schemaLocation="
http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd
http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">
<service>
<jsr107:defaults default-template="default" jsr-107-compliant-atomics="true">
</jsr107:defaults>
</service>
<cache-template name="default">
<expiry>
<ttl unit="seconds">5</ttl>
</expiry>
<heap>100</heap>
</cache-template>
<!-- <cache alias="test" uses-template="default" />--> <!-- I want to omit this. -->
</config>
Here's my application.yml file:
spring:
cache:
jcache:
config: classpath:ehcache.xml
I don't want to have to update ehcache.xml every time I add need new cache name. How do I configure EhCache with Spring Boot to use my default Template?
If I don't specify the cache name configuration, I get this error:
java.lang.IllegalArgumentException: Cannot find cache named 'test' for CacheResultOperation
I believe you are missing this configuration:
properties.put("hibernate.javax.cache.missing_cache_strategy", "create-warn"); //Use create if you don't want to see a warning

Xamarin Forms Mediaplugin Fileprovider

I'm trying to implement the MediaPlugin but I am running into a problem. I have done all steps in the setup instructions and get the following error:
Error: No resource found that matches the given name (at 'resource' with value '#xml/file_paths')
As explained in the setup instructions - in my Android project, I have added a folder inside the Resources-folder, called xml - containing a file called file_paths.xml with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path name="my_images" path="Pictures" />
<external-files-path name="my_movies" path="Movies" />
</paths>
I expect this problem to be related to either the above or the AndroidManifest.xml, so I'll include my complete AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.company.Kvitt" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="Kvitt.Android">
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="com.company.Kvitt.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"/>
</provider>
</application>
</manifest>
Any help or ideas on how to solve this error are really appreciated!
The res/xml directory should be in the same sub-folder as other Resources; drawable, layout, mipmap-XXX, etc...
Do a clean all / build all just as a double check
Double-check your xml path in the project: Resources/xml/file_paths.xml
After a build, check the build artifacts for the file in obj/Debug/android/res/xml
If the resource file is not in the build artifacts the likely cause is the build action is wrong
Check that the build action on the file is set to AndroidResource

How to make clickhouse take new users.xml file?

Do I have to restart clickhouse to make it read any update to users.xml?
Is there a way to juse "reload" clickhouse?
These files are reloaded in runtime, no need to restart the server.
As you can notice config folder has several files, like
config-preprocessed.xml
config.xml
users-preprocessed.xml
users.xml
.*-preprocessed.xml are for parsed config so you will see when it is loaded and parsed.
I wouldn't recommend to modify files '/etc/clickhouse-server/config.xml' or 'etc/clickhouse-server/user.xml' because it will be rewritten after upgrading ClickHouse and you will lose custom settings.
The subfolder '/etc/clickhouse-server/config.d/' and '/etc/clickhouse-server/users.d/' serve to store overrides for 'config.xml' and 'user.xml' relatively.
Example overrides for 'config.xml':
config.d/config.xml
<?xml version="1.0"?>
<yandex>
<listen_host replace="replace">::</listen_host>
<dictionaries_config replace="replace">dictionaries/*.xml</dictionaries_config>
<openSSL>
<client>
<verificationMode replace="replace">none</verificationMode>
</client>
</openSSL>
</yandex>
config.d/cluster.xml
<?xml version="1.0"?>
<yandex>
<remote_servers>
<your_cluster>
<!-- topology definition -->
</your_cluster>
</remote_servers>
<zookeeper>
<!-- .. -->
</zookeeper>
</yandex>
config.d/kafka.xml
<?xml version="1.0"?>
<yandex>
<!-- The default configuration for Kafka Engine Table (https://clickhouse.yandex/docs/en/operations/table_engines/kafka/#configuration). -->
<kafka>
<bootstrap_servers>11.22.33.44:6667,11.22.33.55:6667,11.22.33.66:6667</bootstrap_servers>
<auto_offset_reset>latest</auto_offset_reset>
</kafka>
<!-- The Topics configurations. -->
<kafka_topic_name>
<group_id>clickhouse-group_id</group_id>
</kafka_topic_name>
</yandex>
Example overrides for 'users.xml':
users.d/user.xml
<?xml version="1.0"?>
<yandex>
<users>
<default>
<password replace="replace">hello_clickhouse</password>
</default>
<readonly>
<password replace="replace">hello</password>
</readonly>
</users>
</yandex>
Another example of config overrides.
See for details ClickHouse Configuration files.

My custom CMS Layout Template in Magento is not loaded

I have created custom CMS layout for Magento according this tutorial. On my localhost(XAMPP on Win7) it is working, but when I have uploaded all 3 files to my web:
app/code/local/Lorinc/cmsLayout/etc/config.xml
app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
app/etc/modules/Lorinc_cmsLayout.xml
And it is not working there.
Here is the code of config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<version>0.1.0</version>
</Lorinc_cmsLayout>
</modules>
<global>
<page>
<layouts>
<cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And here is Lorinc_cmsLayout.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Lorinc_cmsLayout>
</modules>
</config>
I have tried everything. I have changed files and folder permissions (files 0644, folders 0755), i have used magento-cleanup.php, my cache is disabled, I have tried to logout and login again and nothing works. Any ideas what is wrong there?
just looked at your question and the first thing I saw is that you have a wrong folder structure:
The path app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
has to be changed to
app/design/frontend/default/sportsfans01/template/page/cmsLayout.phtml
Don't know if its just a typo of yours!
Furthermore you could check the logs of magento:
var/log/exception.log
var/log/system.log
Hope this will help
Regards
Vince
Please try this. I found it in App/code/core/Mage/Page/etc/config.xml for the 1column.phtml layout
<global>
<page>
<layouts>
<cmsLayout module="page" translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>page_cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
If this won't help please try with changing different theme folder.Be sure to avoid typo mistake.
Problem finally solved. I already had one custom layout (called HomeLayout) on that page so I just merged that 2 layouts. Here is the code of app/code/local/Lorinc/HomeLayout/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_HomeLayout>
<version>0.1.0</version>
</Lorinc_HomeLayout>
</modules>
<global>
<page>
<layouts>
<Lorinc_HomeLayout translate="label">
<label>HomeLayout</label>
<template>page/HomeLayout.phtml</template>
<layout_handle>HomeLayout</layout_handle>
</Lorinc_HomeLayout>
<Lorinc_cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</Lorinc_cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And it works perfect.

How to create a simple administration panel for my joomla plugin

I think the problem lies in my xml.
<?xml version="1.0" encoding="UTF-8"?>
<extension version="2.5" type="plugin" group="content">
<install>
<name>Content - eya</name>
<author>eya</author>
<creationDate>February 2013</creationDate>
<copyright>(C) 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>anigag#grzeit.com</authorEmail>
<authorUrl>www.eya.com</authorUrl>
<version>2.5.0</version>
<description>Adds eya plugin ot your site</description>
<files>
<filename plugin="eya">eya.php</filename>
</files>
</install>
<administration >
<filename>admin.php</filename>
</administration>
</extension>
This is my main php file that executes the content:eya.php.
I have got another file (admin.php) that takes 2 session variables from eya.php and put them in an iframe. There are two problems. One is that I dont know if the eya.php runs everytime before admin.php (or at least once to set the session variables). The second problem is that I dont know how to display only the admin.php and nothing else.
to build an admin interface for your plugin just add the config part to your xml
<config>
<fields name="params">
<fieldset name="basic">
<field name="testfield" type="text" default="mytest" label="field_label" description="field_description" />
</fieldset>
</fields>
</config>
but I didn't get the part of your admin.php/eya.php

Resources