Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $productCollection = $this->getProductsByItemNo($itemNo);
- if ($productCollection->getTotalCount() > 0) {
- foreach ($productCollection->getItems() as $product) {
- /** @var ProductInterface $product */
- if ($priceType == 1) {
- //set content update for this date
- if (!empty($priceAttributes['StartingDate'])) {
- $startDt = Datetime::createFromFormat('Y-m-d', $priceAttributes['StartingDate']);
- $nowDt = new Datetime();
- if ($startDt stagingUpdateFactory->create();
- if ($startDt > $nowDt) {
- $stagingUpdate->setStartTime($startDt->format('Y-m-d H:i:s'));
- }
- if (!empty($priceAttributes['EndingDate'])) {
- $endDt = Datetime::createFromFormat('Y-m-d', $priceAttributes['EndingDate']);
- $stagingUpdate->setEndTime($endDt->format('Y-m-d H:i:s'));
- }
- $stagingUpdate = $this->stagingUpdateRepository->save($stagingUpdate);
- $this->versionManager->setCurrentVersionId($stagingUpdate->getId());
- $product->setSpecialPrice($priceAttributes['UnitPrice']);
- $this->productStaging->schedule($product, $stagingUpdate->getId());
- }
- }
- }
- }
- ->unsetData('media_gallery');
Add Comment
Please, Sign In to add comment