Skip to content

Commit

Permalink
Merge pull request #42 from magento-dragons/BugFestW4
Browse files Browse the repository at this point in the history
[DRAGONS] Bug Fest w4
  • Loading branch information
kandy committed Oct 28, 2015
2 parents 19ad496 + a1eba14 commit 9272b2f
Show file tree
Hide file tree
Showing 100 changed files with 1,645 additions and 1,491 deletions.
3 changes: 3 additions & 0 deletions app/code/Magento/Backend/Block/Widget/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public function addTabAfter($tabId, $tab, $afterTabId)
*/
public function addTab($tabId, $tab)
{
if (empty($tabId)) {
throw new \Exception(__('Please correct the tab configuration and try again. Tab Id should be not empry'));
}
if (is_array($tab)) {
$this->_tabs[$tabId] = new \Magento\Framework\DataObject($tab);
} elseif ($tab instanceof \Magento\Framework\DataObject) {
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public function getJsonConfig()
/* @var $product \Magento\Catalog\Model\Product */
$product = $this->getProduct();

$config = [];
if (!$this->hasOptions()) {
$config = [
'productId' => $product->getId(),
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Catalog/Block/Product/View/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function _getPriceConfiguration($option)
$data = [
'prices' => [
'oldPrice' => [
'amount' => $optionPrice,
'amount' => $this->pricingHelper->currency($option->getRegularPrice(), false, false),
'adjustments' => [],
],
'basePrice' => [
Expand Down Expand Up @@ -208,7 +208,6 @@ public function getJsonConfig()
$config = [];
foreach ($this->getOptions() as $option) {
/* @var $option \Magento\Catalog\Model\Product\Option */
$priceValue = 0;
if ($option->getGroupByType() == \Magento\Catalog\Model\Product\Option::OPTION_GROUP_SELECT) {
$tmpPriceValues = [];
foreach ($option->getValues() as $value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public function filter(
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite()
->setVisibility($this->productVisibility->getVisibleInSearchIds())
->setOrder('relevance', Select::SQL_DESC);
->setVisibility($this->productVisibility->getVisibleInSearchIds());
}
}
21 changes: 16 additions & 5 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,19 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
*/
protected $_errors = [];

/**
* Product option factory
*
* @var Product\OptionFactory
*/
protected $optionFactory;

/**
* Product option
*
* @var Product\Option
*/
protected $_optionInstance;
protected $optionInstance;

/**
* @var array
Expand Down Expand Up @@ -337,7 +344,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
* @param Product\Link $productLink
* @param Product\Configuration\Item\OptionFactory $itemOptionFactory
* @param \Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory $stockItemFactory
* @param Product\Option $catalogProductOption
* @param Product\OptionFactory $catalogProductOptionFactory
* @param Product\Visibility $catalogProductVisibility
* @param Product\Attribute\Source\Status $catalogProductStatus
* @param Product\Media\Config $catalogProductMediaConfig
Expand Down Expand Up @@ -376,7 +383,7 @@ public function __construct(
Product\Link $productLink,
\Magento\Catalog\Model\Product\Configuration\Item\OptionFactory $itemOptionFactory,
\Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory $stockItemFactory,
\Magento\Catalog\Model\Product\Option $catalogProductOption,
\Magento\Catalog\Model\Product\OptionFactory $catalogProductOptionFactory,
\Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
\Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus,
\Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig,
Expand Down Expand Up @@ -405,7 +412,7 @@ public function __construct(
$this->metadataService = $metadataService;
$this->_itemOptionFactory = $itemOptionFactory;
$this->_stockItemFactory = $stockItemFactory;
$this->_optionInstance = $catalogProductOption;
$this->optionFactory = $catalogProductOptionFactory;
$this->_catalogProductVisibility = $catalogProductVisibility;
$this->_catalogProductStatus = $catalogProductStatus;
$this->_catalogProductMediaConfig = $catalogProductMediaConfig;
Expand Down Expand Up @@ -1889,7 +1896,11 @@ public function getWeight()
*/
public function getOptionInstance()
{
return $this->_optionInstance;
if (!isset($this->optionInstance)) {
$this->optionInstance = $this->optionFactory->create();
$this->optionInstance->setProduct($this);
}
return $this->optionInstance;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions app/code/Magento/Catalog/Model/Product/Attribute/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group
protected $_attributeCollectionFactory;

/**
* Group constructor.
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param AttributeValueFactory $customAttributeFactory
* @param \Magento\Framework\Filter\Translit $translitFilter
* @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
AttributeValueFactory $customAttributeFactory,
\Magento\Framework\Filter\Translit $translitFilter,
\Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
Expand All @@ -43,6 +46,7 @@ public function __construct(
$registry,
$extensionFactory,
$customAttributeFactory,
$translitFilter,
$resource,
$resourceCollection,
$data
Expand Down
Loading

0 comments on commit 9272b2f

Please sign in to comment.