GoogleShoppingController
extends AdminHttpViewController
in package
Class GoogleShoppingController
This controller displays the several pages for Google Shopping.
Tags
Table of Contents
- EXPORT_GROUP_ID = 3
- $assets : AssetCollectionInterface
- $configurationStorage : GoogleConfigurationStorage
- $contentView : ContentViewInterface
- $csvControl : CSVControl
- $db : CI_DB_query_builder
- $httpContextReader : HttpContextReaderInterface
- $httpResponseProcessor : HttpResponseProcessorInterface
- $jsBaseUrl : string
- $languageTextManager : LanguageTextManager
- $postDataArray : array<string|int, mixed>
- $queryParametersArray : array<string|int, mixed>
- $serverDataArray : array<string|int, mixed>
- $stylesBaseUrl : string
- $templatesBaseUrl : string
- __construct() : mixed
- actionCopyScheme() : bool|RedirectHttpControllerResponse
- Copies a scheme and redirects to the scheme overview.
- actionCreateScheme() : AdminLayoutHttpControllerResponse|bool
- Creates a new scheme.
- actionDefault() : AdminLayoutHttpControllerResponse|bool
- Displays the Google Shopping overview page.
- actionEditScheme() : AdminLayoutHttpControllerResponse|bool
- Edits a scheme.
- actionStoreScheme() : RedirectHttpControllerResponse
- Saves scheme data and redirects to scheme overview page.
- init() : mixed
- Initialize the controller.
- proceed() : mixed
- Processes a http response object which is get by invoking an action method.
- validateCurrentAdminStatus() : mixed
- Makes sure that the admin status is currently given in session
- _accountConnectionData() : mixed
- _callActionMethod() : HttpControllerResponseInterface
- Invokes an action method by the given action name.
- _getPostData() : string|null
- Returns the expected $_POST value by the given key name.
- _getPostDataCollection() : KeyValueCollection
- Creates and returns a key value collection which represent the global $_POST array.
- _getQueryParameter() : mixed|null
- Returns the expected $_GET value by the given key name.
- _getQueryParametersCollection() : KeyValueCollection
- Creates and returns a key value collection which represent the global $_GET array.
- _getServerData() : string|null
- Returns the expected $_SERVER value by the given key name.
- _render() : string
- Renders and returns a template file.
- _validatePageToken() : mixed
- Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
- generateDefaultSchemeData() : array<string|int, mixed>
- Generates and returns an array of default data for a scheme.
- generateSchemeData() : array<string|int, mixed>
- Decides if the scheme data should be fetched from an existing scheme or the default data.
- generateSchemeDataBySchemeId() : array<string|int, mixed>
- Generates and returns a data array by the given scheme ID.
- getAdditionalFields() : array<string|int, mixed>|null
- Returns all additional fields for a given language
- getAttributes() : array<string|int, mixed>|null
- Returns all product attributes for a given language
- getCampaigns() : array<string|int, mixed>
- Get all campaigns with Id, campaign RefId and name.
- getCurrencies() : array<string|int, mixed>
- Get all currencies with Id and currency code.
- getCustomerStatusArray() : array<string|int, mixed>
- Get all Customer Status IDs and names for the provided language ID.
- getDefaultFields() : array<string|int, mixed>
- Returns an array with the default fields for new Google Shopping schemes.
- getHours() : array<string|int, mixed>
- Returns an array with the hours.
- getIntervals() : array<string|int, mixed>
- Returns an array with the interval values.
- getLanguages() : array<string|int, mixed>
- Get all languages with Id and name.
- getProperties() : array<string|int, mixed>|null
- Returns all product properties for a given language
- getSchemeFields() : array<string|int, mixed>
- Gets an array of scheme fields represented in an array of scheme field data.
- getTemplateDataArray() : array<string|int, mixed>
- Generates all data that is needed by the template by an optional scheme ID
- getTemplateFile() : ExistingFile
- Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
- getTransformedFieldData() : array<string|int, mixed>
- Generates and returns an array with the field post data with array keys that corresponds with the table column names.
- getTransformedSchemeData() : array<string|int, mixed>
- Generates and returns an array with the scheme post data with array keys that corresponds with the table column names.
- getUniqueFilename() : string
- Creates and returns an unique export filename.
- getUniqueSchemeName() : string
- Creates and returns an unique scheme name.
- getVariables() : array<string|int, mixed>
- Returns all csv variables
- isValidJson() : bool
- isValidRequestMethod() : bool
- prepareJsonInput() : array<string|int, mixed>
- storeCategoryConfiguration() : mixed
- Stores the category configuration.
Constants
EXPORT_GROUP_ID
public
mixed
EXPORT_GROUP_ID
= 3
Properties
$assets
protected
AssetCollectionInterface
$assets
$configurationStorage
protected
GoogleConfigurationStorage
$configurationStorage
$contentView
protected
ContentViewInterface
$contentView
$csvControl
protected
CSVControl
$csvControl
$db
protected
CI_DB_query_builder
$db
$httpContextReader
protected
HttpContextReaderInterface
$httpContextReader
$httpResponseProcessor
protected
HttpResponseProcessorInterface
$httpResponseProcessor
$jsBaseUrl
protected
string
$jsBaseUrl
$languageTextManager
protected
LanguageTextManager
$languageTextManager
$postDataArray
protected
array<string|int, mixed>
$postDataArray
$queryParametersArray
protected
array<string|int, mixed>
$queryParametersArray
$serverDataArray
protected
array<string|int, mixed>
$serverDataArray
$stylesBaseUrl
protected
string
$stylesBaseUrl
$templatesBaseUrl
protected
string
$templatesBaseUrl
Methods
__construct()
public
__construct(HttpContextReaderInterface $httpContextReader, HttpResponseProcessorInterface $httpResponseProcessor, ContentViewInterface $defaultContentView) : mixed
Parameters
- $httpContextReader : HttpContextReaderInterface
- $httpResponseProcessor : HttpResponseProcessorInterface
- $defaultContentView : ContentViewInterface
Return values
mixed —actionCopyScheme()
Copies a scheme and redirects to the scheme overview.
public
actionCopyScheme() : bool|RedirectHttpControllerResponse
Return values
bool|RedirectHttpControllerResponse —actionCreateScheme()
Creates a new scheme.
public
actionCreateScheme() : AdminLayoutHttpControllerResponse|bool
Return values
AdminLayoutHttpControllerResponse|bool —actionDefault()
Displays the Google Shopping overview page.
public
actionDefault() : AdminLayoutHttpControllerResponse|bool
Return values
AdminLayoutHttpControllerResponse|bool —actionEditScheme()
Edits a scheme.
public
actionEditScheme() : AdminLayoutHttpControllerResponse|bool
Return values
AdminLayoutHttpControllerResponse|bool —actionStoreScheme()
Saves scheme data and redirects to scheme overview page.
public
actionStoreScheme() : RedirectHttpControllerResponse
Return values
RedirectHttpControllerResponse —init()
Initialize the controller.
public
init() : mixed
Return values
mixed —proceed()
Processes a http response object which is get by invoking an action method.
public
proceed(HttpContextInterface $httpContext) : mixed
The action method is determined by the http context reader instance and the current request context. Re-implement this method in child classes to enable XSS and CSRF protection on demand.
Parameters
- $httpContext : HttpContextInterface
-
Http context object which hold the request variables.
Tags
Return values
mixed —validateCurrentAdminStatus()
Makes sure that the admin status is currently given in session
public
validateCurrentAdminStatus() : mixed
Tags
Return values
mixed —_accountConnectionData()
protected
_accountConnectionData() : mixed
Return values
mixed —_callActionMethod()
Invokes an action method by the given action name.
protected
_callActionMethod(string $actionName) : HttpControllerResponseInterface
Parameters
- $actionName : string
-
Name of action method to call, without 'action'-Suffix.
Tags
Return values
HttpControllerResponseInterface —Response message.
_getPostData()
Returns the expected $_POST value by the given key name.
protected
_getPostData(string $keyName) : string|null
This method is the object oriented layer for $_POST[$keyName].
Parameters
- $keyName : string
-
Expected key of post parameter.
Return values
string|null —Either the expected value or null, of not found.
_getPostDataCollection()
Creates and returns a key value collection which represent the global $_POST array.
protected
_getPostDataCollection() : KeyValueCollection
Return values
KeyValueCollection —_getQueryParameter()
Returns the expected $_GET value by the given key name.
protected
_getQueryParameter(string $keyName) : mixed|null
This method is the object oriented layer for $_GET[$keyName].
Parameters
- $keyName : string
-
Expected key of query parameter.
Return values
mixed|null —Either the expected value or null, of not found.
_getQueryParametersCollection()
Creates and returns a key value collection which represent the global $_GET array.
protected
_getQueryParametersCollection() : KeyValueCollection
Return values
KeyValueCollection —_getServerData()
Returns the expected $_SERVER value by the given key name.
protected
_getServerData(string $keyName) : string|null
This method is the object oriented layer for $_SERVER[$keyName].
Parameters
- $keyName : string
-
Expected key of server parameter.
Return values
string|null —Either the expected value or null, of not found.
_render()
Renders and returns a template file.
protected
_render(string $templateFile, array<string|int, mixed> $contentArray) : string
Parameters
- $templateFile : string
-
Template file to render.
- $contentArray : array<string|int, mixed>
-
Content array which represent the variables of the template.
Return values
string —Rendered template.
_validatePageToken()
Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
protected
_validatePageToken([string $customExceptionMessage = null ]) : mixed
Example: public function proceed(HttpContextInterface $httpContext) { parent::proceed($httpContext); // proceed http context from parent class if($_SERVER['REQUEST_METHOD'] === 'POST') { $this->_validatePageToken(); // CSRF Protection } }
Parameters
- $customExceptionMessage : string = null
-
(optional) You can specify a custom exception message.
Tags
Return values
mixed —generateDefaultSchemeData()
Generates and returns an array of default data for a scheme.
protected
generateDefaultSchemeData() : array<string|int, mixed>
Return values
array<string|int, mixed> —The default data array
generateSchemeData()
Decides if the scheme data should be fetched from an existing scheme or the default data.
protected
generateSchemeData([IdType|null $schemeId = null ]) : array<string|int, mixed>
Parameters
- $schemeId : IdType|null = null
-
The optional scheme ID
Return values
array<string|int, mixed> —Scheme data array
generateSchemeDataBySchemeId()
Generates and returns a data array by the given scheme ID.
protected
generateSchemeDataBySchemeId(IdType $schemeId) : array<string|int, mixed>
Parameters
- $schemeId : IdType
-
The scheme ID
Return values
array<string|int, mixed> —A data array that contains all needed information about the scheme
getAdditionalFields()
Returns all additional fields for a given language
protected
getAdditionalFields(IdType $languageId) : array<string|int, mixed>|null
Parameters
- $languageId : IdType
-
Language id for the additional fields
Return values
array<string|int, mixed>|null —getAttributes()
Returns all product attributes for a given language
protected
getAttributes(IdType $languageId) : array<string|int, mixed>|null
Parameters
- $languageId : IdType
-
Language id for the additional fields
Return values
array<string|int, mixed>|null —getCampaigns()
Get all campaigns with Id, campaign RefId and name.
protected
getCampaigns() : array<string|int, mixed>
Return values
array<string|int, mixed> —All campaigns with Id, campaign RefId and name.
getCurrencies()
Get all currencies with Id and currency code.
protected
getCurrencies() : array<string|int, mixed>
Return values
array<string|int, mixed> —All currencies with ID and currency code.
getCustomerStatusArray()
Get all Customer Status IDs and names for the provided language ID.
protected
getCustomerStatusArray(IdType $languageId) : array<string|int, mixed>
Parameters
- $languageId : IdType
Return values
array<string|int, mixed> —All customer status IDs and customer status names.
getDefaultFields()
Returns an array with the default fields for new Google Shopping schemes.
protected
getDefaultFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —Default fields for new Google Shopping schemes.
getHours()
Returns an array with the hours.
protected
getHours() : array<string|int, mixed>
Return values
array<string|int, mixed> —Hours.
getIntervals()
Returns an array with the interval values.
protected
getIntervals() : array<string|int, mixed>
Return values
array<string|int, mixed> —Intervals.
getLanguages()
Get all languages with Id and name.
protected
getLanguages() : array<string|int, mixed>
Return values
array<string|int, mixed> —All languages with Id and language code.
getProperties()
Returns all product properties for a given language
protected
getProperties(IdType $languageId) : array<string|int, mixed>|null
Parameters
- $languageId : IdType
-
Language id for the additional fields
Return values
array<string|int, mixed>|null —getSchemeFields()
Gets an array of scheme fields represented in an array of scheme field data.
protected
getSchemeFields(IdType $schemeId) : array<string|int, mixed>
Parameters
- $schemeId : IdType
-
The ID of the subjected scheme
Return values
array<string|int, mixed> —A two dimensional array that represents all field data of the scheme
getTemplateDataArray()
Generates all data that is needed by the template by an optional scheme ID
protected
getTemplateDataArray([IdType|null $schemeId = null ]) : array<string|int, mixed>
Parameters
- $schemeId : IdType|null = null
-
Optional scheme ID from which the scheme data is fetched from. If not set, default scheme data is provided
Return values
array<string|int, mixed> —Data the template needs to display the page
getTemplateFile()
Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
protected
getTemplateFile(string $templateFile) : ExistingFile
Parameters
- $templateFile : string
-
The relative path and filename to search for
Tags
Return values
ExistingFile —containing absolute file path to the given template file
getTransformedFieldData()
Generates and returns an array with the field post data with array keys that corresponds with the table column names.
protected
getTransformedFieldData(array<string|int, mixed> $fieldData) : array<string|int, mixed>
Parameters
- $fieldData : array<string|int, mixed>
-
The field form data
Return values
array<string|int, mixed> —The field data with keys that corresponds with table column names for using with GMDataObject.
getTransformedSchemeData()
Generates and returns an array with the scheme post data with array keys that corresponds with the table column names.
protected
getTransformedSchemeData(array<string|int, mixed> $schemePostData) : array<string|int, mixed>
Parameters
- $schemePostData : array<string|int, mixed>
-
The scheme form data
Return values
array<string|int, mixed> —The scheme data with keys that corresponds with table column names for using with GMDataObject.
getUniqueFilename()
Creates and returns an unique export filename.
protected
getUniqueFilename(IdType $schemeId, FilenameStringType $filename) : string
If the given export filename already exists, the scheme name will be appended with an incrementing numeric postfix until it is unique.
Parameters
- $schemeId : IdType
- $filename : FilenameStringType
Return values
string —The unique export filename.
getUniqueSchemeName()
Creates and returns an unique scheme name.
protected
getUniqueSchemeName(IdType $schemeId, NonEmptyStringType $schemeName) : string
If the given scheme name already exists, the scheme name will be appended with an incrementing numeric postfix until it is unique.
Parameters
- $schemeId : IdType
- $schemeName : NonEmptyStringType
Return values
string —The unique scheme name.
getVariables()
Returns all csv variables
protected
getVariables() : array<string|int, mixed>
Return values
array<string|int, mixed> —isValidJson()
protected
isValidJson(string $string) : bool
Parameters
- $string : string
Return values
bool —isValidRequestMethod()
protected
isValidRequestMethod(string $method) : bool
Parameters
- $method : string
Return values
bool —prepareJsonInput()
protected
prepareJsonInput(string $json) : array<string|int, mixed>
Parameters
- $json : string
Return values
array<string|int, mixed> —storeCategoryConfiguration()
Stores the category configuration.
protected
storeCategoryConfiguration(int $schemeId) : mixed
Parameters
- $schemeId : int