从Magento中的外部文件调用购物车页面
我不知道如何指定此问题,我想要的是,我必须从外部文件调用购物车页面,其中产品id和数量存储在sales\u flat\u quote\u item表中,我必须在购物车中显示此产品。我试着打电话从Magento中的外部文件调用购物车页面,magento,Magento,我不知道如何指定此问题,我想要的是,我必须从外部文件调用购物车页面,其中产品id和数量存储在sales\u flat\u quote\u item表中,我必须在购物车中显示此产品。我试着打电话 header( 'Location: ' . Mage::getUrl('checkout/cart/')); 我所做的也附加在这一点上:请去核实一下 $orderid=$_GET['orderId']; //$_GET['orderId']; $cusid=$_GET['customer']; //$
header( 'Location: ' . Mage::getUrl('checkout/cart/'));
我所做的也附加在这一点上:请去核实一下
$orderid=$_GET['orderId'];
//$_GET['orderId'];
$cusid=$_GET['customer'];
//$_GET['customer'];
require_once "app/Mage.php";
Mage::app();
Mage::getSingleton('core/session', array('name'=>'frontend') );
Mage::getSingleton('customer/session')->loginById($cusid);
$sql = Mage::getSingleton('core/resource')->getConnection('core_write');
$result=$sql->query('select
sales_flat_quote_item.product_id,sales_flat_quote_item.weight,sales_flat_quote_item.qty,sales_flat_quote_item.price
from sales_flat_quote left outer join sales_flat_quote_item on sales_flat_quote.entity_id=sales_flat_quote_item.quote_id
Where sales_flat_quote.entity_id='.$orderid);
while($row=$result->fetch(PDO::FETCH_ASSOC))
{
$pid=$row['product_id'];
//print_r($id); .'&qty='.$qty
$qty=$row['qty'];
//print_r($qty);
}
$carthelp = Mage::helper('checkout/cart')->getQuote()->getId();
//$cart = Mage::getSingleton('checkout/cart');
//$cart->save();
/*$cart = Mage::getSingleton('checkout/cart')->loadbyId($carthelp);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);*/
//echo Mage::getUrl('../index.php/checkout/cart/');
//header('Location: '.Mage::getUrl('../index.php/checkout/cart/'));
/*$url = Mage::getModel('core/url')
->getUrl("/../index.php/checkout/cart/index");
Mage::app()
->getResponse()
->setRedirect($url);
Mage::app()
->getResponse()
->sendResponse();
header( 'Location: ' . $url ); */
//header( 'Location: ' . Mage::getUrl('../index.php/checkout/cart/'));
但是是获取重定向到空购物车页面
我花了24个多小时试图解决这个问题,但结果是一样的。请帮帮我
提前谢谢。你做得有点不对。首先尝试设定一些目标:
Mage::getSingleton('checkout/session')->setQuoteId($orderid);
$cart = Mage::getSingleton('checkout/cart');
header('Location: '.Mage::getUrl('../index.php/checkout').'cart');
安东,我已经添加了“require_once”app/Mage.php;Mage::app();”。magento还有其他资源文件吗?我在sales_flat_quote_item和sales_flat_quote中添加了项目,我将如何重定向到购物车页面?请帮帮我。。。