I Am Creating Custom catalog_product_link_type,

I've added Additional Section in Related Products Section And It is Working.

But How to Save Values Of This additional section Into Database. enter image description here

I have Created My Custom type by adding it into catalog_product_link_type table.

Does AnyOne Know which controller, js, event is used for saving this data.??

  • 2
    There is a sample module here: github.com/mrkhoa99/Boolfly_ProductRelation Commented Nov 7, 2017 at 14:22
  • @ Khoa TruongDinh Custome Type is Not Saving In this Module... Commented Nov 8, 2017 at 5:10
  • What is your Magento version? Commented Nov 8, 2017 at 5:53
  • @KhoaTruongDinh my magento version is 2.1.5 Commented Nov 8, 2017 at 6:47
  • I will check later. I think many users can use that module, so it will work for you as well. But, I don't know why it doesn't work for your Magento version. Can you check with the 2.1.9 version? Commented Nov 8, 2017 at 7:13

1 Answer 1


After Some R&D I came To This Solution.

Creating Preference For Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper

<preference for="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper" type="Your\Module\Controller\Adminhtml\Product\Initialization\Helper"/>

OverRide setProductLinks() Of That Class Like This,

    protected function setProductLinks(\Magento\Catalog\Model\Product $product)
        $links = $this->getLinkResolver()->getLinks();


        $product = $this->productLinks->initializeLinks($product, $links);
        $productLinks = $product->getProductLinks();
        $linkTypes = [
            'related' => $product->getRelatedReadonly(),
            'upsell' => $product->getUpsellReadonly(),
            'crosssell' => $product->getCrosssellReadonly(),
            'yourtype' => $product->getYourTypeReadonly()

        foreach ($linkTypes as $linkType => $readonly) {
            if (isset($links[$linkType]) && !$readonly) {
                foreach ((array) $links[$linkType] as $linkData) {
                    if (empty($linkData['id'])) {

                    $linkProduct = $this->getProductRepository()->getById($linkData['id']);
                    $link = $this->getProductLinkFactory()->create();
                        ->setPosition(isset($linkData['position']) ? (int)$linkData['position'] : 0);
                    $productLinks[] = $link;

        return $product->setProductLinks($productLinks);

After That Data Will Be saved In catalog_product_link And Other Related Tables.

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.