Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<aura:component implements="forceCommunity:availableForAllPageTypes">
<!-- private attributes -->
<aura:attribute name="url" type="String" default="" access="PRIVATE" />
<aura:attribute name="token" type="String" default="" access="PRIVATE" />
<!-- CHANGE THIS TO YOUR COMMUNITY SITE PREFIX -->
<aura:attribute name="sitePrefix" type="String" default="/ltng2" access="PRIVATE" />
<!-- component events -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:handler name="eCommerceTokenUpdated" event="c:eCommerceTokenUpdated" action="{!c.doInit}" />
<KGRenewal:eCommerceCartTokenProvider aura:id="tokenProvider" />
<a href="{!v.url}">Nav with token: {!v.token}</a>
</aura:component>
({
doInit: function(component) {
var tokenProviderCmp = component.find('tokenProvider');
component.set('v.token', tokenProviderCmp.get('v.eCommerceOrderToken'));
console.log('Link got from provider: ' + component.get('v.token'));
component.set('v.url', component.get('v.sitePrefix') + '/apex/KGRenewal__TransferSession?nextURL=' + encodeURIComponent(component.get('v.sitePrefix') + '/apex/TestCookieTransfer') + '&kg-ecomm-id=' + encodeURIComponent(component.get('v.token')));
}
})
<apex:page controller="KGRenewal.ECommerceCartController" showHeader="true" sidebar="true">
{!eCommerceOrder.Name}
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.