Skip to content

Commit

Permalink
#5 redirect to order with full basket after cancel
Browse files Browse the repository at this point in the history
+ update readme
  • Loading branch information
jakubpolomsky committed Jan 9, 2017
1 parent cd29108 commit 6a2d8c4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 198 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Wirecard Checkout Page plugin for PrestaShop

[![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/prestashop-wcp/master/LICENSE)
[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.5.6.2-green.svg)](https://www.prestashop.com/)
[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.6.1.2-green.svg)](https://www.prestashop.com/)
[![PHP v5.3](https://img.shields.io/badge/php-v5.3-yellow.svg)](http://www.php.net)
[![PrestaShop](https://img.shields.io/badge/PrestaShop-v1.7.0.3-green.svg)](https://www.prestashop.com/)
[![PHP v5.6](https://img.shields.io/badge/php-v5.3-yellow.svg)](http://www.php.net)

Wirecard Checkout Page plugin for PrestaShop.

Expand Down
62 changes: 0 additions & 62 deletions wirecardceecheckoutpage/controllers/front/paymentExecution.php

This file was deleted.

This file was deleted.

This file was deleted.

28 changes: 19 additions & 9 deletions wirecardceecheckoutpage/wirecardceecheckoutpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function __construct()
$this->tab = 'payments_gateways';
$this->version = '2.0.0';
$this->author = 'Wirecard';
$this->controllers = array('breakoutIFrame', 'confirm', 'payment', 'paymentExecution', 'paymentIFrame');
$this->controllers = array('breakoutIFrame', 'confirm', 'payment', 'paymentIFrame');
$this->is_eu_compatible = 1;

$this->currencies = true;
Expand Down Expand Up @@ -677,15 +677,25 @@ public function hookDisplayPaymentReturn($params)
return $this->display(__FILE__, 'pending.tpl');
}

$params = array(
'submitReorder' => true,
'id_order' => (int)$params['objOrder']->id
);

if (Configuration::get('PS_ORDER_PROCESS_TYPE')) {
Tools::redirect($this->context->link->getPageLink('order-opc', true, $this->getOrder()->id_lang, $params));
// rebuild cart
$oldCart = new Cart((int)$params["order"]->id_cart);
$duplication = $oldCart->duplicate();
if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) {
$this->errors[] = Tools::displayError('Sorry. We cannot renew your order.');
} elseif (!$duplication['success']) {
$this->errors[] = Tools::displayError('Some items are no longer available, and we are unable to renew your order.');
} else {
$this->context->cookie->id_cart = $duplication['cart']->id;
$context = $this->context;
$context->cart = $duplication['cart'];
CartRule::autoAddToCart($context);
$this->context->cookie->write();

if (Configuration::get('PS_ORDER_PROCESS_TYPE')) {
Tools::redirect($this->context->link->getPageLink('order-opc', true, $this->getOrder()->id_lang, null));
}
Tools::redirect($this->context->link->getPageLink('order', true, $this->getOrder()->id_lang, null));
}
Tools::redirect($this->context->link->getPageLink('order', true, $this->getOrder()->id_lang, $params));
}

public function hookDisplayPDFInvoice($params)
Expand Down

0 comments on commit 6a2d8c4

Please sign in to comment.