Though BreezingCommerce ships with product configuration capabilities such as options and accessories, you might need to add a more dynamic product configuration option. For this purpose, we created an integration based on our form extension BreezingForms, that enables you to apply the exact same BreezingForms power to your product to either collect data and/or add up to product prices. Read how it's done here.
All the data that is passed with the product before it's getting added to the cart, will be properly displayed all the way to the order. This includes cart display, payment display, administration order screen and invoices as well as email recipes.
You can use this data to perform business actions for the ordered product. If you for example sell t-shirt printing, you can use the submitted text and images as data to be printed on the t-shirt the customer ordered.
It also allows to add to the price if required, so the possibilities that this integration offers are countless.
In order to enable the integration, your Joomla! installation needs to comply with the following prerequisites:
- Latest Joomla! version.
- Latest BreezingCommerce and BreezingForms versions installed.
- The installation and enabling of the BreezingForms content plugin (plg_breezingforms.zip from the /extensions/addons/ folder in the main download package).
- The BC Plugin bc_productdisplay_breezingforms.zip from BreezingCommerce Full.
- *optional* The BC Plugin bc_productprice_breezingforms.zip from BreezingCommerce Full, if you need to add up to prices.
In this tutorial we also assume that you already know how to create forms in BreezingForms as well as how to create products in BreezingCommerce and how to bring them on the site.
How To Collect Form Data Within A Product
The integration is divided into 2 parts:
- Collecting form data and displaying the data along with the order. This is handled by the BC Plugin bc_productdetails_breezingforms.zip, located in the BreezingCommerce main package's bc_plugin folder.
- Optionally adding up to prices based on the data submitted. This is handled by the BC Plugin bc_productprice_breezingforms.zip from the same location like above.
The product details plugin can work by itself, while the price plugin requires its companion to be installed in order to work.
Those plugins should be installed and enabled in BreezingCommerce => Plugins and a BreezingForms based form should have been created as usual. We are not going into details on how to create forms in BreezingForms, all you should know as that creating a form in BreezingForms is a process totally detached from the integration (by default). In most cases it is enough to create prices (if required) in the price plugin's settings.
Once you created a form and a product, head to the product details and locate the tab "Details Plugins". The details plugin has the following options:
- "Please select a form to display": Select the form that you created with BreezingForms and that you want to see in your product details.
- "Display": The location with the product where the form should appear.
- "Include Fields": Select fields to be visible in the order process (cart, payment, orders, invoices)
- "Exclude Fields": Select fields NOT to be visible in the order process (cart, payment, orders, invoices)
- "Hide Price": Hides the price in the product details (useful if you don't use a starter price)
- "Hide Dynamic Total": Show/Hide the cart totals. This will override the standard settings for the totals.
After you choose your form, check the site display of the product and you should see the form inside the product, accepting form data. Upon cart add, the submitted data will be visible across all important places of the order process, up to the administration.
How To Add Prices To A Form
To enable prices, just like the with the BC Plugin above, head to BreezingCommerce => Plugins and install the file bc_plugin_productprice_breezingforms.zip and enable it.
Then once again head back to your product and locate the tab "Price Plugins".
Since you selected a form, it will automatically provide all fields with options to adjust prices for each field. Those options per field are:
- "Product Tax Class": Inherit the product tax class from the main product, set to no tax class or choose another tax class if required. Taxes will be displayed and treated separately in the order process, depending on the tax classes given.
- "Pricing Strategy": The most important part of the price plugin. Here you can either set
- Fixed Price as soon as the submitted value of that field is not empty. If the price is 0, the rule won't fire. All prices should be net and int the default currency of the shop.
- Price Rule where you can just like above set a price for this field but operate on the value of another field.
- Value that uses the exact value from the form submission for this field. If the value is not a number, no calculation will be performed. Please use this with care, as in theory, any user would be able to set a price himself. Use it only if you want to take the risk or you can easily determine an altered price form within the order screen.
- Code. Here you can add any PHP code and add even more capabilities to determining prices. The final price must be given to a variable called $price. You can iterate over the variable $fields, if you need information from other fields.
The above is slightly different for group based elements such as checkbox groups and multiple select lists. The plugin automatically discovers them but the values for Fixed Price and Price Rule must be entered manually in the form:
- "Fixed Price": Enter a line for each group value exaclty in the form *VALUE*: *PRICE* e.g. 'mycheckboxvalue1: 5'. What happens here is that the plugin will listen if such a value has been sent with the form and then triggers the right price from the ones you specified per line.
- "Price Rules": Similar to above, with a small extension that enables you to use an arithmetic operation on the value of another field (one per line): *VALUE* : *PRICE* (+,-,*,/) *FIELDNAME*. e.g. 'mycheckboxvalue1: 5 * myamountfield'.
Now test your form and see how the prices are added.
That's basically it with this tutorial, and as you can see it is pretty easy and straight forward.
There is also a video available where you see all the described in action, just click here to watch it.