Show different prices for customers of different membership

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!
Kylin00
Posts: 3
Joined: 27 Jan 2018, 11:22

Show different prices for customers of different membership

Post by Kylin00 » 27 Jan 2018, 11:50

Hi, everybody. Firstly, I have to say that my tongue is not English, please forgive me if I say something in a wrong way.
Then, my question is "how to show different prices for customers of different membership ?", to be explicit, Our shop have three types of membership currently, and they can buy the product in different price according to their membership level, here I had two thought:(1) every time a customer visit our shop, I will call a ajax to search the corresponding price to them, but It seems too complex if a new product needed to be add in the shop as I must manually add it to my database, (2) Try to change the controller behavior before it render the prices to the front end, and after a week, I still could not find the right way to do that so.

Would you please give me some advice, I will be appreciate!

Kylin00
Posts: 3
Joined: 27 Jan 2018, 11:22

Re: Show different prices for customers of different members

Post by Kylin00 » 27 Jan 2018, 12:06

Notes: My Laravel version is 5.5, Aimeos version is 2017.10.4, PHP version is 7.1, my environment is Linux

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

Re: Show different prices for customers of different members

Post by aimeos » 28 Jan 2018, 17:53

You need the customer / customer group extension form the Aimeos company for this:
https://aimeos.com/extensions/#c823
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Kylin00
Posts: 3
Joined: 27 Jan 2018, 11:22

Re: Show different prices for customers of different members

Post by Kylin00 » 29 Jan 2018, 15:46

aimeos wrote:You need the customer / customer group extension form the Aimeos company for this:
https://aimeos.com/extensions/#c823
So much thanks, I will consider it seriously.

vasile.loghin
Posts: 4
Joined: 09 May 2024, 06:24

Re: Show different prices for customers of different membership

Post by vasile.loghin » 09 May 2024, 06:46

Hi there
I am working on an Aimeos 24 on TYPO3 v.12 installation for a shop.
We need a specific application where the customer needs to be given access to different areas of the website based on the subscription they purchase, either Standard or Premium, and also be assigned to a different usergroup based on what subscription he chooses.
I have read in the docs in the Subscriptions section here https://aimeos.org/docs/latest/manual/subscriptions/ that this would be possible indeed using subscriptions, but it is not clearly exaplained there how this would need to be implemented.
Is there any way this can be implemented with the standard Aimeos package, or would this also require the Customer / Customer group extension, like in the OP?

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

Re: Show different prices for customers of different membership

Post by aimeos » 09 May 2024, 07:43

Assignment to different user groups should work without the extension:
https://aimeos.org/docs/latest/cronjobs ... rocessors/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

vasile.loghin
Posts: 4
Joined: 09 May 2024, 06:24

Re: Show different prices for customers of different membership

Post by vasile.loghin » 16 May 2024, 09:51

Ok, thanks for the reply.

I have implemented the custom processor in a separate extension, in a class called Myproc/Standard.
In the docs, as well as in the class that i try to extend (vendor/aimeos/ai-controller-jobs/src/Controller/Jobs/Subscription/Process/Begin/Standard.php, or vendor/aimeos/ai-controller-jobs/src/Controller/Jobs/Common/Subscription/Process/Processor/Cgroup/Standard.php), in the comments it says that i have to do the following setting in order for my class to be called in the place of the custom class:

* Each default job controller can be replace by an alternative imlementation.
* To use this implementation, you have to set the last part of the class
* name as configuration value so the controller factory knows which class it
* has to instantiate.
*
* For example, if the name of the default class is
*
* \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard
*
* and you want to replace it with your own version named
*
* \Aimeos\Controller\Jobs\Subscription\Process\Begin\Mybegin
*
* then you have to set the this configuration option:
*
* controller/jobs/subscription/process/begin/name = Mybegin

Where can this setting be set in TYPO3?

Code: Select all

controller/jobs/subscription/process/begin/name = Mybegin

I have not managed to find it or something similar anywhere in the code, nor by trying to figure it out by myself from the code how could such a processor class be extended with a custom class. Thus, the custom code from the custom class is still not being executed.

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

Re: Show different prices for customers of different membership

Post by aimeos » 17 May 2024, 17:34

You mix up two things. Either you overwrite the existing "subscription/process/begin" job controller (not recommended) or you create a new subscription processor decorator like the existing ones like you've tried to:
https://github.com/aimeos/ai-controller ... /Processor

Use the "Cgroup" decorator as example:
https://github.com/aimeos/ai-controller ... andard.php

Creating new decorators is described here:
https://aimeos.org/docs/latest/cronjobs ... processors

To configure the new decorator, add it to the Resources/Private/Config/controller.php file of your own Aimeos extension for the project:

Code: Select all

	'common' => [
		'subscription' => [
			'process' => [
				'processors' => ['Myproc']
			]
		]
	]
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

vasile.loghin
Posts: 4
Joined: 09 May 2024, 06:24

Re: Show different prices for customers of different membership

Post by vasile.loghin » 20 May 2024, 08:56

Thanks for the suggestions and the links.
But still doesnt work :D

I have implemented it in the following steps:

==================================
1. Created a scheduler task Aimeos Shop scheduler (aimeos), where in the Jobs select, the following 3 options have been selected:
subscription/process/begin
subscription/process/end
subscription/process/renew

==================================
2. Set the settings you recommended for controller.php in my own custom extension or directly in vendor/aimeos/aimeos-typo3/Resources/Private/Config/controller.php, the following way:
2.1. in the custom extension in packages/reea_aimeos_processors/Resources/Private/Config/controller.php:

Code: Select all

return array(
	'common' => [
		'subscription' => [
			'process' => [
				'processors' => ['Cgroup'],
				'processor' => [
					'cgroup' => [
						'name' => 'Mygroup'
					]
				]
			]
		]
	]
);
2.2. in vendor/aimeos/aimeos-typo3/Resources/Private/Config/controller.php:

Code: Select all

return array(
	'common' => array(
		'media' => array(
			// Mime icon related settings
			'mimeicon' => array(
				// File extension of mime type icons
				'extension' => '.png',
			),
		),
		// controller/common/subscription/process/processors = ['Cgroup']
		// controller/common/subscription/process/processor/cgroup/name = Mygroup
		'subscription' => [
			'process' => [
				'processors' => ['Cgroup'],
				'processor' => [
					'cgroup' => [
						'name' => 'Mygroup'
					]
				]
			]
		]
	),
);
============================================
2. Created the custom processor class, in the following file:
packages/reea_aimeos_processors/Classes/Controller/Jobs/Common/Subscription/Process/Processor/Cgroup/Mygroup.php

The namespace and class declaration:

Code: Select all

namespace Reea\ReeaAimeosProcessors\Controller\Jobs\Common\Subscription\Process\Processor\Cgroup;

use Aimeos\Controller\Jobs\Common\Subscription\Process\Processor\Cgroup\Standard;

class Mygroup
	extends Standard
    implements \Aimeos\Controller\Jobs\Common\Subscription\Process\Processor\Iface
{
    public function __construct( \Aimeos\MShop\ContextIface $context )
	{
		\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($context,'$context -----  '.__FILE__. ' @ '.__LINE__);
        parent::__construct( $context );
        // more initialization code
    }

    public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order )
	{
        // Code that is executed at the beginning of the subscription
		$context = $this->context();
		\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($context,'$context -----  '.__FILE__. ' @ '.__LINE__);
....................................................
For the beginning, i have only added some debugs just to see that it enters my code, but it doesnt.

I have also added some debugs in the core Cgroup class in vendor/aimeos/ai-controller-jobs/src/Controller/Jobs/Common/Subscription/Process/Processor/Cgroup/Standard.php, but it doesnt execut those either. So it behaves as if it doesnt observer at all the Cgroup processor class settings that i have added in controller.php (in 2 places just to make sure it takes at least one) and only executes the standard processors.

From the steps above, any idea what i am missing, or not doing right?

Thanks for your help.

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

Re: Show different prices for customers of different membership

Post by aimeos » 22 May 2024, 12:44

You can't extend from the existing Cgroup decorator. Instead, create a new one and copy the relevant code you need from there.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply