Reputation: 6513
I whish to use magento also from and external (java springframework based) brand site.
Users will see a "buy" button. I would also like to let the user see the summary of cart info (total + number of items in cart) in the header of each external page. The checkout process will proceed on magento as usual.
Magento offers a soap api.
I cannot understand how to handle the switch from my site back to magento when the user wants to checkout and pay.
Scenario 1
Scenario 2:
Upvotes: 1
Views: 2217
Reputation: 2004
You can use the following code in order to use the magento data(for example cart) externally:
<?php
/**
* @author MagePsycho <[email protected]>
* @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();
Hope this helps you. Cheers!!
Upvotes: 2