We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3707
    • 241 Posts
    Brett, That would be a great modification to the snippet if it could auto generate a MODx user account.The more subscription options the better. I use a modified version of the subscription_link snippet myself. It’s called from the user profile page and displays a subscription link if the user hasn’t yet subscribed or if it has expired and displays the expiry date if the subscription is active.

    Danthach6, I think Brett explains the subscription_link snippet well but just to confirm. The snippet checks to see whether the user is logged in or not. If they are, the subLinkTpl chunk is displayed, if not, the regLinkTpl chunk is displayed.

    For your "SubscriptionLink" chunk, you need to leave the userID placeholder as a placeholder so that it picks up the ID of the logged in user and adds the subscription to the right account. If you only have one type of subscription, you can hard code all the other values into the chunk. Otherwise, you will have to create a TV for each of the values and apply those to the template your product page uses. So a TV called product_code, one called product_price etc. If you have more than one type of subscription you’re better off creating the TVs and leaving the placeholders in.

    If you need more help, I’ve written some documentation on this. It’s not completely finished but it might help.
      • 6525
      • 15 Posts
      Bob1000, I would greatly like to read your documentation. Thanks for the help!
        • 16834
        • 93 Posts
        Forgive my ignorance.

        I have just stumbled upon this Foxycart integration - which is a terrific idea and may be perfect for what I need.

        Bob1000, if your documentation would bring me up to speed rapidly, I may be able to contribute in some small way to the coding effort in addition to getting a working subscription system up and running.

        Lee
          • 25883
          • 128 Posts
          We have a scenario where there are three levels. Guests can see a certain amount of material we’ll call Area A. Most people choose to register for free (using just MODx registration) and then get access to more material (lets call it Area B) and get enrolled in a newsletter. Only about 10-20% will upgrade to the extended content area (Area C) and special newsletters (an additional segmentation of the newsletter).

          Should Area C people’s monthly subscription lapse, will they still fall back to being a registered user and have access to Area B?

          Okay, I feel like I just wrote one of those "if the train to Portsmouth is going 40 miles an hour" logic problems, haha.

          Also (not necessarily a question for Luke or Brett although you guys might have some thoughts on this) what is the best newsletter software to use for this implementation? I like MailChimp’s features, but also have seen that Campaign Monitor / MailBuild might have some integration history with Foxy/MODx. Any suggestions on how to structure the setup of the two newsletter segments?

          Thanks!

          John
            • 29635
            • 361 Posts
            This snippet could do that but would take just a smidgen of modification, but FoxyBack would likely be a more solid solution.

            Fwiw, I think a look at FoxyBack might be better than this snippet, but it’s a bit more involved (but it’ll handle more functionality like MailChimp integration). (The "expiration" functionality isn’t built into FoxyBack yet though, so it wouldn’t work right now, but it’ll likely show up in FoxyBack soon (or sooner if you want to contribute it wink.)

            MailChimp’s super solid, as is Campaign Monitor (or MailBuild). They’re all supported with FoxyCart at http://wiki.foxycart.com/integration, but I know that Ryan’s a big fan of MailChimp so if any MODx tie-ins come they’ll likely come for MailChimp before anything else.
              Need MODx Ecommerce? Try FoxyCart!
              • 30228
              • 8 Posts
              Hello,

              I was testing out this plugin on my development environment to see if it fits my needs but I keep coming up with a parse error whenever I try to view the page.

              I followed the instructions in both sets of files, added the template variables, etc but I still can’t figure out what is wrong. Any help would be appreciated!

              This is the error that I receive.

              Thanks!

              « MODx Parse Error »
              MODx encountered the following error while attempting to parse the requested resource:
              « PHP Parse Error »
               
              PHP error debug
                Error: 	Invalid argument supplied for foreach()	 
                Error type/ Nr.: 	Warning - 2	 
                File: 	/path/to/site/modx/assets/snippets/foxycart_webuser_subscriptions/snippet.FoxyCart_Subscription_Link.php	 
                Line: 	54	 
                Line 54 source: 	foreach($tvs as $name=>$value) { 	 
               
              Parser timing
                MySQL: 	0.0110 s	(7 Requests)
                PHP: 	0.0485 s	 
                Total: 	0.0595 s
              
                • 30228
                • 8 Posts
                It seems this error only occurs when I envoke the SubscriptionLink chunk in a page.

                Any thoughts?
                  • 16834
                  • 93 Posts
                  @todd

                  Are you sure you named the tv’s exactly as the script expects? It looks like the SubscriptionLink is failing to pick them up correctly.

                  L
                    • 30228
                    • 8 Posts
                    Quote from: leapy at Oct 25, 2008, 04:44 PM

                    @todd

                    Are you sure you named the tv’s exactly as the script expects? It looks like the SubscriptionLink is failing to pick them up correctly.

                    L

                    Hi leapy,

                    I figured it out - I’m not familiar with ModX and I neglected to publish the pages that I had the SubscriptionLink snippet on. <grins>

                    It’s all up and running now. I did have one more question though. I was able to subscribe via FoxyCart just fine but when the transaction was complete it took me back to the default page rather then the page I specified in the datafeed. Could this be because I’m running FoxyCart in test mode or a publishing error? I’m wondering how to get it to redirect to the SubscriptionManager page that I set up when I installed the plug-in.
                      • 29635
                      • 361 Posts
                      Quote from: toddbloom7 at Oct 25, 2008, 09:36 PM

                      I was able to subscribe via FoxyCart just fine but when the transaction was complete it took me back to the default page rather then the page I specified in the datafeed. Could this be because I’m running FoxyCart in test mode or a publishing error? I’m wondering how to get it to redirect to the SubscriptionManager page that I set up when I installed the plug-in.
                      You mean after the transaction, on the FoxyCart generated receipt page? If that’s what you’re talking about, the "continue" link that’s generated by FoxyCart is set to send you back to the first page that FoxyCart saw you come from on your own site. If you want to send the user to a specific page you could hide that link with CSS and add your own into your receipt template.

                      Or you could use the JSON object to determine what the customer just purchased, and send them to the correct page based on the transaction.

                      If that’s not what you’re talking about, my bad wink
                        Need MODx Ecommerce? Try FoxyCart!