![]() |
Change widget class of some field in Checkout
I want to change the Field City widget class from
\XLite\View\FormField\Input\Text into \XLite\View\FormField\Select\MyCustomClass(). Is there a way to do this job ? |
Re: Change widget class of some field in Checkout
Hi @Alex,
Try to update 'schemaClass' column in the xc_address_field MySQL table for 'city' field. These values are defined by the sql/xlite_data.yaml file, which is loaded during installation, so the new value should not be overwritten by store re-deployment. Tony Quote:
|
Re: Change widget class of some field in Checkout
Quote:
Yes, this is was the solution that i found and use but still remains a problem because when i finish my module i want to install in an production env and there i don't have the access to go and hard-code the yaml file. I need a solution if can be posible to do this task when i deploy the module. |
Re: Change widget class of some field in Checkout
Quote:
There are several ways how to overcome the problem. 1) Decorate \XLite\Model\AddressField class and define its getSchemaClass() method as follows: Code:
public function getSchemaClass() 2) In your module's Main.php file create runBuildCacheHandler() method that will change 'schemaClass' property of the Address Field. Here is an example script that shows how you can change 'schemaClass' property for 'city' address field: Code:
<?php So, in your module you should define 'schemaClass' as your own value, if the module is enabled: Code:
\XLite\Core\Database::getRepo('XLite\Model\Module')->isModuleEnabled('DevID\ModuleID') or if your module is inactive, then you define 'schemaClass' as usual '\XLite\View\FormField\Input\Text'. Please, let me know if it makes sense to you. Tony |
All times are GMT -8. The time now is 03:16 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.