Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Display customer list

Options
U057U47RCBD
U057U47RCBD Posts: 28 🧑🏻‍🚀 - Cadet
edited May 2023 in Help

Hi Team,

I have added a GUI module in merchant portal, and want to display customer list for the same . I am using Customer Facade for the same, but unable to get the customer list . Is there anything else that needs to be done ?

Comments

  • U03SBJFJXBQ
    U03SBJFJXBQ Posts: 13 🧑🏻‍🚀 - Cadet
    Options

    I'm not sure if this is your case but you need to expand the permissions to be able to access other objects from the Merchant Portal

  • U03SBJFJXBQ
    U03SBJFJXBQ Posts: 13 🧑🏻‍🚀 - Cadet
    Options

    you can check here vendor/spryker/acl-merchant-portal/src/Spryker/Zed/AclMerchantPortal/Business/Expander/AclEntity/AclEntityMetadataConfigExpander.php

  • U057U47RCBD
    U057U47RCBD Posts: 28 🧑🏻‍🚀 - Cadet
    Options

    I have created a dataprovider using customerQuery and customerCollection , but the collection is returning empty sets

  • U057U47RCBD
    U057U47RCBD Posts: 28 🧑🏻‍🚀 - Cadet
    Options

    This is the repository code
    $customerQuery = $this->buildCustomerTableBaseQuery(
    $customerTableCriteriaTransfer
    );
    //print_r($productOfferQuery);
    $propelPager = $customerQuery->paginate(
    $customerTableCriteriaTransfer->requirePage()->getPage(),
    $customerTableCriteriaTransfer->requirePageSize()->getPageSize(),
    );
    However
    $propelPager->getResults()->getData()
    return empty

  • U057U47RCBD
    U057U47RCBD Posts: 28 🧑🏻‍🚀 - Cadet
    Options

    protected function buildCustomerTableBaseQuery(
    CustomerTableCriteriaTransfer $customerTableCriteriaTransfer
    ): SpyCustomerQuery {
    $customerQuery = $this->getFactory()->getCustomerPropelQuery();
    $customerQuery
    ->addAsColumn(CustomerTransfer::CUSTOMER_REFERENCE, SpyCustomerTableMap::COL_CUSTOMER_REFERENCE)
    ->addAsColumn(CustomerTransfer::FIRST_NAME , SpyCustomerTableMap::COL_FIRST_NAME)
    ->addAsColumn(CustomerTransfer::LAST_NAME , SpyCustomerTableMap::COL_LAST_NAME)
    ->addAsColumn(CustomerTransfer::EMAIL , SpyCustomerTableMap::COL_EMAIL)
    ->select([
    customerTransfer::CUSTOMER_REFERENCE,
    CustomerTransfer::FIRST_NAME,
    CustomerTransfer::LAST_NAME,
    CustomerTransfer::EMAIL
    ]);
    return $customerQuery;
    }

  • U057U47RCBD
    U057U47RCBD Posts: 28 🧑🏻‍🚀 - Cadet
    Options

    Anything we can get on this issue ?

  • U03SBJFJXBQ
    U03SBJFJXBQ Posts: 13 🧑🏻‍🚀 - Cadet
    Options

    your code looks ok, so it's probably what I referenced in my previous message, when you don't have the ACL permissions configured for an object in the merchant portal, the query will just return an empty result, as a test you can just include the customer object to the file in the vendor folder, something like this

     $aclEntityMetadataCollectionTransfer->addAclEntityMetadata(
                'Orm\Zed\Customer\Persistence\SpyCustomer',
                (new AclEntityMetadataTransfer())
                    ->setEntityName('Orm\Zed\Customer\Persistence\SpyCustomer')
    
                    ->setDefaultGlobalOperationMask(
                        AclEntityConstants::OPERATION_MASK_READ,
                    ),
            );
    
  • U057U47RCBD
    U057U47RCBD Posts: 28 🧑🏻‍🚀 - Cadet
    Options

    Thanks Mate. It worked . Also needed to add Customer in Allow list in expandAclEntityMetadataConfigWithAllowList method