Guest User

Untitled

a guest
Oct 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. $productCollection = $this->getProductsByItemNo($itemNo);
  2.  
  3. if ($productCollection->getTotalCount() > 0) {
  4. foreach ($productCollection->getItems() as $product) {
  5. /** @var ProductInterface $product */
  6. if ($priceType == 1) {
  7. //set content update for this date
  8. if (!empty($priceAttributes['StartingDate'])) {
  9. $startDt = Datetime::createFromFormat('Y-m-d', $priceAttributes['StartingDate']);
  10. $nowDt = new Datetime();
  11.  
  12. if ($startDt stagingUpdateFactory->create();
  13.  
  14. if ($startDt > $nowDt) {
  15. $stagingUpdate->setStartTime($startDt->format('Y-m-d H:i:s'));
  16. }
  17.  
  18. if (!empty($priceAttributes['EndingDate'])) {
  19. $endDt = Datetime::createFromFormat('Y-m-d', $priceAttributes['EndingDate']);
  20. $stagingUpdate->setEndTime($endDt->format('Y-m-d H:i:s'));
  21. }
  22.  
  23. $stagingUpdate = $this->stagingUpdateRepository->save($stagingUpdate);
  24. $this->versionManager->setCurrentVersionId($stagingUpdate->getId());
  25. $product->setSpecialPrice($priceAttributes['UnitPrice']);
  26. $this->productStaging->schedule($product, $stagingUpdate->getId());
  27. }
  28. }
  29. }
  30. }
  31.  
  32. ->unsetData('media_gallery');
Add Comment
Please, Sign In to add comment