Skip to content

How to get the seller id of seller profile i am viewing in magento 2.4.3 marketplace

I want to know the seller id when I go to each seller shop: example link – http://127.0.0.1/marketplace/seller/profile/shop/lamu.

My current code is like this, and it is not working.

<?php

namespace VendorMarketplaceSellerProfilePopUpBlock;

use MagentoFrameworkViewElementTemplate;
use MagentoFrameworkRegistry;
use MagentoFrameworkHTTPClientCurl;

class Popup extends Template
{
    protected $registry;

    /**
     * @var Curl
     */
    protected $curl;

    /**
     * Constructor.
     *
     * @param Curl $curl
     */
    public function __construct(
        Curl $curl,
        TemplateContext $context,
        Registry $registry,
        array $data = []
    ) {
        $this->curl = $curl;
        $this->registry = $registry;
        parent::__construct($context, $data);
    }

    public function getSellerId()
    {
        $seller = $this->registry->registry('current_seller');
        if ($seller) {
            return $seller->getId();
        }
    }
}