Skip to content

Commit

Permalink
The Plugin Store now shows the discounted price when another commerci…
Browse files Browse the repository at this point in the history
…al edition of the plugin is licensed.
  • Loading branch information
benjamindavid committed Mar 7, 2019
1 parent 7f3ddaf commit e7b212a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Changed
- When installing Craft using a `project.yaml`, Craft now processes all sites before installing any plugins. ([craftcms/commerce#752](https://github.com/craftcms/commerce/issues/752))
- The Plugin Store now shows the discounted price when another commercial edition of the plugin is licensed.

### Fixed
- Fixed a bug where the `positionedBefore` element query param was not including direct ancestors in the results.
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/js/app.js.map

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions src/web/assets/pluginstore/src/js/components/PluginEdition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
<edition-badge v-if="plugin.editions.length > 1" :name="edition.name" block big></edition-badge>
<div class="price">
<template v-if="!isPluginEditionFree(edition)">
{{edition.price|currency}}

<template v-if="licensedEdition && licensedEdition.handle !== edition.handle && licensedEdition.price > 0">
<del>{{edition.price|currency}}</del>
{{(edition.price - licensedEdition.price)|currency}}
</template>
<template v-else>
{{edition.price|currency}}
</template>
</template>
<template v-else>
{{ "Free"|t('app') }}
</template>
</div>

<p v-if="!isPluginEditionFree(edition)" class="-mt-8 py-6 text-grey-dark">
{{ "Price includes 1 year of updates."|t('app') }}<br />
{{ "{renewalPrice}/year per site for updates after that."|t('app', {renewalPrice: $options.filters.currency(edition.renewalPrice)}) }}
Expand Down Expand Up @@ -56,8 +62,23 @@
...mapGetters({
isPluginEditionFree: 'pluginStore/isPluginEditionFree',
getPluginEdition: 'pluginStore/getPluginEdition',
getPluginLicenseInfo: 'craft/getPluginLicenseInfo',
}),
pluginLicenseInfo() {
if (!this.plugin) {
return null
}
return this.getPluginLicenseInfo(this.plugin.handle)
},
licensedEdition() {
return this.getPluginEdition(this.plugin.handle, this.pluginLicenseInfo.licensedEdition)
}
},
}
Expand Down

0 comments on commit e7b212a

Please sign in to comment.