Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/app/code/Amasty/MWishlist/Controller/Unsubscribe/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/app/code/Amasty/MWishlist/Controller/Unsubscribe/PriceAlerts.php
<?php

declare(strict_types=1);

/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Multiple Wishlist for Magento 2
 */

namespace Amasty\MWishlist\Controller\Unsubscribe;

use Amasty\MWishlist\Model\ResourceModel\UnsubscribePriceAlerts;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Controller\Result\Redirect;
use Magento\ProductAlert\Controller\Unsubscribe as UnsubscribeController;
use Magento\Framework\Controller\ResultFactory;

class PriceAlerts extends UnsubscribeController
{
    /**
     * @var UnsubscribePriceAlerts
     */
    private $unsubscribePriceAlerts;

    public function __construct(
        Context $context,
        CustomerSession $customerSession,
        UnsubscribePriceAlerts $unsubscribePriceAlerts
    ) {
        parent::__construct($context, $customerSession);
        $this->unsubscribePriceAlerts = $unsubscribePriceAlerts;
    }

    /**
     * @return Redirect
     */
    public function execute(): Redirect
    {
        try {
            $this->unsubscribePriceAlerts->unsubscribeUser((int)$this->customerSession->getCustomerId());
            $this->messageManager->addSuccessMessage(__('You will no longer receive wishlist price alerts.'));
        } catch (\Exception $e) {
            $this->messageManager->addExceptionMessage(
                $e,
                __('Unable to update the wishlist price alert subscription.')
            );
        }

        /** @var Redirect $resultRedirect */
        $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

        return $resultRedirect->setPath('customer/account/');
    }
}

Spamworldpro Mini