magento2 – Decide which interface should be implemented based on the system configuration magento 2

I've created a drop-down menu to select which data source to use (system.xml), and the value was selected using a plug-in after you click Save Configuration.

Now I have to specify which interface to implement based on this parameter.
exp: if I'm & # 39; mysql & # 39; choose as data source. My class implements an interface that contains methods that relate to this data source.
Does somebody has any idea?

magento2 – create grandchild motifs

I use ultimo theme for a multiple shop configuration.
Since I need to update the topic regularly, I do not want to make any changes to the base files. But I have to make some changes that apply to all stores and affect specific changes in each store. That's why I try to create a child motif and a grandchild for every business. So I can make modifications for all the branches within the child theme and make modifications for specific stores within the grandchild designs.

I am not sure if this is the usual way, but that seems to me to be the most obvious, and I have not read that the topic of Inhgeritence is limited.

I used the official guide to create the subordinate topics. Unfortunately, the changes in allstores do not apply to my frontend using a grandson theme. Maybe I made a wrong configuration, but I can not find it.
When I apply the theme "allstores" to my frontend, I see the changes. So I can assume that the subordinate topic "allstores" is well configured.

I deleted the cache, re-indexed, and then forced to play.

PHP Bin / Magento Cache: clean
PHP Bin / Magento Indexer: Reindex
php bin / magento setup: static-content: deploy -f

The theme.xml of the Enkeldesigns I have set as follows:


      store1
      infortis / allstores
      
          media / preview.jpg
      
 

And the composer.json is configured as follows:

{
"name": "infortis / theme-frontend-store1",
"Description": "N / A",
"need": {
"php": "~ 5.5.0 | ~ 5.6.0 | ~ 7.0.0 | ~ 7.1.0 | ~ 7.2.0",
"infortis / theme-frontend-allstores": "^ 2.0.0"
},
"type": "magento2-theme",
"Version": "2.8.0",
"License": [
        "Proprietary"
    ],
"autoload": {
"Files": [
            "registration.php"
        ]
    }
}

This shows what my topic folder actually looks like:

App / Design / Frontend /
├── infortis /
│ │ ├──base- / <core files
│ │ ├── ...
│ │ ├──ultimo / <- core files
│ │ ├── ...
├── │ ├──All stores / <- child topic
│ │ ├── ...
│ │ ├──store1 / <- Grandson theme
│ │ ├── ...
│ │ ├──store2 / <- Grandson theme
│ │ ├── ...

Am I missing something or are not grandchildren supported?

magento2 – Get the product image for the invoice email in magento 2.3

I like to get customers product image in "Invoice E-Mail Template"

I added code in "Magento_Sales / templates / email / items / bill / default.phtml".

$ imageUrl = $ this-> helper (& # 39; Magento  Catalog  Helper  Image & # 39;)
-> init ($ _ item-> getProduct (), & # 39; product_base_image & # 39;
-> constrainOnly (TRUE)
-> keepAspectRatio (TRUE)
-> keepTransparency (TRUE)
-> keepFrame (FALSE)
-> resize (80, 80) -> getUrl ();


<img src = "http://magento.stackexchange.com/"alt =" some "/>

And also in "sent e-mail template" I need details "Picture, Quantity, Subtotal"

magento2 – Magento 2 how to add product dimensions using rest api

I can simply supplement magento 2 with simple products, and adding the weight is no problem at all. I do the following:

                $ data = & # 39; {
"Product": {
"sku": "& # 39;. $ row["item_number"] , ""
"name": "& # 39;. $ row["name"] , & # 39; "
"attributeSetId": 4,
"Price": & # 39; , $ row["price"] , & # 39 ;,
"Status": 1,
"Visibility": 4,
"typeId": "simple",
"createdAt": "& # 39; date (& # 39; Y-m-d H: i: s & # 39;). & # 39;",
"updatedAt": "& # 39; date (& # 39; Y-m-d H: i: s & # 39;). & # 39;",
"Weight": & # 39; , $ row["weight"] , & # 39 ;,
"custom_attributes": {
"description": "& # 39;. $ row["condition_description"] , & # 39;
& # 39 ;. & # 39; Brand: & # 39; , $ row["brand"] , & # 39;
& # 39 ;. & # 39; MPN: & # 39 ;. $ row["mpn"] , & # 39;
& # 39 ;. "Domestic equipments:". & # 39;
& # 39 ;. $ setup. "" "short_description": "& # 39;. $ row["condition_description"] , "" "MPN": "& # 39; $ Row["mpn"] , "" "brand": "& # 39;. $ row["brand"] , & # 39; " },

Adding "Length": 10 "below the weight attribute will result in an error. Magento 2 allows you to add height, width, and length when adding a product manually. This must be possible. I would like to avoid storing them in a custom attribute to simplify the shipping calculations.

is not length called length but something else? I tried ts_dimensions_length, packed dimensions and dimension length.

magento2 – How can I pick up the payment after ordering?

Is there a way for customers to submit an order specifying what they want, without requiring a payment during the checkout process, which will be paid only when they place the order?

The reason is that we want to deal with scenarios in which the customer, when negotiating a different price, determine a final price, process the order accordingly, and then have it paid for.

If this is not integrated in vanilla Magento 2, is there an extension for it?

magento2 – Magento 2: How can I change the background color of the product list?

I would like to change the color of the background in the product list from white to gray.

Here is style.css

// products grid
.product-item .mage-error {
Display: none! important;
}
.product-image-photo.img-thumbnail {
Padding: 0;
Line height: 1;
Background: none;
Border: none;
Minimum width: 100%;
Position: absolutely;
above: 0;
left: 0;
Margin: car! important;
Screen lock;
below: 0;
right: 0;
Limit radius (0);
}

.products-grid {
& .Slider-1-row .owl-item {
Upholstery: 0 15px;
}
.product-item-info {
Bottom edge: 30px;
product-top {
Position: relative;
Hidden overflow;
on {
& .photo {
Screen lock;
Height: 0px;
&:after this {
Content: "";
Position: absolutely;
left: 0;
right: 0;
above: 0;
below: 0;
Background color: # 000;
Opacity: 0;
Visibility: hidden;
.Transition (every 300ms);
z index: 3;
}
img.swatch-option-loading {
Content: none;
+ .img-hover-show {
Opacity: 0! important;
}
}
div {div
Display: none;
& .swatch-option-loading {
Screen lock;
Wallpaper: URL ("../ images / loader.svg");
Background position: middle center;
Background repetition: no repetition;
Background size: 50px car;
Background color: rgba (0,0,0,0,8);
below: 0;
Content: none;
left: 0;
min-width: unset;
z index: 1;
Position: absolutely;
right: 0;
above: 0;
}
}
}
}
.img-hover-show {
Position: absolutely;
left: 0;
right: 0;
above: 0;
below: 0;
Opacity: 0;
Visibility: hidden;
Minimum width: 100%;
.Transition (every 300ms);
}
.actions-link {
Display: Table;
Position: absolutely;
above: 0;
left: 0;
z index: 3;
Key {
Background: none;
Font size: 18px;
Line height: 1;
Color: #fff;
Border: none;
Box shadow: none;
Upholstery: 12px 14px;
Transform (scale (0));
Opacity: 0;
Visibility: hidden;
span {span {
Line height: 1;
Screen lock;
}
&:hover {
Color: @ base color;
}
}
}
&:hover {
a.photo: after {
Opacity: 0.3;
Visibility: visible;
}
.img-hover-show {
Opacity: 1;
Visibility: visible;
}
.actions-link button {
Transform (scale (1));
Opacity: 1;
Visibility: visible;
}
.tocart.btn-cart {
.transform (translate (-50%, -50%));
Opacity: 1;
Visibility: visible;
}
Product label {
Display: none;
}
}
}
product-item-details {
Upholstery pad: 11px;
Product name {
Bottom edge: 6px;
Line height: 1.1;
on {
Color: # 222;
Font size: 14px;
Written weight: 500;
&:hover {
Color: @ base color;
}
}

Enter the image description here

Someone help?

magento2 – Magento 2 MySQL server no longer exists

I managed to migrate Magento 1 to the new Magento 2.2.5
When I index for the first time, I get into the indexer

Category Products

[2019-02-07 21:58:57]    main.CRITICAL: Warning: PDOStatement :: execute (): The MySQL server is in /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228 {"exception" not available anymore. : "[object] (Exception (Code: 0): Warning: PDOStatement :: execute (): MySQL server is not in line 228 in /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php more available in /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61) "} []

mysql.conf settings are:

[mysqld]



#
# * Basic settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = / usr
datadir = / var / lib / mysql
tmpdir = / tmp
lc-messages-dir = / usr / share / mysql
Skip from the outside
#
# Instead of skipping, it is now only heard by default
# localhost is more compatible and no less secure.
bind-address = localhost
#
# * Fine tuning
#
key_buffer_size = 512M
max_allowed_packet = 1024M
thread_stack = 192K
thread_cache_size = 256
connect_timeout = 320 # default 10
table_open_cache = 4096
table_definition_cache = 4096
sort_buffer_size = 16M
max_heap_table_size = 512M
tmp_table_size = 512M
interactive_timeout = 3600
max_connections = 400
max_connect_errors = 1000000
skip_name_resolve
#skip_secure_auth
wait_timeout = 28800
innodb_buffer_pool_size = 2G
myisam_sort_buffer_size = 128M
innodb_log_file_size = 256M
innodb_thread_concurrency = 18
innodb_flush_log_at_trx_commit = 2
# This replaces the startup script and checks MyISAM tables as needed
# They are touched the first time
myisam-recover-options = BACKUP
#max_connections = 100
#table_open_cache = 64
#thread_concurrency = 10
#
# * Query cache configuration
#
query_cache_limit = 1M
query_cache_size = 64M
query_cache_type = 1

Tried to increase the limits in MySQL without success.
Suggestions please?

magento2 – Connect Redis with Docker Compose

I set up my Docker to connect to Redis. When I run the application, I get this error

Fatal Error: Uncatched CredisException: Connection to Redis Redis: 0 failed after two errors. Last error: (111) Connection refused in /var/www/html/vendor/colinmollenhour/credis/Client.php:475. Stack Trace: # 0 / var / www / html / vendor / colinmollenhour / credis / Client.php (471): Credis_Client-> connect () # 1 /var/www/html/vendor/colinmollenhour/credis/Client.php (784): Credis_Client-> connect () # 2 /var/www/html/vendor/colinmollenhour/credis/Client.php(637): Credis_Client -> __ call (& # 39; select & # 39 ;, array) # 3 / var / www / html / vendor / colinmollenhour / cache -backend-redis / Cm / Cache / Backend / Redis.php (382): Credis_Client-> select (1) # 4 / var / www / html / vendor / colinmollenhour / cache-backend-redis / Cm / Cache / Backend / Redis.php (243): Cm_Cache_Backend_Redis -> _ applyClientOptions (Object (Credis_Client)) # 5 / var / www / html / vendor / magento / zendframework1 / library / Zend / Cache.php (153))). # 6 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache :: _ makeBackend (& # 39; Cm_Cache_Backen … & # 39 ;, Array, true, true ) # 7 / var / www / ht in /var/www/html/vendor/colinmollenhour/credis/Client.php on line 475

Not sure where to make changes. Maybe someone can help me here? This is the configuration I have for my docker-compose.yml

Version: & # 39; 3.0 & # 39;
Services:
Network:
Image: Alexcheng / Magento2
ports:
- "8080: 80"
- 443: 443
- 32823: 22
Left:
- db
env_file:
- env
Surroundings:
- WEB_ALIAS_DOMAIN = local.domain.com
- WEB_DOCUMENT_ROOT = / var / www / html
- PHP_DATE_TIMEZONE = EST
- PHP_DISPLAY_ERRORS = 1
- PHP_MEMORY_LIMIT = 2048M
- PHP_MAX_EXECUTION_TIME = 300
- PHP_POST_MAX_SIZE = 500M
- PHP_UPLOAD_MAX_FILESIZE = 1024M
Volume:
- "./project:/var/www/html"
container_name: web
Left:
- db
- Redis
db:
Picture: Mariadb: 10
container_name: mariadb
Volume:
- db-data: / var / lib / mysql / data
env_file:
- env
Reboot: always
ports:
- "3306: 3306"
Surroundings:
- MYSQL_ROOT_PASSWORD = root
- MYSQL_DATABASE = my_local_db
phpmyadmin:
Image: phpmyadmin / phpmyadmin
ports:
- "8580: 80"
Left:
- db
container_name: phpmyadmin
Redis:
Image: Redis: Latest
container_name: redis
Reboot: always
ports:
- "6379: 6379"
Volume:
- redis-data: / data
Volume:
db-data:
external: wrong
Redis data:
external: wrong 

And that is the content of me env.php File under App / etc /

    [
& # 39; frontName & # 39; => & # 39; admin & # 39;
],
& # 39; # 39 & crypt; => [
        'key' => 'MY_KEY_HERE'
    ],
& # 39; db & # 39; => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => 'db',
                'dbname' => 'my_local_db',
                'username' => 'user',
                'password' => 'password',
                'active' => '1'
            ]
        ]],
& # 39; resource & # 39; => [
        'default_setup' => [
            'connection' => 'default'
        ]
    ],
& # 39; x-frame-options & # 39; => & # 39; SAMEORIGIN & # 39 ;,
& # 39; # 39 & MAGE_MODE; => & # 39; Developer & # 39 ;,
& # 39; # 39 & cache; => [
        'frontend' => [
            'default' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => 'redis',
                    'database' => '0',
                    'port' => ''
                ]
            ],
& # 39; # 39 & page_cache; => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => 'redis',
                    'port' => '',
                    'database' => '1',
                    'compress_data' => '0'
                ]
            ]]],
& # 39; session & # 39; => [
        'save' => 'redis',
        'redis' => [
            'host' => 'redis',
            'port' => '',
            'password' => '',
            'timeout' => '2.5',
            'persistent_identifier' => '',
            'database' => '2',
            'compression_threshold' => '2048',
            'compression_library' => 'gzip',
            'log_level' => '1',
            'max_concurrency' => '6',
            'break_after_frontend' => '5',
            'break_after_adminhtml' => '30',
            'first_lifetime' => '600',
            'bot_first_lifetime' => '60',
            'bot_lifetime' => '7200',
            'disable_locking' => '0',
            'min_lifetime' => '60',
            'max_lifetime' => '2592000'
        ]
    ],
& # 39; # 39 & cache_types; => [
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'compiled_config' => 1,
        'eav' => 1,
        'customer_notification' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'full_page' => 1,
        'config_webservice' => 1,
        'translate' => 1,
        'vertex' => 1
    ],
& # 39; install & # 39; => [
        'date' => 'Wed, 09 Jan 2019 12:54:30 +0000'
    ]
];

Hope someone can help me …

magento2 – How do I add custom fields in sales_shipment_items in Magento 2?

You can do that like this:

startSetup ();

if (version_compare ($ context-> getVersion (), & # 39; 1.0.1 & # 39 ;, & # 39;)<')) {
            $setup->getConnection () -> addColumn ()
$ setup-> getTable (& # 39; sales_shipment_item & # 39;),
"Your_custom_field"
                [
                    'type' => Table::TYPE_TEXT,
                    'nullable' => true,
                    'comment' => 'Custom Field Description'
                ]
            );
}

$ setup-> endSetup ();
}
}  

In these cases you have to add one more custom fieldYou just have to change that setup_version from your custom module module.xml,
Suppose you have upgraded your custom module.
Let's say Version 1.0.1 to Version 1.0.2Just do it in yours upgrade scheme:

startSetup ();

if (version_compare ($ context-> getVersion (), & # 39; 1.0.1 & # 39 ;, & # 39;)<')) {
                $setup->getConnection () -> addColumn ()
$ setup-> getTable (& # 39; sales_shipment_item & # 39;),
"Your_custom_field"
                    [
                        'type' => Table::TYPE_TEXT,
                        'nullable' => true,
                        'comment' => 'Custom Field Description'
                    ]
                );
}

if (version_compare ($ context-> getVersion (), & # 39; 1.0.2 & # 39 ;, & # 39;)<')) {
            $setup->getConnection () -> addColumn ()
$ setup-> getTable (& # 39; sales_shipment_item & # 39;),
"Your_custom_field2"
                [
                        'type' => Table::TYPE_TEXT,
                        'nullable' => true,
                        'comment' => 'Custom Field2 Description'
                ]
            );
}

$ setup-> endSetup ();
}
}