Product with required subscription

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
IOU42
Posts: 26
Joined: 25 Jun 2016, 21:10

Product with required subscription

Post by IOU42 » 06 Apr 2023, 12:56

Hi,

I have set up a product with an annual subscription. The product price is also set for a year.
As I want to use the subscription (Next Date field) to check is customer is allowed on member area, I also want to enforce the year interval, but now on the product page the interval can be chosen ('none' or 'a year').

- Is this possible to have a product automatically tied to an interval, and if yes how?
- Is there a better approach?

Kind regards, Marc
(Laravel 9, Aimeos 2022.10)

PS: I also gave it a try asking ChatGPT and it came up with the solution to add below to shop.php config file, but I assume this is incorrect?

Code: Select all

'products' => [
    'product id number' => [
        'subscription' => [
            'enable' => true,
            'options' => [
                [
                    'interval' => 'P1Y0M0W2D',
                ],
            ],
        ],
    ],
],

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

Re: Product with required subscription

Post by aimeos » 11 Apr 2023, 06:39

IOU42 wrote: 06 Apr 2023, 12:56 - Is this possible to have a product automatically tied to an interval, and if yes how?
Yes, configure the attribute of the type to be pre-selected so the "None" or "Please select" isn't rendered here:
https://github.com/aimeos/ai-client-htm ... #L164-L166

Docs: https://aimeos.org/docs/2022.x/config/c ... #preselect
IOU42 wrote: 06 Apr 2023, 12:56 PS: I also gave it a try asking ChatGPT and it came up with the solution to add below to shop.php config file, but I assume this is incorrect?
That's complete non-sense ;-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

IOU42
Posts: 26
Joined: 25 Jun 2016, 21:10

Re: Product with required subscription

Post by IOU42 » 14 Apr 2023, 16:00

Thanks for your response again. I will go with that.

System info:
Running Aimeos Laravel: 2022.10
Laravel Framework 9.52
Almalinux
PHP 8.1

Post Reply