Optberry Product Customization Application

SQLite, PDO Object, PHP populating JavaScript Objects, click tracking

This app lets users design their dream product, from guitars(Revomere as showcased) to sneakers. Update the database, and the app adapts seamlessly. I built it to showcase my skills in web development, database integration, and graphic design.

VisitGitHub

The Process:

Hierarchical Data Structure for Customization

JavaScriptdata structureclick tracking
To represent customizable products, I designed a hierarchical JavaScript object structure. This structure starts with a Product object, which contains an array of Category objects. Each Category can further contain Group objects for finer organization. Finally, Group objects hold individual customization Option objects. This structure, with the addition of a Group layer, provides an extra level of organization and navigation control. Unselected category groups are hidden, improving user experience and keeping the navigation bar clean. I leveraged Bootstrap's collapse component for a user-friendly accordion-style navigation.

planning the data structure
more planning and pseudo code
product class
category class
group class
option class
click class
vertical navigation

Backend Database Schema

SQLitePHPPDO Object
To store product customization options, I implemented a schema using SQLite. This lightweight database efficiently manages the data powering the application. The core table, Options, utilizes foreign keys to link related data.

This relational structure allows for efficient data retrieval and manipulation. Leveraging PHP PDO, I crafted queries to fetch data dynamically. These results were then used to construct JavaScript objects, replicating the hierarchical structure on the front-end.

database tables
Options table

Data Structure Code Snippet

Chrome DevTools
This code snippet, captured from Chrome DevTools, offers a glimpse into the product object in action and how it reflects user customization choices. Here, we see the "Camila" model/shape selected, nestled within the "Model" group of the "Shape" category. The "oneSelection" property ensures only one model can be chosen at a time, enforcing a single selection for this category. The "clicks" array provides valuable insight into user interaction. It reveals "Camila" has been selected three times, with the most recent selection indicated by a Click object lacking an "end" value. This demonstrates how the application accurately tracks user choices within the pre-defined product structure, ensuring a seamless customization experience.

code snippet from Chrome DevTools

Front End Development

CSS positioningPNG filesresponsive design
A key aspect was creating a dynamic product image that reflects user choices. This involved layering PNG images for different customization options. The challenge was maintaining image fidelity (aspect ratio and detail) during page resizes.

I implemented a container-based approach using nested divs. The inner container with relative positioning acts as a reference for individual images. Each image utilizes absolute positioning with a width set as a percentage of the container width ((image width in pixels * 100) / 1445px). Similar percentage calculations ensure precise positioning of each image layer. Safeguards prevent these values from exceeding the original image width to maintain image quality.

shape image files
some hardware image files
images put together inside of containers

Feature Implementation and the Power of Refactoring