magento2.3 – Proper environment for magento2-2.3 on windows 10

The short answer: Don’t!

The long answer: I tried to get magento running with Windows 10 and ran into several problems – most of them related to file-permissions, because Windows handles them very different than Linux does.

But to your problem: you are using composer version 2.0 and magento still needs version 1. You can do a composer self-update --1

magento2.3 – How to refresh summary articles in checkout

I made a module (override Discount.php in Magento_SalesRules) which adds a free product when entering a specific coupon code. So far it is working and in the summary the totals are all correct and updated.
But the view of the added product is not correct. Thubnail is not shown and the count of articles in the cart is not correct.
Have a look to the screen shot:
enter image description here
As you see, the image is not there and the total count of products in the cart still says one, not two as it should.
Does somebody have an idea how I can trigger the udate of this part of the summary?
As well, minicart is not showing the correct stuff.

Would be great if somebody does have an idea how to achieve this.
Best regards,
Chequille

magento2.3 checkout specific payment method showing custom message

i want to like if customer choose specific shipping method like flatrate and if customer choose Check / Money order then i want to below payment method showing custom message

enter image description here

Any help would be appreciated.

Thanks.

magento2.3 – How can we restrict by calling unnecessary third-party API invoking in collectRates() method Magento 2

We are using a third-party extension to get the rates for customers with discounted rates based on customer preferences, Items and etc. And it’s working well.

Here we have couple of questions.

  1. When the product is added to the cart the collectRates() method is called. I think this is unnecessary until the customer on the shopping cart or the Checkout page. Can we restrict? If we restrict is there any issues that may arise?

  2. After adding the products to the cart, when the customer comes to the Checkout page, the collectRates() method is called 3 times. Is this necessary in Magento 2? If Yes why? If Not then how can we restrict?

  3. After selecting the shipping method when we click on the Next for payment method again the collectRates() method is called after selected the shipping method also. Is this necessary to in Magento 2? If Yes why? If Not then how can we restrict?

Can you please help on this?

magento2.3 – How to get product Quantity in Magento 2

I need to retrieve product quantity, I found the interfaces we used before to get product quantity are deprecated, these are:

MagentoCatalogInventoryApiStockStateInterface $stockItem

And,

MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry

Below link says StockStateInterface is replaced with Multi Source Inventory but I cannot see a function returning product quantity in it.

https://www.magentoextensions.org/documentation/interface_magento_1_1_catalog_inventory_1_1_api_1_1_stock_state_interface.html

Is there some other way to get product quantity? I don’t want to use deprecated code.

magento2.3 – Magento 2.3: Override Magento_Sales invoice template phtml for use with Eadesigndev_Pdfgenerator

I am using the Eadesigndev_Pdfgenerator module like other people I’ve seen asking similar questions but none of the answers help. I have been trying to get this fixed for about 3 weeks and I’m getting nowhere.

I see in the modules’ template body is {{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}} which renders out the order items and also the shipping but when I export the pdf it looks terrible. I can add styling in the module so I can sort that.

What I need to do is add some extra blank columns to Magento/Sales/view/frontend/templates/email/invoice/items.phtml

Ideally I would like to separate the items and shipping so I can call them both in different parts of my template

For now I have created a module and in <vendor>/<module>/view/frontend/layout/sales_email_order_renderers.xml I have the following

<?xml version="1.0"?>
<page xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
    <body> 
        <referenceBlock name="sales.email.order.renderers">
            <block class="MagentoSalesBlockOrderEmailItemsOrderDefaultOrder" as="default" template="<vendor>_<module>::email/items/order/default.phtml"/>
        </referenceBlock>
    </body>
</page>

and in <vendor>/<module>/view/frontend/template/email/items/order/default.phtml I have the following (nothing changed yet)

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// phpcs:disable Magento2.Templates.ThisInTemplate

/** @var $block MagentoSalesBlockOrderEmailItemsDefaultItems */

/** @var $_item MagentoSalesModelOrderItem */
$_item = $block->getItem();
$_order = $_item->getOrder();
?>
<tr>
    <td class="item-info<?= ($block->getItemOptions() ? ' has-extra' : '') ?>">
        <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>
        <p class="sku"><?= $block->escapeHtml(__('SKU')) ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p>
        <?php if ($block->getItemOptions()) : ?>
            <dl class="item-options">
            <?php foreach ($block->getItemOptions() as $option) : ?>
                <dt><strong><em><?= $block->escapeHtml($option('label')) ?></em></strong></dt>
                <dd>
                    <?= /* @noEscape */  nl2br($block->escapeHtml($option('value'))) ?>
                </dd>
            <?php endforeach; ?>
            </dl>
        <?php endif; ?>
        <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
        <?php if ($addInfoBlock) :?>
            <?= $addInfoBlock->setItem($_item)->toHtml() ?>
        <?php endif; ?>
        <?= $block->escapeHtml($_item->getDescription()) ?>
    </td>
    <td class="item-qty"><?= (float) $_item->getQtyOrdered() ?></td>
    <td class="item-price">
        <?= /* @noEscape */ $block->getItemPrice($_item) ?>
    </td>
</tr>
<?php if ($_item->getGiftMessageId()
    && $_giftMessage = $this->helper(MagentoGiftMessageHelperMessage::class)
        ->getGiftMessage($_item->getGiftMessageId())
) : ?>
    <tr>
    <td colspan="3" class="item-extra">
        <table class="message-gift">
            <tr>
                <td>
                    <h3><?= $block->escapeHtml(__('Gift Message')) ?></h3>
                    <strong><?= $block->escapeHtml(__('From:')) ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
                    <br /><strong><?= $block->escapeHtml(__('To:')) ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
                    <br /><strong><?= $block->escapeHtml(__('Message:')) ?></strong>
                    <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
                </td>
            </tr>
        </table>
    </td>
</tr>
<?php endif; ?>

When I print the invoice, the rest of the invoice prints fine with all my layout however nothing is rendered for the items.

I have also created a test module with my own layout handle just to echo hello (idea taken from another question related to invoice customisation) and that never rendered anything either.

What is the correct way of overriding Magento_Sales so I can call the layout file to render the items and if possible how could I do the same in a separate layout to call just the shipping part so I can render that elsewhere in my invoice.

Any help or advice appreciated

magento2.3 – Invoice QTY bug Magento 2.3

We have came across a bug in Magento regarding Quantity is not accepting 0.5 on invoic and it is apparently a common issue. https://github.com/magento/magento2/pull/23943/files

I have found the solution on git hub but I just need some help regarding this.

I know you should not edit any file in vendor/… but try to overwrite it by put the files under app/… as you can see in the github solution.

My question is, when I have copied all of the files and put them under app/…. as referred in github, do i need to create a registration.php to make it work? and do i need anything else?

Any help is appreciated .

magento2.3 – Magento2 Enable WYSIWYG On Email Templates Admin Panel

I know Magento has a WYSIWYG library but I am surprised that when you go to Marketing>Email Templates and click into one of the email templates the textarea is not WYSIWYG enabled.

Does anyone know what fileI would edit or an open source plugin that would enable that textarea to be a WYSIWYG

magento2.3 – Importing images with special characters in path

I am trying to import a lot of images. Images for each product are placed in subfolders by product IDs and locale.

The problem is that each locale specific folder name starts with a caret (^).

Example image paths:

9454032/^all/my_image.jpg
9454032/^en/my_english_image.jpg

What I’m getting

1. Wrong URL/path used for attribute image in row(s): 1, 2 
2. Wrong URL/path used for attribute small_image in row(s): 1, 2 
3. Wrong URL/path used for attribute thumbnail in row(s): 1, 2
4. Wrong URL/path used for attribute additional_images in row(s): 1, 2

What I’ve tried

  • Encoding ^ to %5E, like in URLs
  • Simply removing the caret from

What I’m sure of

  • CSV file encoding; I’m using Sublime text, besides Mac’s Numbers, to verify the data
  • Image path is correct, because it works without the caret in the path
  • Multiple images (in additional_images) are separated correctly, with |, and specified in the importer
  • There are no other special characters in the image names
  • No extra slash in the beginning of the image path

Possible solutions

  • A shell script to rename all folders containing ^, although I’d like to avoid altering original data for consistency reasons

References

Versions

  • Magento 2.3.5-p1
  • PHP 7.3.24

magento2.3 – Magento 2.3 Site Unwanted Redirect

My Magento 2.3 site is redirecting and I am unsure why. When I access the domain, it redirects to domain.com/Industrial%20Cleaning%20Products. I have done the following to try and rectify the issue:

  • Checked core_config tables
  • Set both base urls and secure urls through the admin panel
  • Set both base urls and sercure urls through the command line
  • Cleaned/flushed cache
  • Deleted all contents in the cache folders

Looking for any help as to where I should look/how I might be able to fix this?