Git Product home page Git Product logo

b2b-commerce-for-visualforce's Introduction

B2B Commerce for Visualforce

Further integrate your fully featured Visualforce storefront with an Experience Builder site, and deliver a smooth transitional experience for your buyers across your solution.

This guide describes how to deploy the B2B Commerce Header component using Salesforce CLI (https://developer.salesforce.com/tools/sfdxcli).

Prerequisites

Get the Code

Clone the b2b-commerce-for-visualforce repo.

git clone [email protected]:forcedotcom/b2b-commerce-for-visualforce.git

Connect SFDX to your org

Navigate to the project directory.

cd b2b-commerce-for-visualforce

If you haven’t already created an SFDX connection to the org, use the following command. The -s parameter sets the org as default for the current project. Replace myorg with an alias that you want to use.

sfdx force:auth:web:login -s -a myorg

If you already have a connection to the QA org, or forgot the -s parameter, set the QA org as the default for the current project. Replace myqa with the alias of your QA org.

sfdx force:config:set defaultusername=myorg

Deploy the B2B Commerce Header Component

Deploy the component using the force:source:deploy command.

sfdx force:source:deploy -m LightningComponentBundle

Add the B2B Commerce Header Component to your Experience Builder Site

You can login to your org using the following SFDX command.

sfdx force:org:open
  • From Setup, enter All Sites in the Quick Find box, and then select All Sites.
  • Click Builder next to the site that you want to use.
  • In Experience Builder, drag the B2B Commerce Header (Unmanaged) component and drop it on the header section of the page.
  • Click Publish.

The default component is styled for the Capricorn Coffee demo theme, and uses Google fonts. To continue using Google fonts and avoid CSP warnings, add the following CSP entries:

  • From Setup, select CSP Trusted Sites.

  • Click New Trusted Site.

  • Set the following values:

    • Trusted Site Name: Google_Fonts_CSS
    • Trusted Site URL: https://fonts.googleapis.com
    • Active: Enabled
    • Context: Experience Builder Sites
    • Under CSP Directives, enable Allow site for style-src.
  • Click New Trusted Site.

  • Set the following values:

    • Trusted Site Name: Google_Static_Fonts
    • Trusted Site URL: https://fonts.gstatic.com
    • Active: Enabled
    • Context: Experience Builder Sites
    • Under CSP Directives, enable Allow site for font-src.

Enable Users to View Components

The B2B Commerce Header component makes calls to several Apex Classes in the B2B Commerce for Visualforce managed package. For users of the community to properly view the component, they need access to these Apex Classes. To provide this access, update applicable commmunity users' profiles and/or guest user permission sets with access to the following Apex Classes:

  • ccrz.b2b_lwc_CartHeaderController
  • ccrz.b2b_lwc_CommonServices
  • ccrz.b2b_lwc_EffectiveAccountController
  • ccrz.b2b_lwc_FeaturedProductsController
  • ccrz.b2b_lwc_LanguageController
  • ccrz.b2b_lwc_MenuController
  • ccrz.b2b_lwc_MyAccountController
  • ccrz.b2b_lwc_ReOrderController
  • ccrz.b2b_lwc_SearchController
  • ccrz.cc_bean_EffectiveAccount
  • ccrz.cc_bean_MenuItem
  • ccrz.cc_bean_MockContactAddress

Customize the Components

You can now customize the components for your storefront's brand identity. First, modify the components in the force-app/main/default/lwc directory, then push to the org using your IDE or using the force:source:deploy SFDX command.

sfdx force:source:deploy -m LightningComponentBundle

To change the theme that the B2B Commerce Header component uses, modify line 11 in b2b_Header.js and deploy the changes. For example:

import themeResource from '@salesforce/resourceUrl/MyStorefrontTheme';

This change causes the header to look for the styles.css in a B2B Commerce theme static resource called MyStorefrontTheme.

b2b-commerce-for-visualforce's People

Contributors

codeburton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.