I have a custom module which does many things including selling keywords for people to use in communication campaigns. The module checks to see if a keyword is available and then if so, programatically creates a uc_recurring_subscription product type and redirects them to the payment page so they can setup their recurring subscription. It enters details into a custom database table with the keyword being marked as 2 which means Pending.
However some essential information doesn't' get created when the uc_recurring_subscription product node is programatically created. The information about features isn't there. I don't actually know what node->variable/s to use to create this feature information.
Here is what I'm using to create the node - I know I'm missing some information but can't figure out what. I want the order to recur every month indefinitely for the same price as $node->sell_price.
$node = new stdClass();
//Main Node Fields
$node->name = "Monthly Keyword Subscription for Keyword $kw";
$node->title = $node->name;
$node->body = "Information Displayed on the Page ";
$node->type = 'uc_recurring_subscription'; //This can be any node type
$node->created = time();
$node->changed = $node->created;
$node->promote = 0; // Display on front page ? 1 : 0
$node->sticky = 0; // Display top of page ? 1 : 0
$node->format = 2; // 1:Filtered HTML, 2: Full HTML
$node->status = 1; // Published ? 1 : 0
$node->language = 'en';
$node->uid = $account->uid;
//Pricing Information
$node->list_price = 10.00000;
$node->cost = 0.00000;
$node->sell_price = 10.00000;
$node->path = $path; //previously specified
//Custom Information Fields
$node->field_group[0]['value'] = $group;//the group the keyword is linked to
$node->model = $kw; //we are using the sku field for the keyword.
if ($node = node_submit($node))
{
node_save($node);
drupal_set_message(t('Automatic Setup Succeeded - Please Setup Your Payment.'));
}
else
{
drupal_set_message(t('Automatic Setup Failed - Please contact mail@email.com'));
}
drupal_goto($path);
Comments
Also...
I added the features into a test node and then did a dump of the variables and all I got was this
$node->data = 'a:12:s:12:"terms_of_use";i:1;s:7:"captcha";s:0:"";s:11:"captcha_sid";i:159;s:13:"captcha_token";s:32:"f5dbc0cd06210cdf5e925d6ef5d8424f";s:16:"captcha_response";s:9:"reCAPTCHA";s:7:"contact";i:1;s:13:"form_build_id";s:37:"form-f6271483a26af0605554cd9101c4d8aa";s:8:"new_role";i:0;s:12:"new_role_add";s:1:"3";s:16:"new_role_add_qty";s:0:"";s:24:"new_role_add_granularity";s:3:"day";s:27:"notifications_send_interval";s:1:"0";}';I didn't find this useful (although I might be wrong) because when I added this to the node creation script nothing was different.
I'm David, a PADI Rescue Diver, Web Developer and Pastor. I'm currently building a online service to manage private loans for vendor financing.