Files
grzanieplus.pl/plugins/stSantanderRatyPlugin/modules/stSantanderRatyFrontend/actions/components.class.php
2025-03-12 17:06:23 +01:00

57 lines
2.2 KiB
PHP

<?php
class stSantanderRatyFrontendComponents extends sfComponents
{
public function executeShowPayment()
{
$smarty = new stSmarty('stSantanderRatyFrontend');
$order = stPaymentType::getOrderInSummary();
$totalQuantity = count($order->getOrderProducts());
if ($order->getOrderDelivery()->getCostBrutto(true) > 0)
{
$totalQuantity += 1;
}
$smarty->assign('order', $order);
$smarty->assign('order_total_amount', $order->getTotalAmountWithDelivery(true, true));
$smarty->assign('order_total_quantity', $totalQuantity);
$smarty->assign('shop_number', stConfig::getInstance('stSantanderRatyBackend')->get('shop_number'));
$smarty->assign('order_delivery', $order->getOrderDelivery()->getName());
$smarty->assign('client', array(
'name' => $order->getOrderUserDataBilling()->getName(),
'surname' => $order->getOrderUserDataBilling()->getSurname(),
'email' => $order->getOptClientEmail(),
));
$smarty->assign('url_accepted', $this->getController()->genUrl('@stSantanderRatyFrontend?action=accepted', true).'?id=');
$smarty->assign('url_canceled', $this->getController()->genUrl('@stSantanderRatyFrontend?action=canceled', true).'?id=');
return $smarty;
}
public function executeCalculate()
{
$config = stConfig::getInstance(sfContext::getInstance(), 'stSantanderRatyBackend');
if ($this->amount < 100 || !$config->get('shop_number')){
return sfView::NONE;
}
$smarty = new stSmarty('stSantanderRatyFrontend');
$smarty->assign('url', stSantander::getCalculateRateUrl($this->amount));
$smarty->assign('is_ajax', isset($this->is_ajax) ? $this->is_ajax: false);
$smarty->assign('small', isset($this->small) ? $this->small: false);
return $smarty;
}
public function executeCalculateInBasket()
{
sfLoader::loadHelpers(array('Helper', 'stPartial'));
echo st_get_component('stSantanderRatyFrontend', 'calculate', array('amount' => $this->getUser()->getBasket()->getTotalAmount(true, true), 'small' => true));
return sfView::NONE;
}
}