QloApps Forums
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Input Field Value not Updating in Database

    Technical Help
    database custom field
    3
    4
    448
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      vamshi last edited by

      Hi,

      I am trying to add a dropdown field called minimum stay with values one week and one month for each room type in back office >catalog> Manage Room types >edit > configurations Tab . So that each room room type has its own minimum stay period.

      For this I added a field called minStay in ps_products table in database and I overrode the ProductCore class in override\classes.

      This is the code I have used.

      Class Product extends ProductCore{
          public $minStay;
       
          public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
          {
              self::$definition['fields']['minStay'] = array('type' => self::TYPE_STRING,
      'validate' => 'isGenericName', 'size' => 225, 'values' => array('oneMonth', 'oneWeek'), 'default' => 'oneMonth');
              parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
          }
      

      And I added my Minimum Stay Field in \qlo\backoffice\themes\default\template\controllers\products\configuration.tpl after num_child,

      smarty.png

      The field has came to front end and reading values from the database but it is not updating the value into the database when I click on Save or Save and Stay.

      Can you please help me resolving the issue.

      Thank You,
      Vamshi S.

      1 Reply Last reply Reply Quote 0
      • S
        shreesh Global Moderator last edited by

        @vamshi

        In order to save data the input type field name must be same in Db, object definition and input field.
        change select field name to

        &ltselect class="form-control room_stay" name="minStay"&gt 
        

        If data is still not updated, cross check if override is working by dumping product object. If not then please backup and remove /cache/class_index.php

        1 Reply Last reply Reply Quote 0
        • V
          vamshi last edited by

          @shreesh

          Hi shreesh,

          It's working super cool now, Thank you so much for early response.

          1 Reply Last reply Reply Quote 0
          • Faiz
            Faiz last edited by

            Hi @vamshi
            Glad to hear that!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post