1. Fabrik 3.7 is now available. This version contains critical security updates, please update as soon as possible. Please remember to backup your site before updating, we also recommend testing your updates on development sites if possible.
  2. We had to restore the site around midday (CST) on Wed 7/26 from a backup approximately 8 hours old. So a few posts in the forums were lost. You may want to check to see if you need to re-post anything.

J2store form plugin

Nov 30, 2015
J2store form plugin
  • This plugin requires a version of Fabrik later than 30 Nov 2015.

    It should be installed alongside the Fabrik j2store system plugin.
    Both plugins need to be published.

    J2Store is a Joomla e-commerce component, whose concept is to turn any 'item' into a product. It has a plug-in system so that articles, and in this case Fabrik records, become products which you can add to the j2store cart.

    The concept of this plugin is that when you save your form's data the plugin will map your Fabrik form fields to their corresponding j2Store product fields, creating the necessary information to turn your Fabrik data into a j2Store product.

    The plugin equally adds 'add to cart' widgets into the front end list and details views.

    There are some limitations with this plugin:

    We only support product types of 'simple' or 'downloadable'
    Additional product images are not yet supported.


    Setting Up Your Fabrik List and Form(top)


    The first thing to do is to create a Fabrik list with the following elements:
    • product_name (text)
    • product_type (dropdown with values "simple" and "downloadable"
    • enabled (yesno)
    • visible (yesno)
    • sku (field)
    • upc (field)
    • manufacturer (dropdown with the following advanced -> Eval populate code)
    PHP:

    $lang = JFactory::getLanguage();
    $lang->load('com_j2store', JPATH_SITE . '/administrator', null, false, true);
    require_once(JPATH_ADMINISTRATOR.'/components/com_j2store/helpers/select.php');
    $opts = J2StoreHelperSelect::getManufacturers();
    $return = array();
    foreach ($opts as $id => $label)
    {
      $return[] = JHTML::_('select.option', $id, $label);
    }

    return $return;

     
    • price (text)
    • tax_profile (database join element joined to #__j2store_taxprofiles)
    • thumb_img (file upload Upload directory = "/images")
    • main_img (file upload Upload directory = "/images")
    • enable_shipping (yesno)
    • length (field)
    • width (field)
    • height (field)
    • weight (field)
    • length_class (database join element joined to #__j2store_lengths)
    • weight_class (database join element joined to '__j2store_weights)
    • download_limit (field)
    • download_expiry (field)
    If you want to included files (for when the product type is downloadable) then you should add a repeating group and add the following fields to that group:

    product_file_display_name
    product_file_save_name

    Adding the j2Store Fabrik Form plugin(top)


    We now want to add and set up the j2store form plugin. The configuration of this plugin allows us to state how each of our Fabrik form's product data corresponds to the j2store product.

    Edit the form you have just created.
    Go to the plugin's tab and press 'add'
    From the 'do' dropdown select the 'j2store' plugin
    Select "both" for "in" and "on"

    We will now want to map our Fabrik fields to the plugin settings. Each textarea allows us to insert Fabrik placeholders. When the form is submitted these placeholders are replaced with your form's data.

    To bring up a context menu to help you insert the correct placeholder, start by typing '{' and the any part of the element name you wish to insert. In the example below I've started with '{name' and the placeholder {products___product_name} is shown as a possible placeholder. Clicking on this option will insert it into the textarea.

    j2store_placeholder.png

    Some fields should use the raw placeholder. These are those placeholder elements which are either database join or fileupload elements.

    The following screen shots shows a typical set up:

    j2store_options.png

    Note - add to cart is generally just plain text.

    j2store_price.png
    j2store_images.png


    j2store_shipping.png
    j2store_files.png

    As "File display name" and "File path" are in a repeat group - their full element name is slightly different to the other fields. However, you can add them in the same way, using the context menu - just start typing "{file_display" and {"file_save" to filter and select the correct placeholder.

    When creating your Fabrik records - note that the "File path" value must be the full server path to the file, e.g. /var/www/html/mysite/public_html/myfile.zip

    List view(top)


    j2store_listview.png
  • Loading...
joit and daydah like this.