News:

Support the VirtueMart project and become a member

Main Menu

Payment methods for shopper groups only

Started by sandomatyas, December 02, 2024, 13:00:29 PM

Previous topic - Next topic

sandomatyas

Hello, everyone! I've built a shop that uses reseller shopper groups. However, it seems I can't add a payment method exclusively for non-resellers. If I set it to "guests only," it doesn't show for registered users. On the other hand, if I include the default shopper group, it becomes visible to resellers as well.

sandomatyas

I believe the issue is in the getPluginMethods() method of the file:

administrator/components/com_virtuemart/plugins/vmpsplugin.php

Specifically, in the following part of the code:

$usermodel = VmModel::getModel( 'user' );
$user = $usermodel->getUser($userId);
$user->shopper_groups = (array)$user->shopper_groups;

When I log in as a reseller and dump $user->shopper_groups, I get the following result:

Kód másolása
Array
(
    [0] => 13
    [1] => 2
)

The problem is that 2 (the default group) appears in the list of shopper groups. As a result, all shipping methods assigned to the default group are also listed for resellers, which is not the desired behavior.