本文整理汇总了PHP中VirtueMartCart类的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartCart类的具体用法?PHP VirtueMartCart怎么用?PHP VirtueMartCart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VirtueMartCart类的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)
{
$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);
}
示例6: 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);
}
示例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: getBasketDetails
/**
* generate BillSafe informations from basket
* @return array criterion for billSafe
*/
private function getBasketDetails()
{
$user = JFactory::getUser();
$cart = VirtueMartCart::getCart(false);
$items = $cart->products;
$prices = $cart->cartPrices;
$params = array();
if ($items) {
$i = 0;
// ITEMS
foreach ($items as $key => $item) {
$i++;
$prefix = 'CRITERION.POS_' . sprintf('%02d', $i);
$params[$prefix . '.POSITION'] = $i;
$params[$prefix . '.QUANTITY'] = (int) $item->quantity;
if (empty($item->product_unit)) {
$item->product_unit = 'Stk.';
}
$params[$prefix . '.UNIT'] = $item->product_unit;
#price in cents
$params[$prefix . '.AMOUNT_UNIT_GROSS'] = $prices[$key]['basePriceWithTax'] * 100;
$params[$prefix . '.AMOUNT_GROSS'] = $prices[$key]['subtotal_with_tax'] * 100;
$item->product_name = preg_replace('/%/', 'Proz.', $item->product_name);
$item->product_name = preg_replace('/("|\'|!|$|=)/', ' ', $item->product_name);
$params[$prefix . '.TEXT'] = strlen($item->product_name) > 100 ? substr($item->product_name, 0, 90) . '...' : $item->product_name;
$params[$prefix . '.ARTICLE_NUMBER'] = $item->product_sku;
$params[$prefix . '.PERCENT_VAT'] = sprintf('%1.2f', $prices[$key]['VatTax'][$item->product_tax_id]['1']);
$params[$prefix . '.ARTICLE_TYPE'] = 'goods';
}
// SHIPPING
require VMPATH_ADMIN . DS . 'models' . DS . 'shipmentmethod.php';
$vmms = new VirtueMartModelShipmentmethod();
$shipmentInfo = $vmms->getShipments();
foreach ($shipmentInfo as $skey => $svalue) {
if ($svalue->virtuemart_shipmentmethod_id == $cart->virtuemart_shipmentmethod_id) {
$shipmentData = array();
foreach (explode("|", $svalue->shipment_params) as $line) {
list($key, $value) = explode('=', $line, 2);
$shipmentData[$key] = str_replace('"', '', $value);
}
$shipmentTaxId = $shipmentData['tax_id'];
$shipmentTax = sprintf('%1.2f', $cart->cartData['VatTax'][$shipmentTaxId]['calc_value']);
}
}
$i++;
$prefix = 'CRITERION.POS_' . sprintf('%02d', $i);
$params[$prefix . '.POSITION'] = $i;
$params[$prefix . '.QUANTITY'] = '1';
$params[$prefix . '.UNIT'] = 'Stk.';
$params[$prefix . '.AMOUNT_UNIT_GROSS'] = $prices['salesPriceShipment'] * 100;
$params[$prefix . '.AMOUNT_GROSS'] = $prices['salesPriceShipment'] * 100;
$params[$prefix . '.TEXT'] = 'Shipping';
$params[$prefix . '.ARTICLE_NUMBER'] = 'Shipping';
$params[$prefix . '.PERCENT_VAT'] = $shipmentTax;
$params[$prefix . '.ARTICLE_TYPE'] = 'shipment';
// COUPON
if (isset($prices['couponValue']) && $prices['couponValue'] != '') {
$i++;
$prefix = 'CRITERION.POS_' . sprintf('%02d', $i);
$params[$prefix . '.POSITION'] = $i;
$params[$prefix . '.QUANTITY'] = '1';
$params[$prefix . '.UNIT'] = 'Stk.';
$params[$prefix . '.AMOUNT_UNIT_GROSS'] = $prices['couponValue'] * 100;
$params[$prefix . '.AMOUNT_GROSS'] = $prices['couponValue'] * 100;
$params[$prefix . '.TEXT'] = 'Coupon';
$params[$prefix . '.ARTICLE_NUMBER'] = 'Coupon';
$params[$prefix . '.PERCENT_VAT'] = $prices['couponTax'];
$params[$prefix . '.ARTICLE_TYPE'] = 'voucher';
}
}
return $params;
}
示例14: _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;
}
示例15: confirm
/**
* Executes the confirmDone task,
* cart object checks itself, if the data is valid
*
* @author Max Milbers
*
*
*/
public function confirm()
{
//Use false to prevent valid boolean to get deleted
$cart = VirtueMartCart::getCart();
if ($cart) {
$cart->confirmDone();
$view = $this->getView('cart', 'html');
$view->setLayout('order_done');
// Display it all
$view->display();
} else {
$mainframe = JFactory::getApplication();
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'), JText::_('COM_VIRTUEMART_CART_DATA_NOT_VALID'));
}
}