Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Merge branch '2.3-develop' into ENGCOM-3278-magento-engcom-import-exp…
Browse files Browse the repository at this point in the history
…ort-improvements-130
  • Loading branch information
nmalevanec committed Feb 13, 2019
2 parents b0fb044 + f211371 commit 34a2d24
Show file tree
Hide file tree
Showing 115 changed files with 2,641 additions and 249 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
*/
namespace Magento\Backend\Controller\Adminhtml\System\Design;

class Save extends \Magento\Backend\Controller\Adminhtml\System\Design
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* Save design action.
*/
class Save extends \Magento\Backend\Controller\Adminhtml\System\Design implements HttpPostActionInterface
{
/**
* Filtering posted data. Converting localized data if needed
Expand All @@ -26,6 +31,8 @@ protected function _filterPostData($data)
}

/**
* Save design action.
*
* @return \Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
Expand Down Expand Up @@ -54,10 +61,10 @@ public function execute()
} catch (\Exception $e) {
$this->messageManager->addErrorMessage($e->getMessage());
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setDesignData($data);
return $resultRedirect->setPath('adminhtml/*/', ['id' => $design->getId()]);
return $resultRedirect->setPath('*/*/edit', ['id' => $design->getId()]);
}
}

return $resultRedirect->setPath('adminhtml/*/');
return $resultRedirect->setPath('*/*/');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,38 @@ public function build(Filter $filter): string
$conditionValue = $this->mapConditionValue($conditionType, $filter->getValue());

// NOTE: store scope was ignored intentionally to perform search across all stores
$attributeSelect = $this->resourceConnection->getConnection()
->select()
->from(
[$tableAlias => $attribute->getBackendTable()],
$tableAlias . '.' . $attribute->getEntityIdField()
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.' . $attribute->getIdFieldName(),
['eq' => $attribute->getAttributeId()]
)
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.value',
[$conditionType => $conditionValue]
)
);
if ($conditionType == 'is_null') {
$entityResourceModel = $attribute->getEntity();
$attributeSelect = $this->resourceConnection->getConnection()
->select()
->from(
[Collection::MAIN_TABLE_ALIAS => $entityResourceModel->getEntityTable()],
Collection::MAIN_TABLE_ALIAS . '.' . $entityResourceModel->getEntityIdField()
)->joinLeft(
[$tableAlias => $attribute->getBackendTable()],
$tableAlias . '.' . $attribute->getEntityIdField() . '=' . Collection::MAIN_TABLE_ALIAS .
'.' . $entityResourceModel->getEntityIdField() . ' AND ' . $tableAlias . '.' .
$attribute->getIdFieldName() . '=' . $attribute->getAttributeId(),
''
)->where($tableAlias . '.value is null');
} else {
$attributeSelect = $this->resourceConnection->getConnection()
->select()
->from(
[$tableAlias => $attribute->getBackendTable()],
$tableAlias . '.' . $attribute->getEntityIdField()
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.' . $attribute->getIdFieldName(),
['eq' => $attribute->getAttributeId()]
)
)->where(
$this->resourceConnection->getConnection()->prepareSqlCondition(
$tableAlias . '.value',
[$conditionType => $conditionValue]
)
);
}

return $this->resourceConnection
->getConnection()
Expand All @@ -86,6 +102,8 @@ public function build(Filter $filter): string
}

/**
* Get attribute entity by its code
*
* @param string $field
* @return Attribute
* @throws \Magento\Framework\Exception\LocalizedException
Expand Down
29 changes: 15 additions & 14 deletions app/code/Magento/Catalog/Model/Product/Attribute/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,28 @@ private function customizeAttributeCode($meta)
*/
private function customizeFrontendLabels($meta)
{
$labelConfigs = [];

foreach ($this->storeRepository->getList() as $store) {
$storeId = $store->getId();

if (!$storeId) {
continue;
}

$meta['manage-titles']['children'] = [
'frontend_label[' . $storeId . ']' => $this->arrayManager->set(
'arguments/data/config',
[],
[
'formElement' => Input::NAME,
'componentType' => Field::NAME,
'label' => $store->getName(),
'dataType' => Text::NAME,
'dataScope' => 'frontend_label[' . $storeId . ']'
]
),
];
$labelConfigs['frontend_label[' . $storeId . ']'] = $this->arrayManager->set(
'arguments/data/config',
[],
[
'formElement' => Input::NAME,
'componentType' => Field::NAME,
'label' => $store->getName(),
'dataType' => Text::NAME,
'dataScope' => 'frontend_label[' . $storeId . ']'
]
);
}
$meta['manage-titles']['children'] = $labelConfigs;

return $meta;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ public function afterSave()
) {
$this->_indexerEavProcessor->markIndexerAsInvalid();
}

$this->_source = null;

return parent::afterSave();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,41 @@
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3" />
<waitForPageLoad stepKey="waitForPageLoad3" />
</actionGroup>

<actionGroup name="AdminCreateAttributeFromProductPage">
<arguments>
<argument name="attributeName" type="string"/>
<argument name="attributeType" type="string" defaultValue="TextField"/>
</arguments>
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/>
<see userInput="Select Attribute" stepKey="checkNewAttributePopUpAppeared"/>
<click selector="{{AdminProductFormAttributeSection.createNewAttribute}}" stepKey="clickCreateNewAttribute"/>
<fillField selector="{{AdminProductFormNewAttributeSection.attributeLabel}}" userInput="{{attributeName}}" stepKey="fillAttributeLabel"/>
<selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/>
<click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute"/>
</actionGroup>

<actionGroup name="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPage" extends="AdminCreateAttributeFromProductPage">
<remove keyForRemoval="saveAttribute"/>
<arguments>
<argument name="firstStoreViewName" type="string"/>
<argument name="secondStoreViewName" type="string"/>
</arguments>
<click selector="{{AdminProductFormNewAttributeSection.addValue}}" stepKey="addValue" after="selectAttributeType"/>
<seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeFirstStoreView"/>
<seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeSecondStoreView"/>
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('1'))}}" userInput="default" stepKey="fillDefaultStoreView"/>
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('2'))}}" userInput="admin" stepKey="fillAdminStoreView"/>
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('3'))}}" userInput="view1" stepKey="fillFirstStoreView"/>
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('4'))}}" userInput="view2" stepKey="fillSecondStoreView"/>

<!--Check store view in Manage Titles section-->
<click selector="{{AdminProductFormNewAttributeSection.manageTitlesHeader}}" stepKey="openManageTitlesSection"/>
<seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreEN.name)}}" stepKey="seeFirstStoreViewName"/>
<seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreFR.name)}}" stepKey="seeSecondStoreViewName"/>
<click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute1"/>
</actionGroup>

<actionGroup name="changeUseForPromoRuleConditionsProductAttribute">
<arguments>
<argument name="option" type="string"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">

<actionGroup name="CompareTwoProductsOrder">
<arguments>
<argument name="product_1"/>
<argument name="product_2"/>
</arguments>
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
<waitForPageLoad stepKey="waitForPageLoad5"/>
<grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByNumber('1')}}" userInput="alt" stepKey="grabFirstProductName1_1"/>
<assertEquals expected="{{product_1.name}}" actual="($grabFirstProductName1_1)" message="notExpectedOrder" stepKey="compare1"/>
<grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByNumber('2')}}" userInput="alt" stepKey="grabFirstProductName2_2"/>
<assertEquals expected="{{product_2.name}}" actual="($grabFirstProductName2_2)" message="notExpectedOrder" stepKey="compare2"/>
</actionGroup>
</actionGroups>
21 changes: 21 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,27 @@
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
<entity name="productYesNoAttribute" type="ProductAttribute">
<data key="attribute_code" unique="suffix">attribute</data>
<data key="frontend_input">boolean</data>
<data key="scope">global</data>
<data key="is_required">false</data>
<data key="is_unique">false</data>
<data key="is_searchable">true</data>
<data key="is_visible">true</data>
<data key="is_visible_in_advanced_search">true</data>
<data key="is_visible_on_front">true</data>
<data key="is_filterable">true</data>
<data key="is_filterable_in_search">true</data>
<data key="used_in_product_listing">true</data>
<data key="is_used_for_promo_rules">true</data>
<data key="is_comparable">true</data>
<data key="is_used_in_grid">true</data>
<data key="is_visible_in_grid">true</data>
<data key="is_filterable_in_grid">true</data>
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
<entity name="productAttributeText" type="ProductAttribute">
<data key="attribute_code" unique="suffix">attribute</data>
<data key="frontend_input">text</data>
Expand Down
9 changes: 9 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
</entity>
<entity name="ApiSimpleProductWithPrice50" type="product2" extends="ApiSimpleOne">
<data key="price">50</data>
</entity>
<entity name="ApiSimpleProductWithPrice60" type="product2" extends="ApiSimpleTwo">
<data key="price">60</data>
</entity>
<entity name="ApiSimpleProductWithPrice70" type="product2" extends="SimpleOne">
<data key="price">70</data>
</entity>
<entity name="ApiSimpleTwoHidden" type="product2">
<data key="sku" unique="suffix">api-simple-product-two</data>
<data key="type_id">simple</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<element name="productTierPricePercentageValuePriceInput" type="input" selector="[name='product[tier_price][{{var1}}][percentage_value]']" parameterized="true"/>
<element name="specialPrice" type="input" selector="input[name='product[special_price]']"/>
<element name="doneButton" type="button" selector=".product_form_product_form_advanced_pricing_modal button.action-primary" timeout="5"/>
<element name="msrp" type="input" selector="//input[@name='product[msrp]']" timeout="30"/>
<element name="save" type="button" selector="#save-button"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminProductFormAttributeSection">
<element name="createNewAttribute" type="button" selector="//button[@data-index='add_new_attribute_button']" timeout="30"/>
</section>
<section name="AdminProductFormNewAttributeSection">
<element name="attributeLabel" type="button" selector="//input[@name='frontend_label[0]']" timeout="30"/>
<element name="attributeType" type="select" selector="//select[@name='frontend_input']" timeout="30"/>
<element name="addValue" type="button" selector="//button[@data-action='add_new_row']" timeout="30"/>
<element name="optionViewName" type="text" selector="//table[@data-index='attribute_options_select']//span[contains(text(), '{{arg}}')]" parameterized="true" timeout="30"/>
<element name="optionValue" type="input" selector="(//input[contains(@name, 'option[value]')])[{{arg}}]" timeout="30" parameterized="true"/>
<element name="manageTitlesHeader" type="button" selector="//div[@class='fieldset-wrapper-title']//span[contains(text(), 'Manage Titles')]" timeout="30/"/>
<element name="manageTitlesViewName" type="text" selector="//div[@data-index='manage-titles']//span[contains(text(), '{{arg}}')]" timeout="30" parameterized="true"/>
<element name="saveAttribute" type="button" selector="button#save" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,9 @@
<element name="doneButton" type="button" selector=".product_form_product_form_advanced_pricing_modal button.action-primary"/>
<element name="useDefaultPrice" type="checkbox" selector="//input[@name='product[special_price]']/parent::div/following-sibling::div/input[@name='use_default[special_price]']"/>
</section>
<section name="AdminProductAttributeSection">
<element name="attributeSectionHeader" type="button" selector="//div[@data-index='attributes']" timeout="30"/>
<element name="dropDownAttribute" type="select" selector="//select[@name='product[{{arg}}]']" parameterized="true" timeout="30"/>
<element name="attributeSection" type="div" selector="//div[@data-index='attributes']/div[contains(@class, 'admin__collapsible-content _show')]" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<element name="ProductInfoByNumber" type="text" selector="//main//li[{{var1}}]//div[@class='product-item-info']" parameterized="true"/>
<element name="ProductAddToCompareByNumber" type="text" selector="//main//li[{{var1}}]//a[contains(@class, 'tocompare')]" parameterized="true"/>
<element name="listedProduct" type="block" selector="ol li:nth-child({{productPositionInList}}) img" parameterized="true"/>
<element name="ProductImageByNumber" type="button" selector="//main//li[{{var1}}]//img" parameterized="true"/>
<element name="categoryListView" type="button" selector="a[title='List']" timeout="30"/>

<element name="ProductTitleByName" type="button" selector="//main//li//a[contains(text(), '{{var1}}')]" parameterized="true"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<element name="productOptionSelect" type="select" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//select" parameterized="true"/>
<element name="asLowAs" type="input" selector="span[class='price-wrapper '] "/>
<element name="specialPriceValue" type="text" selector="//span[@class='special-price']//span[@class='price']"/>
<element name="mapPrice" type="text" selector="//div[@class='price-box price-final_price']//span[contains(@class, 'price-msrp_price')]"/>
<element name="clickForPriceLink" type="text" selector="//div[@class='price-box price-final_price']//a[contains(text(), 'Click for price')]"/>

<!-- The parameter is the nth custom option that you want to get -->
<element name="nthCustomOption" type="block" selector="//*[@id='product-options-wrapper']/*[@class='fieldset']/*[contains(@class, 'field')][{{customOptionNum}}]" parameterized="true" />
Expand Down
Loading

0 comments on commit 34a2d24

Please sign in to comment.