We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14293
    • 10 Posts
    « 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: 	/html/geyser/assets/snippets/foxycart_webuser_subscriptions/snippet.FoxyCart_Subscription_Link.php	 
      Line: 	54	 
      Line 54 source: 	foreach($tvs as $name=>$value) { 	 
     
    Parser timing
      MySQL: 	0.2474 s	(12 Requests)
      PHP: 	0.3145 s	 
      Total: 	0.5618 s
    


    I’m getting this error. I followed the instructions fully, the NOTES section confused me a bit. If an expert can help me get this performing I’ll be happy to donate to the cause (or to the individual smiley ).

    Thanks in advance.
      • 10076
      • 1,024 Posts
      Been a while I installed FoxyCart, looks here that no data is beeing supplied.Did you follow this step:
      Step 1: Prepare your TVs
      	#	Create a new TV for your product code. Recommended: Variable Name = code; Input Type = Text
      	#	Create a new TV for your subscriptions' web groups. Recommended: Variable Name = webGroup; Input Type = Text
      	#	Assign the TVs to your product templates as necessary.
      

      And this:

      #	Change the following variable values to match your environment:
      	
      */
      		
      	$tvCode = 'product_code';	//	The name of the template variable that will be the unique identifier for your products.
      	$webGroup = 'product_web_group';	//	The TV that stores the name of the web group that users must be added to to access the product.
      	$grace = 10;	//	The number of days, if any, you want to extend to your customers as a grace period if they have not renewed their subscription yet.
      
      /*
      IMPORTANT NOTES:
      	*	Requires products (documents) to have a unique "product code" TV and a TV for storing the name of a web group that
      		users will be added to when they subscribe.
      */
      

      Let me know, Best, fr.
        • 14293
        • 10 Posts
        Quote from: Frank

        Been a while I installed FoxyCart, looks here that no data is beeing supplied.Did you follow this step:
        Step 1: Prepare your TVs
        	#	Create a new TV for your product code. Recommended: Variable Name = code; Input Type = Text
        




        Quote from: Frank

        # Create a new TV for your subscriptions’ web groups. Recommended: Variable Name = webGroup; Input Type = Text



        Quote from: Frank

        # Assign the TVs to your product templates as necessary.



        Quote from: Frank

        And this:

        #	Change the following variable values to match your environment:
        	
        */
        		
        	$tvCode = 'product_code';	//	The name of the template variable that will be the unique identifier for your products.
        	$webGroup = 'product_web_group';	//	The TV that stores the name of the web group that users must be added to to access the product.
        	$grace = 10;	//	The number of days, if any, you want to extend to your customers as a grace period if they have not renewed their subscription yet.
        

        I’m not sure where these settings are - I didn’t see this part in the installation instructions...


        Quote from: Frank

        /*
        IMPORTANT NOTES:
        * Requires products (documents) to have a unique "product code" TV and a TV for storing the name of a web group that
        users will be added to when they subscribe.
        */
        In my case, would this apply to different "levels" of subscriptions? Basic & premium, etc?

        I hope these responses help diagnose the issue - let me know if there’s something else I can provide to help. Thanks again in advance!

        jm
          • 10076
          • 1,024 Posts
          Hi,

          these settings are in the two foxyC snippet codes,
          Uhps, sorry check the plugin code for these settings, other settings are descibed in the manager snippet.
          I think webgroup is not the correct name, it should be a group created in the modx security roles etc setup. And should match the groups you are using so "basic" & "premium".

          fr
            • 14293
            • 10 Posts
            I did this:
            $tvCode = ’subscription’;
            $webGroup = ’webGroup’;
            $grace = 10;

            As for the "basic" and "premium" I just want to get one subscription working first. I still get the same error after uploading the updated plugin.FoxyCart_Subscription_Manager.php (I also did all the installation instructions in that file header). Still this error:

            « 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: 	/home/content/m/m/w/mmwebsystems/html/geyser/assets/snippets/foxycart_webuser_subscriptions/snippet.FoxyCart_Subscription_Link.php	 
              Line: 	54	 
              Line 54 source: 	foreach($tvs as $name=>$value) { 	 
             
            Parser timing
              MySQL: 	0.0426 s	(3 Requests)
              PHP: 	0.1121 s	 
              Total: 	0.1547 s	 


              • 14293
              • 10 Posts
              Ok - so I don’t get the error anymore, but now I have a question about the usage...

              Where should the subscription link go - a custom form or FoxyCart or other? Is there a working example out there that I can take a look at?
                • 10076
                • 1,024 Posts
                Hi,

                did you go to http://www.foxycart.com/?
                Subscribe there?

                fr
                  • 14293
                  • 10 Posts
                  Yes - I have the demo FoxyCart.com Account to test. I have the "add to cart" button added, but don’t know how FoxyCart.com integrates with the Modx Users, and not sure how to protect given pages...

                  That and the process flow of how a user creates, subscribes and ultimately uses the account. I’m just new to modx, and all of these things I know how to do traditionally with PHP, but not modx.
                    • 14293
                    • 10 Posts
                    Ok - finally I got this working, but I’m having a similar problem as other users in the sense that my newly subscribed user is not added to the correct user group. I’ll try the XML scripts, but do you have a suspect place to check?

                    UPDATE: I checked the XML and found the user ID, but didn’t find the web user group name... is this normal?
                      • 10076
                      • 1,024 Posts
                      Maybe try at the forum of foxycart, I once got a quick response through their forum.