Skip to content

Commit

Permalink
Merge pull request #406 from magento-tango/MAGETWO-49914
Browse files Browse the repository at this point in the history
[Tango] Bug fixes #2
  • Loading branch information
magicbunneh committed Mar 9, 2016
2 parents b7dbda1 + 1c14dea commit 5481fac
Show file tree
Hide file tree
Showing 25 changed files with 113 additions and 670 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Magento\Bundle\Test\Unit\Ui\DataProvider\Product\Form\Modifier;

use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundleSku;
use Magento\Catalog\Model\AttributeConstantsInterface;
use Magento\Catalog\Api\Data\ProductAttributeInterface;

/**
* Class BundleSkuTest
Expand All @@ -31,7 +31,7 @@ public function testModifyMeta()
$sourceMeta = [
'testGroup' => [
'children' => [
AttributeConstantsInterface::CODE_SKU => [
ProductAttributeInterface::CODE_SKU => [
'componentType' => 'testComponent',
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\AttributeConstantsInterface as Constants;

/**
* Customize Advanced Pricing modal panel
Expand All @@ -32,13 +32,15 @@ public function modifyMeta(array $meta)
unset($parentNode['container_' . self::CODE_MSRP]);
unset($parentNode['container_' . self::CODE_MSRP_DISPLAY_ACTUAL_PRICE_TYPE]);
}
if (isset($parentNode['container_' . Constants::CODE_SPECIAL_PRICE])) {
$currentNode = &$parentNode['container_' . Constants::CODE_SPECIAL_PRICE]['children'];
$currentNode[Constants::CODE_SPECIAL_PRICE]['arguments']['data']['config']['addbefore'] = "%";
if (isset($parentNode['container_' . ProductAttributeInterface::CODE_SPECIAL_PRICE])) {
$currentNode = &$parentNode['container_' . ProductAttributeInterface::CODE_SPECIAL_PRICE]['children'];
$currentNode[ProductAttributeInterface::CODE_SPECIAL_PRICE]['arguments']['data']['config']['addbefore']
= "%";
}
$parentNodeChildren = &$parentNode[Constants::CODE_TIER_PRICE]['children'];
if (isset( $parentNodeChildren[self::CODE_RECORD]['children'][Constants::CODE_PRICE])) {
$currentNode = &$parentNodeChildren[self::CODE_RECORD]['children'][Constants::CODE_PRICE];
$parentNodeChildren = &$parentNode[ProductAttributeInterface::CODE_TIER_PRICE]['children'];
if (isset($parentNodeChildren[self::CODE_RECORD]['children'][ProductAttributeInterface::CODE_PRICE])) {
$currentNode =
&$parentNodeChildren[self::CODE_RECORD]['children'][ProductAttributeInterface::CODE_PRICE];
$currentNode['arguments']['data']['config']['label'] = __('Percent Discount');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\AttributeConstantsInterface;
use Magento\Ui\Component\Form;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Catalog\Model\Locator\LocatorInterface;
Expand Down Expand Up @@ -49,11 +49,11 @@ public function __construct(
*/
public function modifyMeta(array $meta)
{
if ($groupCode = $this->getGroupCodeByField($meta, AttributeConstantsInterface::CODE_PRICE)
if ($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_PRICE)
?: $this->getGroupCodeByField($meta, self::CODE_GROUP_PRICE)
) {
$isNewProduct = ($this->locator->getProduct()->getId()) ? false : true;
$pricePath = $this->getElementArrayPath($meta, AttributeConstantsInterface::CODE_PRICE)
$pricePath = $this->getElementArrayPath($meta, ProductAttributeInterface::CODE_PRICE)
?: $this->getElementArrayPath($meta, self::CODE_GROUP_PRICE);

$meta[$groupCode]['children'][self::CODE_PRICE_TYPE] = [
Expand Down Expand Up @@ -91,7 +91,7 @@ public function modifyMeta(array $meta)
$meta[$groupCode]['children'][self::CODE_GROUP_PRICE],
[
'children' => [
AttributeConstantsInterface::CODE_PRICE => [
ProductAttributeInterface::CODE_PRICE => [
'arguments' => [
'data' => [
'config' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\AttributeConstantsInterface;
use Magento\Ui\Component\Form;
use Magento\Framework\Stdlib\ArrayManager;

Expand Down Expand Up @@ -36,15 +36,15 @@ public function __construct(ArrayManager $arrayManager)
*/
public function modifyMeta(array $meta)
{
if ($groupCode = $this->getGroupCodeByField($meta, AttributeConstantsInterface::CODE_SKU)) {
$skuPath = $this->getElementArrayPath($meta, AttributeConstantsInterface::CODE_SKU);
if ($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_SKU)) {
$skuPath = $this->getElementArrayPath($meta, ProductAttributeInterface::CODE_SKU);
$meta[$groupCode]['children'][self::CODE_SKU_TYPE] = [
'arguments' => [
'data' => [
'config' => [
'sortOrder' => $this->getNextAttributeSortOrder(
$meta,
[AttributeConstantsInterface::CODE_SKU],
[ProductAttributeInterface::CODE_SKU],
self::SORT_ORDER
),
'formElement' => Form\Element\Checkbox::NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\AttributeConstantsInterface;
use Magento\Ui\Component\Form;
use Magento\Framework\Stdlib\ArrayManager;

Expand Down Expand Up @@ -37,10 +37,10 @@ public function __construct(ArrayManager $arrayManager)
*/
public function modifyMeta(array $meta)
{
if (($groupCode = $this->getGroupCodeByField($meta, AttributeConstantsInterface::CODE_WEIGHT)
if (($groupCode = $this->getGroupCodeByField($meta, ProductAttributeInterface::CODE_WEIGHT)
?: $this->getGroupCodeByField($meta, self::CODE_CONTAINER_WEIGHT))
) {
$weightPath = $this->getElementArrayPath($meta, AttributeConstantsInterface::CODE_WEIGHT)
$weightPath = $this->getElementArrayPath($meta, ProductAttributeInterface::CODE_WEIGHT)
?: $this->getElementArrayPath($meta, self::CODE_CONTAINER_WEIGHT);
$meta[$groupCode]['children'][self::CODE_WEIGHT_TYPE] = [
'arguments' => [
Expand Down Expand Up @@ -76,7 +76,7 @@ public function modifyMeta(array $meta)
$meta[$groupCode]['children'][self::CODE_CONTAINER_WEIGHT],
[
'children' => [
AttributeConstantsInterface::CODE_HAS_WEIGHT => [
ProductAttributeInterface::CODE_HAS_WEIGHT => [
'arguments' => [
'data' => [
'config' => [
Expand All @@ -93,7 +93,7 @@ public function modifyMeta(array $meta)
$meta[$groupCode]['children'][self::CODE_CONTAINER_WEIGHT],
[
'children' => [
AttributeConstantsInterface::CODE_WEIGHT => [
ProductAttributeInterface::CODE_WEIGHT => [
'arguments' => [
'data' => [
'config' => [
Expand Down
17 changes: 17 additions & 0 deletions app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,21 @@
interface ProductAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface
{
const ENTITY_TYPE_CODE = 'catalog_product';
const CODE_TIER_PRICE_FIELD_PRICE = 'price';
const CODE_HAS_WEIGHT = 'product_has_weight';
const CODE_SPECIAL_PRICE = 'special_price';
const CODE_PRICE = 'price';
const CODE_TIER_PRICE_FIELD_PRICE_QTY = 'price_qty';
const CODE_SHORT_DESCRIPTION = 'short_description';
const CODE_SEO_FIELD_META_TITLE = 'meta_title';
const CODE_STATUS = 'status';
const CODE_NAME = 'name';
const CODE_SKU = 'sku';
const CODE_SEO_FIELD_META_KEYWORD = 'meta_keyword';
const CODE_DESCRIPTION = 'description';
const CODE_COST = 'cost';
const CODE_SEO_FIELD_URL_KEY = 'url_key';
const CODE_TIER_PRICE = 'tier_price';
const CODE_SEO_FIELD_META_DESCRIPTION = 'meta_description';
const CODE_WEIGHT = 'weight';
}
31 changes: 0 additions & 31 deletions app/code/Magento/Catalog/Model/AttributeConstantsInterface.php

This file was deleted.

Loading

0 comments on commit 5481fac

Please sign in to comment.