PHP Variable as default value for custom fields

  • Posts: 25
  • Thank you received: 0
7 years 9 months ago #244022

-- 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.

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 9 months ago #244031

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 ?

Please Log in or Create an account to join the conversation.

  • Posts: 25
  • Thank you received: 0
7 years 9 months ago #244037

It is a normal field in the address table

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 9 months ago #244058

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.

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum