michelve / software-license-manager

🔐Wordpress Software License Management. Supports WooCommerce, and WP eStore.
https://epikly.com
GNU General Public License v3.0
77 stars 27 forks source link

Version 5.3.3 - added item refence verification #21

Closed MechComp closed 4 years ago

MechComp commented 4 years ago

New feature to allow selling multiple items licences - now it can compare Item reference of the plug-in versus Item reference of licenced product

MechComp commented 4 years ago

Version 5.3.3 - Item reference

michelve commented 4 years ago

how about manually typing item reference... we bind this to wp categories

user A select the category as reference instead.

MechComp commented 4 years ago

I have started to use the solution in there already. And it's working fine.

I think that manually typing reference on product page is not so big problem. There is a checkbox in the settings to use this.

I found that using categories also brings sometimes unwanted result - category archive

The only thing which is bad in my approach is when you want to start selling multiple items and you have some already - without the item reference. Then you need to update the table for the existing records with reference for of the already used software. I did it in sql editor, but it should be possible to do that somewhere in settings.

⁣Sent from BlueMail ​

On Apr 27, 2020, 22:16, at 22:16, Michel notifications@github.com wrote:

how about manually typing item reference... we bind this to wp categories

user A select the category as reference instead.

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/michelve/software-license-manager/pull/21#issuecomment-620210051

michelve commented 4 years ago

here is a work around i have done, when reference is not set or empty, it will be set to default.


if (version_compare($used_db_version, '4.1.3', '<=')) {
      // get empty values
      $item_result = $wpdb->get_results("SELECT id FROM `$lic_key_table` WHERE `item_reference` LIKE '' ORDER BY id");

      foreach ($item_result as $reference_item) {
            $item_id = $reference_item->id;
            // update and set default value
            $update_reference = "UPDATE $lic_key_table SET item_reference='default' WHERE id='".$item_id."';";
            dbDelta($update_reference);
      }
}
michelve commented 4 years ago

i have updated the repo with your changes - will close this pull request for now.