0

I am using magento 2.3 version. I want to add anchor tag after product attribute Name. I tried with adminhtml_catalog_product_edit_prepare_form observer but not working.

I also tried with JS but not able to add <a class= "product-fuc allow_personalization" href="#" onclick= "sendapproval(this)"> Need Apprvoal after product name.

Please help me

2
  • Do you require the same in admin product edit? Commented Jul 13, 2020 at 10:22
  • Yes, I want in admin product edit form.
    – Aish
    Commented Jul 13, 2020 at 10:59

1 Answer 1

0

Create Vendor\Extension\view\adminhtml\layout\catalog_product_edit.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="Vendor_Extension::js/custom_product_edit.js"/>
    </head>
</page>

Create Vendor\Extension\view\adminhtml\web\js\custom_product_edit.js

require([
    'jquery',
], function ($) {
    'use strict';
    $(document).ready(function(){
        $(document).ajaxStop(function () {
            $('input[name="product[name]"]').after("<a href='#'>Product Link</a>");
        });

    });
})

;

4
  • I tried via JS but link is not adding
    – Aish
    Commented Jul 15, 2020 at 5:13
  • jQuery('input[name="product[name]"]').after("<a href='#'>Product Link</a>"); Place this in the console and try again. Also, refer this screenshot - meetanshi.d.pr/yIy1MY Commented Jul 15, 2020 at 5:26
  • I tried and its working but I add some custom ajax on product edit page and this function is calling each and every ajaxstop and also I want to add multiple product attributes and it is not working with multiple fields.
    – Aish
    Commented Jul 16, 2020 at 9:41
  • If you want to do for the multiple attribute product: input[name="product[name] You will have to do the live change: input[name="product[name] and for SKU - input[name="product[sku] I hope it helps. Commented Jul 17, 2020 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.