<?php

class PaxyprestaPaxyupdatecartModuleFrontController extends ModuleFrontController
{
    public function __construct()
    {
        parent::__construct();
    }

    public function initContent(){
        $this->ajax = true;

        if (Tools::isSubmit('pickup_point_id')) {
            $pickupPointId = (string)Tools::getValue('pickup_point_id');
            $this->module->updateCartData($pickupPointId);
            die(json_encode(['success' => true, 'message' => 'Cart updated']));
        } else {
            die(json_encode(['success' => false, 'message' => 'Invalid data']));
        }
    }
}
