Closed eduardogomez97 closed 1 month ago
Doing a previous research of all the functions and methods.
After reviewing every function I came to the following proposal:
function __construct()
function install()
function uninstall()
function hookModuleRoutes()
function installDb()
function autoinstaller($shop_id = null)
function installTabs()
function uninstallTabs()
function uninstallDb()
function deleteConfigVars()
function getInstallUrl($region)
function getShopBaseURI($shop)
function getShopURL($shop_id)
function buildFeedUrl($shop_id, $language, $currency) → rename to getFeedUrl($shop_id, $language, $currency)
function getProcessCallbackUrl()
function hookModuleRoutes()
function configureHookCommon($params = false)
function hookHeader($params)
function proccessHookUpdateOnSave($object, $id_object, $action)
function hookActionProductSave($params)
function hookActionProductDelete($params)
function hookActionObjectCmsAddAfter($params)
function hookActionObjectCmsUpdateAfter($params)
function hookActionObjectCmsDeleteAfter($params)
function hookActionObjectCategoryAddAfter($params)
function hookActionObjectCategoryUpdateAfter($params)
function hookActionObjectCategoryDeleteAfter($params)
function allowProcessItemsQueue()
function setExecUpdateOnSave()
function addItemQueue($object, $id_object, $id_shop, $action)
function processItemQueue($id_shop)
function getItemsQueue($id_shop, $type, $action = 'update')
function deleteItemsQueue($id_shop)
function sendProductApi($products, $id_shop, $id_lang, $id_currency, $action = 'update')
function sendCmsApi($cms_pages, $id_shop, $id_lang, $id_currency, $action = 'update')
function sendCategoryApi($categories, $id_shop, $id_lang, $id_currency, $action = 'update')
function updateItemsApi($hashid, $type, $payload)
function deleteItemsApi($hashid, $type, $payload)
function deleteItemsApi($hashid, $type, $payload)
function indexApiInvokeReindexing()
function is_valid_update_on_save() → Change to camelCase
function testDoofinderApi($onlyOneLang = false)
function searchOnApi($string, $page = 1, $page_size = 12, $timeout = 8000, $filters = null, $return_facets = false)
function saveApiData($apikey, $api_endpoint, $admin_endpoint)
function checkApiKey($text = false)
function getLanguageByHashid($hashid)
function getLanguageIdByLocale($locale)
function getIsoCodeById($id)
function getLanguageCode($code)
function SetSearchEnginesByConfig()
function getHashId($id_lang, $id_currency)
function createStore($shop)
function getContent()
function isConfigured()
function showNewShopForm($shop)
function renderFormDataFeed($adv = false)
function renderFormAdvanced()
function renderFeedURLs()
function getWarningMultishopHtml()
All display functions
function displayScriptLiveLayer()
function displayScriptV7() → It will be deleted
function searchLayerMustBeInitialized()
function getConfigFormSearchLayer()
function getConfigFormDataFeed($valid_update_on_save = false)
function getConfigFormValuesDataFeed()
function getConfigFormAdvanced()
function getConfigFormValuesAdvanced()
function getBooleanFormValue()
function checkOutsideConnection()
function setDefaultShopConfig($shopGroupId, $shopId)
function debug($message)
function postProcess()
✅ Validated with @sofia-doofinder
She thinks that the proposed structure is cleaner and easier to read and understand. After talking to her, we agreed to change the name of the files to PascalCase to fullfil Prestashop coding standards.
HookManager has to be shorten since some functions which contains protected attributes cannot be migrated.
Small update: createStore won't be moved from DoofinderInstallation class since it fits very well here.
I'm going to add some translations 🤞
The translations were messed up after the refactor, but luckily I've noticed it before releasing the major changes in the translations
It's live now 🙌
We have been reviewing the doofinder.php file and believe that it should be refactored as it is a monolith with too much functionality. From update on save stuff that can be taken out to its own files and response checks for the different apis we have. Investigate what else could be moved and make the code cleaner.
Some examples: