kongondo

FieldtypeVariations: Upcoming Pro Module for Product Variations & Attributes

9 posts in this topic

Introducing Variations, an Input- and Fieldtype for product variations and their attributes.

Product variations is a topic that has been coming up now and then, especially in the recent past.  This module seeks to fill this gap. Though it's in its early stages of development, it is already functional and can be used as is. I decided to make an early announcement (modules development forum) in order to get early feedback from potential users. 

The module is an alternative take on how variations can be built for a product. Imagine the ubiquitous T-Shirt. The product could vary by ...Size, Colour, Material, etc...These variations could in turn have internal variations, i.e. attributes....so, Size [Small, Large], Colour [Red, Blue]...etc; you get the drift.

The usual approaches to building variations have been either to use Multiple pages, Repeaters, Page Table, Table or Matrix (limited to 1x1 variations). In this module, we do it a bit differently.

First, the variations occur not at the Field level (meaning all product pages would have the same variations and attributes for each template) but at the page level. Secondly, there are no multiple pages for each variation and/or attributes; a product is a single page. The variations and their attributes are defined by site editors at the page level. Once a variations configuration has been defined, it is applied to the page and all possible combinations are generated (i.e. the Red,Small,Cotton; Red,Large,Cotton, etc) in the Inputfield. There is no limit to the number of variations and attributes that can be defined, although you will be amazed at how quickly the combinations grow! Prices are entered for each combination when editing the page. Combinations without prices are not saved to the database. Please note that prices cannot themselves vary at the page-level. Meaning, you cannot have ONE variation configuration that has different price inputs per product in the same FieldtypeVariations field.

The module ships with an API for outputting variation combinations in the frontend. Search, database and in-memory work as normal in the frontend. In the backend, DataTables provides a nice paginated, filterable table. Prices can be entered on any pages (of the table) without loss of data (meaning you can enter prices on page 1, scroll to page 10, enter more prices, filter or search the products table, enter more prices and finally save; no data will be lost).

I still have a couple of ideas and plans pending but would love to hear from you, thanks.

Below is a short video demo of the module in its current state. Things may/will change, both UI and features. Btw, the Fieldtype, although primarily targeted at commerce applications, is by no means limited to this. Other uses requiring combinations of whatever number of variables are very much within the remit of the module.

Planned/Hoped for features

  1. Import/Export product variations and attributes (Excel, etc)
  2. Full integration with Padloper (I will have to  discuss with @apeisa)
  3. SKU fields for each product variation
  4. Add/Remove extra subfields, e.g. multi-currency prices (currently there is only 1 input for each product variations' price)
  5. Product variation images?
  6. Etc...

Please not this module is not related to this other planned module (but it may eventually).

Sneak Peek Demo

 

 

Edited by kongondo
9 people like this

Share this post


Link to post
Share on other sites

Sounds very interesting!

47 minutes ago, kongondo said:

Combinations without prices are not saved to the database.

47 minutes ago, kongondo said:

Btw, the Fieldtype, although primarily targeted at commerce applications, is by no means limited to this.

Does this mean the "Price" field is only an example, and in non-commerce situations you could add some other type of field to store data related to the variation? Will you be able to add multiple data fields to the variations?

1 person likes this

Share this post


Link to post
Share on other sites
27 minutes ago, Robin S said:

Does this mean the "Price" field is only an example, and in non-commerce situations you could add some other type of field to store data related to the variation?

Yes, e commerce being the most likely use for this module.

Just to be clear for the sake of others, technically, these are subfields. E.g., price is a subfield (meaning a database column in a FieldtypeVariations field [technically a database Table] which you access as $variationsfield.price, similar to $page->image.description).

Back to your question, this is a planned feature (although code is already in place). Please note that, in respect of these subfields, there are no plans to include anything as near exhaustive as what Table does. Meaning, these will likely be limited to TEXT, INT, FLOAT, etc fields, but not complicated Fieldtypes such as Page fields, Repeaters, etc. 

 

27 minutes ago, Robin S said:

Will you be able to add multiple data fields to the variations?

Yes, as many or as little as you want, pre or post-field use. For instance, start with price (default but in future versions one will be able to remove the subfield), then later or at field configuration add an SKU subfield, a discount subfield, some text subfield, etc. 

Edited by kongondo
3 people like this

Share this post


Link to post
Share on other sites

I am thinking of changing the way variations +  attributes are created and applied. Currently, these have to be typed whenever one needs them. For different products that share an attribute (e.g. 'Red') but not necessarily a variation configuration, all that typing is repetitive. For instance, the colour Red means the same thing irrespective of whether it is a Car or a T-Shirt or a Phone. If you have all these products for sale, you should be able to just select colour from some list you previously typed and be presented with all colours from which you can select which apply to your product. Meaning, at the product/page configuration level, you will first have to select the variations you want, e.g. Size, Colour, Material, etc....then select the respective values/attributes, e.g. Yellow, etc. Small, etc.

1 person likes this

Share this post


Link to post
Share on other sites

This looks really nice! I agree having the page as context is a smart move! Hadn't thought of the problems of having that represented at field level. I also REALLY like the idea of variations existing on its own as presets somewhere else. 

Something that I see solved nicely and horrible at the same time, is Shopify's very own variation editor is batch edition of prices and variation names.

Eg. Select a variation by one of its properties and change the price in a batch table mode. This was done pretty nicely in an Excel like fashion, or multi checkbox select and command in menu.

What I did suffered was making a soccer uniform shop with 10+ sizes and sometimes 20+ variations in color. An error in creating the names would imply to REDO all the variations, or go through a menu to edit EACH variations name. Always almost easier to recreate the whole thing. It seemed as if after creating the list of variations per property in a nice interface, they all lost the relationship amongst them. So if you had written Brgundy / Dark Blue, get ready to edit +50 fields in modals or just delete the whole thing. There goes your day!

And the variations problem reveals a  flaw in Shopify's service, no more than 100 product variations. Why I might guess won't be a problem for PW.

I think variations images would also be quite the deal!

Nothing more to add, just personal experiences of suffering from product variations. Hope to see this released!

1 person likes this

Share this post


Link to post
Share on other sites

Hi all,

Quick update. I finished the first release of this module nearly two weeks ago. However, I have not yet had the time to finish the documentation and clean it up a bit nor produce a demo. I'll see if I can squeeze something in this week, but doubtful.  Current features are:

  • Fully integrated with Padloper! This was easier than expected. Thanks to Hooks, I didn't have to lift a finger. Please note that you will have to write the Hooks code yourself. We'll give you examples (very similar to this in Padloper docs).
  • Dynamically add or remove subfields. Price is no longer the default; there is no default. When creating the a Variations field, you create the subfields/columns you want (e.g. Price, SKU, Remarks, Price 2, Discount Codes, whatever...!
  • Attributes are created separately from the variations. For instance, you can create the attribute Colour and add as many colours to it as we you want. Colour will then be selectable (add one or all, remove one or all) when creating a variation configuration. Once you select colour, all the colours in it are auto-populated in a dropdown, ready for selection. This means that you can choose some colours for one product and choose different set of colours for another.

The above will be clearer in the demo. Just wanted to let you know that this is ready...:).

Edited by kongondo
More info

Share this post


Link to post
Share on other sites

Hi @kongondo

I have started a project with Padloper, and I'm thinking to wait for your module, but want to know about price and the maximum term of release date.

Could you please provide some info? 

Share this post


Link to post
Share on other sites
1 hour ago, Zeka said:

I have started a project with Padloper, and I'm thinking to wait for your module, but want to know about price and the maximum term of release date.

I'm hoping maximum 2 weeks, 3 at the most before an official release. It will be priced similar to my other modules (but could be subject to change).

Thanks for your interest.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By justb3a
      Little admin helper module: Using this module you can view all template cache settings at once. E.g. cache status, cache time (configurable). Furthermore it adds the functionality to clear the entire template cache or just the template cache for a given template. Note that this may cause a temporary delay for one or more requests while pages are re-cached.

      GitHub: https://github.com/justb3a/processwire-templatecacheoverview
    • By blad
       
      Hi guys!
      I'm creating a module to manage, edit, publish ... pages. It is very similar to ProcessBatcher.
       
       
      Changelog:
      In progress 
      Features:



      Select pages with your mouse like a desktop enviroment. If you press "edit" the selected pages will appear in a lightbox.


      Drag pages to do actions.
      Any feedback is welcome
       
       
    • By abdus
      I dont know how they work internally, whether they depend on each other, but I'd love to be able to test and buy RepeaterMatrix or Multiplier or Table (or any other) module individually. Whole pack of ProFields modules seems awesome to have, however, being able to buy one for ~$30 --instead of all for $130-- sounds much more affordable and this way I could buy the whole pack part by part in several months and wouldn't think twice. But $130 at once, I can't really justify it (and still havent been able to) just as easily with low (to none) disposable student income.  Or instead, having sales one - twice a year would be great as well.
      One advantage of this change would be allowing more people to buy -> support the development & community -> give feedback -> improve these products. This could also potentially pose a disadvantage where requests from people would increase the headache and time required to respond to all these requests, but this community is more than able to handle that.
      I'm sure there's a reason to why these modules are sold together, and I'd love to hear your side as well, @ryan, (and all other maintainers).
      Regards,
      Abdus.
    • By Richard Jedlička
      Tense    
      Tense (Test ENvironment Setup & Execution) is a command-line tool to easily run tests agains multiple versions of ProcessWire CMF.
      Are you building a module, or a template and you need to make sure it works in all supported ProcessWire versions? Then Tense is exactly what you need. Write the tests in any testing framework, tell Tense which ProcessWire versions you are interested in and it will do the rest for you.

      See example or see usage in a real project.
      How to use?
      1. Install it: 
      composer global require uiii/tense 2. Create tense.yml config:
      tense init 3. Run it:
      tense run  
      For detailed instructions see Github page: https://github.com/uiii/tense
       
      This is made possible thanks to the great wireshell tool by @justb3a, @marcus and others.
       
      What do you think about it? Do you find it useful? Do you have some idea? Did you find some bug? Tell me you opinion. Write it here or in the issue tracker.
    • By ukyo
      FieldtypeFontIconPicker
      v.0.1.6
      Fix FieldtypeFontIconPicker sanitizeValue() v.0.1.5
      Added uikit icon select support (required AdminThemeUikit), because uikit icons not working standalone. v.0.1.4 :
      Fix issue FontIconPicker inside repeater v.0.1.3 :
      FontAwesome updated to 4.7.0 v.0.1.2 :
      Little Corrections Some works about icon pickers inside repeater via ajax load v.0.1.1 :
      FontAwesome updated to 4.6.3 v.0.1.0 :
      Custom CSS file url support Added hook method ___beforeRender(), you can check hook example for usage Added multiple icons library use option Added Ionicons Library Now module using cdn for load icon fonts v.0.0.9 inside dev branch
      Added hook method ___beforeRender(), you can check hook example for usage Added multiple icons library use option Added Ionicons Library Now module using cdn for load icon fonts v.0.0.8
      FontAwesome 4.5 update, Improvements and Performance updates Important ! After update module check your input settings, because i changed input attribute names (This will only effect input options, like theme, category). Changed loading icon method from input:hidden to select>optgroup>option, added module js file for load and correct icon picker container many changes…. v.0.0.7
      FontAwesome updated to 4.4.0 v.0.0.6
      Missed... array compatibility for usage, from [$foo, $bar] to array($foo, $bar) v.0.0.5
      Fix for oldest pw versions (Assets file loding scripts moved to inputfieldfonticonpicker module) v.0.0.4
      Array compatibility for usage, from [$foo, $bar] to array($foo, $bar) v.0.0.3
      Small z-index problem solved v.0.0.2
      MarkupFontIconPicker added v.0.0.1
      Start Point Module allow you to use Fotn-Awesome icons easily. You can select icons directly from icon select list, also you can set settings for each InputfieldFontIconPicker.
       
      NOTE : Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix".

      Example :
      if($my-icon-field) echo "<i class='my-prefix-{$my-icon-field}' />"; Hook Before Render Example This example using /site/templates/admin.php file for hook
      wire()->addHook('InputfieldFontIconPicker::beforeRender', function($event) { if(!$event->return) return; // Get Input Name (For specified input hook, if you want apply all InputfieldFontIconPicker remove inputName check) $inputName = ""; if(isset($event->object->attributes['name'])) $inputName = $event->object->attributes['name']; // Get Input Name (For specified input hook, if you want apply all InputfieldFontIconPicker remove inputName check) if($inputName == 'icon_picker') { /** * Load your custom icons function file * Your array need to be same format with Icons/FontAwesome.php or Icons/Ionicons.php * Also you can pass directly an array */ wireIncludeFile('MyCustomIconFile'); // Set icons as $icons variable $icons = MyCustomIconsArray(); // Set your options $return = array( 'attributes' => array( 'category' => '', 'theme' => 'fip-grey', 'empty-icon' => 1, 'empty-icon-value' => '', 'icons-per-page' => 20, 'has-search' => 1 ), 'icons' => $icons ); // Return the event $event->return = $return; } $event->return; }); MarkupFontIconPicker Usage
      // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Module Using
      Font-Awesome v4.3 jQuery fontIconPicker v2.0.0 Screenshots - InputfieldFontIconPicker input settings

      InputfieldFontIconPicker Setting "Category Select"
       


      InputfieldFontIconPicker Setting "Theme Select"



      Screenshots - InputfieldFontIconPicker page edit views

      InputfieldFontIconPicker Search


      InputfieldFontIconPicker Categories


       
      For issues and other things here is MY Github Repo