You are here

function uc_cart_links_add_to_cart in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart_links/uc_cart_links.module \uc_cart_links_add_to_cart()

Implementation of hook_add_to_cart().

File

uc_cart_links/uc_cart_links.module, line 72
Allows store owners to create links to add products to carts and send customers on to checkout.

Code

function uc_cart_links_add_to_cart($nid, $qty, $data) {
  if (user_access('administer cart links') && variable_get('uc_cart_links_add_show', TRUE)) {
    $cart_link = 'p' . $nid . '_q' . $qty;
    if (!empty($data['attributes'])) {
      foreach ($data['attributes'] as $attribute => $option) {
        $cart_link .= '_a' . $attribute . 'o' . $option;
      }
    }
    drupal_set_message(t('Cart link product action: @cart_link', array(
      '@cart_link' => $cart_link,
    )));
  }
}