[#3017] including a php file during a plan registration ?

12 years 6 months ago #181357 by activha
Thanks Kyle but too complicated for me :-(

We have asked for an integration between the enmasse component and CB and CBsubs and the developer sent us this file in order to upgrade enmasse users, using cb fields and this script, and depending upon the plan subscribed.

But at this point I am absolutely not able to integrate it in our system.

Please Log in to join the conversation.

12 years 6 months ago #181362 by krileon
The script you were provided is accurate if it was being included and ran from a Joomla extension. This just isn't the case for CBSubs URL which just performs an HTTP request on the URL supplied. The script would need to be altered to use raw PHP functions, which I've done nearly all of this for you already, for it to work with CBSubs URL. You should be able to just use SQL Actions however sense all that script does is essentially run 2 database queries.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 6 months ago #181366 by activha
OK I understand and will try to use the SQL integration in the plans.

Can I use the same wording if I only remove the $POST bit ?

Please Log in to join the conversation.

12 years 6 months ago - 12 years 6 months ago #181368 by krileon

Can I use the same wording if I only remove the $POST bit ?

The query in the file is correct, needs PHP cleaned out, and you'd used substitutions instead of the posts (e.g. [username]). The second query is where the problem really comes from as you need the last insert id which to do that you just use "SELECT LAST_INSERT_ID()".


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 6 months ago #182406 by activha
Kyle
We modified the mysql script with enmasse developers to
# INSERT Sales Person
INSERT INTO #__enmasse_sales_person(name,user_name,address,phone,email,zip_code,city,country,published,created_at,updated_at)
    VALUES(
        "[name]",
        "[username]",
        "[address]",
        "[phone]",  
        "[email]",
        "[zipcode]",
        "[city]",
        "[country]",
        "1",
        NOW(),
        NOW()
    );
    
# INSERT Merchant
INSERT INTO #__enmasse_merchant_branch(name,user_name,sales_person_id,branches,zip_code,city,country,published,created_at,updated_at)
    VALUES(
        '[name]',
        '[username]',
        LAST_INSERT_ID(),
        '{"branch1":{"branchname":"branch1","name":"[name]","description":"","google_map_width":"200","google_map_height":"200","address":"[address]","telephone":"[phone]","fax":"[fax]","google_map_lat":"","google_map_long":"","google_map_zoom":""}}',
        '[zipcode]',
        '[city]',
        '[country]',
        '1',
        NOW(),
        NOW()
    );
    
# UPDATE usergroup
    INSERT INTO #__user_usergroup_map(user_id,group_id)
    VALUES
    ('[user_id]', (SELECT merchant_group FROM #__enmasse_setting)),
    ('[user_id]', (SELECT sale_group FROM #__enmasse_setting));

But this just fails with an error in the back end
Fatal error: Call to a member function commitTabsContents() on a non-object in /Applications/MAMP/htdocs/activnew/administrator/components/com_comprofiler/library/cb/cb.tables.php on line 1494

Any clues ?
Thanks

Please Log in to join the conversation.

12 years 6 months ago #182412 by nant
Kyle is away on much needed rest...

My experience is to first use phpmyadmin to test the script and then once tested make modifications with cb field replacements ([user_id], etc).

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.251 seconds

Facebook Twitter LinkedIn