Download the PHP package arkonsoft/ps-module-core without Composer
On this page you can find all versions of the php package arkonsoft/ps-module-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arkonsoft/ps-module-core
More information about arkonsoft/ps-module-core
Files in arkonsoft/ps-module-core
Package ps-module-core
Short Description Core utilities for PrestaShop module
License MIT
Informations about the package ps-module-core
PS Module Core
Introduction
Creating modules for Presta is a real horror story. This package contains basic tools to make development a little less masochistic.
Requirements
- PHP >= 7.0
Installation
Install package with composer:
Basic usage
AbstractModule
Inherit the AbstractModule class from your module class. Now you have access to the $this->canBeUpgraded() method, which can be used to display a warning about module updates or anything else.
You can also use the ModuleCategory dictionary to set $this->tab, which contains the module category (it has meaning on the module list page).
AbstractAdminSettingsController
Inherit from the AbstractAdminSettingsController class on your module AdminController class. Now all you need to do is define the fields of the settings form in HelperForm format and you're done!
Data writing and reading operations happen in the abstract class so you can focus only on defining the fields.
Definitions
AbstractModule Class
The AbstractModule
class extends the PrestaShop Module
class and provides common functionalities for PrestaShop modules.
getDatabaseVersion Method
This method retrieves the database version of the module from the PrestaShop database.
canBeUpgraded Method
This method checks if the database version of the module is lower than the specified version, indicating a potential need for upgrade.
Example usage:
ModuleCategory Interface
The ModuleCategory
interface defines constants representing different categories of PrestaShop modules.
Constants
ADMINISTRATION
: Modules related to administration.ADVERTISING_MARKETING
: Modules related to advertising and marketing.ANALYTICS_STATS
: Modules for analytics and statistics.BILLING_INVOICING
: Modules for billing and invoicing.CHECKOUT
: Modules related to the checkout process.CONTENT_MANAGEMENT
: Modules for content management.DASHBOARD
: Modules for dashboard functionalities.EMAILING
: Modules related to emailing.EXPORT
: Modules for exporting data.FRONT_OFFICE_FEATURES
: Modules providing features for the front office.I18N_LOCALIZATION
: Modules for internationalization and localization.MARKET_PLACE
: Modules related to marketplaces.MERCHANDIZING
: Modules for merchandizing.MIGRATION_TOOLS
: Modules for migration tools.MOBILE
: Modules optimized for mobile devices.OTHERS
: Other miscellaneous modules.PAYMENTS_GATEWAYS
: Modules for payments and gateways.PAYMENT_SECURITY
: Modules for payment security.PRICING_PROMOTION
: Modules for pricing and promotions.QUICK_BULK_UPDATE
: Modules for quick bulk updates.SEARCH_FILTER
: Modules for search and filtering.SEO
: Modules for search engine optimization.SHIPPING_LOGISTICS
: Modules for shipping and logistics.SLIDESHOWS
: Modules for creating slideshows.SMART_SHOPPING
: Modules for smart shopping.SOCIAL_NETWORKS
: Modules integrating with social networks.
Example usage:
TabDictionary Interface
The TabDictionary interface contains constants that represent various tabs in the PrestaShop admin panel. Each constant is a string that corresponds to an admin section.
Constants
Example Constants
ACCESS
: Represents the "AdminAccess" tab.ADDONS_CATALOG
: Represents the "AdminAddonsCatalog" tab.ADDRESSES
: Represents the "AdminAddresses" tab.ADVANCED_PARAMETERS
: Represents the "AdminAdvancedParameters" tab.ATTACHMENTS
: Represents the "AdminAttachments" tab.ATTRIBUTES_GROUPS
: Represents the "AdminAttributesGroups" tab.BACKUP
: Represents the "AdminBackup" tab.CARRIERS
: Represents the "AdminCarriers" tab.CART_RULES
: Represents the "AdminCartRules" tab.CARTS
: Represents the "AdminCarts" tab.CATALOG
: Represents the "AdminCatalog" tab.-
CATEGORIES
: Represents the "AdminCategories" tab.
Example usage:
AbstractAdminSettingsController Class
The AbstractAdminSettingsController
class extends the PrestaShop ModuleAdminController
class and provides functionalities for managing module settings in the admin panel better than native OptionsAPI.
Constructor
The constructor method initializes the AbstractAdminSettingsController
class by setting up the context, bootstrapping, and calling the prepareOptions
method.
prepareOptions Method
This abstract method is used to prepare options for the settings controller. Subclasses must implement this method.
initContent Method
This method initializes the content of the settings controller by rendering the form.
postProcess Method
This method handles post-processing tasks after form submission, such as saving form data.
dispatchAction Method
This method dispatches actions based on form submissions.
renderForm Method
This method renders the form using the HelperForm
class.
loadFormValues Method
This method loads form values from the database.
saveForm Method
This method saves form data to the database.
Other Helper Methods
loadField
: Loads a field value from the database.loadCategoryField
: Loads values for a category field from the database.saveField
: Saves a field value to the database.saveLangField
: Saves a multilingual field value to the database.saveCategoryField
: Saves values for a category field to the database.isHTMLAllowed
: Checks if HTML is allowed for a field type.isNestedArray
: Checks if an array is nested.