protected function prepareArtefacts($linkTypeCode, array $columns)
    {

        // initialize the array for the product media
        $artefacts = array();

        // load the parent SKU from the row
        $parentSku = $this->getValue(ColumnKeys::SKU);

        // shift the column with the header information from the stack
        list ($columnNameChildSkus, $callbackChildSkus) = array_shift($columns);

        // query whether or not, we've up sell products
        if ($links = $this->getValue($columnNameChildSkus, null, $callbackChildSkus)) {
            // intialize the array for the link attributes
            $linkAttributeValues = array();
            // iterate over the colums to prepare all link type attribute values
            foreach ($columns as $column) {
                // extract the column names and their callbacks
                list ($columnNameLinkTypeAttributeValue, $callbackLinkAttribute, $linkTypeAttributeCode) = $column;

                // explode the link type attributes
                $linkAttributeValues = $this->getValue($columnNameLinkTypeAttributeValue, array(), $callbackLinkAttribute);

                // load the SKUs of the related products
                foreach ($links as $key => $childSku) {
                    // prepare the link type attribute value
                    $linkTypeAttributeValue = $key + 1;
                    if (isset($linkAttributeValues[$key]) && !empty($linkAttributeValues[$key])) {
                        $linkTypeAttributeValue = $linkAttributeValues[$key];
                    }

                    // prepare and append the relation to the artefacts
                    $artefacts[] = $this->newArtefact(
                        array(
                            ColumnKeys::LINK_PARENT_SKU           => $parentSku,
                            ColumnKeys::LINK_CHILD_SKU            => $childSku,
                            ColumnKeys::LINK_TYPE_CODE            => $linkTypeCode,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_CODE  => $linkTypeAttributeCode,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_VALUE => $linkTypeAttributeValue
                        ),
                        array(
                            ColumnKeys::LINK_PARENT_SKU           => ColumnKeys::SKU,
                            ColumnKeys::LINK_CHILD_SKU            => $columnNameChildSkus,
                            ColumnKeys::LINK_TYPE_CODE            => $columnNameChildSkus,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_CODE  => $columnNameLinkTypeAttributeValue,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_VALUE => $columnNameLinkTypeAttributeValue
                        )
                    );
                }
            }
        }

        // return the artefacts
        return $artefacts;
    }
protected function prepareArtefacts($linkTypeCode, array $columns)
    {

        // initialize the array for the product media
        $artefacts = array();

        // load the parent SKU from the row
        $parentSku = $this->getValue(ColumnKeys::SKU);

        // shift the column with the header information from the stack
        list ($columnNameChildSkus, $callbackChildSkus) = array_shift($columns);

        // query whether or not, we've up sell products
        if ($links = $this->getValue($columnNameChildSkus, null, $callbackChildSkus)) {
            // intialize the array for the link attributes
            $linkAttributeValues = array();
            // iterate over the colums to prepare all link type attribute values
            foreach ($columns as $column) {
                // extract the column names and their callbacks
                list ($columnNameLinkTypeAttributeValue, $callbackLinkAttribute, $linkTypeAttributeCode) = $column;

                // explode the link type attributes
                $linkAttributeValues = $this->getValue($columnNameLinkTypeAttributeValue, array(), $callbackLinkAttribute);

                // load the SKUs of the related products
                foreach ($links as $key => $childSku) {
                    // prepare the link type attribute value
                    $linkTypeAttributeValue = $key + 1;
                    if (isset($linkAttributeValues[$key]) && !empty($linkAttributeValues[$key])) {
                        $linkTypeAttributeValue = $linkAttributeValues[$key];
                    }

                    // prepare and append the relation to the artefacts
                    $artefacts[] = $this->newArtefact(
                        array(
                            ColumnKeys::LINK_PARENT_SKU           => $parentSku,
                            ColumnKeys::LINK_CHILD_SKU            => $childSku,
                            ColumnKeys::LINK_TYPE_CODE            => $linkTypeCode,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_CODE  => $linkTypeAttributeCode,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_VALUE => $linkTypeAttributeValue
                        ),
                        array(
                            ColumnKeys::LINK_PARENT_SKU           => ColumnKeys::SKU,
                            ColumnKeys::LINK_CHILD_SKU            => $columnNameChildSkus,
                            ColumnKeys::LINK_TYPE_CODE            => $columnNameChildSkus,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_CODE  => $columnNameLinkTypeAttributeValue,
                            ColumnKeys::LINK_TYPE_ATTRIBUTE_VALUE => $columnNameLinkTypeAttributeValue
                        )
                    );
                }
            }
        }

        // return the artefacts
        return $artefacts;
    }
protected function prepareArtefacts ( $ linkTypeCode , array $ columns ) { // initialize the array for the product media $ artefacts = array ( ) ; // load the parent SKU from the row $ parentSku = $ this -> getValue ( ColumnKeys :: SKU ) ; // shift the column with the header information from the stack list ( $ columnNameChildSkus , $ callbackChildSkus ) = array_shift ( $ columns ) ; // query whether or not, we've up sell products if ( $ links = $ this -> getValue ( $ columnNameChildSkus , null , $ callbackChildSkus ) ) { // intialize the array for the link attributes $ linkAttributeValues = array ( ) ; // iterate over the colums to prepare all link type attribute values foreach ( $ columns as $ column ) { // extract the column names and their callbacks list ( $ columnNameLinkTypeAttributeValue , $ callbackLinkAttribute , $ linkTypeAttributeCode ) = $ column ; // explode the link type attributes $ linkAttributeValues = $ this -> getValue ( $ columnNameLinkTypeAttributeValue , array ( ) , $ callbackLinkAttribute ) ; // load the SKUs of the related products foreach ( $ links as $ key => $ childSku ) { // prepare the link type attribute value $ linkTypeAttributeValue = $ key + 1 ; if ( isset ( $ linkAttributeValues [ $ key ] ) && ! empty ( $ linkAttributeValues [ $ key ] ) ) { $ linkTypeAttributeValue = $ linkAttributeValues [ $ key ] ; } // prepare and append the relation to the artefacts $ artefacts [ ] = $ this -> newArtefact ( array ( ColumnKeys :: LINK_PARENT_SKU => $ parentSku , ColumnKeys :: LINK_CHILD_SKU => $ childSku , ColumnKeys :: LINK_TYPE_CODE => $ linkTypeCode , ColumnKeys :: LINK_TYPE_ATTRIBUTE_CODE => $ linkTypeAttributeCode , ColumnKeys :: LINK_TYPE_ATTRIBUTE_VALUE => $ linkTypeAttributeValue ) , array ( ColumnKeys :: LINK_PARENT_SKU => ColumnKeys :: SKU , ColumnKeys :: LINK_CHILD_SKU => $ columnNameChildSkus , ColumnKeys :: LINK_TYPE_CODE => $ columnNameChildSkus , ColumnKeys :: LINK_TYPE_ATTRIBUTE_CODE => $ columnNameLinkTypeAttributeValue , ColumnKeys :: LINK_TYPE_ATTRIBUTE_VALUE => $ columnNameLinkTypeAttributeValue ) ) ; } } } // return the artefacts return $ artefacts ; }
Prepare's and return's the artefacts for the passed link type.

@param string $linkTypeCode The link type code to prepare the artefacts for
@param array  $columns      The column names that contains the data (SKU + position)

@return array The link artefacts assembled from the passed row
Prepare s and return s the artefacts for the passed link type .