@@ -181,6 +181,7 @@ class Wishlist extends AbstractModel implements IdentityInterface
181
181
* @param Json|null $serializer
182
182
* @param StockRegistryInterface|null $stockRegistry
183
183
* @param ScopeConfigInterface|null $scopeConfig
184
+ *
184
185
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
185
186
*/
186
187
public function __construct (
@@ -226,6 +227,7 @@ public function __construct(
226
227
*
227
228
* @param int $customerId
228
229
* @param bool $create Create wishlist if don't exists
230
+ *
229
231
* @return $this
230
232
*/
231
233
public function loadByCustomerId ($ customerId , $ create = false )
@@ -274,6 +276,7 @@ public function generateSharingCode()
274
276
* Load by sharing code
275
277
*
276
278
* @param string $code
279
+ *
277
280
* @return $this
278
281
*/
279
282
public function loadByCode ($ code )
@@ -370,6 +373,7 @@ protected function _addCatalogProduct(Product $product, $qty = 1, $forciblySetQt
370
373
* Retrieve wishlist item collection
371
374
*
372
375
* @return \Magento\Wishlist\Model\ResourceModel\Item\Collection
376
+ *
373
377
* @throws NoSuchEntityException
374
378
*/
375
379
public function getItemCollection ()
@@ -389,6 +393,7 @@ public function getItemCollection()
389
393
* Retrieve wishlist item collection
390
394
*
391
395
* @param int $itemId
396
+ *
392
397
* @return false|Item
393
398
*/
394
399
public function getItem ($ itemId )
@@ -403,7 +408,9 @@ public function getItem($itemId)
403
408
* Adding item to wishlist
404
409
*
405
410
* @param Item $item
411
+ *
406
412
* @return $this
413
+ *
407
414
* @throws Exception
408
415
*/
409
416
public function addItem (Item $ item )
@@ -424,9 +431,12 @@ public function addItem(Item $item)
424
431
* @param int|Product $product
425
432
* @param DataObject|array|string|null $buyRequest
426
433
* @param bool $forciblySetQty
434
+ *
427
435
* @return Item|string
436
+ *
428
437
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
429
438
* @SuppressWarnings(PHPMD.NPathComplexity)
439
+ *
430
440
* @throws LocalizedException
431
441
* @throws InvalidArgumentException
432
442
*/
@@ -529,7 +539,9 @@ public function addNewItem($product, $buyRequest = null, $forciblySetQty = false
529
539
* Set customer id
530
540
*
531
541
* @param int $customerId
542
+ *
532
543
* @return $this
544
+ *
533
545
* @throws LocalizedException
534
546
*/
535
547
public function setCustomerId ($ customerId )
@@ -541,6 +553,7 @@ public function setCustomerId($customerId)
541
553
* Retrieve customer id
542
554
*
543
555
* @return int
556
+ *
544
557
* @throws LocalizedException
545
558
*/
546
559
public function getCustomerId ()
@@ -552,6 +565,7 @@ public function getCustomerId()
552
565
* Retrieve data for save
553
566
*
554
567
* @return array
568
+ *
555
569
* @throws LocalizedException
556
570
*/
557
571
public function getDataForSave ()
@@ -567,6 +581,7 @@ public function getDataForSave()
567
581
* Retrieve shared store ids for current website or all stores if $current is false
568
582
*
569
583
* @return array
584
+ *
570
585
* @throws NoSuchEntityException
571
586
*/
572
587
public function getSharedStoreIds ()
@@ -590,6 +605,7 @@ public function getSharedStoreIds()
590
605
* Set shared store ids
591
606
*
592
607
* @param array $storeIds
608
+ *
593
609
* @return $this
594
610
*/
595
611
public function setSharedStoreIds ($ storeIds )
@@ -602,6 +618,7 @@ public function setSharedStoreIds($storeIds)
602
618
* Retrieve wishlist store object
603
619
*
604
620
* @return \Magento\Store\Model\Store
621
+ *
605
622
* @throws NoSuchEntityException
606
623
*/
607
624
public function getStore ()
@@ -616,6 +633,7 @@ public function getStore()
616
633
* Set wishlist store
617
634
*
618
635
* @param Store $store
636
+ *
619
637
* @return $this
620
638
*/
621
639
public function setStore ($ store )
@@ -653,6 +671,7 @@ public function isSalable()
653
671
* Retrieve if product has stock or config is set for showing out of stock products
654
672
*
655
673
* @param int $productId
674
+ *
656
675
* @return bool
657
676
*/
658
677
private function isInStock ($ productId )
@@ -671,7 +690,9 @@ private function isInStock($productId)
671
690
* Check customer is owner this wishlist
672
691
*
673
692
* @param int $customerId
693
+ *
674
694
* @return bool
695
+ *
675
696
* @throws LocalizedException
676
697
*/
677
698
public function isOwner ($ customerId )
@@ -696,10 +717,13 @@ public function isOwner($customerId)
696
717
* @param int|Item $itemId
697
718
* @param DataObject $buyRequest
698
719
* @param null|array|DataObject $params
720
+ *
699
721
* @return $this
722
+ *
700
723
* @throws LocalizedException
701
724
*
702
725
* @see \Magento\Catalog\Helper\Product::addParamsToBuyRequest()
726
+ *
703
727
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
704
728
* @SuppressWarnings(PHPMD.NPathComplexity)
705
729
*/
@@ -748,10 +772,11 @@ public function updateItem($itemId, $buyRequest, $params = null)
748
772
throw new LocalizedException (__ ($ resultItem ));
749
773
}
750
774
775
+ if ($ resultItem ->getDescription () != $ item ->getDescription ()) {
776
+ $ resultItem ->setDescription ($ item ->getDescription ())->save ();
777
+ }
778
+
751
779
if ($ resultItem ->getId () != $ itemId ) {
752
- if ($ resultItem ->getDescription () != $ item ->getDescription ()) {
753
- $ resultItem ->setDescription ($ item ->getDescription ())->save ();
754
- }
755
780
$ item ->isDeleted (true );
756
781
$ this ->setDataChanges (true );
757
782
} else {
0 commit comments