Skip to content

Commit 141933b

Browse files
author
Yaroslav Onischenko
committed
Merge remote-tracking branch 'mainline/develop' into develop
2 parents 3d6e1cc + 46dc2c0 commit 141933b

File tree

169 files changed

+8492
-4116
lines changed

Some content is hidden

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

169 files changed

+8492
-4116
lines changed

app/code/Magento/Backend/i18n/de_DE.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Backend/i18n/es_ES.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Backend/i18n/fr_FR.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Backend/i18n/nl_NL.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Backend/i18n/pt_BR.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Backend/i18n/zh_Hans_CN.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,11 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
Marketing,Marketing
610+
Communications,Communications
611+
"SEO & Search","SEO & Search"
612+
"User Content","User Content"
613+
"Data Transfer","Data Transfer"
614+
"Import History","Import History"
615+
Extensions,Extensions
616+
"Web Setup Wizard","Web Setup Wizard"

app/code/Magento/Braintree/view/frontend/templates/creditcard/edit.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
/** @var $block \Magento\Braintree\Block\Creditcard\Management */
1010

1111
echo $block->getLayout()->getMessagesBlock()->getGroupedHtml();
12-
$defaultExpMonth = $block->getTodayMonth();
13-
$defaultExpYear = $block->getTodayYear();
12+
$defaultExpMonth = '';
13+
$defaultExpYear = '';
1414
$countrySpecificCardTypeConfig = $block->getCountrySpecificCardTypeConfig();
1515
$applicableCardTypeConfig = $block->getCcApplicableTypes();
1616
if ($block->isEditMode()) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Api\Data;
8+
9+
/**
10+
* @api
11+
*/
12+
interface ProductWebsiteLinkInterface
13+
{
14+
/**
15+
* @return string
16+
*/
17+
public function getSku();
18+
19+
/**
20+
* @param string $sku
21+
* @return $this
22+
*/
23+
public function setSku($sku);
24+
25+
/**
26+
* Get website ids
27+
*
28+
* @return int
29+
*/
30+
public function getWebsiteId();
31+
32+
/**
33+
* Set website id
34+
*
35+
* @param int $websiteId
36+
* @return $this
37+
*/
38+
public function setWebsiteId($websiteId);
39+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Api;
8+
9+
interface ProductWebsiteLinkRepositoryInterface
10+
{
11+
/**
12+
* Assign a product to the website
13+
*
14+
* @param \Magento\Catalog\Api\Data\ProductWebsiteLinkInterface $productWebsiteLink
15+
* @return bool will returned True if website successfully assigned to product
16+
*
17+
* @throws \Magento\Framework\Exception\CouldNotSaveException
18+
* @throws \Magento\Framework\Exception\InputException
19+
*/
20+
public function save(Data\ProductWebsiteLinkInterface $productWebsiteLink);
21+
22+
/**
23+
* Remove the website assignment from the product
24+
*
25+
* @param \Magento\Catalog\Api\Data\ProductWebsiteLinkInterface $productWebsiteLink
26+
* @return bool will returned True if website successfully unassigned from product
27+
*
28+
* @throws \Magento\Framework\Exception\CouldNotSaveException
29+
*/
30+
public function delete(Data\ProductWebsiteLinkInterface $productWebsiteLink);
31+
32+
/**
33+
* Remove the website assignment from the product by product sku
34+
*
35+
* @param string $sku
36+
* @param int $websiteId
37+
* @return bool will returned True if website successfully unassigned from product
38+
*
39+
* @throws \Magento\Framework\Exception\CouldNotSaveException
40+
*/
41+
public function deleteById($sku, $websiteId);
42+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Model;
8+
9+
class ProductWebsiteLink extends \Magento\Framework\Api\AbstractSimpleObject implements
10+
\Magento\Catalog\Api\Data\ProductWebsiteLinkInterface
11+
{
12+
/**#@+
13+
* Field names
14+
*/
15+
const KEY_SKU = 'sku';
16+
const WEBSITE_ID = 'website_id';
17+
/**#@-*/
18+
19+
/**
20+
* {@inheritdoc}
21+
*/
22+
public function getSku()
23+
{
24+
return $this->_get(self::KEY_SKU);
25+
}
26+
27+
/**
28+
* {@inheritdoc}
29+
*/
30+
public function getWebsiteId()
31+
{
32+
return $this->_get(self::WEBSITE_ID);
33+
}
34+
35+
/**
36+
* @param string $sku
37+
* @return $this
38+
*/
39+
public function setSku($sku)
40+
{
41+
return $this->setData(self::KEY_SKU, $sku);
42+
}
43+
44+
/**
45+
* {@inheritdoc}
46+
*/
47+
public function setWebsiteId($websiteId)
48+
{
49+
return $this->setData(self::WEBSITE_ID, $websiteId);
50+
}
51+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Model;
8+
9+
use Magento\Framework\Exception\InputException;
10+
use Magento\Framework\Exception\CouldNotSaveException;
11+
use Magento\Catalog\Api\Data\ProductWebsiteLinkInterface;
12+
13+
class ProductWebsiteLinkRepository implements \Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface
14+
{
15+
/**
16+
* @var \Magento\Catalog\Api\ProductRepositoryInterface
17+
*/
18+
protected $productRepository;
19+
20+
/**
21+
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
22+
*/
23+
public function __construct(
24+
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository
25+
) {
26+
$this->productRepository = $productRepository;
27+
}
28+
29+
/**
30+
* {@inheritdoc}
31+
*/
32+
public function save(ProductWebsiteLinkInterface $productWebsiteLink)
33+
{
34+
if (!$productWebsiteLink->getWebsiteId()) {
35+
throw new InputException(__('There are not websites for assign to product'));
36+
}
37+
$product = $this->productRepository->get($productWebsiteLink->getSku());
38+
$product->setWebsiteIds(array_merge($product->getWebsiteIds(), [$productWebsiteLink->getWebsiteId()]));
39+
try {
40+
$product->save();
41+
} catch (\Exception $e) {
42+
throw new CouldNotSaveException(
43+
__(
44+
'Could not assign product "%1" to websites "%2"',
45+
$product->getId(),
46+
$productWebsiteLink->getWebsiteId()
47+
),
48+
$e
49+
);
50+
}
51+
return true;
52+
}
53+
54+
/**
55+
* {@inheritdoc}
56+
*/
57+
public function delete(ProductWebsiteLinkInterface $productLink)
58+
{
59+
return $this->deleteById($productLink->getSku(), $productLink->getSku());
60+
}
61+
62+
/**
63+
* {@inheritdoc}
64+
*/
65+
public function deleteById($sku, $websiteId)
66+
{
67+
$product = $this->productRepository->get($sku);
68+
$product->setWebsiteIds(array_diff($product->getWebsiteIds(), [$websiteId]));
69+
70+
try {
71+
$product->save();
72+
} catch (\Exception $e) {
73+
throw new CouldNotSaveException(
74+
__(
75+
'Could not save product "%1" with websites %2',
76+
$product->getId(),
77+
implode(', ', $product->getWebsiteIds())
78+
),
79+
$e
80+
);
81+
}
82+
return true;
83+
}
84+
}

app/code/Magento/Catalog/etc/di.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@
459459
<preference for="Magento\Catalog\Api\ProductLinkManagementInterface" type="Magento\Catalog\Model\ProductLink\Management" />
460460
<preference for="Magento\Catalog\Api\Data\ProductLinkInterface" type="Magento\Catalog\Model\ProductLink\Link" />
461461
<preference for="\Magento\Catalog\Api\CategoryLinkManagementInterface" type="\Magento\Catalog\Model\CategoryLinkManagement" />
462+
<preference for="Magento\Catalog\Api\Data\ProductWebsiteLinkInterface" type="Magento\Catalog\Model\ProductWebsiteLink" />
463+
<preference for="Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface" type="Magento\Catalog\Model\ProductWebsiteLinkRepository" />
462464
<preference for="\Magento\Catalog\Api\CategoryLinkRepositoryInterface" type="\Magento\Catalog\Model\CategoryLinkRepository" />
463465
<preference for="Magento\Catalog\Api\Data\ProductCustomOptionInterface" type="Magento\Catalog\Model\Product\Option" />
464466
<preference for="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" type="\Magento\Catalog\Model\Product\Option\Repository" />

app/code/Magento/Catalog/etc/webapi.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,4 +385,24 @@
385385
<resource ref="Magento_Catalog::categories" />
386386
</resources>
387387
</route>
388+
389+
<!-- Product Website Links -->
390+
<route url="/V1/products/:sku/websites" method="POST">
391+
<service class="Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface" method="save" />
392+
<resources>
393+
<resource ref="Magento_Catalog::products" />
394+
</resources>
395+
</route>
396+
<route url="/V1/products/:sku/websites" method="PUT">
397+
<service class="Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface" method="save" />
398+
<resources>
399+
<resource ref="Magento_Catalog::products" />
400+
</resources>
401+
</route>
402+
<route url="/V1/products/:sku/websites/:websiteId" method="DELETE">
403+
<service class="Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface" method="deleteById" />
404+
<resources>
405+
<resource ref="Magento_Catalog::products" />
406+
</resources>
407+
</route>
388408
</routes>

app/code/Magento/Catalog/i18n/de_DE.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ Empty,Leer
161161
"Add New Attribute Set","Neuer Eigenschaftensatz hinzufügen"
162162
"Add New Set","Neuen Satz hinzufügen"
163163
"Attribute Sets","Attribute Sets"
164+
"Product Templates","Product Templates"
165+
"Product Template","Product Template"
164166
"Close Window","Fenster Schließen"
165167
"New Product","Neues Produkt"
166168
"Save & Edit","Save & Edit"
@@ -281,6 +283,7 @@ Categories,Kategorien
281283
"You saved the attribute set.","You saved the attribute set."
282284
"An error occurred while saving the attribute set.","Beim Speichern des Eigenschaftensatzes ist ein Fehler aufgetreten."
283285
"New Attribute Set","New Attribute Set"
286+
"New Product Template","New Product Template"
284287
"The attribute set has been removed.","The attribute set has been removed."
285288
"An error occurred while deleting this set.","An error occurred while deleting this set."
286289
"Search Terms","Search Terms"

app/code/Magento/Catalog/i18n/en_US.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ Empty,Empty
161161
"Add New Attribute Set","Add New Attribute Set"
162162
"Add New Set","Add New Set"
163163
"Attribute Sets","Attribute Sets"
164+
"Product Templates","Product Templates"
165+
"Product Template","Product Template"
164166
"Close Window","Close Window"
165167
"New Product","New Product"
166168
"Save & Edit","Save & Edit"
@@ -281,6 +283,7 @@ Categories,Categories
281283
"You saved the attribute set.","You saved the attribute set."
282284
"An error occurred while saving the attribute set.","An error occurred while saving the attribute set."
283285
"New Attribute Set","New Attribute Set"
286+
"New Product Template","New Product Template"
284287
"The attribute set has been removed.","The attribute set has been removed."
285288
"An error occurred while deleting this set.","An error occurred while deleting this set."
286289
"Search Terms","Search Terms"

app/code/Magento/Catalog/i18n/es_ES.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ Empty,Vacío(a)
161161
"Add New Attribute Set","Agregar nuevo conjunto de atributos"
162162
"Add New Set","Agregar nuevo conjunto"
163163
"Attribute Sets","Attribute Sets"
164+
"Product Templates","Product Templates"
165+
"Product Template","Product Template"
164166
"Close Window","Cerrar Ventana"
165167
"New Product","Nuevo producto"
166168
"Save & Edit","Save & Edit"
@@ -281,6 +283,7 @@ Categories,Categorías
281283
"You saved the attribute set.","You saved the attribute set."
282284
"An error occurred while saving the attribute set.","Se produjo un error mientras se guardaba el conjunto de atributos."
283285
"New Attribute Set","New Attribute Set"
286+
"New Product Template","New Product Template"
284287
"The attribute set has been removed.","The attribute set has been removed."
285288
"An error occurred while deleting this set.","An error occurred while deleting this set."
286289
"Search Terms","Search Terms"

0 commit comments

Comments
 (0)