getPaymentFields example



    /** * {@inheritdoc} */
    public function getList(array $paymentIds, ShopContextInterface $context)
    {
        $paymentIds = array_unique($paymentIds);

        $query = $this->connection->createQueryBuilder();

        $query->addSelect($this->fieldHelper->getPaymentFields());

        $query->from('s_core_paymentmeans', 'payment')
            ->leftJoin('payment', 's_core_paymentmeans_attributes', 'paymentAttribute', 'paymentAttribute.paymentmeanID = payment.id')
            ->where('payment.id IN (:ids)')
            ->addOrderBy('position', 'ASC')
            ->addOrderBy('name', 'ASC')
            ->setParameter(':ids', $paymentIds, Connection::PARAM_INT_ARRAY);

        $this->fieldHelper->addPaymentTranslation($query$context);

        $data = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        
/** * @param int[] $ids * * @return array<array<string, mixed>> */
    private function fetchCustomers(array $ids): array
    {
        $query = $this->connection->createQueryBuilder();
        $query->addSelect($this->fieldHelper->getCustomerFields());
        $query->addSelect($this->fieldHelper->getCustomerGroupFields());
        $query->addSelect($this->fieldHelper->getPaymentFields());
        $query->addSelect('(SELECT 1 FROM s_campaigns_mailaddresses campaign_mail WHERE campaign_mail.email = customer.email LIMIT 1) as __active_campaign');
        $query->from('s_user', 'customer');
        $query->where('customer.id IN (:ids)');
        $query->leftJoin('customer', 's_core_customergroups', 'customerGroup', 'customerGroup.groupkey = customer.customergroup');
        $query->leftJoin('customerGroup', 's_core_customergroups_attributes', 'customerGroupAttribute', 'customerGroupAttribute.customerGroupID = customerGroup.id');
        $query->leftJoin('customer', 's_core_paymentmeans', 'payment', 'payment.id = customer.paymentID');
        $query->leftJoin('payment', 's_core_paymentmeans_attributes', 'paymentAttribute', 'payment.id = paymentAttribute.paymentmeanID');
        $query->leftJoin('customer', 's_user_attributes', 'customerAttribute', 'customer.id = customerAttribute.userID');
        $query->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY);

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
Home | Imprint | This part of the site doesn't use cookies.