diff --git a/README.md b/README.md
index 843fc58..8004965 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Pull lists of books directly into your Craft templates.
To install Bookworm, copy the bookworm/ folder into craft/plugins/, then goto Settings > Plugins and click **Install**.
-You will then need to enter your Goodreads User ID. This can be found in the address bar when viewing your Goodreads shelves. It’s the seven digit number listed after _/list/_
+You will then need to enter your Goodreads User ID. This can be found in the address bar when viewing your Goodreads shelves. It's the seven digit number listed after _/list/_
E.g.
@@ -40,13 +40,63 @@ In your template add the following line to pull a list from Bookworm. This will
You can also define optional parameters to change the results you get back.
```
-{% set books = craft.bookworm.fetch({'shelf': ‘to-read','limit': 200,'sortBy': 'date_read'}) %}
+{% set books = craft.bookworm.fetch({'shelf': 'to-read','limit': 200,'sortBy': 'date_read'}) %}
```
-Please note, there seems to be a limit of 200 books that can be retrieved from the Goodreads feeds.
+### shelf
+
+Used: ` 'shelf': 'to-read' `
+
+This can be any public shelf in your Goodreads profile
+
+Default shelves are:
+
+- read
+- currently-reading
+- to-read
+
+### limit
+
+Used: ` 'limit': 100 `
+
+This is the number of books to fetch.
+
+*Please note, there seems to be a limit of 200 books that can be retrieved from the Goodreads feeds.*
+
+### sortBy
+
+Used: ` 'sortBy': 'date_read' `
+
+Options include:
+
+- author
+- date_read
+- date_added
+- date_started
+- read_count
+- title
+- rating
+
+### order
+
+Used: ` 'order': 'asc' `
+
+Books that have been retrieved are in descending order by default. You can reverse the order using this parameter.
+
+*Please note: Unfortunately Goodreads will not provide the feed in an ascending order. So we can only reorder the results once we have them.*
+
+*This means for example that if you have more than 200 books in a shelf, sort by title, and order ascending, you may miss books at the beginning of the alphabet.*
+
+
## Changelog
+
+### 1.0.2
+
+- Added order parameter (you can now order your results in ascending order)
+- Updated README
+
### 1.0.1
- API key is now optional
diff --git a/bookworm/BookwormPlugin.php b/bookworm/BookwormPlugin.php
index 648de80..17ad9db 100644
--- a/bookworm/BookwormPlugin.php
+++ b/bookworm/BookwormPlugin.php
@@ -18,7 +18,7 @@ function getName()
function getVersion()
{
- return '1.0';
+ return '1.0.2';
}
function getDeveloper()
diff --git a/bookworm/variables/BookwormVariable.php b/bookworm/variables/BookwormVariable.php
index e008ad9..ce8f337 100644
--- a/bookworm/variables/BookwormVariable.php
+++ b/bookworm/variables/BookwormVariable.php
@@ -31,6 +31,7 @@ public function fetch($options = NULL)
$shelf = (isset($options['shelf']) ? $options['shelf'] : 'read');
$limit = (isset($options['limit']) ? $options['limit'] : '10');
$sortBy = (isset($options['sortBy']) ? $options['sortBy'] : 'date_read');
+ $order = (isset($options['order']) ? $options['order'] : 'desc');
if ($userID === "") {
@@ -65,7 +66,15 @@ public function fetch($options = NULL)
}
if (count($books) > 0) {
+ // Check if order is set to ascending. If it is, reverse the array, otherwise carry on.
+
+ if ($order == "asc") {
+ $books = array_reverse($books);
+ }
+
+
// Everything seems to have worked, send the books to the template.
+
return $books;
} else {
$error = "No books could be found. Are your settings correct?
Feed url: $feed_url";