dongwei2882 2019-04-21 19:04
浏览 107

如何将购物车转移到php中的<BrowserFromPost>(cxml Punch-out订单消息)

I've been learning cxml for the past 2 weeks. At first its horrible. But eventually it gets easier. SO I was finally able to successfully use Punch-out Setup Request which will return the start url. I can browse the supplier website and add to cart. Now i need to transfer the items in the cart to my page. In the Punch-out Setup Request i had to provide url for that url. When i click on transfer cart, the supplier website will redirect me to mypage. Now how do i parse or even get the Punch-out Order Message in php. Here is how the punchoutordermessage should look like:

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
 <cXML timestamp="2019-05-04T13:44:46+00:00" xml:lang="en-US" payloadID="zxysdfdsdafasdfsfdsf">
<Header>
    <From>
        <Credential domain='NetworkID'>
            <Identity></Identity>
        </Credential>
    </From>
    <To>
        <Credential domain='NetworkID'>
            <Identity></Identity>
        </Credential>
    </To>
    <Sender>
        <Credential domain='NetworkID'>
            <Identity></Identity>
            <SharedSecret></SharedSecret>
        </Credential>
        <UserAgent></UserAgent>
    </Sender>
</Header>
<Message>
    <Punch-outOrderMessage>
        <BuyerCookie></BuyerCookie>
        <Punch-outOrderMessageHeader operationAllowed="edit">
            <Total>
                <Money currency="USD">300.52</Money>
            </Total>
        </Punch-outOrderMessageHeader>
        <ItemIn quantity="1">
            <ItemID>
            <SupplierPartID></SupplierPartID>
            <SupplierPartAuxiliaryID></SupplierPartAuxiliaryID>
            </ItemID>
            <ItemDetail>
                <UnitPrice>
                    <Money currency="USD">7.99</Money>
                </UnitPrice>
                <Description xml:lang="en"></Description>
                <UnitOfMeasure>EA</UnitOfMeasure>

            </ItemDetail>
        </ItemIn>

    </Punch-outOrderMessage>
</Message>

I've tried using simplexml_load_file. No Help. I'm not sure what exactly happens when the buyer click on transfer cart beside it will load the page that i supplied. Any help would be appreciated. There are not much information out there about cxml. Its been really hard to get any info.

 <?php
 $xml=simplexml_load_file("cxml_form") or die("Error: Cannot create 
 object");
 print_r($xml);
 ?>
  • 写回答

1条回答 默认 最新

  • duanmiexi2275 2019-04-22 14:51
    关注

    When the customer click on checkout/transfercart the supplier site send the message to ur page. However in order to receive it, you must automatic post the form. On your Page: add the following php code:

     <?php $xml = file_get_contents('php://input'); 
     $URL = "https://yourlandingpage";
    
     echo "<FORM ID='xmlpostform' METHOD=POST ACTION='".$URL."'>";
     echo "<INPUT TYPE=HIDDEN NAME='cXML-urlencoded' VALUE='".$xml."'>"; 
     echo "<INPUT TYPE=SUBMIT VALUE='Sending Order Information .......'>";
     echo "</FORM>"; ?> <SCRIPT 
                         LANGUAGE="JavaScript">document.forms["xmlpostform"].submit();</SCRIPT>
    

    To retrieve the value using VB.net

     dim cxml as string= doc.GetElementById("cXML-urlencoded").GetAttribute("VALUE")
    
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题