Java 是否可以获取magento购物车摘要(总计和#项)以供外部使用?
我也希望使用来自外部(基于java springframework)品牌站点的magento 用户将看到一个“购买”按钮。 我还想让用户在每个外部页面的标题中看到购物车信息的摘要(购物车中的项目总数+数量)。 检查过程将照常在magento上进行 Magento提供了一个soap api 当用户想要结账和付款时,我无法理解如何处理从我的网站切换回magento的问题 情景1Java 是否可以获取magento购物车摘要(总计和#项)以供外部使用?,java,magento,soap,Java,Magento,Soap,我也希望使用来自外部(基于java springframework)品牌站点的magento 用户将看到一个“购买”按钮。 我还想让用户在每个外部页面的标题中看到购物车信息的摘要(购物车中的项目总数+数量)。 检查过程将照常在magento上进行 Magento提供了一个soap api 当用户想要结账和付款时,我无法理解如何处理从我的网站切换回magento的问题 情景1 用户浏览我的java网站并最终单击“购买”按钮(在这种情况下,这是指向magento实例{ID}的简单REST链接…sho
您可以使用以下代码在外部使用magento数据(例如购物车):
<?php
/**
* @author MagePsycho <info@magepsycho.com>
* @website http://www.magepsycho.com
* @category using Magento Externally
*/
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
#Mage::setIsDeveloperMode(true);
#ini_set('display_errors', 1);
umask(0);
Mage::app();
Mage::getSingleton('core/session', array('name'=>'frontend'));
#Get total items and total quantity in cart
$totalItems = Mage::getModel('checkout/cart')->getQuote()->getItemsCount();
$totalQuantity = Mage::getModel('checkout/cart')->getQuote()->getItemsQty();
#Get subtotal and grand total price of cart
$subTotal = Mage::getModel('checkout/cart')->getQuote()->getSubtotal();
$grandTotal = Mage::getModel('checkout/cart')->getQuote()->getGrandTotal();
在您的第二个场景中:尝试将用户重定向到{ID}。如果我使用REST-ful链接将商品放入购物车,我将不知道服务器端的shoppingCartId来检索信息:-(实际上,我的站点是一个java应用程序,我不知道如何require_once'app/Mage.php
:-(