public function getPaymentsAction() { try { $builder =
$this->
get('models'
)->
createQueryBuilder();
$builder->
select(['payment', 'ruleSets'
]) ->
from('Shopware\Models\Payment\Payment', 'payment'
);
$builder->
leftJoin('payment.ruleSets', 'ruleSets'
);
$builder->
orderBy('payment.active', 'desc'
);
$builder->
addOrderBy('payment.id'
);
$result =
$builder->
getQuery()->
getArrayResult();
$total =
$this->
get('models'
)->
getQueryCount($builder->
getQuery());
// Translate the payment methods
$translationComponent =
$this->
get(Shopware_Components_Translation::
class);
$result =
$translationComponent->
translatePaymentMethods($result);
$this->
View()->
assign(['success' => true, 'data' =>
$result, 'total' =>
$total]);
} catch (Exception
$e) { $this->
View()->
assign(['success' => false, 'errorMsg' =>
$e->
getMessage()]);
} }