Hello,
I’m trying to create a little time saving device for my end-users that will create a package for them using php. I have started to write the script that will do this, but I’m having trouble constructing the $data array for the Cartthrob Package field. Can you help?
This script should create a new package entry with package field containing products with IDs 4, 5, & 6. The custom field ID of my package field is 33. The channel ID is 9.
My script is below, and I’ve marked the place where I’m stuck.
Any pointers greatly appreciated!!
Mike
<?php
$channel_id = 9;
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');
$this->EE->api->instantiate('channel_fields');
$data = array(
'title' => 'Package Title',
'entry_date' => '1256953732',
'field_id_33' => '', // I need help here...
'field_ft_33' => '' // and here.
);
$this->EE->api_channel_fields->setup_entry_settings($channel_id, $data);
if ($this->EE->api_channel_entries->submit_new_entry($channel_id, $data) === FALSE)
{
show_error('An Error Occurred Creating the Entry');
}
?>
