Skip to content

Commit

Permalink
Fixed upgrade from version 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Pieters committed Feb 13, 2018
1 parent bff04c6 commit d157500
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
22 changes: 8 additions & 14 deletions paynlpaymentmethods/paynlpaymentmethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ public function install()
if ( ! parent::install()
|| ! $this->registerHook('paymentOptions')
|| ! $this->registerHook('paymentReturn')
|| ! $this->uninstallOverrides()
|| ! $this->removeFeeTable()
) {
return false;
}
Expand All @@ -94,17 +92,6 @@ public function install()
return true;
}

/**
* This table was added in a previous version, but is no longer needed
*
* @return bool
*/
private function removeFeeTable()
{
return (bool)Db::getInstance()->execute(
'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'paynl_pfee_cart`');
}

public function createPaymentFeeProduct()
{
$id_product = Configuration::get('PAYNL_FEE_PRODUCT_ID');
Expand Down Expand Up @@ -137,6 +124,13 @@ public function createPaymentFeeProduct()
return true;
}

public function installOverrides()
{
// This version doesn't have overrides anymode, but prestashop still keeps them around.
// By overriding this method we can prevent prestashop from reinstalling the old overrides
return true;
}

public function uninstall()
{

Expand Down Expand Up @@ -249,7 +243,7 @@ private function getPaymentMethodsForCart($cart = null)
$totalWithFee = $cartTotal + $paymentMethod->fee;

if ($paymentMethod->fee > 0) {
$strFee = " (+ " . Tools::displayPrice($paymentMethod->fee, (int) $cart->id_currency, true) . ")";
$strFee = " (+ " . Tools::displayPrice($paymentMethod->fee, (int)$cart->id_currency, true) . ")";
}

$paymentMethod->name .= $strFee;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @param $module PaynlPaymentMethods
*/
function upgrade_module_4_1($module)
function upgrade_module_4_2($module)
{
$results = array();

Expand Down

0 comments on commit d157500

Please sign in to comment.