How to add a group to the customers' account during the customer has an active subscribtion?

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Jens3456
Posts: 5
Joined: 24 Sep 2023, 00:03

How to add a group to the customers' account during the customer has an active subscribtion?

Post by Jens3456 » 24 Sep 2023, 00:32

Hi,

I want to sell a product with a subscription. While the subscription is active, the customer should be a member of a customer group 'subscribers' with the ID=4.

I created a customer group with the key 'subscribers' and the label 'Subscribers'.

Then, I created the catalog attribute 'customer/group' with the key '4' and the label 'Subscribers'.

I added the type 'customer/group' with the attribute (hidden) 'Subscribers' to the product under features.

I added the following code to the TS-Config field of the scheduler task "Subscription Process Start":
controller.common.subscription.process.processors { 0 = cgroup }
controller.common.subscription.process.processor.cgroup.groupids { 0 = 4 }

When customers buy this item, they are not assigned to the customer group 'subscribers' as expected. What is going wrong? Do additional entries need to be made in Typoscript?

Used versions: Typo3 12, Aimeos 2023 and PHP 8.1.

Many thanks

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: How to add a group to the customers' account during the customer has an active subscribtion?

Post by aimeos » 26 Sep 2023, 16:11

Jens3456 wrote: 24 Sep 2023, 00:32 controller.common.subscription.process.processors { 0 = cgroup }
controller.common.subscription.process.processor.cgroup.groupids { 0 = 4 }
Don't know if this works properly in TYPO3 and you should try this formatting instead:

Code: Select all

controller.common.subscription.process.processors {
  0 = Cgroup
}
controller.common.subscription.process.processor.cgroup.groupids {
  0 = 4
}
The rest seems to be fine.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Jens3456
Posts: 5
Joined: 24 Sep 2023, 00:03

Re: How to add a group to the customers' account during the customer has an active subscribtion?

Post by Jens3456 » 26 Sep 2023, 21:08

Many thanks for the answer.

I've made the changes, but unfortunately they don't have the desired effect.

It is currently not possible for me to assign the purchaser of a subscription to a specific customer group.

But I will try other possible variations of my settings to solve the problem.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: How to add a group to the customers' account during the customer has an active subscribtion?

Post by aimeos » 27 Sep 2023, 06:49

Does it work if you execute the scheduler task for starting the subscription by hand after you've placed the order?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Jens3456
Posts: 5
Joined: 24 Sep 2023, 00:03

Re: How to add a group to the customers' account during the customer has an active subscribtion?

Post by Jens3456 » 27 Sep 2023, 07:39

No, unfortunately it doesn't work even then.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: How to add a group to the customers' account during the customer has an active subscribtion?

Post by aimeos » 27 Sep 2023, 08:02

This method should be executed when the scheduler task runs for a new order:
https://github.com/aimeos/ai-controller ... hp#L68-L84

Can you add a debug statement if that happens?
Furthermore, the orders to process are selected here:
https://github.com/aimeos/ai-controller ... #L158-L190

Check there too if the order is found or why not.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Jens3456
Posts: 5
Joined: 24 Sep 2023, 00:03

Re: How to add a group to the customers' account during the customer has an active subscribtion?

Post by Jens3456 » 27 Sep 2023, 13:20

I checked the function

https://github.com/aimeos/ai-controller ... #L158-L190

and found that under $processors only Email is included, not Cgroup.
If I add Cgroup here using the typescript of the cron-job "Start subscription":

controller.jobs.subscription.process.processors {
0 = Cgroup
1 = Email
}

additionally to

controller.common.subscription.process.processors {
0 = Cgroup
}
controller.common.subscription.process.processor.cgroup.groupids {
0 = 4
}

, then the buyer of the product with subscription interval is added to the desired customer group (ID=4) and everything works fine. :)

Post Reply