-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from magento-goinc/prepared-pull-request
[GoInc] bugsfixing
- Loading branch information
Showing
6 changed files
with
171 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
app/code/Magento/ConfigurableProduct/Model/Product/VariationMediaAttributes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\ConfigurableProduct\Model\Product; | ||
|
||
/** | ||
* Class VariationMediaAttributes. Return media attributes allowed for variations | ||
*/ | ||
class VariationMediaAttributes | ||
{ | ||
/** | ||
* @var \Magento\Catalog\Model\ProductFactory | ||
*/ | ||
protected $productFactory; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $mediaAttributes; | ||
|
||
/** | ||
* @param \Magento\Catalog\Model\ProductFactory $productFactory | ||
*/ | ||
public function __construct(\Magento\Catalog\Model\ProductFactory $productFactory) | ||
{ | ||
$this->productFactory = $productFactory; | ||
} | ||
|
||
/** | ||
* Get media attributes for Configurable variation | ||
* | ||
* @return array | ||
*/ | ||
public function getMediaAttributes() | ||
{ | ||
if (null === $this->mediaAttributes) { | ||
$this->mediaAttributes = $this->getProduct()->getMediaAttributes(); | ||
} | ||
return $this->mediaAttributes; | ||
} | ||
|
||
/** | ||
* Get product container for Simple product | ||
* | ||
* @return \Magento\Catalog\Model\Product | ||
*/ | ||
private function getProduct() | ||
{ | ||
return $this->productFactory->create()->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.