Skip to content

Commit 49cf838

Browse files
Merge pull request #394 from shivendra-webkul/update-docs
Update theme code
2 parents 3ad99e0 + 1ed7c4e commit 49cf838

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+8733
-18
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = {
3131
'/1.x/': require('./version-configs/1.x'),
3232
'/1.5.x/': require('./version-configs/1.5.x'),
3333
'/2.x/': require('./version-configs/2.x'),
34+
'/2.0/': require('./version-configs/2.0'),
3435
'/2.1/': require('./version-configs/2.1'),
3536
'/2.2/': require('./version-configs/2.2'),
3637
'/master/': require('./version-configs/master')

docs/.vuepress/theme/components/NavLinks.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656
<option value="2.1">2.1</option>
5757

58+
<option value="2.0">2.0</option>
59+
5860
<option value="1.5.x">1.5.x</option>
5961

6062
<option value="1.x">1.x</option>

docs/.vuepress/theme/layouts/Layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default {
136136
137137
let version = currentPath[1];
138138
139-
if ([`master`, `2.2`, '2.1', '2.x', '1.5.x', '1.x'].includes(version)) {
139+
if ([`master`, `2.2`, '2.1', '2.0', '2.x', '1.5.x', '1.x'].includes(version)) {
140140
this.applyTopNavCustomStyles();
141141
} else {
142142
this.removeTopNavCustomStyles();

docs/.vuepress/version-configs/2.0.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/* set version */
2+
let version = '2.0';
3+
4+
/* version prefix setter */
5+
function setVersionPrefix(children) {
6+
if (children.constructor === Array) {
7+
return children.map(child => {
8+
child[0] = `/${version}/${child[0]}`;
9+
return child;
10+
});
11+
}
12+
return `/${version}/${children}`;
13+
}
14+
15+
/* module export */
16+
module.exports = [
17+
{
18+
title: 'Prologue',
19+
path: setVersionPrefix('prologue'),
20+
collapsable: true,
21+
children: setVersionPrefix([
22+
['prologue/upgrade-guide', 'Upgrade Guide'],
23+
['prologue/contribution-guide', ' Contribution Guide']
24+
])
25+
},
26+
{
27+
title: 'Introduction',
28+
path: setVersionPrefix('introduction'),
29+
collapsable: true,
30+
children: setVersionPrefix([
31+
['introduction/requirements', 'Requirements'],
32+
['introduction/installation', 'Installation'],
33+
['introduction/docker', 'Docker']
34+
])
35+
},
36+
{
37+
title: 'Architecture concepts',
38+
path: setVersionPrefix('architecture'),
39+
collapsable: true,
40+
children: setVersionPrefix([
41+
['architecture/packages', 'Packages'],
42+
['architecture/frontend', 'Frontend'],
43+
['architecture/theme', 'Theme'],
44+
['architecture/performance', 'Performance'],
45+
['architecture/repository-pattern', 'Repository Pattern'],
46+
['architecture/modular-design', 'Modular Design']
47+
])
48+
},
49+
{
50+
title: 'Package Development',
51+
path: setVersionPrefix('packages'),
52+
collapsable: true,
53+
children: setVersionPrefix([
54+
['packages/create-package', 'Getting Started'],
55+
['packages/create-migrations', 'Migrations'],
56+
['packages/create-models', 'Models'],
57+
['packages/store-data-through-repositories', 'Repositories'],
58+
['packages/routes', 'Routes'],
59+
['packages/controllers', 'Controllers'],
60+
['packages/views', 'Views'],
61+
['packages/localization', 'Localization'],
62+
['packages/blade-components', 'Blade Components'],
63+
['packages/layouts', 'Layouts'],
64+
['packages/bundling-assets', 'Bundling Assets'],
65+
['packages/add-menu-in-admin', 'Admin Menu'],
66+
['packages/validation', 'Validation'],
67+
['packages/datagrid', 'DataGrid'],
68+
['packages/create-acl', 'Access Control List'],
69+
['packages/create-system-configuration', 'System Configuration']
70+
])
71+
},
72+
{
73+
title: 'Digging Deeper',
74+
path: setVersionPrefix('advanced'),
75+
collapsable: true,
76+
children: setVersionPrefix([
77+
['advanced/create-shipping-method', 'Shipping Method'],
78+
['advanced/create-payment-method', 'Payment Method'],
79+
['advanced/create-product-type', 'Product Type'],
80+
['advanced/events', 'Events Listeners'],
81+
['advanced/helpers', 'Helpers'],
82+
['advanced/override-core-model', 'Override Core Models'],
83+
['advanced/render-event', 'View Render Event'],
84+
['advanced/change-email-template.md', 'Email Template'],
85+
['advanced/indexing-products-to-elasticsearch.md', 'Configure Elasticsearch'],
86+
['advanced/security-practice', 'Best Security Practices'],
87+
['advanced/create-data-import', 'Data Transfer']
88+
])
89+
},
90+
{
91+
title: 'Themes',
92+
path: setVersionPrefix('themes'),
93+
collapsable: true,
94+
children: setVersionPrefix([
95+
['themes/create-store-theme', 'Store Theme'],
96+
['themes/create-admin-theme', 'Admin Theme'],
97+
])
98+
},
99+
{
100+
title: 'Bagisto APIs',
101+
path: setVersionPrefix('api'),
102+
collapsable: true,
103+
children: setVersionPrefix([
104+
['api/getting-started-with-the-api', 'Rest API'],
105+
])
106+
},
107+
]

docs/2.0/advanced/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Digging Deeper
2+
3+
Welcome to the "Digging Deeper" section of the Bagisto documentation. Here, we will explore various advanced topics related to Bagisto, which will enable you to customize and extend your e-commerce platform to suit your specific needs.
4+
5+
We expect you to have knowledge of creating packages in Laravel. If you are new to package development, we recommend referring to the [Package Development](../packages/create-package.html) section for a primer on creating and managing packages in Laravel.
6+
7+
### Creating Payment Methods
8+
9+
Bagisto provides a flexible and configurable system for integrating different payment methods into your e-commerce store. We will guide you through the process of setting up and configuring payment methods, allowing you to offer a variety of options to your customers while ensuring a seamless and secure checkout experience.
10+
11+
### Product Types
12+
13+
Bagisto supports different types of products, allowing you to showcase and sell a wide range of items. We will delve into the details of configuring and managing product types, giving you the ability to define specific attributes and behaviors for each product category.
14+
15+
### Shipping Methods
16+
17+
Efficient and reliable shipping is crucial for any e-commerce business. Bagisto offers robust features for managing shipping methods, enabling you to define various shipping options, rates, and rules based on factors such as location, weight, or order value. We will explain how to configure and customize shipping methods to streamline your order fulfillment process.
18+
19+
### Events and Event Handlers
20+
21+
Events and event handlers provide a powerful way to extend the functionality of Bagisto by allowing you to react to specific actions or triggers within the application. We will show you how to utilize events and event handlers effectively, enabling you to integrate custom functionalities and automate processes.
22+
23+
### Helpers
24+
25+
Bagisto includes a comprehensive set of helper functions that simplify common development tasks and enhance productivity. We will explore the various helper functions available, explaining their purpose and usage to assist you in writing clean and efficient code.
26+
27+
### Indexing through Elastic
28+
29+
To optimize search performance, Bagisto integrates with Elasticsearch, a highly scalable search engine. We will guide you through the process of indexing your data using Elastic, improving the search functionality of your e-commerce store and providing a seamless search experience for your customers.
30+
31+
### Overriding Core Models
32+
33+
Sometimes, you may need to modify or extend the default behavior of Bagisto's core models to accommodate your specific business requirements. We will demonstrate how to override core models effectively, enabling you to customize the behavior of Bagisto without modifying the underlying codebase.
34+
35+
### Data Transfer
36+
Directory Structure
37+
Creating a data import in a custom package makes it very easy to import bulk data into Bagisto. In Bagisto, data transfer can be found in the admin panel under the Settings Menu.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Email Template
2+
3+
[[TOC]]
4+
5+
## Introduction
6+
7+
In this section, we'll guide you through the process of customizing email templates in Bagisto. Customizing email templates allows you to personalize the appearance and content of email notifications sent from your Bagisto application.
8+
9+
## Email Template Flow
10+
11+
Before customizing, let's understand how email templates work in Bagisto. Bagisto uses mail notification classes located in namespaces like `Webkul\Admin\Mail`. These classes, such as `CancelOrderAdminNotification`, extend Laravel's `Mailable` class and define the email's structure and data.
12+
13+
Here's an example from `CancelOrderAdminNotification`:
14+
15+
```php
16+
<?php
17+
18+
namespace Webkul\Admin\Mail;
19+
20+
use Illuminate\Bus\Queueable;
21+
use Illuminate\Mail\Mailable;
22+
use Illuminate\Queue\SerializesModels;
23+
24+
class CancelOrderAdminNotification extends Mailable
25+
{
26+
use Queueable, SerializesModels;
27+
28+
/**
29+
* Order.
30+
*
31+
* @var \Webkul\Sales\Contracts\Order
32+
*/
33+
public $order;
34+
35+
/**
36+
* Constructor.
37+
*
38+
* @param \Webkul\Sales\Contracts\Order $order
39+
* @return void
40+
*/
41+
public function __construct($order)
42+
{
43+
$this->order = $order;
44+
}
45+
46+
/**
47+
* Build.
48+
*
49+
* @return void
50+
*/
51+
public function build()
52+
{
53+
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
54+
->to(core()->getAdminEmailDetails()['email'])
55+
->subject(trans('shop::app.mail.order.cancel.subject'))
56+
->view('shop::emails.sales.order-cancel-admin');
57+
}
58+
}
59+
```
60+
61+
In the `build()` method, the email view `shop::emails.sales.order-cancel-admin` is specified, which is located in the package's view directory.
62+
63+
The view file `order-cancel-admin.blade.php` typically includes a layout component, such as `shop::emails.layouts.master`.
64+
65+
Now, let's explore the view file mentioned in `view('shop::emails.sales.order-cancel-admin')`. If you check the file at the path `packages/Webkul/Shop/src/Resources/views/emails/sales/order-cancel-admin.blade.php`, you will find it. This view file uses the main layout component `shop::emails.layouts.master`.
66+
67+
```php
68+
@component('shop::emails.layout')
69+
...
70+
@endcomponent
71+
```
72+
73+
This layout component is responsible for the overall email layout. If desired, you can explore this file as well. Now, let's proceed to learn how to change these email templates.
74+
75+
## Changing Email Template
76+
77+
To customize an email template in Bagisto, follow these steps:
78+
79+
### Override the View
80+
81+
To customize the email template, the recommended approach is to override the package's view. Since all email views are defined in the shop package, we need to override the view within the shop package.
82+
83+
Here's how you can override the view for the same file we mentioned above, `view('shop::emails.sales.order-cancel-admin')`.
84+
85+
Bagisto registers two locations for views: the application's `resources/themes` directory specified in `config/themes.php`, and the directory you specify. If you are using the default theme, `shop` package, Bagisto will first check if a custom version of the view exists in the`resources/themes/default` directory. If the view has not been customized, Bagisto will then search the package's view directory.
86+
87+
To override the view, create the same directory structure in the application's `resources/themes/default` directory:
88+
89+
```
90+
- resources/
91+
└── themes/
92+
└── default/
93+
└── views/
94+
└── emails/
95+
└── sales/
96+
└── order-cancel-admin.blade.php
97+
```
98+
99+
For example, create a file named `order-cancel-admin.blade.php` within the `sales` directory, and modify its content as desired:
100+
101+
```blade
102+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum porro cumque numquam neque dicta quo, accusantium, perferendis sed beatae nesc
103+
104+
iunt eum impedit vel doloribus dolor excepturi vero tenetur perspiciatis saepe?
105+
```
106+
107+
### Test Your Template
108+
109+
After customizing the template, test it by triggering the relevant email notification from your Bagisto application to verify that the changes are applied correctly.
110+

0 commit comments

Comments
 (0)