Skip to content

Commit 934675f

Browse files
committed
MAGETWO-57129: Identity Service fix
2 parents 3aa7a86 + f66123e commit 934675f

File tree

91 files changed

+1647
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1647
-352
lines changed

Gruntfile.js.sample

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@
55

66
// For performance use one level down: 'name/{,*/}*.js'
77
// If you want to recursively match all subfolders, use: 'name/**/*.js'
8+
89
module.exports = function (grunt) {
910
'use strict';
1011

1112
var _ = require('underscore'),
1213
path = require('path'),
13-
themes = require('./dev/tools/grunt/configs/themes'),
14+
filesRouter = require('./dev/tools/grunt/tools/files-router'),
1415
configDir = './dev/tools/grunt/configs',
15-
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*');
16+
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'),
17+
themes;
18+
19+
filesRouter.set('themes', 'dev/tools/grunt/configs/themes');
20+
themes = filesRouter.get('themes');
1621

1722
tasks = _.map(tasks, function(task){ return task.replace('.js', '') });
1823
tasks.push('time-grunt');

app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
interface ProductAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface
1313
{
1414
const ENTITY_TYPE_CODE = 'catalog_product';
15-
const CODE_TIER_PRICE_FIELD_PRICE = 'price';
1615
const CODE_HAS_WEIGHT = 'product_has_weight';
1716
const CODE_SPECIAL_PRICE = 'special_price';
1817
const CODE_PRICE = 'price';
@@ -27,6 +26,9 @@ interface ProductAttributeInterface extends \Magento\Catalog\Api\Data\EavAttribu
2726
const CODE_COST = 'cost';
2827
const CODE_SEO_FIELD_URL_KEY = 'url_key';
2928
const CODE_TIER_PRICE = 'tier_price';
29+
const CODE_TIER_PRICE_FIELD_PRICE = 'price';
30+
const CODE_TIER_PRICE_FIELD_PERCENTAGE_VALUE = 'percentage_value';
31+
const CODE_TIER_PRICE_FIELD_VALUE_TYPE = 'value_type';
3032
const CODE_SEO_FIELD_META_DESCRIPTION = 'meta_description';
3133
const CODE_WEIGHT = 'weight';
3234
}

app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* @api
11+
* @deprecated use ScopedProductTierPriceManagementInterface instead
1112
*/
1213
interface ProductTierPriceManagementInterface
1314
{
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
*
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
namespace Magento\Catalog\Api;
8+
9+
/**
10+
* @api
11+
*/
12+
interface ScopedProductTierPriceManagementInterface
13+
{
14+
/**
15+
* Create tier price for product
16+
*
17+
* @param string $sku
18+
* @param \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice
19+
* @return boolean
20+
* @throws \Magento\Framework\Exception\NoSuchEntityException
21+
* @throws \Magento\Framework\Exception\CouldNotSaveException
22+
*/
23+
public function add($sku, \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice);
24+
25+
/**
26+
* Remove tier price from product
27+
*
28+
* @param string $sku
29+
* @param \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice
30+
* @return boolean
31+
* @throws \Magento\Framework\Exception\NoSuchEntityException
32+
* @throws \Magento\Framework\Exception\CouldNotSaveException
33+
*/
34+
public function remove($sku, \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice);
35+
36+
/**
37+
* Get tier price of product
38+
*
39+
* @param string $sku
40+
* @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS'
41+
* @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[]
42+
* @throws \Magento\Framework\Exception\NoSuchEntityException
43+
*/
44+
public function getList($sku, $customerGroupId);
45+
}

app/code/Magento/Catalog/Model/Config/Source/Product/Options/Price.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
*/
66
namespace Magento\Catalog\Model\Config\Source\Product\Options;
77

8+
use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface;
9+
810
/**
911
* Price types mode source
1012
*
1113
* @author Magento Core Team <[email protected]>
1214
*/
13-
class Price implements \Magento\Framework\Option\ArrayInterface
15+
class Price implements ProductPriceOptionsInterface
1416
{
1517
/**
1618
* {@inheritdoc}
@@ -20,8 +22,8 @@ class Price implements \Magento\Framework\Option\ArrayInterface
2022
public function toOptionArray()
2123
{
2224
return [
23-
['value' => 'fixed', 'label' => __('Fixed')],
24-
['value' => 'percent', 'label' => __('Percent')]
25+
['value' => self::VALUE_FIXED, 'label' => __('Fixed')],
26+
['value' => self::VALUE_PERCENT, 'label' => __('Percent')],
2527
];
2628
}
2729
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Model\Config\Source;
7+
8+
use Magento\Framework\Data\OptionSourceInterface;
9+
10+
/**
11+
* Interface ProductPriceOptionsInterface
12+
*/
13+
interface ProductPriceOptionsInterface extends OptionSourceInterface
14+
{
15+
/**#@+
16+
* Values
17+
*/
18+
const VALUE_FIXED = 'fixed';
19+
const VALUE_PERCENT = 'percent';
20+
/**#@-*/
21+
}

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ abstract class AbstractAction
7070
*/
7171
protected $_indexers;
7272

73+
/**
74+
* @var \Magento\Catalog\Model\ResourceModel\Product
75+
*/
76+
private $productResource;
77+
7378
/**
7479
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
7580
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -213,12 +218,19 @@ protected function _prepareTierPriceIndex($entityIds = null)
213218
$table = $this->_defaultIndexerResource->getTable('catalog_product_index_tier_price');
214219
$this->_emptyTable($table);
215220

221+
$tierPriceExpression = $this->_connection->getCheckSql(
222+
'tp.value = 0',
223+
'product_price.value * (1 - tp.percentage_value / 100)',
224+
'tp.value'
225+
);
216226
$websiteExpression = $this->_connection->getCheckSql(
217227
'tp.website_id = 0',
218-
'ROUND(tp.value * cwd.rate, 4)',
219-
'tp.value'
228+
'ROUND(' . $tierPriceExpression . ' * cwd.rate, 4)',
229+
$tierPriceExpression
220230
);
221231
$linkField = $this->getProductIdFieldName();
232+
$priceAttribute = $this->getProductResource()->getAttribute('price');
233+
222234
$select = $this->_connection->select()->from(
223235
['cpe' => $this->_defaultIndexerResource->getTable('catalog_product_entity')],
224236
['cpe.entity_id']
@@ -238,8 +250,15 @@ protected function _prepareTierPriceIndex($entityIds = null)
238250
['cwd' => $this->_defaultIndexerResource->getTable('catalog_product_index_website')],
239251
'cw.website_id = cwd.website_id',
240252
[]
253+
)->join(
254+
['product_price' => $priceAttribute->getBackend()->getTable()],
255+
'tp.' . $linkField . ' = product_price.' . $linkField,
256+
[]
241257
)->where(
242258
'cw.website_id != 0'
259+
)->where(
260+
'product_price.attribute_id = ?',
261+
$priceAttribute->getAttributeId()
243262
)->columns(
244263
new \Zend_Db_Expr("MIN({$websiteExpression})")
245264
)->group(
@@ -462,4 +481,17 @@ protected function getProductIdFieldName()
462481
$indexList = $this->_connection->getIndexList($table);
463482
return $indexList[$this->_connection->getPrimaryKeyName($table)]['COLUMNS_LIST'][0];
464483
}
484+
485+
/**
486+
* @return \Magento\Catalog\Model\ResourceModel\Product
487+
* @deprecated
488+
*/
489+
private function getProductResource()
490+
{
491+
if (null === $this->productResource) {
492+
$this->productResource = \Magento\Framework\App\ObjectManager::getInstance()
493+
->get(\Magento\Catalog\Model\ResourceModel\Product::class);
494+
}
495+
return $this->productResource;
496+
}
465497
}

0 commit comments

Comments
 (0)