magento成功页面变量 [英] magento success page variables

查看:66
本文介绍了magento成功页面变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试捕获一些magento成功页面变量以传递给我们的广告公司.

I am trying to capture some magento success page variables to pass to our advertising company.

到目前为止,我已经知道了,但是变量没有输出任何东西:

So far I have got this but the variables are not outputting anything:

<?php 
$items = $order->getItemsCollection();
foreach ($items as $item)
{
    $price="'".$item->getPrice()."', ";
    $qty="'".$item->getQty()."', ";
    $sku="'".$item->getSku()."', ";
}
?>

数据必须采用以下格式:

The data needs to be in the format:

'price1', 'price2', 'price3'
'qty1', 'qty2', 'qty3'
'sku1', 'sku2', 'sku3'

推荐答案

尝试将其添加到Success.phtml

Try adding this to Success.phtml

$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$items = $order->getItemsCollection();

$price = $qty = $sku = array();
foreach($items as $item){
  $price[] = $item->getPrice(); 
  $qty[] = $item->getQty();
  $sku[] = $item->getSku();
}

echo "'" . implode("', '", $price) . "'";
echo "'" . implode("', '", $qty) . "'";
echo "'" . implode("', '", $sku) . "'";

这篇关于magento成功页面变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆