-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #394 from shivendra-webkul/update-docs
Update theme code
- Loading branch information
Showing
68 changed files
with
8,733 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* set version */ | ||
let version = '2.0'; | ||
|
||
/* version prefix setter */ | ||
function setVersionPrefix(children) { | ||
if (children.constructor === Array) { | ||
return children.map(child => { | ||
child[0] = `/${version}/${child[0]}`; | ||
return child; | ||
}); | ||
} | ||
return `/${version}/${children}`; | ||
} | ||
|
||
/* module export */ | ||
module.exports = [ | ||
{ | ||
title: 'Prologue', | ||
path: setVersionPrefix('prologue'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['prologue/upgrade-guide', 'Upgrade Guide'], | ||
['prologue/contribution-guide', ' Contribution Guide'] | ||
]) | ||
}, | ||
{ | ||
title: 'Introduction', | ||
path: setVersionPrefix('introduction'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['introduction/requirements', 'Requirements'], | ||
['introduction/installation', 'Installation'], | ||
['introduction/docker', 'Docker'] | ||
]) | ||
}, | ||
{ | ||
title: 'Architecture concepts', | ||
path: setVersionPrefix('architecture'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['architecture/packages', 'Packages'], | ||
['architecture/frontend', 'Frontend'], | ||
['architecture/theme', 'Theme'], | ||
['architecture/performance', 'Performance'], | ||
['architecture/repository-pattern', 'Repository Pattern'], | ||
['architecture/modular-design', 'Modular Design'] | ||
]) | ||
}, | ||
{ | ||
title: 'Package Development', | ||
path: setVersionPrefix('packages'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['packages/create-package', 'Getting Started'], | ||
['packages/create-migrations', 'Migrations'], | ||
['packages/create-models', 'Models'], | ||
['packages/store-data-through-repositories', 'Repositories'], | ||
['packages/routes', 'Routes'], | ||
['packages/controllers', 'Controllers'], | ||
['packages/views', 'Views'], | ||
['packages/localization', 'Localization'], | ||
['packages/blade-components', 'Blade Components'], | ||
['packages/layouts', 'Layouts'], | ||
['packages/bundling-assets', 'Bundling Assets'], | ||
['packages/add-menu-in-admin', 'Admin Menu'], | ||
['packages/validation', 'Validation'], | ||
['packages/datagrid', 'DataGrid'], | ||
['packages/create-acl', 'Access Control List'], | ||
['packages/create-system-configuration', 'System Configuration'] | ||
]) | ||
}, | ||
{ | ||
title: 'Digging Deeper', | ||
path: setVersionPrefix('advanced'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['advanced/create-shipping-method', 'Shipping Method'], | ||
['advanced/create-payment-method', 'Payment Method'], | ||
['advanced/create-product-type', 'Product Type'], | ||
['advanced/events', 'Events Listeners'], | ||
['advanced/helpers', 'Helpers'], | ||
['advanced/override-core-model', 'Override Core Models'], | ||
['advanced/render-event', 'View Render Event'], | ||
['advanced/change-email-template.md', 'Email Template'], | ||
['advanced/indexing-products-to-elasticsearch.md', 'Configure Elasticsearch'], | ||
['advanced/security-practice', 'Best Security Practices'], | ||
['advanced/create-data-import', 'Data Transfer'] | ||
]) | ||
}, | ||
{ | ||
title: 'Themes', | ||
path: setVersionPrefix('themes'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['themes/create-store-theme', 'Store Theme'], | ||
['themes/create-admin-theme', 'Admin Theme'], | ||
]) | ||
}, | ||
{ | ||
title: 'Bagisto APIs', | ||
path: setVersionPrefix('api'), | ||
collapsable: true, | ||
children: setVersionPrefix([ | ||
['api/getting-started-with-the-api', 'Rest API'], | ||
]) | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Digging Deeper | ||
|
||
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. | ||
|
||
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. | ||
|
||
### Creating Payment Methods | ||
|
||
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. | ||
|
||
### Product Types | ||
|
||
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. | ||
|
||
### Shipping Methods | ||
|
||
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. | ||
|
||
### Events and Event Handlers | ||
|
||
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. | ||
|
||
### Helpers | ||
|
||
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. | ||
|
||
### Indexing through Elastic | ||
|
||
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. | ||
|
||
### Overriding Core Models | ||
|
||
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. | ||
|
||
### Data Transfer | ||
Directory Structure | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Email Template | ||
|
||
[[TOC]] | ||
|
||
## Introduction | ||
|
||
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. | ||
|
||
## Email Template Flow | ||
|
||
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. | ||
|
||
Here's an example from `CancelOrderAdminNotification`: | ||
|
||
```php | ||
<?php | ||
|
||
namespace Webkul\Admin\Mail; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class CancelOrderAdminNotification extends Mailable | ||
{ | ||
use Queueable, SerializesModels; | ||
|
||
/** | ||
* Order. | ||
* | ||
* @var \Webkul\Sales\Contracts\Order | ||
*/ | ||
public $order; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \Webkul\Sales\Contracts\Order $order | ||
* @return void | ||
*/ | ||
public function __construct($order) | ||
{ | ||
$this->order = $order; | ||
} | ||
|
||
/** | ||
* Build. | ||
* | ||
* @return void | ||
*/ | ||
public function build() | ||
{ | ||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name']) | ||
->to(core()->getAdminEmailDetails()['email']) | ||
->subject(trans('shop::app.mail.order.cancel.subject')) | ||
->view('shop::emails.sales.order-cancel-admin'); | ||
} | ||
} | ||
``` | ||
|
||
In the `build()` method, the email view `shop::emails.sales.order-cancel-admin` is specified, which is located in the package's view directory. | ||
|
||
The view file `order-cancel-admin.blade.php` typically includes a layout component, such as `shop::emails.layouts.master`. | ||
|
||
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`. | ||
|
||
```php | ||
@component('shop::emails.layout') | ||
... | ||
@endcomponent | ||
``` | ||
|
||
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. | ||
|
||
## Changing Email Template | ||
|
||
To customize an email template in Bagisto, follow these steps: | ||
|
||
### Override the View | ||
|
||
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. | ||
|
||
Here's how you can override the view for the same file we mentioned above, `view('shop::emails.sales.order-cancel-admin')`. | ||
|
||
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. | ||
|
||
To override the view, create the same directory structure in the application's `resources/themes/default` directory: | ||
|
||
``` | ||
- resources/ | ||
└── themes/ | ||
└── default/ | ||
└── views/ | ||
└── emails/ | ||
└── sales/ | ||
└── order-cancel-admin.blade.php | ||
``` | ||
|
||
For example, create a file named `order-cancel-admin.blade.php` within the `sales` directory, and modify its content as desired: | ||
|
||
```blade | ||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum porro cumque numquam neque dicta quo, accusantium, perferendis sed beatae nesc | ||
iunt eum impedit vel doloribus dolor excepturi vero tenetur perspiciatis saepe? | ||
``` | ||
|
||
### Test Your Template | ||
|
||
After customizing the template, test it by triggering the relevant email notification from your Bagisto application to verify that the changes are applied correctly. | ||
|
Oops, something went wrong.