magento2 – write Jquery event to append text to textbox on checkout page

I am new to Magento 2.
I have a website, in magento2 which offers some products to be add in cart.

On checkout page, I want to append country ISD code to mobile number textbox next to Country dropdown.
For example, if user select Singapore as Country then +63 should be added to mobile number text box, so that user can add his/her mobile number.
So mobile number textbox can have text as +639988776655.

I can achieve this with jQuery, so kindly share where I can write this jquery stuff in magento2 for checkout page.

Any help would be great for me.

javascript – PWA for Magento2 – best option now?

We would like to develop a PWA storefront with Nuxt.js. Vue Storefront for Magento 2 doesn’t utilize Nuxt.js and it will be many months (or longer) before Vue Storefront Next (the version built with Nuxt.js) supports Magento.

Some options we have seen include:

VueFront looks interesting, but it appears to be a much smaller project than Vue Storefont. Any thoughts on it?

Are there other Nuxt.js options we should consider?

BTW, our store is very non-standard. We cannot use Vue Storefront without heavy customization.

What is our best path for developing a Magento PWA frontend in Nuxt.js at this time? Our timeline dictates that we have to start development now.

magento2 – Customer Customer attribute not appearing in Create new order in magento 2

I have created a custom attribute for customer https://prnt.sc/tb68lv The values are getting saved in the database. i have cross checked it again after opening the customer for edit and the values were present.
I want this information to be present when admin creates a new order for the customer. See https://prnt.sc/tb8ak7

Here is my code for custom attribute creation

<?php

namespace VidushiCustomattributeSetup;

use MagentoCustomerSetupCustomerSetupFactory;
use MagentoCustomerModelCustomer;
use MagentoEavModelEntityAttributeSet as AttributeSet;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
/**
* @var CustomerSetupFactory
*/
protected $customerSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @param CustomerSetupFactory $customerSetupFactory
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
    CustomerSetupFactory $customerSetupFactory,
    AttributeSetFactory $attributeSetFactory
) {
    $this->customerSetupFactory = $customerSetupFactory;
    $this->attributeSetFactory = $attributeSetFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    /*customersetupfactory instead of eavsetupfactory */
    $customerSetup = $this->customerSetupFactory->create(('setup' => $setup));


    // for remove attribute
    //$customerSetup->removeAttribute(MagentoCustomerModelCustomer::ENTITY,'account_notes');

    $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
    $attributeSetId = $customerEntity->getDefaultAttributeSetId();
    /** @var $attributeSet AttributeSet */
    $attributeSet = $this->attributeSetFactory->create();
    $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
    /* create customer Address book attribute */



    $customerSetup->addAttribute(
    Customer::ENTITY,'internal_account_notes',
            (
                'type' => 'varchar', // attribute with varchar type
                'label' => 'Internal Account Notes',
                'input' => 'textarea', // attribute input field is textarea
                'required' => false, // field is not required
                'visible' => true,
                'user_defined' => true,
                'position' => 9999,
                'system'=>0,
            )
        );
    $sampleAttribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'internal_account_notes')
        ->addData(
            (
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ('adminhtml_customer','customer_account_edit','customer_account_create'),
            )
        // more used_in_forms ('adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address')
        );
    $sampleAttribute->save();
}

}

magento2 – Can i add product in category page product collection?

Can I add a product in category page product collection?

I want to add product #123 in category page product collection but the same product already exists in the collection so it is possible?

My concern is
I want to repeat products on the category page multiple times. with pagination and filter working so any have an idea about this. like ento

magento2 – Add module to Magento Marketplace – where can I find their official tester utility

I intend to add my first module to Magento marketplace.

While reading the documents they say that in the first step the module will go into a first automatic test phase using their utility and they encourage people to download this script and test before application. But the link provided is not working.

Anyone know how can I get it ?

Thanks !!!

magento2 – Cannot insert widgets in CMS page or static block, somebody knowing what could be wrong?

using Magento version 2.3.5-p1.
Have the follwing problem and do not know why this is not working anymore.
Editing a block, disable editor and clicking on “insert widget” I get a “404 page not found screen.
On the log I got a debug.log containing the following:

(2020-07-02 21:48:14) main.DEBUG: URI ‘/admin/cms/page/edit/page_id/6/key/9cda62bd1db41b6a327d51c1b2b9abb85a93b75f938498bdf2b8b897c40b9247/widget_target_id/cms_page_form_content/mode/new?isAjax=true” cannot be accessed with POST method (MagentoCmsControllerAdminhtmlPageEdit) () ()
(2020-07-02 21:48:14) main.DEBUG: Request validation failed for action “MagentoCmsControllerAdminhtmlPageEditInterceptor” {“exception”:”(object) (MagentoFrameworkAppRequestInvalidRequestException(code: 0): Invalid request received at D:WebMagentoAktuellvendormagentoframeworkAppRequestHttpMethodValidator.php:69)”} ()

Any idea what could cause this error?

Because of this, I cannot insert a widget.

Please help
Best regards,
Jürgen

magento2 – Unknown column ‘shipping_city’ in ‘where clause’ afterSearch Grid Table

I’m trying to use the afterSearch in a Admin Grid but when I try to filter a result I’m getting an Unknown column 'shipping_city' in 'where clause' where shipping_city is the custom column I added.

I found a sample here but just as the title state I’m getting an error. Below is my class that do this query and throws the error

class Grid
{
    public static $table = 'customer_entity';
    public static $leftJoinTable = 'customer_address_entity';

    public function afterSearch($intercepter, $collection)
    {
        if ($collection->getMainTable() === $collection->getConnection()->getTableName(self::$table)) {
            $leftJoinTableName = $collection->getConnection()->getTableName(self::$leftJoinTable);

            $collection
                ->getSelect()
                ->joinLeft(
                    ('co'=>$leftJoinTableName),
                    "co.entity_id = main_table.default_shipping",
                    ('shipping_city' => 'co.city')
                );

            $where = $collection->getSelect()->getPart(MagentoFrameworkDBSelect::WHERE);
            $collection->getSelect()->setPart(MagentoFrameworkDBSelect::WHERE, $where);
            // echo $collection->getSelect()->__toString();die;
        }
        return $collection;
    }
}

When trying to print the generated query I got this

SELECT `main_table`.*, `co`.`city` AS `shipping_city` FROM `customer_entity` AS `main_table`
LEFT JOIN `customer_address_entity` AS `co` ON co.entity_id = main_table.default_shipping 
WHERE (`shipping_city` LIKE '%Maidenhead%') 

As you can see the shipping_city is the custom column so whenever I tried to search in this column it’s passing this parameter. But I can’t get a result and it’s throwing an error. How can I fix this please.. badly need your help. Thanks

magento2 – How to clean cloudways Varnish cache after cleaning statics on magento 2 side

I wrote a class that works if I call it through pure php. It looks something like this

class CloudwaysAPIClient
{
    const API_URL = "https://api.cloudways.com/api/v1";
    ...
    public function purgeCache()
    {
        ...
    }
    ...
}

After that I call it with the necessary parameters

$apiClient = new CloudwaysAPIClient('...', '...');
$apiClient->purgeCache();

How can I call my class after cleaning static files through a button in the admin panel
System > Cache Management > Flush Static Files Cache

magento2 – Change “Manage_Stock” via REST API on Magento 2

Using Magento 2, I’m trying to change Manage Stock attribute via rest API however does not seem to work via both the stockItems endpoint or the product one. Updating quantity seems to work fine.

Tried like below initially:

    $url = "https://www.magestore.com/rest/all/V1/products/" . $sku;
    $post_data = array(
        'product' =>
        array(
            'sku' => $sku,
            'extension_attributes' => 
                array(
                    "stock_item" => array( 
                        "qty" => $qty,
                        "is_in_stock" => $is_in_stock,
                        "manage_stock" => true
                    )
                )
            )
        );

Then tried like this for the stockItems endpoint:

    $url = "https://www.magestores.com/rest/V1/products/" . $sku . "/stockItems/1";
    $post_data = array(
        "stock_item" => array( 
                "qty" => $qty,
                "is_in_stock" => $is_in_stock,
                "manage_stock" => true
            )
        );

However neither seem to change manage stock to true for me, is this possible to achieve with Rest API?

magento2 – Error 404 when go to simple product URL of configurable product

I have a configurable product showing on frontend. There are 3 simple product link with it.

Here is my configurable product in backend:

enter image description here

The URL of my configurable product in frontend will be like this:

https://domain/becks-beer-bt-330ml-24pk.html

But if I try to access its simple product link like my URL key:

https://domain/becks-beer-bt-330ml-24pk-case-24.html

or

https://domain/becks-beer-bt-330ml-24pk-each.html

It give me error 404 page. Is it possible for me to go to simple product URL of my configurable product.

Thank you!