Skip to content

Instantly share code, notes, and snippets.

@Fivell
Last active April 5, 2016 09:53
Show Gist options
  • Save Fivell/db0b5eb355959d708bb2acebfe5bacf8 to your computer and use it in GitHub Desktop.
Save Fivell/db0b5eb355959d708bb2acebfe5bacf8 to your computer and use it in GitHub Desktop.
patch.php
<?php
///....
function step4()
{
$app = JFactory::getApplication();
$this->ordering->processRequest(JRequest::get('post'),self::$required_payments_objects);
$this->order = $this->ordering->getOrder();
/// begin of patch
$failUrl = DidwwRoute::_('index.php?option=com_didww&view=order&layout=orderconfirm',false);
if ($this->ordering->pay_system->type == "balance" && $this->order->total_price() > $this->client->deposit) {
$this->setRedirect($failUrl,JText::_('ORDER_ERROR'),'error');
$this->redirect();
}
/// end of patch
$this->saveOrdering($this->ordering);
if(count($this->ordering->getErrors())){
$this->addErrors($this->ordering->getErrors());
return false;
}
if(!$this->ordering->checkSubscription()) {
$app->enqueueMessage(
JText::sprintf('SUBSCRIPTION_PERIOD_ERROR',
$this->ordering->pay_system()->module->label(),
$this->ordering->pay_system()->module->label(),
$this->ordering->pay_system()->available_periods_string()),
'error');
$this->setRedirect('index.php?option=com_didww&view=order&layout=neworder');
$this->redirect();
}
$this->ordering->setGlobalForwarding();
$this->ordering = $this->order->create($this->ordering, true);
$this->try_to_pay($this->ordering);
$this->setConfirmedOrder($this->ordering);
$this->clearOrdering();
$form_data = array('option'=>'com_didww','view'=>'order','layout'=>'success');
$this->setRedirect( DidwwRoute::_('index.php?'.http_build_query($form_data), false) );
$this->redirect();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment