// Plaatsen in de functions editor bij de All import/export

<?php
function wbmz_output_items( $skus = '', $qty = '' ) {
	
    // Declare our variable to store the new XML.
    $xml = '';
	
    // Ensure $skus isn't empty and that it's an array.
    if ( !empty( $skus ) && is_array( $skus ) ) {

        // Process each SKU in the array.
        foreach ( $skus as $key => $value ) {

            // Add the opening item tag.
            $xml .= "**LT**Item**GT**";

            // Add the Product ID tags and value.
            //$xml .= "**LT**ProductID**GT**" . ( empty( $ids[ $key ] ) ? '' : $ids[ $key ] ) . "**LT**/ProductID**GT**";

            // Add the SKU tags and value.
            $xml .= "**LT**Sku**GT**" . ( empty( $value ) ? '' : $value ) . "**LT**/Sku**GT**";

            // Add the Quantity tags and value.
            $xml .= "**LT**Quantity**GT**" . ( empty( $qty[ $key ] ) ? '' : $qty[ $key ] ) . "**LT**/Quantity**GT**";

            // Add the ItemCost tags and value.
            //$xml .= "**LT**ItemCost**GT**" . ( empty( $cost[ $key ] ) ? '' : $cost[ $key ] ) . "**LT**/ItemCost**GT**";

            // Add the closing item tag.
            $xml .= "**LT**/Item**GT**";
        }

    // If $skus isn't an array handle it here.
    } else {

        // Add the opening item tag.
        $xml .= "**LT**Item**GT**";

        // Add the ProductID tags and value.		
        //$xml .= "**LT**ProductID**GT**" . ( empty( $ids ) ? '' : $ids ) . "**LT**/ProductID**GT**";

        // Add the SKU tags and value.
        $xml .= "**LT**Sku**GT**" . ( empty( $skus ) ? '' : $skus ) . "**LT**/Sku**GT**";

        // Add the Quantity tags and value.
        $xml .= "**LT**Quantity**GT**" . ( empty( $qty ) ? '' : $qty ) . "**LT**/Quantity**GT**";

        // Add the ItemCost tags and value.
        //$xml .= "**LT**ItemCost**GT**" . ( empty( $cost ) ? '' : $cost ) . "**LT**/ItemCost**GT**";

        // Add the closing item tag.
        $xml .= "**LT**/Item**GT**";
    }

    return $xml;

}
?>
Geef een reactie 0