本文整理汇总了PHP中EnmasseHelper::isGuestBuyingEnable方法的典型用法代码示例。如果您正苦于以下问题:PHP EnmasseHelper::isGuestBuyingEnable方法的具体用法?PHP EnmasseHelper::isGuestBuyingEnable怎么用?PHP EnmasseHelper::isGuestBuyingEnable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnmasseHelper
的用法示例。
在下文中一共展示了EnmasseHelper::isGuestBuyingEnable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitCheckOut
function submitCheckOut()
{
$activeGuestBuying = EnmasseHelper::isGuestBuyingEnable();
$bBuy4friend = JRequest::getVar('buy4friend', 0);
$sEmailPt = "/^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})\$/";
//save user input data into the session
if (JRequest::getMethod() == "POST") {
$arData = JRequest::get('post');
JFactory::getApplication()->setUserState("com_enmasse.checkout.data", $arData);
}
//check the permission for checkout action
if (JFactory::getUser()->get('guest') && !$activeGuestBuying) {
$msg = JText::_("MERCHANT_PLEASE_LOGIN_BEFORE");
$redirectUrl = base64_encode("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}");
$link = JRoute::_("index.php?option=com_users&view=login&return=" . $redirectUrl, false);
JFactory::getApplication()->redirect($link, $msg, 'error');
}
//validate the cart
$cart = unserialize(JFactory::getSession()->get('cart'));
CartHelper::checkCart($cart);
foreach ($cart->getAll() as $cartItem) {
$item = $cartItem->getItem();
}
//get enmasse setting
$setting = JModel::getInstance('setting', 'enmasseModel')->getSetting();
// check max cart Item
$this->checkMaxCartItem($cart);
//validate Buyer information
$buyerName = JRequest::getVar('name');
$buyerEmail = JRequest::getVar('email');
if (empty($buyerName) || empty($buyerEmail)) {
$msg = JText::_("SHOP_CARD_CHECKOUT_BUYER_INFORMATION_REQUIRED_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
} elseif (!preg_match($sEmailPt, $buyerEmail)) {
$msg = JText::_("SHOP_CARD_CHECKOUT_BUYER_EMAIL_INVALID_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
}
//----- If the deal permit partial payment, it mean the coupon was delivery by directly, so we need to validate address and phone number of receiver
if ($item->prepay_percent < 100) {
$receiverAddress = JRequest::getVar('receiver_address');
$receiverPhone = JRequest::getVar('receiver_phone');
if (empty($receiverPhone) || empty($receiverAddress)) {
$msg = JText::_("SHOP_CARD_CHECKOUT_RECEIVER_INFORMATION_REQUIRED_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
} else {
if (!preg_match('/^[0-9 \\.,\\-\\(\\)\\+]*$/', $receiverPhone)) {
$msg = JText::_("SHOP_CARD_CHECKOUT_RECEIVER_PHONE_INVALID");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
}
}
}
if ($bBuy4friend) {
$receiverName = JRequest::getVar('receiver_name');
$receiverEmail = JRequest::getVar('receiver_email');
$receiverMsg = JRequest::getVar('receiver_msg');
if (empty($receiverName) || empty($receiverEmail)) {
$msg = JText::_("SHOP_CARD_CHECKOUT_RECEIVER_INFORMATION_REQUIRED_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
} elseif (!preg_match($sEmailPt, $receiverEmail)) {
$msg = JText::_("SHOP_CARD_CHECKOUT_RECEIVER_EMAIL_INVALID_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
}
}
//------------------------------------------------------
// to check it this deal is free for customer
if ($cart->getTotalPrice() > 0) {
//deal is not free
$payGtyId = JRequest::getVar('payGtyId');
if ($payGtyId == null) {
$msg = JText::_("SELECT_PAYMENT_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
}
if ($setting->article_id != 0 && JRequest::getVar('terms') == false) {
$msg = JText::_("AGREE_TERM_CONDITION_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg, 'error');
}
$payGty = JModel::getInstance('payGty', 'enmasseModel')->getById($payGtyId);
// checking gateway configuration
if (CartHelper::checkGty($payGty) == false) {
$msg = JText::_("PAYMENT_INCOMPLETE_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg);
}
// save gty info into session
JFactory::getSession()->set('payGty', serialize($payGty));
JFactory::getSession()->set('attribute_config', json_encode($payGty->attribute_config));
//--------If admin set the prepay_percent of the deal to 0.00, set the order status to 'Paid' (with paid_amount is 0.00)
if ($item->prepay_percent == 0.0) {
$status = EnmasseHelper::$ORDER_STATUS_LIST['Paid'];
$couponStatus = EnmasseHelper::$INVTY_STATUS_LIST['Hold'];
} else {
//------------------------------------
//.........这里部分代码省略.........