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

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenziearts committed Apr 23, 2019
2 parents 49d9444 + bb4fb05 commit c8ffbe3
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 1 deletion.
Binary file added docs/.gitbook/assets/media_manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 104 additions & 0 deletions docs/architecture-concepts/helper-methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Helper methods

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.

## Thumbnails URL

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.

```php
namespace Mckenziearts\Shopper\Plugins\Catalogue\Models;

use Mckenziearts\Shopper\Traits\Resize;

class Product extends Model
{
use Resize;
}
```

To set custom thumbnails size you can make it on the shopper config file, for crop image, add sizes on the model name array.

```php
/*
|--------------------------------------------------------------------------
| Image resize
|--------------------------------------------------------------------------
|
| Resize and create thumbnails for previewImage on Brand, Category and Product
| Model.
|
*/
'quality' => 70,
'upsize' => true,
'thumbnails' => [
[
'name' => 'medium',
'scale' => '50'
],
[
'name' => 'small',
'scale' => '25'
],
[
'name' => 'cropped',
'crop' => [
'brand' => [
'145x50' => ['width' => '145', 'height' => '50']
],
'product' => [
'1000x1000' => ['width' => '1000', 'height' => '1000']
],
'category' => [
'220x197' => ['width' => '220', 'height' => '197']
]
]
]
],
```

#### Display a single image

```php
@foreach($products as $product)
<img src="{{ $product->getImageUrl() }}" />
@endforeach
```

Or you can specify the preview image relation field name \(attribute\)

```php
@foreach($products as $product)
<img src="{{ shopperAsset($product->previewImage->disk_name) }}" />
@endforeach
```

Or to display a cropped image

```php
@foreach($products as $product)
<img src="{{ $product->thumbnail('cropped', '1000x1000') }}" alt="" />
@endforeach
```

#### Display multiple images

```php
@foreach($product->images as $image)
<img src="{{ shopperAsset($image->disk_name) }}" alt="" />
@endforeach
```

## Website Currency

If you want to display correct money format, Shopper provide a simple helper to help you, not based on default `money_format` php function :

```php
shopperMoney($product->offers->last()->price, setting('site_currency'))
```

Or inside of any blade template like:

```text
{{ shopperMoney($product->offers->last()->price, setting('site_currency')) }}
```
10 changes: 10 additions & 0 deletions docs/architecture-concepts/media-manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Media Manager

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.

![](../.gitbook/assets/media_manager.png)

{% hint style="info" %}
**Notice on File Upload Size**
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`
{% endhint %}
21 changes: 21 additions & 0 deletions docs/architecture-concepts/settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Settings

The Settings is the simple «key-value» storage that uses the key to access a value. These storages are usually used to store settings.
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).

![](../.gitbook/assets/settings.png)

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:

```php
<?php
//Using the helper
echo setting('site_title');
```
Or inside of any blade template like:

```text
{{ setting('site_title') }}
```

So, now you can update all settings in Shopper Global settings tab and reference them in your application.
5 changes: 5 additions & 0 deletions docs/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
* [Upgrading](getting-started/upgrading.md)
* [Configurations](getting-started/configurations.md)

## Architecture concepts

* [Media Manager](architecture-concepts/media-manager.md)
* [Settings](architecture-concepts/settings.md)
* [Helper methods](architecture-concepts/helper-methods.md)
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ http://localhost:8000/console
```

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


## Change log
Expand Down

0 comments on commit c8ffbe3

Please sign in to comment.