Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diy controllers #1

Open
wants to merge 9 commits into
base: DIY_ISML
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lerna-debug.log*
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
.DS_Store
pids
*.pid
*.seed
Expand Down
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# Salesforce B2C Commerce Developer 101 : ISMLs
# Salesforce B2C Commerce Developer 101 : Controllers

This branch has the changes required to support the DIY's requirements. We will implement the following parts of the overall approach:
This branch has the changes required to support the following DIY's requirements. We will implement the following parts of the overall approach:

* Make changes to the required ISMLs, Forms, Models, Resource Properties.
* Extend the profile object to accommodate the weather preference, create a custom attribute.
* Extend the Account controller to persist & retrieve this preference.

# Implementation Changes to be done:

> First complete the [tasks](https://github.com/pravngaur/Dev_101/blob/DIY_Controllers/README.md#implementation-changes-to-be-done) mentioned in DIY_Controllers branch.
* Create a custom cartridge custom_app_dev101
* Update the cartridge path to: custom_app_dev101:app_storefront_base
* Extended the Profile System Object to have an additional attribute which holds the value for product's preferred season of usage. Enum of Strings: WINTER, SUMMER, RAIN.
* Inherit the Account.js controller in the new cartridge.

* Override the editProfileForm.isml & profileCard.isml in your custom cartridge -- this is to accomodate the additional custom attribute to be persisted & shown.
* Add the required properties(for the new attribute) in the resource bundles.
* Update account.js model to accommodate the new attribute -- this is to show the value of the attribute on profile page.
* Update the profile.xml form to persist the customer's selection in Profile's custom attribute. Remember the possible values a customer can choose should match to the values of enum-of-string in the profile metadata.
_Please try doing these changes yourself first & then compare with this branch._

# Configuration changes required:

#### Adding custom profile attribute:

* You can do that by importing the profile_extension.xml file in sites folder.
* Or do that manually by updating the profile system object to add a custom attribute named 'weather_preference' as enum of strings type:

![Attribute config](https://github.com/pravngaur/Dev_101/blob/DIY_Controllers/custom_app_dev101/docs/profile_attr_1.png)

Values:

![Attribute values](https://github.com/pravngaur/Dev_101/blob/DIY_Controllers/custom_app_dev101/docs/profile_attr_2.png)

_Please try doing these changes yourself first & then compare with this branch. No config changes required for this task._
2 changes: 1 addition & 1 deletion custom_app_dev101/cartridge/controllers/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function (req, res, next) {
profile.setPhoneHome(formInfo.phone);
// TODO: In productionize code, you ideally should store 'WINTER' in custom preferences(or someehere else as config).
// Should not hard code it
profile.custom.weather_preference = formInfo.weatherPref;
profile.custom.weather_preference = 'WINTER';
});

// Send account edited email
Expand Down
109 changes: 0 additions & 109 deletions custom_app_dev101/cartridge/forms/default/profile.xml

This file was deleted.

50 changes: 0 additions & 50 deletions custom_app_dev101/cartridge/models/account.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file added custom_app_dev101/docs/profile_attr_1.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 custom_app_dev101/docs/profile_attr_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.