- Posts: 25
- Thank you received: 0
PHP Variable as default value for custom fields
10 years 3 months ago #244022
by ingjjaa
PHP Variable as default value for custom fields was created by ingjjaa
-- HikaShop version -- : 3.6
-- Joomla version -- : 3.5.2
-- PHP version -- : 5.4
-- Error-message(debug-mod must be tuned on) -- : Value for custom fields
HI i have create a custom field name amountofproduct which should storage the amount of items in the cart i have no problem to get thata number in a php code variable, the problem is thata i could put thata field like just disable (just read) vut how could i give the value of the php variable to the default value of the field.
-- Joomla version -- : 3.5.2
-- PHP version -- : 5.4
-- Error-message(debug-mod must be tuned on) -- : Value for custom fields
HI i have create a custom field name amountofproduct which should storage the amount of items in the cart i have no problem to get thata number in a php code variable, the problem is thata i could put thata field like just disable (just read) vut how could i give the value of the php variable to the default value of the field.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #244031
by nicolas
Replied by nicolas on topic PHP Variable as default value for custom fields
Hi,
The way to do it will depend on how you configured your custom field.
Could you provide a screenshot of the settings of your custom field ?
The way to do it will depend on how you configured your custom field.
Could you provide a screenshot of the settings of your custom field ?
Please Log in or Create an account to join the conversation.
10 years 3 months ago #244037
by ingjjaa
Replied by ingjjaa on topic PHP Variable as default value for custom fields
It is a normal field in the address table
Please Log in or Create an account to join the conversation.
10 years 3 months ago #244058
by nicolas
Replied by nicolas on topic PHP Variable as default value for custom fields
Hi,
So for the registration form, you can edit the file "custom_fields" or "custom_fields_boostrap" (based on whether the "use bootstrap design" setting is configured in the HikaShop configuration), and add such code at the top:
<?php $this->address->cantidaddeproductos = $myvalue; ?>
For the address edition interface, you'll want to add similar code at the top of the file "show" or "form" of the view "address" based on how you configured the "address selector" setting of the HikaShop configuration.
So for the registration form, you can edit the file "custom_fields" or "custom_fields_boostrap" (based on whether the "use bootstrap design" setting is configured in the HikaShop configuration), and add such code at the top:
<?php $this->address->cantidaddeproductos = $myvalue; ?>
For the address edition interface, you'll want to add similar code at the top of the file "show" or "form" of the view "address" based on how you configured the "address selector" setting of the HikaShop configuration.
Please Log in or Create an account to join the conversation.
Time to create page: 0.167 seconds