本文整理汇总了PHP中Cart66Common::getPageLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::getPageLink方法的具体用法?PHP Cart66Common::getPageLink怎么用?PHP Cart66Common::getPageLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::getPageLink方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: basename
if ($createAccount) {
$account->save();
$accountId = $account->id;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Just created account with id: accountId");
}
if ($mp = Cart66Session::get('Cart66Cart')->getMembershipProduct()) {
$account->attachMembershipProduct($mp, $account->firstName, $account->lastName);
$accountId = $account->id;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Attached membership to account id: {$accountId}");
}
// Save the order locally
$orderId = $gateway->saveOrder($total, $tax, $transactionId, $status, $accountId);
Cart66Session::drop('Cart66SubscriberToken');
Cart66Session::set('order_id', $orderId);
Cart66Session::drop('Cart66ProRateAmount');
$receiptLink = Cart66Common::getPageLink('store/receipt');
$newOrder = new Cart66Order($orderId);
// Send email receipts
if (CART66_PRO && CART66_EMAILS && Cart66Setting::getValue('enable_advanced_notifications') == 1) {
$notify = new Cart66AdvancedNotifications($orderId);
$notify->sendAdvancedEmailReceipts();
} elseif (CART66_EMAILS) {
$notify = new Cart66Notifications($orderId);
$notify->sendEmailReceipts();
}
// Send buyer to receipt page
$receiptVars = strpos($receiptLink, '?') ? '&' : '?';
$receiptVars .= "ouid=" . $newOrder->ouid;
wp_redirect($receiptLink . $receiptVars);
exit;
} else {
示例2: goToReceipt
/**
* Redirect buyer to receipt page for the given order id
*
* @param int The id in the orders table
*/
public function goToReceipt($order_id)
{
$order = new Cart66Order($order_id);
$receipt = Cart66Common::getPageLink('store/receipt');
$vars = strpos($receipt, '?') ? '&' : '?';
$vars .= "ouid=" . $order->ouid;
// Look for newsletter options
if (Cart66Setting::getValue('constantcontact_list_ids') || Cart66Setting::getValue('mailchimp_list_ids')) {
$vars .= '&newsletter=1';
}
$receipt .= $vars;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Redirecting to: {$receipt}");
wp_redirect($receipt);
exit;
}
示例3:
?>
</span>
<?php
}
?>
<?php
} else {
?>
<form id='cartButtonForm_<?php
echo $id;
?>
' class="Cart66CartButton" method="post" action="<?php
echo Cart66Common::getPageLink('store/cart');
?>
" <?php
echo $data['style'];
?>
>
<input type='hidden' name='task' id="task_<?php
echo $id;
?>
" value='addToCart' />
<input type='hidden' name='cart66ItemId' value='<?php
echo $data['product']->id;
?>
' />
<input type='hidden' name='product_url' value='<?php
echo Cart66Common::getCurrentPageUrl();
示例4: get_redirect_url
public function get_redirect_url()
{
// Specify your 2CheckOut vendor id
$this->addField('sid', Cart66Setting::getValue('tco_account_number'));
// Specify the order information
$items = Cart66Session::get('Cart66Cart')->getItems();
$number = 0;
$item_amount = array();
foreach ($items as $i) {
$product = new Cart66Product($i->getProductId());
$this->addField('li_' . $number . '_type', 'product');
$this->addField('li_' . $number . '_name', $product->name);
$this->addField('li_' . $number . '_price', number_format($i->getProductPrice(), 2, '.', ''));
$this->addField('li_' . $number . '_product_id', $i->getItemNumber());
$this->addField('li_' . $number . '_quantity', $i->getQuantity());
$this->addField('li_' . $number . '_tangible', 'N');
$item_amount[] = number_format($i->getProductPrice(), 2, '.', '');
$number++;
}
$item_amount = array_sum($item_amount);
$total_amount = number_format(Cart66Session::get('Cart66Cart')->getGrandTotal() + Cart66Session::get('Cart66Tax'), 2, '.', '');
// Discounts
$promotion = Cart66Session::get('Cart66Promotion');
if ($promotion) {
$this->addField('li_' . $number . '_type', 'coupon');
$this->addField('li_' . $number . '_name', $promotion->name);
$this->addField('li_' . $number . '_price', Cart66Session::get('Cart66Cart')->getDiscountAmount());
$this->addField('li_' . $number . '_product_id', __('Discount', 'cart66') . '(' . Cart66Session::get('Cart66PromotionCode') . ')');
$this->addField('li_' . $number . '_quantity', 1);
$this->addField('li_' . $number . '_tangible', 'N');
$number++;
}
// Shipping
$shipping = Cart66Session::get('Cart66Cart')->getShippingCost();
if (CART66_PRO && Cart66Setting::getValue('use_live_rates')) {
$selectedRate = Cart66Session::get('Cart66LiveRates')->getSelected();
$shippingMethod = $selectedRate->service;
} else {
$method = new Cart66ShippingMethod(Cart66Session::get('Cart66Cart')->getShippingMethodId());
$shippingMethod = $method->name;
}
$cart = Cart66Session::get('Cart66Cart');
if ($cart->requireShipping() || $cart->hasTaxableProducts()) {
$this->addField('li_' . $number . '_type', 'product');
$this->addField('li_' . $number . '_product_id', __('Shipping', 'cart66'));
$this->addField('li_' . $number . '_name', $shippingMethod);
$this->addField('li_' . $number . '_price', $shipping);
$this->addField('li_' . $number . '_quantity', 1);
$this->addField('li_' . $number . '_tangible', 'N');
$number++;
// Shipping Fields
if (strlen($this->_shipping['address']) > 3) {
$this->addField('ship_name', $this->_shipping['firstName'] . ' ' . $this->_shipping['lastName']);
$this->addField('ship_street_address', $this->_shipping['address']);
$this->addField('ship_street_address2', $this->_shipping['address2']);
$this->addField('ship_city', $this->_shipping['city']);
$this->addField('ship_state', $this->_shipping['state']);
$this->addField('ship_zip', $this->_shipping['zip']);
$this->addField('ship_country', $this->_shipping['country']);
$this->addField('phone', $this->_payment['phone']);
}
}
// Tax
$tax = Cart66Session::get('Cart66Tax');
if ($tax > 0) {
$this->addField('li_' . $number . '_type', 'tax');
$this->addField('li_' . $number . '_product_id', __('Tax', 'cart66'));
$this->addField('li_' . $number . '_name', Cart66Session::get('Cart66TaxRate'));
$this->addField('li_' . $number . '_price', $tax);
$this->addField('li_' . $number . '_quantity', 1);
$this->addField('li_' . $number . '_tangible', 'N');
$number++;
}
// Default Fields
$this->addField('mode', '2CO');
$this->addField('return_url', Cart66Setting::getValue('shopping_url'));
$this->addField('pay_method', 'CC');
$this->addField('x_receipt_link_url', add_query_arg('listener', '2CO', Cart66Common::getPageLink('store/receipt')));
$this->addField('tco_currency', 'USD');
$redirect_url = $this->gatewayUrl . '?' . http_build_query($this->fields, '', '&');
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] {$redirect_url}");
return $redirect_url;
}