1

I'm trying to do a checkout with cartthrob and instantly creating a new member. This really works great so I have a member entry in the members table. But I use zoo visitor and also need a channel entry there. It is described in the docs of cartthrob that it has to work: http://cartthrob.com/docs/tutorials/member-accounts/#addons-for-member-management

Does anybody has a working example for this scenario?

Regards

1
  • The entry should be created automatically, but perhaps CT isn't calling the correct hook. I would suggest bringing this up with CT to resolve. In the meantime, you could write your own extension that triggers the Zoo Visitor entry creation for the new member ID, if you're familiar with writing extensions. Commented Feb 6, 2014 at 20:02

2 Answers 2

0

I solved it with {exp:zoo_visitor:sync}

first screen is for CT to create member account and others (payment select etc). second screen I used {exp:zoo_visitor:sync} to sync CT member data to zoo_visitor.

Works great. If needed you could use the second screen to alter or add extra data to zoo_visitor.

4
  • only works if you use the {exp:zoo_visitor:sync} on the same site (site_id=1 in my case) where the member profiles are usually stored. I do the checkout on site_id=2 so I got problems here. I had to change the data array in create_member_entry() (zoo_visitor_lib.php). Perhaps the zoo visitor developers can drop the site_id information because of the knowledge about the channel_id which already has the site_id information of itself?
    – Pibble
    Commented Feb 12, 2014 at 12:17
  • Yes, true. But I see you solved it... nice.
    – Gfive
    Commented Feb 12, 2014 at 15:03
  • I really appreciate your help to find out that this function exists! Thanks @gfive
    – Pibble
    Commented Feb 12, 2014 at 16:40
  • Do you know if the {exp:zoo_visitor:sync} syncs all users or only the currently logged in user?
    – Jon Horton
    Commented Jul 24, 2014 at 20:57
0

With the hint from Gfive I played around with {exp:zoo_visitor:sync}. After I recognized that this function uses the wrong site_id for me I wrote a small plugin which temporarily changes the site_id especially to my needs. Here is the code:


class Custom_Zoo_Sync
{
    public function sync()
    {
        $this->EE =& get_instance();

        $this->EE->load->add_package_path(PATH_THIRD . 'zoo_visitor/');
        $this->EE->load->library('zoo_visitor_lib');
        $this->EE->load->helper('zoo_visitor');

        $real_site_id = $this->EE->config->item('site_id');
        $this->EE->config->set_item('site_id', 1);
        $this->EE->zoo_visitor_lib->sync_member_data();
        $this->EE->config->set_item('site_id', $real_site_id);

    }
}

Feel free to comment this solution. Perhaps it is a bad idea to do it this way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.