Skip to content

How to call javascript function from Observer file in Magento 2

I have created a custom js file in my custom module. appcodeVendorModuleviewfrontendlayoutdefault.xml <?xml version=”1.0″?> <page xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <head> <script src=”Vendor_Module::js/test.js”/> </head> appcodeVendorModuleviewfrontendwebjstest.js function Test(json){ console.log(‘Test Web’,json); } Then used add to cart event. appcodeVednorModuleetcevents.xml <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Event/etc/events.xsd”> <event… Read More »How to call javascript function from Observer file in Magento 2

Failed to open file composer.json. Please verify the archive error in commercedeveloper

My composer file is below “name”: “mymodule/module-shipping”, “description”: “Description of module”, “type”: “magento2-module”, “version”: “1.0.0”, “license”: [ “OSL-3.0” ], “require”: { “php”: “>=7.4”, “magento/framework”: “~100.0.4” }, “autoload”: { “files”: [ “registration.php” ], “psr-4”: { “Mymodule\Shipping\”: “” } } }“` My… Read More »Failed to open file composer.json. Please verify the archive error in commercedeveloper

Magento 2.4.7 grid using ui_component set column sortOrder

I am creating a new grid in Magento 2.4.7 using ui_component and it won’t respect columns sortOrder values. This is column example: <column name=”created_at” sortOrder=”999″ class=”MagentoUiComponentListingColumnsColumn”> <settings> <filter>text</filter> <label translate=”true”>Created At</label> <sortable>true</sortable> </settings> </column> Recent Magento 2.4.* versions do not… Read More »Magento 2.4.7 grid using ui_component set column sortOrder