Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Olav van Schie committed Oct 31, 2015
2 parents 7aacfad + 9b05329 commit 70f5269
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 106 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- hhvm
matrix:
allow_failures:
- php: 5.6
- php: hhvm
env:
# global:
# - MAGENTO_DB_ALLOWSAME=1
# - SKIP_CLEANUP=1
- MAGENTO_VERSION=magento-ce-1.9.2.1
- MAGENTO_VERSION=magento-ce-1.9.0.1
- MAGENTO_VERSION=magento-ce-1.8.1.0
- MAGENTO_VERSION=magento-ce-1.8.0.0
script:
- curl -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand/master/setup.sh | bash
191 changes: 95 additions & 96 deletions app/code/community/Ovs/Magefaker/Model/Faker.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,118 +112,117 @@ protected function insertProduct($categories, $type = 'simple', $incReviews, $co

try {

if($type == 'configurable') {
// check attributes first

// check attributes first
// Color
$color_code = 'magefaker_color';
$color = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product', $color_code);

// Color
$color_code = 'magefaker_color';
$color = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product', $color_code);
if (is_object($color) && $color->getId()) {
$color_id = $color->getId();
} else {

if (is_object($color) && $color->getId()) {
$color_id = $color->getId();
} else {
$colorValues = array(
0 => 'Blue',
1 => 'Green',
2 => 'Red'
);

$colorValues = array(
0 => 'Blue',
1 => 'Green',
2 => 'Red'
);
$color_id = $this->_insertAttribute($color_code, 'select', $colorValues, 'Blue', 'Fake Color');
}

$color_id = $this->_insertAttribute($color_code, 'select', $colorValues, 'Blue', 'Fake Color');
}
$color_options = Mage::getModel('eav/config')
->getAttribute('catalog_product', $color_code)
->getSource()
->getAllOptions();

$color_options = Mage::getModel('eav/config')
->getAttribute('catalog_product', $color_code)
->getSource()
->getAllOptions();
$colors_data = array();

$colors_data = array();
$colors_data[1] = array(
'0' => array(
'label' => $color_options[1]['label'],
'attribute_id' => $color_id,
'value_index' => $color_options[1]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);

$colors_data[2] = array(
'0' => array(
'label' => $color_options[2]['label'],
'attribute_id' => $color_id,
'value_index' => $color_options[2]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);

$colors_data[3] = array(
'0' => array(
'label' => $color_options[3]['label'],
'attribute_id' => $color_id,
'value_index' => $color_options[3]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);

$colors_data[1] = array(
'0' => array(
'label' => $color_options[1]['label'],
'attribute_id' => $color_id,
'value_index' => $color_options[1]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);
// Size
$size_code = 'magefaker_size';
$size = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product', $size_code);

$colors_data[2] = array(
'0' => array(
'label' => $color_options[2]['label'],
'attribute_id' => $color_id,
'value_index' => $color_options[2]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);
if (is_object($size) && $size->getId()) {
$size_id = $size->getId();
} else {

$colors_data[3] = array(
'0' => array(
'label' => $color_options[3]['label'],
'attribute_id' => $color_id,
'value_index' => $color_options[3]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
$sizeValues = array(
0 => 'S',
1 => 'M',
2 => 'L'
);

// Size
$size_code = 'magefaker_size';
$size = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product', $size_code);

if (is_object($size) && $size->getId()) {
$size_id = $size->getId();
} else {

$sizeValues = array(
0 => 'S',
1 => 'M',
2 => 'L'
);

$size_id = $this->_insertAttribute($size_code, 'select', $sizeValues, 'S', 'Fake Size');
}
$size_id = $this->_insertAttribute($size_code, 'select', $sizeValues, 'S', 'Fake Size');
}

$size_options = Mage::getModel('eav/config')
->getAttribute('catalog_product', $size_code)
->getSource()
->getAllOptions();
$size_options = Mage::getModel('eav/config')
->getAttribute('catalog_product', $size_code)
->getSource()
->getAllOptions();

$size_data = array();
$size_data = array();

$size_data[1] = array(
'0' => array(
'label' => $size_options[1]['label'],
'attribute_id' => $size_id,
'value_index' => $size_options[1]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);

$size_data[2] = array(
'0' => array(
'label' => $size_options[2]['label'],
'attribute_id' => $size_id,
'value_index' => $size_options[2]['value'],
'is_percent' => '0',
'pricing_value' => '5.00'
)
);
$size_data[1] = array(
'0' => array(
'label' => $size_options[1]['label'],
'attribute_id' => $size_id,
'value_index' => $size_options[1]['value'],
'is_percent' => '0',
'pricing_value' => '0'
)
);

$size_data[2] = array(
'0' => array(
'label' => $size_options[2]['label'],
'attribute_id' => $size_id,
'value_index' => $size_options[2]['value'],
'is_percent' => '0',
'pricing_value' => '5.00'
)
);

$size_data[3] = array(
'0' => array(
'label' => $size_options[3]['label'],
'attribute_id' => $size_id,
'value_index' => $size_options[3]['value'],
'is_percent' => '0',
'pricing_value' => '10.00'
)
);

$size_data[3] = array(
'0' => array(
'label' => $size_options[3]['label'],
'attribute_id' => $size_id,
'value_index' => $size_options[3]['value'],
'is_percent' => '0',
'pricing_value' => '10.00'
)
);
}
// insert the product

$product = Mage::getModel('catalog/product');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Main controller
*/
class Ovs_Magefaker_Adminhtml_FakerController extends Mage_Adminhtml_Controller_Action{
class Ovs_Magefaker_Adminhtml_MagefakerController extends Mage_Adminhtml_Controller_Action{

protected function _isAllowed() {
return Mage::getSingleton('admin/session')->isAllowed('system/magefaker');
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ovs/Magefaker/etc/adminhtml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<magefaker>
<title>MageFaker</title>
<sort_order>10</sort_order>
<action>magefaker/adminhtml_faker</action>
<action>adminhtml/magefaker</action>
</magefaker>
</children>
</system>
Expand Down
12 changes: 6 additions & 6 deletions app/code/community/Ovs/Magefaker/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<modules>
<ovs_magefaker>
<version>0.7.0</version>
<version>0.7.1</version>
</ovs_magefaker>
</modules>

Expand Down Expand Up @@ -43,13 +43,13 @@

<admin>
<routers>
<ovs_magefaker>
<use>admin</use>
<adminhtml>
<args>
<module>Ovs_Magefaker</module>
<frontName>magefaker</frontName>
<modules>
<ovs_magefaker after="Mage_Adminhtml">Ovs_Magefaker_Adminhtml</ovs_magefaker>
</modules>
</args>
</ovs_magefaker>
</adminhtml>
</routers>
</admin>

Expand Down
4 changes: 2 additions & 2 deletions app/design/adminhtml/default/default/layout/ovs_magefaker.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<layout version="0.0.1">

<ovs_magefaker_adminhtml_faker_index>
<adminhtml_magefaker_index>

<reference name="content">
<block type="ovs_magefaker/adminhtml_faker_edit" name="edit" />
Expand All @@ -11,6 +11,6 @@
<block type="ovs_magefaker/adminhtml_faker_edit_tabs" name="tabs"/>
</reference>

</ovs_magefaker_adminhtml_faker_index>
</adminhtml_magefaker_index>

</layout>

0 comments on commit 70f5269

Please sign in to comment.