Closed (fixed)
Project:
Ubercart
Version:
6.x-2.0-rc7
Component:
Code
Priority:
Critical
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2009 at 15:46 UTC
Updated:
11 Apr 2010 at 16:10 UTC
Hi folks,
on my website I´ve got a self-developed Module to generate card-games. When you hav finished creating a game, I´m using node_save() to save it as a product node, then I add the node to the users cart, and redirect him to cart. When I now want to checkout, the delivery information and the calculate shipping fieldset are not displayed on checkout page.
This ist the funktion that creates the new product:
function cardgenerator_order_form_submit($form, &$form_state) {
global $user;
$sku = 'UG-' . sprintf('%08d', $_POST['user_game_id']);
if (!$nid = _cardgenerator_uc_product_exists($sku)) {
$taxonomy = taxonomy_get_term_by_name('Kartenspiele');
$product = new stdClass();
$product->type = 'product';
$product->uid = $user->uid;
$product->taxonomy = $taxonomy;
$product->model = $sku;
$product->title = _get_game_title($form_state['values']['user_game_id']);
$product->sell_price = 14.95;
$product->weight_units = 'kg';
$product->length_units = 'cm';
$product->pkg_qty = 1;
$product->default_qty = 1;
$product->shippable = 1;
$product->language = 'de';
$product->comment = 2;
$product->promote = 1;
node_save($product);
$nid = $product->nid;
}
uc_cart_add_item($nid);
}
The database entry in {uc_products} seems to be right (attached file). Has anybody an idea how to solve the problem?
Greets
dops
| Comment | File | Size | Author |
|---|---|---|---|
| drpl_uc_products.jpg | 31.46 KB | dops |
Comments
Comment #1
dops commentedI solved the problem. There have to be some more parameters given to the function uc_cart_add_item().
The third paramter is needed to fetch the product attributes and the value fpr shippable! The fourth parameter defines a specific cart-id. I left the at null because the items should be added to the users cart (the users cart id is taken from the session then). The fivth parameter is only for enabling or disabling the message display.
Greets
dops
Comment #2
univate commented