Skip to content

Commit

Permalink
Initialization store tests (#287)
Browse files Browse the repository at this point in the history
* test: Add features test for the initialization store wizard

* docs: update Initialization docs and apply refactoring to blade views

* fix: Remove gender migration and add Enum Type

* chore: fix code formatting

* chore: Add WithMigration Attribute on TestCase


* chore: fix code formatting

---------

Co-authored-by: mckenziearts <[email protected]>
  • Loading branch information
mckenziearts and mckenziearts authored Aug 17, 2024
1 parent 48e5a7b commit 14ab40f
Show file tree
Hide file tree
Showing 27 changed files with 73,132 additions and 20,334 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,4 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "shopper/core" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
env:
APP_ENV: testing
DB_CONNECTION: testing
DB_DATABASE: ":memory:"
run: ./vendor/bin/pest
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"doctrine/dbal": "^3.6",
"filament/filament": "^3.2",
"filament/spatie-laravel-media-library-plugin": "^3.2",
"gehrisandro/tailwind-merge-laravel": "^1.2",
"jenssegers/agent": "^2.6",
"larastan/larastan": "^2.9",
"laravel/pint": "^1.16",
Expand Down Expand Up @@ -87,8 +88,8 @@
"test:pest": "pest --parallel",
"test:phpstan": "phpstan analyse --memory-limit=2G",
"test": [
"@test:pest",
"@test:phpstan"
"@test:phpstan",
"@test:pest"
]
},
"config": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
# Customization

Once you have installed Shopper, you need to set up a store to serve as your first location. After creating a new user, you need to login via the url `/shopper/login`. After logging in you need to fill in the required information to access the Laravel Shopper dashboard
Once you have installed Shopper, you need to set up a store to serve as your first location. After creating a new user, you have to logged in via the url `/shopper/login`.
After logging in, if it's your first time, you'll be redirected to your store's initialization page. This step is essential for your store's basic information (country, currencies, location).

<div class="screenshot">
<img src="/img/screenshots/{{version}}/customization.png" alt="Shopper Config Example">
<div class="caption">Store customization</div>
<img src="/img/screenshots/{{version}}/initialization.png" alt="Shopper Initialization Step">
<div class="caption">Store initialization</div>
</div>

Defines your shop’s address country and state, where you are based as a seller. It determines default tax rates and customer locations.

## Global
All thoses informations is stored using the **Setting** Model which is located `\Shopper\Core\Models\Setting`

```php
namespace Shopper\Core\Models;

use Illuminate\Database\Eloquent\Model;

class Setting extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'display_name',
'key',
'value',
'locked',
];
}
```
All these data are stored using the **Setting** Model which is located `\Shopper\Core\Models\Setting`

### Fields

Expand All @@ -43,21 +23,18 @@ class Setting extends Model
| `value` | json | Nullable, represents the value of the key that will be displayed when the parameter is requested |
| `locked` | boolean | default is false (0), allows to define if this parameter can be updated |

### Component
Shopper is made of several Livewire components, to make the configuration easier and more adaptable to any kind of system.

The component used to manage the configuration and customization of the store is found in the component configuration file `config/shopper/components.php`.

So you can replace it and configure your store the way you want. Yes it's magic 🎩

### Retrieving setting
By default to retrieve the value of a key you can use the helper function `shopper_setting()` passing the desired key as parameter
To retrieve the value of a key you can use the helper function `shopper_setting()` passing the desired key as param

```php
shopper_setting('my_key')
```

This value is cached for one day and under the key `shopper-setting-{$key}`
This value is cached for one day and under the key `shopper-setting-{$key}`. But if you don't want the data to be cached, and you want to receive the last value every time, set `false` as the second parameter.

```php
shopper_setting('my_key', withCache: false)
```

## Store
When you launch your store the first important thing to do is to fill in the information about this store.
Expand All @@ -71,19 +48,19 @@ Your customers and the different services you might use need to know the informa

The information stored in this section is available using the following keys: `shop_name` for the store name, `shop_email` for the email and `shop_country_id` for the Country.

## Currency
### Currency
Choose the default currency for the store. Only one may be selected.

<div class="screenshot">
<img src="/img/screenshots/{{version}}/store-currency.png" alt="Store currency">
<div class="caption">Store currency</div>
</div>

For currency configurations we use the [moneyphp/money](https://github.com/moneyphp/money) package. At the moment, the formatter does it automatically depending on the currency.
For currency configurations we use the [akaunting/laravel-money](https://github.com/akaunting/laravel-money) package. At the moment, the formatter does it automatically depending on the currency.

As you may have noticed in the code, there is also a helper that returns the currency you registered `shopper_currency()`. This will return the currency configured in your admin panel: **USD**, **XAF**, **EUR**, etc

## Location
## Address
Most stores keep their products in different locations around the world. When setting up this configuration you need to define a location that will be set as the default location for your products.

When shipping an order, the products to be delivered/shipped will start from this location and thus the shipping price can be set according to this.
Expand Down Expand Up @@ -122,7 +99,7 @@ Channels represent a single sales channel, which can be one of the following thi

or pretty much anything similar you can imagine.

By default when you set up your store Shopper creates a sales channel at the same time as your first location with the same location information.
During the shopper installation, with the execution of the seeder `ShopperSeeder`, we create a default sale channel named `Web Store` .

```php
(new ChannelRepository())->create([
Expand Down
12,211 changes: 12,210 additions & 1 deletion packages/admin/public/shopper.css

Large diffs are not rendered by default.

Loading

0 comments on commit 14ab40f

Please sign in to comment.