This cartridge (together with ThirdPartyConfigProvider) is used by 3rd party cartridges to configure settings in the provider back office without developing a provider cartridge for each 3rd party cartridge as it was in the past.
This cartridge is available from epages 6.09 on.
If the PBO user clicks on one of the 3rd party config tabs, the ThirdPartyConfigProvider cartridge sends a webservice request to the respective store. The webservice client in the ThirdPartyConfig cartridge triggers the hook API_GetThirdPartyConfigAttributes. The 3rd party cartridges use this hook to register their attributes for configuration. After the hook execution is finished the webservice function collects all the necessary data (type, current value, name, description) for every attribute and sends it back to the ThirdPartyConfigProvider cartridge, which builds the settings page in PBO.
<?xml version="1.0" encoding="UTF-8"?> <epages> <Dependency Package="DE_EPAGES::Payment" /> <Dependency Package="DE_EPAGES::Order" /> <Dependency Package="DE_EPAGES::ThirdPartyConfig" /> </epages>
<?xml version="1.0" encoding="UTF-8"?> <epages> <Hook reference="1" Name="API_GetThirdPartyConfigAttributes"> <HookFunction FunctionName="DE_EPAGES::WorldPay::Hooks::Attribute::OnGetThirdPartyConfigAttributes" OrderNo="180" delete="1" /> </Hook> </epages>
package DE_EPAGES::WorldPay::Hooks::Attribute; use strict; use DE_EPAGES::Object::API::Factory qw (LoadObjectByPath GetRootObjectID); use DE_EPAGES::ThirdPartyConfig::API::Constants qw (ATTRIBUTES_CATEGORY_PAYMENT); sub OnGetThirdPartyConfigAttributes { my ($hParams) = @_; return unless $hParams->{'AttributesCategory'} eq ATTRIBUTES_CATEGORY_PAYMENT; my $PaymentType = LoadObjectByPath('/PaymentTypes/WorldPay'); my $RootObjectID = GetRootObjectID(); push(@{$hParams->{'Attributes'}}, { 'SectionID' => $PaymentType->alias, 'SectionName' => $PaymentType->get('NameOrAlias', $hParams->{'LanguageID'}), 'Attributes' => [ {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'Worldpay_logging'}, {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'Worldpay_registerURL1'}, {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'Worldpay_registerURL2'}, {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'Worldpay_adminURL'}, {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'Worldpay_purchaseURL'}, {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'Worldpay_purchaseTestURL'} ] }); return; } 1;The hook function will be called with several parameters:
package DE_EPAGES::Pangora::Hooks::Attribute; use strict; use DE_EPAGES::Object::API::Factory qw (GetRootObjectID LoadObjectByPath LoadRootObject); use DE_EPAGES::ThirdPartyConfig::API::Constants qw (ATTRIBUTES_CATEGORY_PRODUCTPORTAL); sub OnGetThirdPartyConfigAttributes { my ($hParams) = @_; return unless $hParams->{'AttributesCategory'} eq ATTRIBUTES_CATEGORY_PRODUCTPORTAL; my $RootObjectID = GetRootObjectID(); my $Portal = LoadObjectByPath('/Portals/Pangora'); my @Attributes = ( {'ObjectID' => $Portal->id, 'AttributeAlias' => 'Logging'}, {'ObjectID' => $RootObjectID, 'AttributeAlias' => 'PangoraTrackingID'} ); my $ProtocolAndServer = LoadRootObject()->get('ProtocolAndServerSSL'); foreach my $PortalSite (@{$Portal->get('PortalSites')}) { my $IconImage = $PortalSite->get('FlagGif'); my $IconImageText = undef; if (defined $IconImage) { $IconImage = $ProtocolAndServer . $IconImage; $IconImageText = $PortalSite->get('Country')->{'Native'} . ' / ' . $PortalSite->get('Language')->{'Native'}; } push(@Attributes, {'ObjectID' => $PortalSite->id, 'AttributeAlias' => 'RegisterURL', 'IconImage' => $IconImage, 'IconImageText' => $IconImageText}, {'ObjectID' => $PortalSite->id, 'AttributeAlias' => 'PortalURL', 'IconImage' => $IconImage, 'IconImageText' => $IconImageText}, {'ObjectID' => $PortalSite->id, 'AttributeAlias' => 'EMail', 'IconImage' => $IconImage, 'IconImageText' => $IconImageText}, {'ObjectID' => $PortalSite->id, 'AttributeAlias' => 'Phone', 'IconImage' => $IconImage, 'IconImageText' => $IconImageText} ); } push(@{$hParams->{'Attributes'}}, { 'SectionID' => $Portal->alias, 'SectionName' => $Portal->get('NameOrAlias', $hParams->{'LanguageID'}), 'Attributes' => \@Attributes }); return; } 1;