Is it possible while creating new users with AvS_Fastsimpleimporter to add more than the standard address ?
Currently my array "data" looks like this
'email' => $kunde['email'],
'_website' => $_website,
'_store' => $_website . 'store',
'confirmation' => '',
'created_at' => $created_at,
'created_in' => 'Import',
'disable_auto_group_change' => 0,
'firstname' => $kunde['name_1'],
'group_id' => 3,
'kontonummer' => $kunde['kontonr'],
'kundennummer' => $kunde['kundennr'],
'lastname' => $lastname,
'password_hash' => $password_hash,
'store_id' => 0,
'website_id' => $country['id'],
'_address_city' => $kunde['ort'],
'_address_country_id' => $kunde['land'],
'_address_fax' => $kunde['fax'],
'_address_firstname' => $kunde['name_1'],
'_address_lastname' => $lastname,
'_address_postcode' => $kunde['plz'],
'_address_street' => $kunde['strasse'],
'_address_telephone' => $_address_telephone,
'_address_vat_id' => $kunde['ust_id'],
'_address_default_billing_' => 1,
'_address_default_shipping_' => 1,
And i want to add a second address with the AvS_Simpleimporter.
I tried to add a second array in data like this:
array_push($data, array(
'email' => null,
'_website' => null,
'_address_city' => checkRequiredInput($address['ort']),
'_address_country_id' => $address['land'],
'_address_firstname' => checkRequiredInputVadr($address['name_1']),
'_address_lastname' => checkRequiredInputVadr($address['name_2']),
'_address_postcode' => checkRequiredInput($address['plz']),
'_address_street' => checkRequiredInput($address['strasse']),
'_address_default_billing_' => 0,
'_address_default_shipping_' => 0,
));
And then executing with
$importer = Mage::getModel('fastsimpleimport/import');
$importer->setIgnoreDuplicates('password_hash')->processCustomerImport($data);
But this currently doesn't work. The second address is added as an extra array to data like this
.... data array
....
'_address_default_billing_' => 1
'_address_default_shipping_' => 1
[0] => 'email' => bla bla
'_website' => bla bla
and so son
Any help ?
Multiple addresses are imported as additional rows. Hence you need to:
'_address_country_id' => array($country1,$country2),
'_address_city' => array($city1, $city2),
....
Related
I have DB in SQL Server and I execute it with Laravel. However, I get the following error.
ParseError syntax error, unexpected ' ' (T_STRING), expecting ']'
I am trying to figure out why this is happening. It shows this syntax error, but I don't understand it. I can't find a typo. I read and update SQL Server database. Is there a bug or something?
$siswa_regNo = DB::table('upload_tbpendaftaran$')
->select('Reg_No', 'F_Name',
'N_Name',
'Place',
'Birthday',
'BirthID',
'Gender',
'Bloods',
'Glass',
'Height',
'Weight',
'Child_No',
'Child_Qty',
'School_Code',
'School_Name',
'School_Address',
'School_Distric',
'School_Distric_Desc',
'School_City',
'School_City_Desc',
'School_Province',
'School_Province_Desc',
'School_NEM_Avg',
'School_STTB',
'Certificate_ID',
'Stay',
'Stay_Address',
'Stay_RT',
'Stay_RW',
'Stay_Village',
'Stay_Distric',
'Stay_Distric_Desc',
'Stay_City',
'Stay_City_Desc',
'Stay_Province',
'Stay_Province_Desc',
'Stay_Phone',
'Stay_HP',
'Stay_Postal',
'Stay_Longitude',
'Stay_Latitude',
'Home_Address',
'Home_RT',
'Home_RW',
'Home_Village',
'Home_Distric',
'Home_Distric_Desc',
'Home_City',
'Home_City_Desc',
'Home_Province',
'Home_Province_Desc',
'Home_Postal',
'Home_Phone',
'Home_HP',
'Home_HP2',
'Home_Longitude',
'Home_Latitude',
'EMail',
'Email_Parent',
'Email_Parent2',
'ID_Cards',
'Distance',
'Time_HH',
'Time_MM',
'TransportID',
'TransportDesc',
'Remarks',
'NISN',
'ExamUNNo')
->orderBy('Reg_No')
->get();
foreach ($siswa_regNo as $s) {
DB::table('Registration')
->where('Reg_No', $s->Reg_No)
->update([
'F_Name' => $s->F_Name,
'N_Name' => $s->N_Name,
'Place' => $s->Place,
'Birthday' => $s->Birthday,
'BirthID' => $s->BirthID,
'Gender' => $s->Gender,
'Religion' => $s->Religion,
'Citizen' => $s->Citizen,
'FamilyID' => $s->FamilyID,
'Bloods' => $s->Bloods,
'Glass' => $s->Glass,
'Height' => $s->Height,
'Weight' => $s->Weight,
'Child_No' => $s->Child_No,
'Child_Qty' => $s->Child_Qty,
'School_Code' => $s->School_Code,
'School_Name' => $s->School_Name,
'School_Address' => $s->School_Address,
'School_Distric' => $s->School_Distric,
'School_Distric_Desc' => $s->School_Distric_Desc,
'School_City' => $s->School_City,
'School_City_Desc' => $s->School_City_Desc,
'School_Province' => $s->School_Province,
'School_Province_Desc' => $s->School_Province_Desc,
'School_NEM_Avg' => $s->School_NEM_Avg,
'School_STTB' => $s->School_STTB,
'Certificate_ID' => $s->Certificate_ID,
'Stay' => $s->Stay,
'Stay_Address' => $s->Stay_Address,
'Stay_RT' => $s->Stay_RT,
'Stay_RW' => $s->Stay_RW,
'Stay_Village' => $s->Stay_Village,
'Stay_Distric' => $s->Stay_Distric,
'Stay_Distric_Desc' => $s->Stay_Distric_Desc,
'Stay_City' => $s->Stay_City,
'Stay_City_Desc' => $s->Stay_City_Desc,
'Stay_Province' => $s->Stay_Province,
'Stay_Province_Desc' => $s->Stay_Province_Desc,
'Stay_Phone' => $s->Stay_Phone,
'Stay_HP' => $s->Stay_HP,
'Stay_Postal' => $s->Stay_Postal,
'Stay_Longitude' => $s->Stay_Longitude,
'Stay_Latitude' => $s->Stay_Latitude,
'Home_Address' => $s->Home_Address,
'Home_RT' => $s->Home_RT,
'Home_RW' => $s->Home_RW,
'Home_Village' => $s->Home_Village,
'Home_Distric' => $s->Home_Distric,
'Home_Distric_Desc' => $s->Home_Distric_Desc,
'Home_City' => $s->Home_City,
'Home_City_Desc' => $s->Home_City_Desc,
'Home_Province' => $s->Home_Province,
'Home_Province_Desc' => $s->Home_Province_Desc,
'Home_Postal' => $s->Home_Postal,
'Home_Phone' => $s->Home_Phone,
'Home_HP' => $s->Home_HP,
'Home_HP2' => $s->Home_HP2,
'Home_Longitude' => $s->Home_Longitude,
'Home_Latitude' => $s->Home_Latitude,
'EMail' => $s->EMail,
'Email_Parent' => $s->Email_Parent,
'Email_Parent2' => $s->Email_Parent2,
'ID_Cards' => $s->ID_Cards,
'Distance' => $s->Distance,
'Time_HH' => $s->Time_HH,
'Time_MM' => $s->Time_MM,
'TransportID' => $s->TransportID,
'TransportDesc' => $s->TransportDesc,
'Remarks' => $s->Remarks,
'NISN' => $s->NISN,
'ExamUNNo' => $s->ExamUNNo
]);
}
I am very confused, please help.
in second FOREACH, when you are getting data from DB you should add ->first() or ->get() in the last.
foreach ($siswa_regNo as $s) {
DB::table('Registration')
->where('Reg_No', $s->Reg_No)
->first() // this line added
->update([
'F_Name' => $s->F_Name,
'N_Name' => $s->N_Name,
'Place' => $s->Place,
.
.
.
]);
}
or if you want to use ->get() you should foreach to this also...
Thank you very much for reading this, its quite long!
I run my function:
public function createSpreadSheet()
{
$client = $this->getClient();
$service = new \Google_Service_Sheets($client);
// TODO: Assign values to desired properties of `requestBody`:
$requestBody = new \Google_Service_Sheets_Spreadsheet();
$response = $service->spreadsheets->create($requestBody);
echo '<pre>', var_export($response, true), '</pre>', "\n";
}
I got a result:
Google_Service_Sheets_Spreadsheet::__set_state(array(
'collection_key' => 'sheets',
'developerMetadataType' => 'Google_Service_Sheets_DeveloperMetadata',
'developerMetadataDataType' => 'array',
'namedRangesType' => 'Google_Service_Sheets_NamedRange',
'namedRangesDataType' => 'array',
'propertiesType' => 'Google_Service_Sheets_SpreadsheetProperties',
'propertiesDataType' => '',
'sheetsType' => 'Google_Service_Sheets_Sheet',
'sheetsDataType' => 'array',
'spreadsheetId' => '1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU',
'spreadsheetUrl' => 'https://docs.google.com/spreadsheets/d/1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU/edit',
'internal_gapi_mappings' =>
array (
),
modelData' =>
array (
),
'processed' =>
array (
),
'properties' =>
Google_Service_Sheets_SpreadsheetProperties::__set_state(array(
'autoRecalc' => 'ON_CHANGE',
'defaultFormatType' => 'Google_Service_Sheets_CellFormat',
'defaultFormatDataType' => '',
'iterativeCalculationSettingsType' => 'Google_Service_Sheets_IterativeCalculationSettings',
'iterativeCalculationSettingsDataType' => '',
'locale' => 'en_US',
'timeZone' => 'Etc/GMT',
'title' => 'Untitled spreadsheet',
'internal_gapi_mappings' =>
array (
),
'modelData' =>
array (
),
'processed' =>
array (
),
'defaultFormat' =>
Google_Service_Sheets_CellFormat::__set_state(array(
'backgroundColorType' => 'Google_Service_Sheets_Color',
'backgroundColorDataType' => '',
'bordersType' => 'Google_Service_Sheets_Borders',
'bordersDataType' => '',
'horizontalAlignment' => NULL,
'hyperlinkDisplayType' => NULL,
'numberFormatType' => 'Google_Service_Sheets_NumberFormat',
'numberFormatDataType' => '',
.........
.........
))
I access to the link it returned:
'https://docs.google.com/spreadsheets/d/1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU/edit'
it gives me this 'request access' page, then I press the request access
I open my email and get this:
Your message wasn't delivered to xxxxxx#xxxxxxxx.iam.gserviceaccount.com because the domain admanager-1x3x71x4x27x4.iam.gserviceaccount.com couldn't be found. Check for typos or unnecessary spaces and try again.
Is there something wrong and what should I do? I just want to open the file and check where it is.
Thank you very much!
I tried to create edit method on form data submission, but instead of updating the old entry, it creates a new entry in the database.
My source files are:
web.php
Route::get('/input_gedung_bangunan/{id_bangunan}', 'input_gedung_bangunan#tampiledit');
Route::post('/data_gedung_bangunan/hitung_data', 'input_gedung_bangunan#store');
Controller:
public function store(Request $request){
//DB::enableQueryLog();
//$id_bangunan = $id;
$validation = \App\Tbl_uraian_datas::where('id_bangunan', '=', $request->get('id_bangunan'))->first();
if(is_null($validation)){
$tbl_uraian_datas = new \App\Tbl_uraian_datas;
$tbl_uraian_datas->id_bangunan = $request->get('id_bangunan');
$tbl_uraian_datas->id_kanwil = Input::get('IDKanwil');
$tbl_uraian_datas->id_kota_kab = Input::get('IDKotaKab');
$tbl_uraian_datas->nomor_baris = Input::get('NomorBaris');
$tbl_uraian_datas->nama_bangunan = Input::get('NamaBangunan');
$tbl_uraian_datas->alamat_bangunan = Input::get('AlamatBangunan');
$tbl_uraian_datas->nama_kota_kab = Input::get('Kota/Kabupaten');
$tbl_uraian_datas->kode_barang = Input::get('KodeBarang');
$tbl_uraian_datas->nup_barang = Input::get('NUPBarang');
$tbl_uraian_datas->luas_lantai = Input::get('LuasLantai');
$tbl_uraian_datas->jumlah_lantai = Input::get('JumlahLantai');
$tbl_uraian_datas->tahun_penilaian = Input::get('TahunPenilaian');
$tbl_uraian_datas->tahun_dibangun = Input::get('TahunDibangun');
$tbl_uraian_datas->tahun_direnovasi = Input::get('TahunDirenovasi');
$tbl_uraian_datas->id_jenis_bangunan = Input::get('IDJenisBangunan');
$tbl_uraian_datas->jenis_bangunan = Input::get('JenisBangunan');
$tbl_uraian_datas->id_kategori = Input::get('IDKategoriBangunan');
$tbl_uraian_datas->kategori_bangunan = Input::get('KategoriBangunan');
$tbl_uraian_datas->id_kondisi = Input::get('IDKondisiBangunan');
$tbl_uraian_datas->kondisi_bangunan = Input::get('KondisiBangunan');
$tbl_uraian_datas->luas_carport = Input::get('LuasCarport');
$tbl_uraian_datas->panjang_pagar_material1 = Input::get('PanjangPagar1');
$tbl_uraian_datas->panjang_pagar_material2 = Input::get('PanjangPagar2');
$tbl_uraian_datas->panjang_pagar_material3 = Input::get('PanjangPagar3');
$tbl_uraian_datas->harga_per_m2 = Input::get('Hargaperm2');
$tbl_uraian_datas->alasan_fisik = Input::get('Alasan1');
$tbl_uraian_datas->penyusutan = Input::get('Penyusutan');
$tbl_uraian_datas->alasan_penyusutan = Input::get('Alasan2');
$tbl_uraian_datas->save();
}else{
//Edit Data Gedung/Bangunan
$tbl_uraian_datas = \App\Tbl_uraian_datas::update(['id_kanwil' => Input::get('IDKanwil'), 'id_kota_kab' => Input::get('IDKotaKab'), 'nomor_baris' => Input::get('NomorBaris'),'nama_bangunan' => Input::get('nama_bangunan'),'alamat_bangunan' => Input::get('AlamatBangunan'),'nama_kota_kab' => Input::get('Kota/Kabupaten'),'kode_barang' => Input::get('KodeBarang'),'nup_barang' => Input::get('NUPBarang'),'luas_lantai' => Input::get('LuasLantai'),'jumlah_lantai' => Input::get('JumlahLantai'),'tahun_penilaian' => Input::get('TahunPenilaian'),'tahun_dibangun' => Input::get('TahunDibangun'),'tahun_direnovasi' => Input::get('TahunDirenovasi'),'id_jenis_bangunan' => Input::get('IDJenisBangunan'),'jenis_bangunan' => Input::get('JenisBangunan'),'id_kategori' => Input::get('IDKategoriBangunan'),'kategori_bangunan' => Input::get('KategoriBangunan'),'id_kondisi' => Input::get('IDKondisiBangunan'),'kondisi_bangunan' => Input::get('KondisiBangunan'),'luas_carport' => Input::get('LuasCarport'),'panjang_pagar_material1' => Input::get('PanjangPagar1'),'panjang_pagar_material2' => Input::get('PanjangPagar2'),'panjang_pagar_material3' => Input::get('PanjangPagar3'),'harga_per_m2' => Input::get('Hargaperm2'),'alasan_fisik' => Input::get('Alasan1'),'penyusutan' => Input::get('Penyusutan'),'alasan_penyusutan' => Input::get('Alasan2')]);
//$tbl_hasil_perhitungans = \App\Tbl_hasil_perhitungans::where('id_bangunan', '=',$request->get('id_bangunan'))->update(['umur_efektif_bangunan' => Input::get('nUmurEfektifBangunan'), 'pembulatan' => Input::get('nPembulatan')]);
$request->session()->flash('alert-success', 'Data Gedung Bangunan was successfully added!');
return back();
}
}
It looks like the controller keeps making the new id for the editted data and I don't know what I did wrong in my controller.
Instead of the following lines in your code:
$validation = \App\Tbl_uraian_datas::where('id_bangunan', '=', $request->get('id_bangunan'))->first();
if(is_null($validation)){
Try this:
$validation = \App\Tbl_uraian_datas::where('id_bangunan', $request->input('id_bangunan'))->first();
if(empty($validation)){
AND
instead of
$tbl_uraian_datas = \App\Tbl_uraian_datas::update(['id_kanwil' => Input::get('IDKanwil'), 'id_kota_kab' => Input::get('IDKotaKab'), 'nomor_baris' => Input::get('NomorBaris'),'nama_bangunan' => Input::get('nama_bangunan'),'alamat_bangunan' => Input::get('AlamatBangunan'),'nama_kota_kab' => Input::get('Kota/Kabupaten'),'kode_barang' => Input::get('KodeBarang'),'nup_barang' => Input::get('NUPBarang'),'luas_lantai' => Input::get('LuasLantai'),'jumlah_lantai' => Input::get('JumlahLantai'),'tahun_penilaian' => Input::get('TahunPenilaian'),'tahun_dibangun' => Input::get('TahunDibangun'),'tahun_direnovasi' => Input::get('TahunDirenovasi'),'id_jenis_bangunan' => Input::get('IDJenisBangunan'),'jenis_bangunan' => Input::get('JenisBangunan'),'id_kategori' => Input::get('IDKategoriBangunan'),'kategori_bangunan' => Input::get('KategoriBangunan'),'id_kondisi' => Input::get('IDKondisiBangunan'),'kondisi_bangunan' => Input::get('KondisiBangunan'),'luas_carport' => Input::get('LuasCarport'),'panjang_pagar_material1' => Input::get('PanjangPagar1'),'panjang_pagar_material2' => Input::get('PanjangPagar2'),'panjang_pagar_material3' => Input::get('PanjangPagar3'),'harga_per_m2' => Input::get('Hargaperm2'),'alasan_fisik' => Input::get('Alasan1'),'penyusutan' => Input::get('Penyusutan'),'alasan_penyusutan' => Input::get('Alasan2')]);
Try:
$tbl_uraian_datas = \App\Tbl_uraian_datas::where('id_bangunan',$request->input('id_bangunan'))->update(['id_kanwil' => Input::get('IDKanwil'), 'id_kota_kab' => Input::get('IDKotaKab'), 'nomor_baris' => Input::get('NomorBaris'),'nama_bangunan' => Input::get('nama_bangunan'),'alamat_bangunan' => Input::get('AlamatBangunan'),'nama_kota_kab' => Input::get('Kota/Kabupaten'),'kode_barang' => Input::get('KodeBarang'),'nup_barang' => Input::get('NUPBarang'),'luas_lantai' => Input::get('LuasLantai'),'jumlah_lantai' => Input::get('JumlahLantai'),'tahun_penilaian' => Input::get('TahunPenilaian'),'tahun_dibangun' => Input::get('TahunDibangun'),'tahun_direnovasi' => Input::get('TahunDirenovasi'),'id_jenis_bangunan' => Input::get('IDJenisBangunan'),'jenis_bangunan' => Input::get('JenisBangunan'),'id_kategori' => Input::get('IDKategoriBangunan'),'kategori_bangunan' => Input::get('KategoriBangunan'),'id_kondisi' => Input::get('IDKondisiBangunan'),'kondisi_bangunan' => Input::get('KondisiBangunan'),'luas_carport' => Input::get('LuasCarport'),'panjang_pagar_material1' => Input::get('PanjangPagar1'),'panjang_pagar_material2' => Input::get('PanjangPagar2'),'panjang_pagar_material3' => Input::get('PanjangPagar3'),'harga_per_m2' => Input::get('Hargaperm2'),'alasan_fisik' => Input::get('Alasan1'),'penyusutan' => Input::get('Penyusutan'),'alasan_penyusutan' => Input::get('Alasan2')]);
You need to tell which row to actually update by giving a where clause
In database seeder, I just want to insert some hard-coded data to the table.
$Pro1_id = DB::table('projects')->select('id')->where('projectName', '=', 'Project A')->get();
$data1_1 = array(
'id' => 1,
'projectID' => $Pro1_id,
'attributeID' => 1,
'levelID' => 2,
'percentage' => 20,
'risk_value' => 25186.86311,
'expectation_value' => 706455.9401,
);
$data1_2 = array(
'projectID' => $Pro1_id,
'attributeID' => 2,
'levelID' => 1,
'percentage' => 60,
'risk_value' => 530351.3397,
'expectation_value' => 392207.1248,
);
$data1 = [$data1_1, $data1_2];
DB::table('Mapping')->insert($data1);
However, I got the error:
[ErrorException] preg_replace(): Parameter mismatch, pattern is a
string while replacement is an array
It is so weird, because I did the same to another table, it worked.
DB::table('projects')->insert(array(
array(
'id' => Webpatser\Uuid\Uuid::generate(),
'projectName' => 'Project A',
'creator_id' => $pro1_creatorID,
'create_at' => \Carbon\Carbon::now()->toDateString(),
'lastEditor_id' => $pro1_creatorID,
'edit_at' => \Carbon\Carbon::now()->toDateString(),
'utility' => 1.597119661,
'exponential' => 4.94,
'projectValue' => 1225090.39
),
array(
'id' => Webpatser\Uuid\Uuid::generate(),
'projectName' => 'Project B',
'creator_id' => $pro2_creatorID,
'create_at' => \Carbon\Carbon::create(2014, 12, 12)->toDateString(),
'lastEditor_id' => $pro2_creatorID,
'edit_at' => \Carbon\Carbon::create(2014, 12, 12)->toDateString(),
'utility' => 1.754989409,
'exponential' => 5.78,
'projectValue' => 293760.36
),
array(
'id' => Webpatser\Uuid\Uuid::generate(),
'projectName' => 'Project C',
'creator_id' => $pro3_creatorID,
'create_at' => \Carbon\Carbon::create(2013, 10, 21)->toDateString(),
'lastEditor_id' => $pro3_creatorID,
'edit_at' => \Carbon\Carbon::create(2013, 10, 21)->toDateString(),
'utility' => 1.423114267,
'exponential' => 4.15,
'projectValue' => 1461924.67
)
)
);
I really don't understand why inserting into projects table works, but the one of the mapping table does NOT work.
They are exactly the same method.
I think your code is correct but when you insert the id in array, you are doing the wrong way.
$Pro1_id = DB::table('projects')->select('id')->where('projectName', '=', 'Project A')->get();
Here, $Pro1_id is Collection that contain value return from your query. Sometimes it might be one, but sometimes it might be 2 or 3.... So , your are doing the wrong way when you are inserting the id in the array. So , use foreach loop like this :
foreach($Pro1_id as $pro){
DB::table('Mapping')->insert(array(
'id' => 1,
'projectID' => $pro->id,
'attributeID' => 1,
'levelID' => 2,
'percentage' => 20,
'risk_value' => 25186.86311,
'expectation_value' => 706455.9401,
));
}
For simple , get returns Collection and is rather supposed to fetch multiple rows.
For more info . Check this
The following code does create a configurable product, however, when I open the product in the backend, the following message appears:
Select Configurable Attributes
"Only attributes with scope "Global", input type "Dropdown" and Use To Create Configurable Product "Yes" are available."
A single checkbox is displayed ("Colour Group"), which must be selected before continuing.
When I click "Continue", all of the product data is there as expected EXCEPT for the associated products.
//Mage Product
$mpr = Mage::getModel('catalog/product');
$mpr
->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
->setTaxClassId(5)
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
->setWebsiteIds(array(1))
->setAttributeSetId(4) // You can determine this another way if you need to.
->setSku("C12345")
->setName("C12345")
->setQty(25)
->setShortDescription('short description')
->setDescription('description')
->setPrice(1)
->setStockData(array(
'use_config_manage_stock' => 1,
'is_in_stock' => 1,
'is_salable' => 1,
));
$productData = array(
'7039604' =>
array('0' => array('attribute_id' => '85', 'label' => 'ROYAL','value_index' => '28563', 'is_percent' => 0, 'pricing_value' => '')
,'1' => array('attribute_id' => '192', 'label' => '14', 'value_index' => '28728', 'is_percent' => 0, 'pricing_value' => '')
)
);
$attributeData = array(
'0' => array(
'id' => NULL
,'label' => 'Color'
,'position' => NULL
,'values' => array(
'0' => array('value_index' => 28563, 'label' => 'ROYAL', 'is_percent' => 0, 'pricing_value' => '0', 'attribute_id' => '85')
)
,'attribute_id' => 85
,'attribute_code' => 'color'
,'frontend_label' => 'Color'
,'html_id' => 'config_super_product__attribute_0')
,'1' => array(
'id' => NULL
,'label' => 'Rivers Size'
,'position' => NULL
,'values' => array(
'0' => array('value_index' => 28728, 'label' => '14', 'is_percent' => 0, 'pricing_value' => '0', 'attribute_id' => '192')
)
,'attribute_id' => 192
,'attribute_code' => 'rivers_size'
,'frontend_label' => 'Rivers Size'
,'html_id' => 'config_super_product__attribute_1')
);
$mpr->setConfigurableProductsData($productData);
$mpr->setConfigurableAttributesData($attributeData);
$mpr->setCanSaveConfigurableAttributes(true);
$mpr->save();
Add this code before $mpr->save();
$SKU = "any-simple product sku enter here";
$productid = Mage::getModel('catalog/product')
->getIdBySku(trim($SKU));
$mpr->assignProduct($productid);
And set simple product sku in $SKU variable. and i have check that when i select global variable then after i see associated product in configure product.
Its work fine !!!
If you are getting redirected to select attribute page, this means that attribute data you set in this sample is not saved correctly.
Try viewing catalog_product_super_attribute after script run (new rows should be added).