Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3-develop' into BugFixPR
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan He committed Nov 26, 2018
2 parents 2a4d59d + 7755eef commit 62efbf6
Show file tree
Hide file tree
Showing 65 changed files with 1,391 additions and 417 deletions.
1 change: 0 additions & 1 deletion app/code/Magento/Backend/Block/Widget/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ protected function _construct()
parent::_construct();

$this->setDestElementId('edit_form');
$this->setShowGlobalIcon(false);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Backend/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @api
* @deprecated 100.2.0 in favour of UI component implementation
* @method string getRowClickCallback() getRowClickCallback()
* @method \Magento\Backend\Block\Widget\Grid setRowClickCallback() setRowClickCallback(string $value)
* @method \Magento\Backend\Block\Widget\Grid setRowClickCallback(string $value)
* @SuppressWarnings(PHPMD.TooManyFields)
* @since 100.0.2
*/
Expand Down Expand Up @@ -150,7 +150,10 @@ public function __construct(
}

/**
* Internal constructor, that is called from real constructor
*
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _construct()
Expand Down Expand Up @@ -709,6 +712,7 @@ public function getGridUrl()

/**
* Grid url getter
*
* Version of getGridUrl() but with parameters
*
* @param array $params url parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@ public function __construct(
parent::__construct($context, $registry, $formFactory, $data);
}

/**
* Construct block
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setShowGlobalIcon(true);
}

/**
* Prepares form
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
namespace Magento\Catalog\Block\Product\ProductList;

/**
* Crosssell block for product
*/
class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
{
/**
Expand All @@ -25,7 +28,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
*/
protected function _prepareData()
{
$product = $this->_coreRegistry->registry('product');
$product = $this->getProduct();
/* @var $product \Magento\Catalog\Model\Product */

$this->_itemCollection = $product->getCrossSellProductCollection()->addAttributeToSelect(
Expand All @@ -43,6 +46,7 @@ protected function _prepareData()

/**
* Before rendering html process
*
* Prepare items collection
*
* @return \Magento\Catalog\Block\Product\ProductList\Crosssell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ public function __construct(
}

/**
* Prepare data
*
* @return $this
*/
protected function _prepareData()
{
$product = $this->_coreRegistry->registry('product');
$product = $this->getProduct();
/* @var $product \Magento\Catalog\Model\Product */

$this->_itemCollection = $product->getRelatedProductCollection()->addAttributeToSelect(
Expand All @@ -103,6 +105,8 @@ protected function _prepareData()
}

/**
* Before to html handler
*
* @return $this
*/
protected function _beforeToHtml()
Expand All @@ -112,6 +116,8 @@ protected function _beforeToHtml()
}

/**
* Get collection items
*
* @return Collection
*/
public function getItems()
Expand Down
23 changes: 22 additions & 1 deletion app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ public function __construct(
}

/**
* Prepare data
*
* @return $this
*/
protected function _prepareData()
{
$product = $this->_coreRegistry->registry('product');
$product = $this->getProduct();
/* @var $product \Magento\Catalog\Model\Product */
$this->_itemCollection = $product->getUpSellProductCollection()->setPositionOrder()->addStoreFilter();
if ($this->moduleManager->isEnabled('Magento_Checkout')) {
Expand All @@ -121,6 +123,8 @@ protected function _prepareData()
}

/**
* Before to html handler
*
* @return $this
*/
protected function _beforeToHtml()
Expand All @@ -130,6 +134,8 @@ protected function _beforeToHtml()
}

/**
* Get items collection
*
* @return Collection
*/
public function getItemCollection()
Expand All @@ -145,6 +151,8 @@ public function getItemCollection()
}

/**
* Get collection items
*
* @return \Magento\Framework\DataObject[]
*/
public function getItems()
Expand All @@ -156,6 +164,8 @@ public function getItems()
}

/**
* Get row count
*
* @return float
*/
public function getRowCount()
Expand All @@ -164,6 +174,8 @@ public function getRowCount()
}

/**
* Set column count
*
* @param string $columns
* @return $this
*/
Expand All @@ -176,6 +188,8 @@ public function setColumnCount($columns)
}

/**
* Get column count
*
* @return int
*/
public function getColumnCount()
Expand All @@ -184,6 +198,8 @@ public function getColumnCount()
}

/**
* Reset items iterator
*
* @return void
*/
public function resetItemsIterator()
Expand All @@ -193,6 +209,8 @@ public function resetItemsIterator()
}

/**
* Get iterable item
*
* @return mixed
*/
public function getIterableItem()
Expand All @@ -204,6 +222,7 @@ public function getIterableItem()

/**
* Set how many items we need to show in upsell block
*
* Notice: this parameter will be also applied
*
* @param string $type
Expand All @@ -219,6 +238,8 @@ public function setItemLimit($type, $limit)
}

/**
* Get item limit
*
* @param string $type
* @return array|int
*/
Expand Down
14 changes: 13 additions & 1 deletion app/code/Magento/Catalog/Controller/Product/Compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Catalog\Controller\Product;

use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Data\Form\FormKey\Validator;
use Magento\Framework\View\Result\PageFactory;

Expand All @@ -15,7 +16,7 @@
* @SuppressWarnings(PHPMD.LongVariable)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
abstract class Compare extends \Magento\Framework\App\Action\Action
abstract class Compare extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface
{
/**
* Customer id
Expand Down Expand Up @@ -139,4 +140,15 @@ public function setCustomerId($customerId)
$this->_customerId = $customerId;
return $this;
}

/**
* @inheritdoc
*/
public function execute()
{
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('catalog/product_compare');

return $resultRedirect;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,28 @@
<conditionalClick selector="{{AdminProductGridTableHeaderSection.id('descend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('ascend')}}" visible="false" stepKey="sortById"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>

<!--Disabled a product by filtering grid and using change status action-->
<actionGroup name="ChangeStatusProductUsingProductGridActionGroup">
<arguments>
<argument name="product"/>
<argument name="status" defaultValue="Enable" type="string" />
</arguments>
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
<waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
<see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/>
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/>
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/>

<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
<click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/>
<click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled" parameterized="true"/>
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
<element name="productGridNameProduct" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
<element name="productGridContentsOnRow" type="checkbox" selector="//*[@id='container']//tr[{{row}}]/td" parameterized="true"/>
<element name="selectRowBasedOnName" type="input" selector="//td/div[text()='{{var1}}']" parameterized="true"/>
<element name="changeStatus" type="button" selector="//div[contains(@class,'admin__data-grid-header-row') and contains(@class, 'row')]//div[contains(@class, 'action-menu-item')]//ul/li/span[text() = '{{status}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

<!--Step5. Open *Advanced Inventory* pop-up. Set *Enable Qty Increments* to *Yes*. Fill *.5* in *Qty Increments*-->
<click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink2"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<scrollTo selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="scrollToEnableQtyIncrements"/>
<click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsUseConfigSettings}}" stepKey="clickOnEnableQtyIncrementsUseConfigSettingsCheckbox"/>
<click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="clickOnEnableQtyIncrements"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Type as ProductType;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute as EavAttribute;
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory as EavAttributeFactory;
use Magento\Catalog\Ui\DataProvider\CatalogEavValidationRules;
Expand Down Expand Up @@ -419,7 +420,7 @@ public function modifyData(array $data)

foreach ($attributes as $attribute) {
if (null !== ($attributeValue = $this->setupAttributeData($attribute))) {
if ($attribute->getFrontendInput() === 'price' && is_scalar($attributeValue)) {
if ($this->isPriceAttribute($attribute, $attributeValue)) {
$attributeValue = $this->formatPrice($attributeValue);
}
$data[$productId][self::DATA_SOURCE_DEFAULT][$attribute->getAttributeCode()] = $attributeValue;
Expand All @@ -430,6 +431,32 @@ public function modifyData(array $data)
return $data;
}

/**
* Obtain if given attribute is a price
*
* @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
* @param string|integer $attributeValue
* @return bool
*/
private function isPriceAttribute(ProductAttributeInterface $attribute, $attributeValue)
{
return $attribute->getFrontendInput() === 'price'
&& is_scalar($attributeValue)
&& !$this->isBundleSpecialPrice($attribute);
}

/**
* Obtain if current product is bundle and given attribute is special_price
*
* @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute
* @return bool
*/
private function isBundleSpecialPrice(ProductAttributeInterface $attribute)
{
return $this->locator->getProduct()->getTypeId() === ProductType::TYPE_BUNDLE
&& $attribute->getAttributeCode() === ProductAttributeInterface::CODE_SPECIAL_PRICE;
}

/**
* Resolve data persistence
*
Expand Down
Loading

0 comments on commit 62efbf6

Please sign in to comment.