-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add Subscription Bundle #385
Conversation
Hi guys, thanks for checking this out. I hope this feature is in everybody's interest and not too opinionated. I'm looking for feedback on whether this is the right approach, flexible enough, "Sylius worthy", etc. With regards to the implementation, I'm not 100% sure about the Processor integration because it really only throws events, and I am also thinking about better interval handling which supports more flexible intervals. The current implementation works with only one unit (days), and it would be nice to support other intervals: First of every month, every Monday, each year on my Birthday.. so I'm wondering if the complex scheduling support should be delegated to a separate bundle which could also be used for other activities within Sylius (triggering emails, running batch operations, etc). Thank you for feedback! |
{ | ||
$output->writeln('Processing Subscriptions...'); | ||
|
||
$counter = new \stdClass(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using a simple array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got it. Forgot about the "by reference" trick..
I had a very quick look, but awesome work so far! |
*/ | ||
public function getProduct() | ||
{ | ||
return $this->variant->getProduct(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if variant was not yet set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I took inspiration from here: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CoreBundle/Model/OrderItem.php#L34 Guess we should fix it there as well.
Hey guys, I just pushed a refactoring of the scheduling/processing code, and renamed a few interfaces/classes. (I took some inspiration from Magento). This version should start to be pretty solid:
Also, thanks everybody for the feedback so far - I will make sure it will all be addressed. (todo list moved up top) |
@Richtermeister Please do not squash these commits, they're fine and reflect the dev process. Usually I prefer to squash some CS fix commits, simple typos or 5 commits changing 1 line. :) |
Oh i love this idea !!! 👍 |
@pjedrzejewski Thanks man, and thanks for the tweet! :) Glad you like the idea, hope this implementation covers the features you had in your project. |
@amenophis Thanks man. This should already be usable and I think it's starting to stabilize, you can give it a shot and let me know if it works for you or if you have unaddressed use-cases. Thanks! :) |
{ | ||
if ($this->variant) { | ||
return $this->variant->getProduct(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO you should do:
return null;
After that if
just to have all things clear, and not guess.
Would be nice to add some Behat scenarios for the account panel. Also, I think we want to create and list subscriptions in backend, but I'm in favor of adding this functionality after redesign PR which I hope to merge tonight / tomorrow in worst case... (I need to make the login page prettier and working) Thoughts? |
@stloyd Very good feedback man, can't sneak anything past you! ;) I hope I addressed it all. Thanks! |
@pjedrzejewski Absolutely! What I am not so sure about is how to select a product(variant) when adding a new subscription item, but I guess I can use the same form / resolving logic used in the front-end? Also, great to hear about the Bootstrap3 update. I am currently running BS3 in the front-end and the global form-theming is messing with the admin area. I guess the demo site will have the reverse problem until the front-end is upgraded, too? Maybe forms should not be globally themed, only in the template where they are used? /offtopic |
Yeah, @stloyd's reviews are awesome, thanks for that man! :) @Richtermeister I'll think about simplest way to select variant, we'll need the same thing for order creation... I think we should have a product selection autocomplete field, and then dynamically load options / variants selection fields. It can become complex, but I think we can do it in next iteration, it's cool as is. In my use case, subscriptions were created "in code", not via ui. Regarding the B3 issue, I will take a look hard it will be to switch frontend to BS3, not changing the look, just updating the forms etc. I think I will be able to do it pretty easily so we avoid the conflicts. Thanks for your work, I could give you a hand with Behat part, hm? |
@pjedrzejewski Re: Behat, if you're offering, I'm taking! Thanks! :) I'm sure I'll get another chance to learn it better.. |
@@ -0,0 +1,72 @@ | |||
<?php | |||
|
|||
namespace Sylius\Bundle\CoreBundle\DataFixtures\ORM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing license header.
…ionItem and Subscription
e5a5194
to
f93129b
Compare
Any chance to see this PR merged soon ? |
@amenophis I'd love to have that in core, but it requires review and this functionality is not a priority at this moment. I greatly appreciate all work done here and this will land in master, but can't estimate when... When we are done with current things. (search, api, new frontend/backend theme, multi-store) |
@amenophis an alternative would be to use the 2 repos I linked to above... you should be able to add those to your composer.json and implement the necessary forms (from CoreBundle) in your application.. this is how we're doing it in one of our sites since they need this feature now There's still things to be done, though... the payment processing & storage still needs to be implemented, for example. But I think this should be a good start, and the subscription frontend seems to be working well. @pjedrzejewski if there's anything I can do to speed up the merge let me know |
@pjedrzejewski search, api, new frontend/backend theme, multi-store and the doc ;) |
any news about this issue? |
I just want to give a shout out that this is functionality I am looking for in Sylius as well. I will give a shot at trying to implement the repo's linked above and add the missing functionality, but would be awesome if this would be implemented in the core. |
@pjedrzejewski is there any core component for this even? or is subscriptions considered an archetype or a special pricing calculator on a product? whats the easiest way one would extend the core to have subscriptions? @MichaelMackus is this still being developed here or where should PR's be submitted? |
@kzap development for this is being continued in the repos linked above.. the PR is on a hiatus until dev team is interested in merging |
@MichaelMackus @kzap unfortunately this feature will not land on master in Sylius 1.0 release. We're in stabilization phase and as @pjedrzejewski comment here we have other more important features to polish. We will be interested to resume this work later on ;) |
Thanks for keeping a updated repo..ill use yours then
|
[Rbac] Update documentation
Hi, I have an requirement on this feature. The last update is already long ago. I am wondering, if one can provide an update on the roadmap / timings. So far is looks like that this will never get merged since it is so old. Please don't mind asking. I am just curious. Thx. |
I'm not sure if there is any point in keeping this one open. Too many things have changed. Thus it is a good plugin proposal :) |
hmm, any plugin already available providing this feature? |
This goal of this PR is to add subscription features to Sylius, to support recurring orders, club-memberships, etc.
The model revolves around subscriptions and subscription items, which on the application level can be linked specific products/variants. The scheduling mechanism is decoupled so that complex scheduling scenarios can be supported. A simple interval-based scheduler is included. The bundle also comes with a command and a processor harness to process subscriptions that are due. Actual processing logic is delegated to the application layer.
I also added a new section to the customer panel to allow customers to manage their subscriptions.
Feedback pleez!
Thanks! :)
Todos: