Skip to content

superReal/edi-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edi-parser

This is a parser for UN/EDIFACT messages.

Usage

To parse a message initialize a new EDIParser Instance with a path to the file you want to parse.

//To
$parser = new EDIParser(__DIR__ . "/PAORES.edi");
$parser->parse();

To retrieve the parsed message call:

$oMessage = $parser->getOMessage();

#INVRPT (Inventory report message)

The only message type implemented at the moment is INVRPT.

An INVRPT basically consists of several LINE ITEM Elements (LIN), each followed by a QUANTITY Element (QTY).

Example:

foreach($this->oMessage->getLineItems() as $oLineItem) {
    if (in_array($oLineItem->getItemNumber(), array_keys($aVariantIds))) {
        $aStockChanges[] = array(
            'OXID'      => $aVariantIds[$oLineItem->getItemNumber()],
            'OXSTOCK'   => $oLineItem->getQuantity()
        );

        $aParentChanges[] = array(
            'OXID'      => $aParentIds[$oLineItem->getItemNumber()]
        );
    }
}

To retrieve the Line Items from the Message call:

$oMessage->getLineItems();

Methods available on Line Item Objects (LIN) to ease access to parsed data:

$oLIN->getLineItemNumber();
$oLIN->getActionRequest();
$oLIN->getItemNumber();
$oLIN->getItemNumberType();
$oLIN->getQuantityQualifier();
$oLIN->getQuantity();
$oLIN->getMeasureUnit();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages