From a0608b29208368e75b22edecaba6d2973165db84 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 21 Apr 2016 17:07:45 +0200 Subject: [PATCH 1/3] Backport from 2.0 settings fix that prevented all shipping options to appear --- shoppingcart.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/shoppingcart.php b/shoppingcart.php index db75ca6..c47c058 100644 --- a/shoppingcart.php +++ b/shoppingcart.php @@ -352,10 +352,10 @@ protected function recurse_settings($base, $settings) { $output = ''; - foreach($settings as $key => $value) { + foreach ($settings as $key => $value) { if (!is_array($value)) { //Avoid adding private settings to the frontend - if (!in_array($key, ['secretKey'])) { + if ($key !== 'secretKey') { if (is_numeric($key)) { $key = '[' . $key . ']'; } else { @@ -365,17 +365,20 @@ protected function recurse_settings($base, $settings) if (!is_numeric($value)) { $value = '"' . $value . '"'; } - $output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key .' = ' . $value . '; ' . PHP_EOL; + $output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key . ' = ' . $value . '; ' . PHP_EOL; } } else { - if (is_numeric($key)) { - $key = '[' . $key . ']'; - } else { - $key = '.' . $key; + if ($key !== 'checkout_form') { + if (is_numeric($key)) { + $key = '[' . $key . ']'; + } else { + $key = '.' . $key; + } + $output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key . ' = {}; ' . PHP_EOL; + + $output .= $this->recurse_settings($base . $key, $value); } - $output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key .' = {}; ' . PHP_EOL; - $output .= $this->recurse_settings($base . $key, $value); } } From a361e5db1a207badfd1b97cbb303c98ef4d9293f Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 21 Apr 2016 17:07:58 +0200 Subject: [PATCH 2/3] Fix for payment URL task --- shoppingcart.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shoppingcart.php b/shoppingcart.php index c47c058..0d6d3ae 100644 --- a/shoppingcart.php +++ b/shoppingcart.php @@ -123,9 +123,16 @@ public function saveOrder() { /** @var Uri $uri */ $uri = $this->grav['uri']; - $task = $uri->query('task'); + $task = !empty($_POST['task']) ? $_POST['task'] : $uri->query('task'); $post = !empty($_POST) ? $_POST : []; + // @todo: remove in 2.0 + if (!$task) { + $uri_bits = Uri::parseUrl(urldecode($uri->query())); + parse_str($uri_bits['query'], $query); + $task = $query['task']; + } + require_once __DIR__ . '/classes/controller.php'; $controller = new ShoppingCartController($this->grav, $task, $post); $controller->execute(); From d415748632680a68d76f7dd44fd2036e38cca1a8 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 21 Apr 2016 17:09:58 +0200 Subject: [PATCH 3/3] Prepare release --- CHANGELOG.md | 7 +++++++ blueprints.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7135105..b7e3b61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v1.0.6 +## 21-04-2016 + +1. [](#bugfix) + * Fix issue in JS settings build, backported from 2.0 + * Fix issue in payment URL task fetch + # v1.0.5 ## 13-03-2016 diff --git a/blueprints.yaml b/blueprints.yaml index 8618728..55028e7 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Shopping Cart -version: 1.0.5 +version: 1.0.6 description: "This plugin turns your Grav site into a shopping cart" icon: shopping-cart author: