0

i have setup an product import with AVS fastsimpleimport and have some trouble to get the right fields or syntax for configurable option value prices. What i want to do is price changes to the options similar to this:

enter image description here

so, how can i set the option price thruh the import array?

my importdata so far (just for e.g):

....                
$data[$key] = array(
                'store'                   => array('default'),
                '_product_websites'       => array('base'),
                'sku'                     => isset($information[0]) ? $information[0] : null,                        
                '_attribute_set'          => 'Default',
                '_type'                   => 'configurable',
                '_category'               => isset($information[39]) ? explode(',',$information[39]) : null,
                'price'                   => isset($information[22]) ? str_replace(',', '.', $information[22]) : null,       
//                'special_price'           => isset($product['special_price']) ? $product['special_price'] : null,
                'weight'                  => isset($information[16]) ? $information[16] : null,                      
                'name'                    => (isset($information[0]) && isset($information[4])) ? utf8_encode($information[4]." - ".$information[0]." ".$information[5]." ".$information[6]) : null, 
                'description'             => isset($information[7]) ? $information[7] : null,                        
                'short_description'       => (isset($information[5]) && isset($information[6])) ? utf8_encode($information[5]." ".$information[6]) : null, /
                'status'                  => '1',
                'visibility'              => '4',
                'tax_class_id'            => '1',
                'qty'                     => '99',
                'is_in_stock'             => '1',
....

thanks in advance

EDIT ----

i edited my code but get errors. here is it:

        // create variants first 
        $simples = $this->createVariants($data, $additionalInformations);
        $simple_sku = array();

            // create the values for each simple product
            foreach($simples as $simple)
            {

                $data[$key]['_super_products_sku'] =  $simple['sku'];
                $data[$key]['_super_attribute_code'] =  array('material','schirme');
                $data[$key]['_super_attribute_option'] =  $simple['schirme'];
                $data[$key]['_super_attribute_price_corr'] =  $simple['price'];

        }

    // merge the data arrays
    array_unshift($data, $simple);
                print_r($data);

log output:

[_super_products_sku] => AF4125-780.RK25
            [_super_attribute_code] => Array
                (
                    [0] => size
                    [1] => size
                )

            [_super_attribute_option] => label
            [_super_attribute_price_corr] => 340

but seems to not bee right

1

In my case i had to use _super_attribute_code, _super_attribute_option and _super_attribute_price_corr for every option i wanted a price correction for.

From your data-array it looks like you are using the nested-array-adapter so you have to take care and have the keys of the corresponding options/prices/attributes the same because they are internally split into different rows.

  • thanks nils. i found allready out which fields i need. now its about the right array syntax – Florin P. Dec 17 '14 at 14:41
0

ok, found the solution. Its a bit tricky with all the arrays but this works for me:

       $super_attributes = array('size', 'color');

        // !!!super attribute option price
        foreach($super_attributes as $superattribute)
        {
            foreach($simples as $simple) // simples are the variations, see above
            {

                    $data[$key]['_super_attribute_code'][] =  $superattribute; 
                    $data[$key]['_super_products_sku'][] =  $simple['sku'];
                    $data[$key]['_super_attribute_option'][] =  $simple[$superattribute];                                              
                    $data[$key]['_super_attribute_price_corr'][] =  $simple['price'];

            }

        }

with this code you get the formated options for the super attributes + pricing, e.g:

       [_super_attribute_code] => Array
            (
                [0] => size
                [1] => color
            )

        [_super_products_sku] => Array
            (
                [0] => sku-1
                [1] => sku-2
            )

        [_super_attribute_option] => Array
            (
                [0] => label size
                [1] => label color
            )

        [_super_attribute_price_corr] => Array
            (
                [0] => 0
                [1] => 140
            )

thats it. thanks for the help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.