2 replies [Last post]
slayerment's picture
Offline
Uber Donor
Joined: 01/06/2008
Juice: 86
Was this information Helpful?

I am looking to add some more data into the $data array ie:

<?php
$data
['file_nid'] = 55;
?>

and then have it store that serialized with the rest of the data in the uc_cart_products table.

I have checked out the hook_add_to_cart hook but that doesn't seem to allow me to send new data to the $data array. I also see that there is a hook_add_to_cart_data hook which may be what I am looking for but I can't seem to find any documentation on it, or find it in the uc_cart module.

Is there a hook/way to do this right now or would my best bet just be to write it to the database manually?

Thanks,
Quinton

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: How can I add info to the data array when a product is added

hook_add_to_cart_data() is what you want. You can see an example of its use in uc_product and uc_attribute. Your implementation of the hook would return an array like

<?php
 
return array('file_nid' => 55);
?>
slayerment's picture
Offline
Uber Donor
Joined: 01/06/2008
Juice: 86
Re: Re: How can I add info to the data array when a product is a

Perfect, thanks Lyle!