Files
interblue.pl/modules/x13allegro/controllers/admin/AdminXAllegroCustomPricesController.php
2024-10-25 14:16:28 +02:00

49 lines
1.4 KiB
PHP

<?php
require_once (dirname(__FILE__) . '/../../x13allegro.php');
final class AdminXAllegroCustomPricesController extends XAllegroController
{
public function __construct()
{
parent::__construct();
}
public function ajaxProcessRefreshCustomPrices()
{
$product = new XAllegroProduct(null, (int) Tools::getValue('id_product'));
$customPricesForm = (new XAllegroHelperCustomPrices())
->setProduct($product)
->setAccountId((int) Tools::getValue('id_xallegro_account'))
->renderCustomPricesForm();
die(
json_encode(
array(
'result' => true,
'html' => $customPricesForm,
'message' => $this->l('Poprawnie zaktualizowano')
)
)
);
}
public function ajaxProcessDeleteCustomPrices()
{
$customPriceEntity = new XAllegroCustomPrice();
$customPriceEntity->setProductId((int) (int) Tools::getValue('id_product'));
$customPriceEntity->setAccountId((int) Tools::getValue('id_xallegro_account'));
$customPriceEntity->deletePrices(true);
die(
json_encode(
array(
'result' => true,
'message' => $this->l('Poprawnie skasowano ceny dedykowane'),
)
)
);
}
}