Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EcomDev_PHPUnit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open
EcomDev_PHPUnit
Commits
29b01c15
Commit
29b01c15
authored
Sep 11, 2013
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #127 from aligent/feature/bundle_fixture_loader
Bundle fixture loader
parents
631c4e6a
5cd47c08
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
...mDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
+38
-0
No files found.
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
View file @
29b01c15
...
...
@@ -60,6 +60,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
$records
+=
$this
->
_getCategoryAssociationRecords
(
$row
,
$entityTypeModel
);
$records
+=
$this
->
_getProductStockRecords
(
$row
,
$entityTypeModel
);
$records
+=
$this
->
_getProductSuperRelations
(
$row
,
$entityTypeModel
);
$records
+=
$this
->
_getProductBundleRelations
(
$row
,
$entityTypeModel
);
return
$records
;
}
...
...
@@ -80,6 +81,43 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
return
parent
::
_getAttributeRecords
(
$row
,
$attribute
,
$tableColumns
);
}
/**
* Generates records for catalog_product_bundle_option and catalog_product_bundle_selection tables
*
* @param array $row
* @param Mage_Eav_Model_Entity_Type $entityTypeModel
* @return array
* @throws RuntimeException
*/
protected
function
_getProductBundleRelations
(
$row
,
$entityTypeModel
){
$result
=
array
();
if
(
isset
(
$row
[
'bundle_options'
])
&&
is_array
(
$row
[
'bundle_options'
]))
{
$aOptions
=
array
();
$aSelections
=
array
();
foreach
(
$row
[
'bundle_options'
]
as
$iOptionId
=>
$aOption
){
$aOptions
[]
=
array
(
'option_id'
=>
$iOptionId
,
'parent_id'
=>
$row
[
$this
->
_getEntityIdField
(
$entityTypeModel
)],
'type'
=>
'radio'
//TODO: allow specification of different types
);
foreach
(
$aOption
as
$iSelectionProductId
){
$aSelections
[]
=
array
(
'option_id'
=>
$iOptionId
,
'parent_product_id'
=>
$row
[
$this
->
_getEntityIdField
(
$entityTypeModel
)],
'product_id'
=>
$iSelectionProductId
,
);
}
}
if
(
!
empty
(
$aOptions
)){
$result
+=
array
(
'bundle/option'
=>
$aOptions
);
}
if
(
!
empty
(
$aSelections
)){
$result
+=
array
(
'bundle/selection'
=>
$aSelections
);
}
}
return
$result
;
}
/**
* Generates records for catalog_product_super_attribute and catalog_product_super_link tables
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment