public function updateObject($values = null) { $zone = Doctrine::getTable('ShippingZone')->find($values['shipping_zone_id']); $this->getObject()->setInformation($zone['name'] . ';' . $values['address'] . ';' . $values['city'] . ';' . $values['country']); $this->getObject()->setName($values['name']); $interval = BasketCheckedOut::getInstance($values['order_id'])->shippingZoneInterval($values['shipping_zone_id']); $this->getObject()->setMassIntervalStart($interval['start']); $this->getObject()->setMassIntervalEnd($interval['end']); $this->getObject()->setCost($interval['price']); // parent::updateObject($values); // DO NOT USE here, or values will not save. If appears need THEN replace logic from this method to OrderingForm class }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { # setup $databaseManager = new sfDatabaseManager($this->configuration); // databaseManager $context = sfContext::createInstance($this->configuration); $this->logSection('invoice', 'Enviroment initialized'); # render invoice HTML $this->logSection('invoice', sprintf('Starting HTML generation for order ID:%s', $this->getOrder()->getId())); $htmlString = $context->getController()->getAction('sfInvoiceGeneration', 'pdf')->getPartial('sfInvoiceGeneration/invoice', array('order' => $this->getOrder(), 'i18n' => $this->getI18N(), 'basketCheckedOut' => BasketCheckedOut::getInstance($this->getOrder()->getId()))); $this->logSection('invoice', sprintf('invoice HTML generated for order ID:%s', $this->getOrder()->getId())); # convert HTML string to PDF string $this->logSection('invoice', sprintf('Starting HTML2PDF conversion for order ID:%s', $this->getOrder()->getId())); $pdfString = $this->convertHTML2PDF($htmlString); $this->logSection('invoice', sprintf('PDF generated for order ID:%s', $this->getOrder()->getId())); # PDF file saving $this->logSection('invoice', sprintf('PDF file saving for order ID:%s', $this->getOrder()->getId())); file_put_contents($this->getInvoiceAbsolutePath('pdf'), $pdfString); $this->logSection('invoice', sprintf('PDF file saved (%s) for order ID:%s', $this->getInvoiceAbsolutePath('pdf'), $this->getOrder()->getId())); }
public function executeChangeShippingZone(sfWebRequest $request) { sfProjectConfiguration::getActive()->loadHelpers(array('Currency', 'Number')); $this->forward404Unless($this->getUser()->isMyOrder(Doctrine::getTable('ProductOrder')->find($this->getRequestParameter('orderID')))); $id = $this->getRequestParameter('orderID'); if ($request->getParameter('zoneID') == 0) { return $this->renderPartial('global/json', array('item' => array('total' => price_format(BasketCheckedOut::getInstance($id)->price(BasketCheckedOut::TOTAL_NO_SHIPPING)), 'shipping' => price_format(0)))); } $zone = BasketCheckedOut::getInstance($id)->shippingCost($this->getRequestParameter('zoneID')); $total = BasketCheckedOut::getInstance($id)->price(BasketCheckedOut::TOTAL_NO_SHIPPING) + $zone; return $this->renderPartial('global/json', array('item' => array('total' => price_format($total), 'shipping' => price_format($zone)))); }
public function createBankLinkPayment() { return new CPayment($this->getId(), 'Faye', Currency::convert(BasketCheckedOut::getInstance($this->getId())->price(BasketCheckedOut::TOTAL_PAYABLE), 'EEK'), 'EEK'); }