happypixels / laravel-shopr Goto Github PK
View Code? Open in Web Editor NEWA developer-friendly e-commerce foundation for your Laravel app
Home Page: https://laravel-shopr.happypixels.se
License: MIT License
A developer-friendly e-commerce foundation for your Laravel app
Home Page: https://laravel-shopr.happypixels.se
License: MIT License
Is your feature request related to a problem? Please describe.
We currently only support using the REST API for dealing with the cart. This may be insufficient for more complex shops where custom functionality needs to be combined with it.
Describe the solution you'd like
Implement facades and helper methods for managing the cart.
Additional context
Possibly also allow configuring whether the REST api should be enabled at all.
Implement facade methods for
A highly requested feature which I've wanted to implement since the beginning of Shopr is Discount coupons. This issue will serve as a gathering place for checklists and discussions for this feature.
Database structure
I figure we'll add another table and model to the package. I thought about letting each user build their own database design, but eventually landed in the fact that this package is meant to make it as easy as possible to get started with a web shop, while still allowing for flexibility. Most projects won't need to modify the discount functionality or design if we just think it through, and so they shouldn't have to think about how to structure their discount table.
Validation
Some projects may need the ability to add custom validation to make sure the applied discount code is valid according to rules beyond a timestamp, code validation and other default rules. We need to make this easily configurable and modifiable.
Todo
On September 14 Strong Customer Authentication will be required for all EU customers. To prevent purchases from being declined, we need to implement support for this.
Subtotal subtracts (wrong amount at that) tax from item price?
Not sure if this a bug, or by design. When adding an item to the cart with a price of $100 and a tax rate of %10, the subtotal shows $90.91.
Subtotal = 100.00
Tax = 10.00
=================
Total = 110.00
Response Object
shoppingCart:Object
count:1
discounts:Array[0]
items:Array[1]
sub_total:90.9090909090909
sub_total_formatted:"$90.91"
tax_total:9.090909090909092
tax_total_formatted:"$9.09"
total:100
total_formatted:"$100.00"
shoppingCartCount:1
shoppingCartEmpty:false
To Reproduce
Steps to reproduce the behavior:
let data = {
'shoppable_type': 'App\\Model',
'shoppable_id': product,
'quantity': 1,
'price': 100.00
}
this.$http.post('/api/shopr/cart/items',data)
Expected behavior
shoppingCart:Object
count:1
discounts:Array[0]
items:Array[1]
sub_total:100.00
sub_total_formatted:"$100.00"
tax_total:10.000
tax_total_formatted:"$10.00"
total:110
total_formatted:"$110.00"
shoppingCartCount:1
shoppingCartEmpty:false
Desktop (please complete the following information):
Additional context
Config file: shopr.php
/*
* The tax percentage.
*/
'tax' => 10,
I think for many shop-owners it would be really valuable to know if/when a discount has been given on an order, currently this info is not included in the $order object that is created in convertToOrder
.
Describe the solution you'd like
Perhaps a nullable column "discounted_amount" on the orders
table or a direct relation between the discounts and the order table (however I'm not sure about this approach).
This is a minor thing obviously :) what do you think though?
Describe the solution you'd like
A simple configuration key for defining if the tax should be calculated on a product's gross or net price.
Describe the bug
The class NumberFormatter isn't found, probable cause is missing php-intl extension.
To Reproduce
Steps to reproduce the behavior:
Is your feature request related to a problem? Please describe.
The route paths and middleware can't be configured atm.
Describe the solution you'd like
Update config to support route path and middleware similar to laravel/telescope
Haven't had the time to add this yet. It's time.
Describe the bug
In the checkout process, if the transaction fails (for example due to insufficient funds), the cart will still be cleared and the order will be created with the payment_status 'pending'. No order should be created and the cart should still be there, in order to reattempt the checkout.
To Reproduce
Steps to reproduce the behavior:
Describe the bug
Im trying to update items in the cart by making a call to the API like this
window.axios.patch('/api/shopr/cart/items/' + item.id, {quantity: item.quantity}).then(response => {
this.cart = response.data;
console.log(this.cart);
});
This works fine, and it returns the cart summary (UI updates etc.), however it does not seem to take into account any discounts that have been applied already. I added a discount with a value of 50.00 as a percentage discount.
Also I can confirm that the cart summary that comes back from the backend does not reflect the changes either. ๐ค
Here is my full cart summary object for reference (don't mind the formatting):
{
"items":[
{
"id":"15497087885c5eadf485ce3",
"quantity":4,
"shoppableType":"App\\Product",
"shoppableId":1,
"shoppable":{
"id":1,
"name":"Nice AirMax",
"description":"This is the most amazing shoe you will ever see lol!",
"featured_image":"https:\/\/c.static-nike.com\/a\/images\/t_PDP_1280_v1\/f_auto\/gorfwjchoasrrzr1fggt\/air-max-270-shoe-nnTrqDGR.jpg",
"price":800,
"created_at":null,
"updated_at":null
},
"options":[
],
"subItems":[
],
"total":3200,
"price":800,
"price_formatted":"DKK\u00a0800.00"
}
],
"discounts":[
{
"id":"15497087935c5eadf961800",
"quantity":1,
"shoppableType":"Happypixels\\Shopr\\Models\\DiscountCoupon",
"shoppableId":2,
"shoppable":{
"id":2,
"valid_from":"2019-02-08 15:42:34",
"valid_until":"2019-05-08 15:42:34",
"uses":8,
"code":"NEWCODE",
"description":null,
"is_fixed":0,
"value":"50.00",
"lower_cart_limit":"0.00",
"created_at":"2019-02-08 15:42:34",
"updated_at":"2019-02-09 10:37:57",
"deleted_at":null
},
"options":[
],
"subItems":[
],
"total":-400,
"price":-400,
"price_formatted":"-DKK\u00a0400.00"
}
],
"sub_total":2240,
"sub_total_formatted":"DKK\u00a02,240.00",
"tax_total":560,
"tax_total_formatted":"DKK\u00a0560.00",
"total":2800,
"total_formatted":"DKK\u00a02,800.00",
"count":4
}
Is this intended design perhaps?
Expected behavior
The cart total and subtotal should be updated and take discounts into account also.
First of all I want to say that working with laravel-shopr is an absolute delight, great job!
Is your feature request related to a problem? Please describe.
Currently you can specify your currency code in the ISO format, for instance, "DKK" (Danish Kr.), however, there is no way to change the formatting of this.
Describe the solution you'd like
It would be great to be able to format it as "kr" or whatever is possible with the money library you are using.
This is just an example but in the money package that I currently use in my app, they expose this api in the config, perhaps inspiration could be drawn from there:
'DKK' => [
'name' => 'Danish Krone',
'code' => 208,
'precision' => 0,
'subunit' => 100,
'symbol' => 'kr',
'symbol_first' => false,
'decimal_mark' => ',',
'thousands_separator' => '.',
],
What do you think?
Describe the bug
A clear and concise description of what the bug is.
When trying to add a coupon code a 422 validation error is thrown.
To Reproduce
Steps to reproduce the behavior:
{code: 'somecode'}
Might help
My assumption is that the rules array is colliding with the custom rules array set in the configuration file, because I tried to override the original rules array in CartDiscountController.php $rules = ['required', 'string'];
with my own implementation it worked:
$request->validate([
'code' => 'required|string'
]);
instead of
$rules = ['required', 'string'];
But obviously this is not compatible with the custom rules ๐ค
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.