Php 获取管道分隔字符串中的订单项

Php 获取管道分隔字符串中的订单项,php,magento,magento-1.4,Php,Magento,Magento 1.4,我需要在Magento商店(1.4.1)上设置一些跟踪,希望有人以前已经实现了这一点 基本上,我需要从order confirm页面创建一个字符串变量,该页面包含已订购的项目,并要求字符串中的每个项目用管道符号(|)分隔,每个项目的每个属性必须用两个冒号(:)分隔 此外,如果在同一订单中多次购买同一项目,则需要将其视为多个单独的项目,因为字符串的收件人不支持qty变量 所需字符串格式的示例如下: $purchased_items="1234::9.99::CD Album::CD002345|1

我需要在Magento商店(1.4.1)上设置一些跟踪,希望有人以前已经实现了这一点

基本上,我需要从order confirm页面创建一个字符串变量,该页面包含已订购的项目,并要求字符串中的每个项目用管道符号(|)分隔,每个项目的每个属性必须用两个冒号(:)分隔

此外,如果在同一订单中多次购买同一项目,则需要将其视为多个单独的项目,因为字符串的收件人不支持qty变量

所需字符串格式的示例如下:

$purchased_items="1234::9.99::CD Album::CD002345|1255::12.99::James Bond DVD::DVD001234::ABCD123|1255::12.99::James Bond DVD::DVD001234::ABCD123";
我希望有人以前也实施过类似的解决方案-非常感谢您提供的任何帮助

这里有一些元代码(未测试)通过了正确的order对象

//we need a buffer
$stringArray = array();

//and we need to iterate over all objects (note that they are objects)
foreach ($_order->getAllItems() as $item){
    //add your formatted strings to buffer array by imploding the product information array
    $stringArray[]= implode('::',$item->getProduct()->getData());
}

//$string will contain the stuff you need to echo
$string = implode('|', $stringArray); 

$stringArray = null;