public function removeItemFromCart($nid, $data) { $content = $this->getCartContents(); $product = node_load($nid); uc_product_load($product); if ($product->type == 'product_kit') { foreach ($data as $nid => $product) { uc_cart_remove_item($nid, uc_cart_get_id(), $product->data); } } else { uc_cart_remove_item($nid, uc_cart_get_id(), $data); } }
print t('Payment details'); ?> </div> <div class="checkout-form"> <?php print $billing; print $customer; print $payment; print $submit; ?> </div> </div> <div class="cartPane"> <?php $cid = uc_cart_get_id($create = TRUE); $count = count_cart_items($cid); $subtotal = cart_total_amount($cid); $max_order_value = variable_get('max_order_value', 20); if ($subtotal > $max_order_value) { $subtotal = $max_order_value; // @todo:bulat - replace with variable or value on the event. } ?> <div class="checkout-title blue-heading"><?php print t('Order summary'); ?> </div> <div class="checkout-cart-summary"> <div class="order-items"><?php
/** * Handle requests to update a cart item. * * @param $nid * Node id of the cart item. * @param $data * Array of extra information about the item. * @param $qty * The quantity of this item in the cart. * @param $cid * The cart id. Defaults to NULL, which indicates that the current user's cart * should be retrieved with uc_cart_get_id(). */ function hook_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { if (!$nid) { return NULL; } $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id(); if ($qty < 1) { uc_cart_remove_item($nid, $cid, $data); } else { db_query("UPDATE {uc_cart_products} SET qty = %d, changed = %d WHERE nid = %d AND cart_id = '%s' AND data = '%s'", $qty, time(), $nid, $cid, serialize($data)); } // Rebuild the items hash uc_cart_get_contents(NULL, 'rebuild'); if (!strpos(request_uri(), 'cart', -4)) { drupal_set_message(t('Your item(s) have been updated.')); } }
/** * Handles requests to update a cart item. * * @param $nid * Node id of the cart item. * @param $data * Array of extra information about the item. * @param $qty * The quantity of this item in the cart. * @param $cid * The cart id. Defaults to NULL, which indicates that the current user's cart * should be retrieved with uc_cart_get_id(). */ function hook_uc_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id(); $result = \Drupal::entityQuery('uc_cart_item')->condition('cart_id', $cid)->condition('nid', $nid)->condition('data', serialize($data))->execute(); if (!empty($result)) { $item = \Drupal\uc_cart\Entity\CartItem::load(current(array_keys($result))); if ($item->qty->value != $qty) { $item->qty->value = $qty; $item->save(); } } }
/** * Handles requests to update a cart item. * * @param $nid * Node id of the cart item. * @param $data * Array of extra information about the item. * @param $qty * The quantity of this item in the cart. * @param $cid * The cart id. Defaults to NULL, which indicates that the current user's cart * should be retrieved with uc_cart_get_id(). */ function hook_uc_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { if (!$nid) { return NULL; } $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id(); if ($qty < 1) { uc_cart_remove_item($nid, $cid, $data); } else { db_update('uc_cart_products')->fields(array('qty' => $qty, 'changed' => REQUEST_TIME))->condition('nid', $nid)->condition('cart_id', $cid)->condition('data', serialize($data))->execute(); } // Rebuild the items hash uc_cart_get_contents(NULL, 'rebuild'); if (!strpos(request_uri(), 'cart', -4)) { drupal_set_message(t('Your item(s) have been updated.')); } }
function uc_ideal_payment_api_statreq_call($arg1, $arg2) { $transaction_id = $_GET['trxid']; $order_id = $_GET['ec']; //echo $transaction_id; /*START ThinMPI code for TransrReq*/ require_once drupal_get_path('module', 'ideal_payment_api') . "/lib/ThinMPI.php"; require_once drupal_get_path('module', 'ideal_payment_api') . "/lib/AcquirerStatusRequest.php"; //Create StatusRequest $q_data =& new AcquirerStatusRequest(); $transID = str_pad($transaction_id, 16, "0"); $q_data->setTransactionID($transID); //Create ThinMPI instance and process request $rule = new ThinMPI(); $result = $rule->ProcessRequest($q_data); if (!$result->isOK()) { //StatusRequest failed, let the consumer click to try again $Msg = $result->getErrorMessage(); drupal_set_message(t('We could not verify the payment status automaticaly, we will check your payment manualy, pleas contact us regarding this. IDEAL error:')) . '<br>' . $Msg; drupal_goto('ideal'); } else { if (!$result->isAuthenticated()) { //Transaction failed, inform the consumer drupal_set_message(t('Your IDEAL payment has been canceled by you or by the IDEAL process. Please try again or go back to select another payment method.'), 'ERROR'); if ($order_id == $_SESSION['ideal_payment_api_order_id']) { //Check if orer_id is valid // This lets us know it's a legitimate access of the review page. $_SESSION['do_review'] = TRUE; // Ensure the cart we're looking at is the one that payment was attempted for. $_SESSION['cart_order'] = uc_cart_get_id(); drupal_goto('ideal/review'); } else { drupal_goto('cart'); } } else { drupal_set_message(t('Thank you for shopping with us, your payment is processed sucessfuly')); $transactionID = $result->getTransactionID(); //Here you should retrieve the order from the database, mark it as "payed" $order = uc_order_load($order_id); if ($order == FALSE) { //Check if order exist watchdog('ideal_api', t('iDeal payment completion attempted for non-existent order.'), WATCHDOG_ERROR); return; } //uc_order_update_status($order_id, 1); *Uitgezet 281107 KK uc_order_update_status($order->order_id, uc_order_state_default('post_checkout')); //Todo?? //uc_payment_enter($order_id, 'ideal_payment_api', $payment_amount, $order->uid, NULL, $comment); //uc_cart_complete_sale($order); //uc_order_comment_save($order_id, 0, t('iDeal Pro reported a payment of !amount !currency.', array('!amount' => uc_currency_format($payment_amount, FALSE), '!currency' => $payment_currency)), 'admin'); unset($_SESSION['ideal_payment_api_order_id']); // This lets us know it's a legitimate access of the complete page. $_SESSION['do_complete'] = TRUE; drupal_goto('ideal/complete'); exit; } } }