1. Important notice about Cloudbleed - if your site uses the Cloudflare CDN, and you intend to follow the Joomla security team's advice to change your site "secret", you MUST READ THIS NOTICE.
  2. Fabrik 3.6 Released Remember to backup and test your backup before proceeding with this update. Please report any problems you might experience with this new version here on the forum. You are safe to upgrade to Joomla! 3.7 and PHP 7.x with this version of Fabrik. View the blog for more details on this release.

Concatenate 3 fields when creating product sku from permutations

Discussion in 'Community' started by bryankaran, Mar 26, 2017.

  1. bryankaran

    bryankaran New Member

    Level: Community
    So I have a list of words. I wish to create unique permutations as products to be randomly generated and reserved upon. Each permutation would consist of 3 words. Once a product is created, that permutation will be excluded from being created in the future.

    Example:
    The "words" list contains thousands of words, ex. Apple Orange Banana

    On product creation, the product would have an sku of one of the following permutations and added to a new list called "products".

    AppleBananaOrange
    AppleOrange Banana
    BananaAppleOrange
    BananaOrangeApple
    OrangeAppleBanana
    OrangeBananaApple

    If a permutation already exists in the "products" list, then the next random permutation would be created.

    This is similar to a password generator that uses words.

    Thanks
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Supporter
    I can't really help much with this kind of thing in Community support, but I can nudge you in the right direction.

    You'd have to maintain your own table of combination already in use, and you'd need some custom code to generate the combos.

    You would create your combination either as an eval'ed element default (if you want the name to be shown on the form when creating the product), or as a PHP submission script. if you do it as an element default, you would probably also want to have either a PHP submission script or a PHP validation, to make sure that you don't have a clash (two people create products at the same time, get the same combination when opening the form through the element default).

    -- hugh
     

Share This Page