Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit c8ffbe3

Browse files
committed
update readme
2 parents 49d9444 + bb4fb05 commit c8ffbe3

File tree

7 files changed

+141
-1
lines changed

7 files changed

+141
-1
lines changed
284 KB
Loading

docs/.gitbook/assets/settings.png

337 KB
Loading
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Helper methods
2+
3+
Shopper has several helper functions that are ready to use. Here you can find the list of available function that may speed up your development.
4+
5+
## Thumbnails URL
6+
7+
After registering your product, Shopper will generate thumbnails for your products. You may want to view the thumbnails displayed in your view or get the thumbnail URL. Product Model uses `Resize` trait to display thumbnails.
8+
9+
```php
10+
namespace Mckenziearts\Shopper\Plugins\Catalogue\Models;
11+
12+
use Mckenziearts\Shopper\Traits\Resize;
13+
14+
class Product extends Model
15+
{
16+
use Resize;
17+
}
18+
```
19+
20+
To set custom thumbnails size you can make it on the shopper config file, for crop image, add sizes on the model name array.
21+
22+
```php
23+
/*
24+
|--------------------------------------------------------------------------
25+
| Image resize
26+
|--------------------------------------------------------------------------
27+
|
28+
| Resize and create thumbnails for previewImage on Brand, Category and Product
29+
| Model.
30+
|
31+
*/
32+
'quality' => 70,
33+
'upsize' => true,
34+
'thumbnails' => [
35+
[
36+
'name' => 'medium',
37+
'scale' => '50'
38+
],
39+
[
40+
'name' => 'small',
41+
'scale' => '25'
42+
],
43+
[
44+
'name' => 'cropped',
45+
'crop' => [
46+
'brand' => [
47+
'145x50' => ['width' => '145', 'height' => '50']
48+
],
49+
'product' => [
50+
'1000x1000' => ['width' => '1000', 'height' => '1000']
51+
],
52+
'category' => [
53+
'220x197' => ['width' => '220', 'height' => '197']
54+
]
55+
]
56+
]
57+
],
58+
```
59+
60+
#### Display a single image
61+
62+
```php
63+
@foreach($products as $product)
64+
<img src="{{ $product->getImageUrl() }}" />
65+
@endforeach
66+
```
67+
68+
Or you can specify the preview image relation field name \(attribute\)
69+
70+
```php
71+
@foreach($products as $product)
72+
<img src="{{ shopperAsset($product->previewImage->disk_name) }}" />
73+
@endforeach
74+
```
75+
76+
Or to display a cropped image
77+
78+
```php
79+
@foreach($products as $product)
80+
<img src="{{ $product->thumbnail('cropped', '1000x1000') }}" alt="" />
81+
@endforeach
82+
```
83+
84+
#### Display multiple images
85+
86+
```php
87+
@foreach($product->images as $image)
88+
<img src="{{ shopperAsset($image->disk_name) }}" alt="" />
89+
@endforeach
90+
```
91+
92+
## Website Currency
93+
94+
If you want to display correct money format, Shopper provide a simple helper to help you, not based on default `money_format` php function :
95+
96+
```php
97+
shopperMoney($product->offers->last()->price, setting('site_currency'))
98+
```
99+
100+
Or inside of any blade template like:
101+
102+
```text
103+
{{ shopperMoney($product->offers->last()->price, setting('site_currency')) }}
104+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Media Manager
2+
3+
Shopper has a full-fledged Media Manager which allows you to upload files, re-name files, and delete files. You can also add new folders and move files/folders. Basically anything that you would be able to do in any type of Media Manager you can do so in the Shopper Media Manager.
4+
5+
![](../.gitbook/assets/media_manager.png)
6+
7+
{% hint style="info" %}
8+
**Notice on File Upload Size**
9+
If you are getting an error when trying to upload large files, this may be a setting that needs to be changed in your PHP. Be sure to check `max_file_upload` and `file_upload_size`
10+
{% endhint %}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Settings
2+
3+
The Settings is the simple «key-value» storage that uses the key to access a value. These storages are usually used to store settings.
4+
The Settings section allows you to set site wide settings you would like. You can add the main headline on your homepage, the shop email address, the default website currency, your site description (important for your seo ranking).
5+
6+
![](../.gitbook/assets/settings.png)
7+
8+
So, if you updated a setting inside of the settings tab and it had the key of site_title you would then be able to reference that setting any where on your site by doing the following:
9+
10+
```php
11+
<?php
12+
//Using the helper
13+
echo setting('site_title');
14+
```
15+
Or inside of any blade template like:
16+
17+
```text
18+
{{ setting('site_title') }}
19+
```
20+
21+
So, now you can update all settings in Shopper Global settings tab and reference them in your application.

docs/summary.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@
99
* [Upgrading](getting-started/upgrading.md)
1010
* [Configurations](getting-started/configurations.md)
1111

12+
## Architecture concepts
13+
14+
* [Media Manager](architecture-concepts/media-manager.md)
15+
* [Settings](architecture-concepts/settings.md)
16+
* [Helper methods](architecture-concepts/helper-methods.md)

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ http://localhost:8000/console
114114
```
115115

116116
## Documentation
117-
Official documentation is available [Here](https://shopper.gitbook.io/docs).
117+
Official documentation is available [Here](https://docs.shopper.com).
118118

119119

120120
## Change log

0 commit comments

Comments
 (0)