magento2.3 – assign only one and leaf category per product in magento 2.3.3

I want that the only category checkbox selectable should be the leaf category that is the category checkbox without children in the current branch and only one category checkbox per product can be selected.
The pseudo code is:

if category has children then input checkbox tag is disabled
if at least one category is selected then disable all other checkboxes

I can’t find where to edit the category checkboxes code.
They are the checlboxes shown in the product edit page or new product page.

magento2 – Magento 2.3.3 Tax question

I know this is a common issue, but cant seem to find a proper answer anywhere.
I am running a Magento 2.3.3 shop and have my product imported through a plugin and these are imported excluding tax (i cannot change this, my industry suppliers work on excluding tax and this is how the prices are imported).
No matter what tax settings i use the inc VAT prices are always wrong when added to the cart.
For example, i have a product that sells for £8 inc VAT, so the ex VAT price set in the catalog is £6.67. The catalog and product pages display this correct at £8, but when a quantity of 2 is added to that cart it shows at £8.01 each.
I had an order yesterday for:
2 x £8
2 x 17 (these show as £17.01 in the cart)
£5 delivery

Magento works this out at £55.02, not £55. Before tax it displays as £45.85, not £45.83 like it should be.

No customers have yet questioned it, but it is frustrating and only a matter of time until somebody does.

My current tax settings are:
Tax Calculation Method Based On: Total (Have tried unit and row and i would prefer unit)
Catalog Prices: Excluding Tax (has to be this way)
Shipping Prices: Excluding Tax

Discounts are a whole other ball game and dont seem to be ale to do calculate discount after and including tax but this is not my worry for now.

I would like to figure out how i can display, in this example the prices correct with a total of £55 inc VAT. I know this is a rounding issue but dont know how to solve it. All prices are imported at 2 decimal places.

Thanks

multistore – Magento 2.3.3 Newbie – How To Setup Multiple Stores in Multi-Domain?

I’m sorry if this has been asked/answered in a different way of wording it. My apologies.

I have, what seems to be an EXTREMELY simple problem that – no matter how I search it – seems to come up with different solutions. Again, please excuse my ignorance of the solution.

BACKGROUND:
The only reason I switched to Magento is because of Multi-Domain support. I currently have a site up that houses over 400,000 SKUs and I want to be able to move those over to one backend and serve different descriptions/prices on each domain. I am hosted currently on Cloudways AWS server and have the DNS pointing to the correct IP addresses as verified by ‘whatsmydns.com’.

PROBLEM:

When navigating to ‘PCS.COM’ I get ‘PCS.COM’ to appear as ‘PCS.COM/DEFAULT’
When navigating to ‘CRESCOM.COM’ I get ‘PCS.COM’ to appear as ‘PCS.COM/DEFAULT’
When navigating to ‘RRESCOM.COM’ I get ‘PCS.COM’ to appear as ‘PCS.COM/DEFAULT’

Id like each domain to point to the correct domain…

I was given instruction from Cloudways that says the following:

1- change the webroot to /pub
2- Fetch the mage run code and mage run type of your stores.
3- Verify the domains in the store-> configurations -> web. Every store should have its own domain, not using the default value.
4- Add the following rules inside the /pub/index.php before $params = $_SERVER;

The code that was provided says:

switch ($_SERVER('HTTP_HOST')) {

case 'abc.com':
                $mageRunCode = 'abc_base';
                $mageRunType = 'website';
                break;

        case 'xyz.com':
                $mageRunCode = 'xyz_base';
                $mageRunType = 'website';
                break;


        default:
                $mageRunCode = 'base';
                $mageRunType = 'website';
                break;
                        }

TRIED:

  • Updating the pub/index.php file to the recommended settings.
  • Setting up all Stores > Config > Web settings to the correct values
  • Deleting Server & Reinstalling Magento 2.3.3
  • Researching to the fullest extent I can. No matter where I look there are different ways to redirect traffic to the correct domain.

FRUSTRATED:
I don’t know why/what/how to manage these redirections work. It seems like it should be a simple deal to do but I am at a loss – any help would be appreciated.

ADDITIONAL QUESTIONS:

  • In regards to $mageRunCode – I don’t know what code to put in. The Website, Store, or StoreView?
  • In regards to $mageRunType – I don’t know what code to put in. Store or Store View…..Or Web Site?

FURTHERMORE:
I’ve seen ‘solutions’ that mention editing the .htaccess file but from my research this would not be optimal because an update to M2 MAY edit that file to make it useless. True?

THANK YOU:
I just want to ‘Thank You’ for you time, assistance, and patience with me with this issue. For you developers out there I have nothing but respect. //// I just don’t know (YET) how to do this operation.
Thank You..Thank You..Thank You.

magento2.3 – magento 2.3.3 konckout translation doesn’t work

Hello I have the official stripe module for magento 2 which is not trasnlated correctly.
This is the piece of code:

    <span><!-- ko i18n: 'Use a new card'--><!-- /ko --></span>

I created the csv file into the i18n directory but the text is not translated.
I take a look into the js-translation.json file and the string it is not there.
If I manually put the string into that file it is translated. It seem that the process to insert the string into that file doesn’t work.

magento2 – Magento 2 EE (2.3.3) Gift card balance: Gift card Balance should be retained when the user cancels the transaction, Currently, it shows 0

Actual bug:
Gift card balance: Gift card Balance should be retained when the user cancels the transaction, Currently, it shows 0. [Eg. The order amount is 100 KWD and applied GV has 20 KWD then after the transaction gets canceled by canceling or clicking the browser back, the Gift card amount shows as 0.

Anyone?

Thanks

magento2.3 – Magento 2.3.3. programatically creating product – link to image on a CDN

I am creating/updating simples and configurables and their images are stored on a CDN.
I would like to use the CDN rather than pulling the images on to the server and then in to Magento when I am creating the products.

How can I achieve this?

I can change the media base URL of course but then how do I get the image file name in to the product?

My current code is something like this:

...
$simpleProduct = $this->_productInterfaceFactory->create();
$simpleProduct->setSku("testsku")
                  ->setName("test product")
                  ->setImage('???')
                  ->setSmallImage('???')
                  ->setThumbnail('???')                                 
                  ->setAttributeSetId(4)
                  ...
                  ...
                  
$this->_productRepository->save($simpleProduct);
...

Is it possible this way?

I thought perhaps I can add the image to a new product attribute and then change the media phtml file to load the CDN image instead rather than the Magento image. But I would rather do it the “Magento” way.

Thanks

(Magento 2.3.3)

magento2 – magento 2.3.3 not sending any mail

I just installed Magento 2.3.3 in the Cpanel using Installatron. I didn’t add any product. I changed the email in store->configuration->Email Options->Send Emails To.
but no email is coming when I submit the contact form. because of this issue, I reinstalled Magento before.
I search for a solution but nothing worked, can anyone help me I am new to Magento
you can check from this URL: http://zahratalebtsama.ae/

magento2 – Magento 2 customer attribute not working in Magento 2.3.3

I have created a module for adding a customer attribute and show it in create account form on frontend and account edit in backend, the thing is that it worked in Magento 2.2 but not on Magento 2.3.3, I don’t know if it changes.

Here is my code.

InstallData.php

<?php
namespace KageRegisterFormSetup;

use MagentoCustomerApiCustomerMetadataInterface;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;

class InstallData implements InstallDataInterface 
{
    /**
     * @var EavSetupFactory
     */
    private $eavSetupFactory;
    /**
     * @var MagentoEavModelConfig
     */
    private $eavConfig;

    public function __construct(
        EavSetupFactory $eavSetupFactory,
        MagentoEavModelConfig $eavConfig
    ) {
        $this->eavSetupFactory = $eavSetupFactory;
        $this->eavConfig = $eavConfig;
    }

    /**
     * Installs data for a module
     *
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     * @return void
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        /** @var MagentoEavSetupEavSetup $eavSetup */
        $eavSetup = $this->eavSetupFactory->create(('setup' => $setup));

        $setup->startSetup();

        $attributeCode = 'register_zip_code';
        $eavSetup->addAttribute(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, 'register_zip_code', (
            'type' => 'text',
            'label' => 'Zip Code',
            'input' => 'text',
            'required' => true,
            'visible' => true,
            'source' => '',
            'backend' => '',
            'user_defined' => true,
            'is_user_defined' => false,
            'sort_order' => 1000,
            'is_used_in_grid' => false,
            'is_visible_in_grid' => false,
            'is_filterable_in_grid' => false,
            'is_searchable_in_grid' => false,
            'position' => 1000,
            'default' => 0,
            'system' => 0,
        ));

        $eavSetup->addAttributeToSet(
            CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
            CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
            null,
            $attributeCode);

        $registerZipCode= $this->eavConfig->getAttribute(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, $attributeCode);
        $registerZipCode->setData('used_in_forms', (
            'adminhtml_customer',
            'customer_account_create',
            'customer_account_edit'
        ));
        $registerZipCode->getResource()->save($registerZipCode);

        $setup->endSetup();
    }
}

view/frontend/layout/customer_account_create.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="form.additional.info">
                <block class="MagentoFrameworkViewElementTemplate" name="register_zip_code" template="Kage_RegisterForm::register.phtml"/>
    </referenceContainer>
</body>
</page>

view/templates/register.phtml

<fieldset class="fieldset create account" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>">
    <legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Additional Information') ?></span></legend>
    <p>
    <div class="field required regulation">
        <label for="regulation" class="label"><span><?php /* @escapeNotVerified */
                echo __('Zip Code') ?></span></label>
        <div class="control">
            <input type="text" name="register_zip_code" id="register_zip_code" title="<?php /* @escapeNotVerified */ echo __('Zip Code') ?>" class="input-text" data-validate="{required:true}">
        </div>
    </div>
    </p>
</fieldset>