first commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
class stPocztaPolskaFrontendComponents extends sfComponents
|
||||
{
|
||||
public function executeChooseDeliveryPoint()
|
||||
{
|
||||
if ($this->delivery->getTypeId() != DeliveryTypePeer::retrieveIdByType('ppo') || !stConfig::getInstance('stPocztaPolskaBackend')->get('enabled'))
|
||||
{
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
$smarty = new stSmarty('stPocztaPolskaFrontend');
|
||||
$points = $this->getUser()->getAttribute('delivery_point', array(), 'soteshop/stPocztaPolskaPlugin');
|
||||
|
||||
$config = stConfig::getInstance('stPocztaPolskaBackend');
|
||||
|
||||
$smarty->assign('point', $points && isset($points[$this->delivery->getId()]) ? $points[$this->delivery->getId()] : array());
|
||||
$smarty->assign('id', $this->delivery->getId());
|
||||
|
||||
return $smarty;
|
||||
}
|
||||
|
||||
public function executeHelper()
|
||||
{
|
||||
$ids = [];
|
||||
$smarty = new stSmarty('stPocztaPolskaFrontend');
|
||||
/**
|
||||
* @var stBasket
|
||||
*/
|
||||
$basket = $this->getUser()->getBasket();
|
||||
|
||||
foreach (PaymentTypePeer::doSelectCached() as $payment)
|
||||
{
|
||||
if ($payment->getIsCod())
|
||||
{
|
||||
$ids[] = $payment->getId();
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('payments', json_encode($ids));
|
||||
$smarty->assign('pay_on_pickup_amount', $basket->getTotalAmount(true, true) + stDeliveryFrontend::getInstance($basket)->getTotalDeliveryCost(true, true));
|
||||
|
||||
return $smarty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user