
Untitled
By: a guest on
Jul 22nd, 2012 | syntax:
PHP | size: 1.04 KB | hits: 23 | expires: Never
<?php
* Implementation of hook_form_alter().
function commerce_dedicatoria_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'commerce_checkout_form_checkout') {
drupal_set_message("estoy en commerce_dedicatoria_form_alter ");
$form['buttons']['continue']['#submit'][] = 'commerce_dedicatoria_add_cart_submit';
dsm($form_id); // print form ID to messages
dsm($form);
}
}
/**
* Submit handler for the simple add to cart.
*
* This uses the default values of commerce_cart_product_add_by_id(), but that
* function also accepts $quantity, $combine, and $uid arguments.
*
* Note that commerce_cart_product_add_by_id() simply wraps up the creation
* of a line item and the adding of the line item to the product. The code
* inside is not very hard either.
*/
function commerce_dedicatoria_add_cart_submit($form, &$form_state) {
//commerce_cart_product_add_by_id($form_state['values']['addcart_product']);
//El producto con el id=75 es mi dedicatoria personalizada
commerce_cart_product_add_by_id(75);
}