本文整理汇总了PHP中VirtueMartCart::getCart方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartCart::getCart方法的具体用法?PHP VirtueMartCart::getCart怎么用?PHP VirtueMartCart::getCart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtueMartCart
的用法示例。
在下文中一共展示了VirtueMartCart::getCart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExtraPluginNameInfo
function getExtraPluginNameInfo()
{
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
//if (!isset($cart->cartPrices)) {
$cart->getCartPrices();
//}
$pbxTotalVendorCurrency = $this->getPbxAmount($cart->cartPrices['salesPrice']);
$subscribe = $this->getSubscribeProducts($cart, $pbxTotalVendorCurrency);
$extraInfo = false;
if (!empty($subscribe)) {
$extraInfo['subscribe'] = true;
$amount2montInCurrency = vmPSPlugin::getAmountInCurrency($subscribe['PBX_2MONT'] * 0.01, $this->_method->payment_currency);
$amount1montInCurrency = vmPSPlugin::getAmountInCurrency($subscribe['PBX_TOTAL'] * 0.01, $this->_method->payment_currency);
$extraInfo['subscribe_2mont'] = $amount2montInCurrency['display'];
$extraInfo['subscribe_1mont'] = $amount1montInCurrency['display'];
$extraInfo['subscribe_nbpaie'] = $subscribe['PBX_NBPAIE'];
$extraInfo['subscribe_freq'] = $subscribe['PBX_FREQ'];
$extraInfo['subscribe_quand'] = $this->_method->subscribe_quand;
$extraInfo['subscribe_delais'] = $this->_method->subscribe_delais;
}
return $extraInfo;
}
示例2: __construct
function __construct()
{
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
$this->cart = VirtueMartCart::getCart(false);
JFactory::getLanguage()->load('com_virtuemart');
}
示例3: withKeepAlive
public function withKeepAlive()
{
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
if (!empty($cart->cartProductsData)) {
vmJsApi::keepAlive(1, 4);
}
}
示例4: display
public function display($tpl = null)
{
$document = JFactory::getDocument();
$layoutName = $this->getLayout();
if (!$layoutName) {
$layoutName = JRequest::getWord('layout', 'default');
}
$this->assignRef('layoutName', $layoutName);
$format = JRequest::getWord('format');
JLoader::register('VirtueMartCart', JPATH_VM_SITE . '/helpers/cart.php');
$cart = VirtueMartCart::getCart();
$this->assignRef('cart', $cart);
$this->prepareContinueLink();
shopFunctionsF::setVmTemplate($this, 0, 0, $layoutName);
parent::display($tpl);
}
示例5: display
public function display($tpl = null)
{
$layoutName = $this->getLayout();
if (!$layoutName) {
$layoutName = vRequest::getCmd('layout', 'default');
}
$this->assignRef('layoutName', $layoutName);
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
$this->cart = VirtueMartCart::getCart();
$this->prepareContinueLink();
if (!class_exists('VmTemplate')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
}
VmTemplate::setVmTemplate($this, 0, 0, $layoutName);
parent::display($tpl);
}
示例6: display
public function display($tpl = null)
{
$document = JFactory::getDocument();
$layoutName = $this->getLayout();
if (!$layoutName) {
$layoutName = vRequest::getCmd('layout', 'default');
}
$this->assignRef('layoutName', $layoutName);
$format = vRequest::getCmd('format');
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
$this->assignRef('cart', $cart);
$this->prepareContinueLink();
shopFunctionsF::setVmTemplate($this, 0, 0, $layoutName);
parent::display($tpl);
}
示例7: getList
public static function getList($params)
{
if (class_exists('VirtueMartCart')) {
$productModel = VmModel::getModel('product');
$calculator = calculationHelper::getInstance();
$customfields = VmModel::getModel('Customfields');
$cart = VirtueMartCart::getCart(false);
$cart->pricesUnformatted = $calculator->getCheckoutPrices($cart, true);
$viewName = vRequest::getString('view', 0);
if ($viewName == 'cart') {
$checkAutomaticPS = true;
} else {
$checkAutomaticPS = false;
}
$cart->prepareAjaxData($checkAutomaticPS);
$productModel->addImages($cart->products);
ini_set('xdebug.var_display_max_depth', 10);
return $cart;
}
}
示例8: onAfterDispatch
/**
* Do something onAfterDispatch
*/
function onAfterDispatch()
{
global $mainframe, $Itemid, $page, $option, $cart, $_SESSION, $_POST, $_REQUEST, $VM_CHECKOUT_MODULES, $ship_to_info_id, $vars, $auth, $sess;
// if Admin side, just exit
$application = JFactory::getApplication();
if ($application->isAdmin()) {
return;
}
$option = JRequest::getCmd('option');
if ($option != 'com_virtuemart') {
return;
}
$plugin =& JPluginHelper::getPlugin('system', 'vmskipcart');
if (JFile::exists(JPATH_SITE . '/components/com_virtuemart/virtuemart_parser.php')) {
//Virtuemart 1.1.x
$currentPage = $page;
$cart = $_SESSION['cart'];
if ($currentPage == 'shop.cart' && $cart["idx"]) {
$href = $sess->url($_SERVER['PHP_SELF'] . '?page=checkout.index&ssl_redirect=1', true);
$application->redirect($href);
}
} else {
if (JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php') && class_exists('VirtueMartCart')) {
//Virtuemart 2.0
$view = JRequest::getWord('view');
if ($view == 'cart') {
$session = JFactory::getSession();
$redirected = $session->get('vmcart_redirect', false, 'vmcart_redirect');
if (!$redirected) {
$cart = VirtueMartCart::getCart();
$session->set('vmcart_redirect', true, 'vmcart_redirect');
$cart->setDataValidation(true);
$cart->checkout();
} else {
$session->set('vmcart_redirect', false, 'vmcart_redirect');
}
}
}
}
}
示例9: plgVmOnPaymentResponseReceived
/**
* @param $html
* @return bool|null|string
*/
function plgVmOnPaymentResponseReceived(&$html)
{
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
//vmdebug('PAYPAL plgVmOnPaymentResponseReceived', $paypal_data);
// the payment itself should send the parameter needed.
$virtuemart_paymentmethod_id = JRequest::getInt('pm', 0);
$order_number = JRequest::getString('on', 0);
if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
return NULL;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return NULL;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return NULL;
}
if (!($paymentTable = $this->getDataByOrderId($virtuemart_order_id))) {
// JError::raiseWarning(500, $db->getErrorMsg());
return '';
}
$payment_name = $this->renderPluginName($method);
$html = $this->_getPaymentResponseHtml($paymentTable, $payment_name);
//We delete the old stuff
// get the correct cart / session
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
return TRUE;
}
示例10: updateCartWithKlarnacheckoutAddress
function updateCartWithKlarnacheckoutAddress()
{
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
$updated = false;
$zip = vRequest::getWord('zip', '');
$email = vRequest::getEmail('email', '');
$first_name = vRequest::getWord('given_name', '');
$last_name = vRequest::getWord('family_name', '');
if ($zip) {
$cart->BT['zip'] = $zip;
$updated = true;
}
if ($email) {
$cart->BT['email'] = $email;
$updated = true;
}
if ($first_name) {
$cart->BT['first_name'] = $first_name;
$updated = true;
}
if ($last_name) {
$cart->BT['last_name'] = $last_name;
$updated = true;
}
if (!$updated) {
return $updated;
}
$cart->setCartIntoSession();
return $updated;
}
示例11: defined
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
// Implement Joomla's form validation
JHtml::_('behavior.formvalidation');
JHtml::stylesheet('vmpanels.css', JURI::root() . 'components/com_virtuemart/assets/css/');
?>
<h1><?php
echo $this->page_title;
?>
</h1>
<?php
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
$this->cart = VirtueMartCart::getCart();
$url = 0;
if ($this->cart->_fromCart or $this->cart->getInCheckOut()) {
$rview = 'cart';
} else {
$rview = 'user';
}
$task = '';
if ($this->cart->getInCheckOut()) {
//$task = '&task=checkout';
}
$url = JRoute::_('index.php?option=com_virtuemart&view=' . $rview . $task, $this->useXHTML, $this->useSSL);
echo shopFunctionsF::getLoginForm(TRUE, FALSE, $url);
$this->vmValidator();
?>
示例12: plgVmOnSelfCallFE
/**
* For Express Checkout
* @param $type
* @param $name
* @param $render
* @return bool|null
*/
function plgVmOnSelfCallFE($type, $name, &$render) {
if ($name != $this->_name || $type != 'vmpayment') {
return FALSE;
}
$action = jRequest::getWord('action');
$virtuemart_paymentmethod_id = JRequest::getInt('virtuemart_paymentmethod_id');
//Load the method
if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
return NULL; // Another method was selected, do nothing
}
if ($action != 'SetExpressCheckout') {
return false;
}
if (!class_exists('VirtueMartCart')) {
require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
}
$cart = VirtueMartCart::getCart();
$cart->virtuemart_paymentmethod_id = $virtuemart_paymentmethod_id;
$cart->setCartIntoSession();
$paypalInterface = $this->_loadPayPalInterface();
$paypalInterface->setCart($cart);
$paypalInterface->setTotal($cart->pricesUnformatted['billTotal']);
$paypalInterface->loadCustomerData();
$paypalInterface->getExtraPluginInfo($this->_currentMethod);
if (!$paypalInterface->validate()) {
VmInfo('VMPAYMENT_PAYPAL_PAYMENT_NOT_VALID');
return false;
} else {
$app = JFactory::getApplication();
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&Itemid=' . JRequest::getInt('Itemid'), false));
}
}
示例13: _getPaymentResponseHtml
/**
* @param $method
* @param $order
* @return string
*/
function _getPaymentResponseHtml($method, $order, $payments)
{
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
if (!class_exists('VirtueMartCart')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
}
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
$totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
$cart = VirtueMartCart::getCart();
$currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency);
$payment = end($payments);
$pluginName = $this->renderPluginName($method, $where = 'post_payment');
$html = $this->renderByLayout('post_payment', array('order' => $order, 'paymentInfos' => $payment, 'pluginName' => $pluginName, 'displayTotalInPaymentCurrency' => $totalInPaymentCurrency['display']));
//vmdebug('_getPaymentResponseHtml', $html,$pluginName,$paypalTable );
return $html;
}
示例14: plgVmOnPaymentResponseReceived
/**
* @param $html
* @return bool|null|string
*/
function plgVmOnPaymentResponseReceived(&$html)
{
$jinput = JFactory::getApplication()->input;
if (empty($jinput->get('vmethod')) || !$jinput->get('vmethod') == "pagantis") {
return NULL;
}
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'cart.php';
}
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'shopfunctionsf.php';
}
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'orders.php';
}
// Recuperamos Identificador de pedido
$virtuemart_paymentmethod_id = $jinput->get('pm', 0);
if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
return NULL;
}
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if (!empty($data["event"])) {
//CallBack URL
$this->log("Entramos en el CallBack");
//Account Settings
$environment = $method->pagamastarde_env;
if ($environment == 'test') {
$key = $method->pagamastarde_test_key;
} else {
$key = $method->pagamastarde_real_key;
}
if ($data["event"] == 'charge.created' && !empty($data["data"]["order_id"])) {
$signature_check = sha1($key . $data['account_id'] . $data['api_version'] . $data['event'] . $data['data']['id']);
$signature_check_512 = hash('sha512', $key . $data['account_id'] . $data['api_version'] . $data['event'] . $data['data']['id']);
if ($signature_check != $data['signature'] && $signature_check_512 != $data['signature']) {
//hack detected
$this->log("Hack detected");
exit;
}
$virtuemart_order_id = $data["data"]["order_id"];
$orderModel = VmModel::getModel('orders');
$order_number = $orderModel->getOrderIdByOrderNumber($virtuemart_order_id);
$order = $orderModel->getOrder($order_number);
$order['order_status'] = "C";
$order['customer_notified'] = 1;
$updated = $orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
$msg = $updated ? "Actualizado pedido " . $order['details']['BT']->virtuemart_order_id . " a estado C" : "No se ha actualizado el pedido " . $order['details']['BT']->virtuemart_order_id . " a estado C";
$this->log($msg);
//Se eliminan productos del carrito
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
} else {
if ($data["event"] == 'charge.failed' && !empty($data["data"]["order_id"])) {
$virtuemart_order_id = $data["data"]["order_id"];
$orderModel = VmModel::getModel('orders');
//Don't lose cart
$order_number = $orderModel->getOrderIdByOrderNumber($virtuemart_order_id);
$order = $orderModel->getOrder($order_number);
$order['order_status'] = "X";
$order['customer_notified'] = 1;
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
$orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
}
}
} else {
//URL OK Y KO
$status = $jinput->get("status");
$order_number = $jinput->get("on");
if (!$this->selectedThisElement($method->payment_element)) {
return NULL;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return NULL;
}
if ($status == "ok") {
$this->log("PAGA+TARDE Pedido Number: " . $order_number . ", Pedido Id: " . $virtuemart_order_id . ' Finalizado correctamente, mostrando pantalla de éxito');
$html = '<img src="' . JURI::root() . 'plugins/vmpayment/pagamastarde/pagamastarde/assets/images/pagamastarde.png" width="225"><br><br><br>';
$html .= '<h3>El pedido con referencia ' . $order_number . ' ha finalizado correctamente. Gracias por utilizar Paga+Tarde.</h3>';
//Flush cart
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
} else {
$this->log("PAGA+TARDE Pedido Number: " . $order_number . ", Pedido Id: " . $virtuemart_order_id . ' Finalizado con error, mostrando pantalla de error ');
$html = '<img src="' . JURI::root() . 'plugins/vmpayment/pagamastarde/pagamastarde/assets/images/pagamastarde.png" width="225"><br><br><br>';
$html .= '<h3>El pedido con referencia ' . $order_number . ' ha finalizado con error en la respuesta. Gracias por utilizar Paga+Tarde.</h3>';
$html .= '<h3>Su carrito no se ha borrado, puede reintentar su compra.</h3>';
}
}
return TRUE;
}
示例15: paymentResponseReceived
/**
* @param $paybox_data
* @return bool
*/
function paymentResponseReceived($paybox_data)
{
if ($payboxResponseValid = $this->isPayboxResponseValid($paybox_data, false, true)) {
// we don't do anything actually, it is probably an invalid signature.
// we do not update order status and let IPN do his job
}
$order_number = $this->getOrderNumber($paybox_data['R']);
if (empty($order_number)) {
$this->plugin->debugLog($order_number, 'getOrderNumber not correct' . $paybox_data['R'], 'debug', false);
return FALSE;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return FALSE;
}
if (!($payments = $this->plugin->getPluginDatasByOrderId($virtuemart_order_id))) {
$this->plugin->debugLog('no payments found', 'getDatasByOrderId', 'debug', false);
$this->redirectToCart();
return FALSE;
}
$orderModel = tmsModel::getModel('orders');
$order = $orderModel->getOrder($virtuemart_order_id);
$paybox_data = $this->unsetNonPayboxData($paybox_data);
$success = $paybox_data['E'] == self::RESPONSE_SUCCESS;
$extra_comment = "";
// The order status is nly updated if the validation is ok
if ($payboxResponseValid) {
if (count($payments) == 1) {
// NOTIFY not received
$order_history = $this->updateOrderStatus($paybox_data, $order, $payments);
if (isset($order_history['extra_comment'])) {
$extra_comment = $order_history['extra_comment'];
}
}
}
$html = $this->plugin->getResponseHTML($order, $paybox_data, $success, $extra_comment);
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
return $html;
}