Buybase Theme Docs

Welcome to the theme building documentation. The great part about our theme development is that you can care less about whats going on, and more about the design.

Get started »



File installation

Getting started is easy. Download (if you haven't already) the Buybase files. This can be done by going to our home page and clicking download. Or by clicking here.

Extract the files from the ZIP folder, open the folder and place the elements in you htdocs or on you file manager on a live website.





Application installation

Once you have installed all the files and you can use the site, go to YOURDOMAIN.COM/buybase/install.php. If you are running on a localhost then it would look something like this localhost/YOURPROJECT/buybase/install.php.

Once you are on the install page, follow the instructions by going to Stripe.com and getting an account. Get your API keys and enter the rest of the information to get started.





Framework Installation

Start off by downloading the buybase.php file. Store it how ever you wan't.

Then you will have to go in to you header and include buybase.php or wherever you kept it. Simple installation, but it's not using composer unfortiunatley.





Configure file

If you ever want to change your API keys or your shop name you will have to go to buybase/config.php and change it manually through PHP. Don't worry its super simple.





Show a Product

To show a specific product you will need to take your instance of the buybase object, $buybase = new Buybase(); is already set in the buybase.php file. Then you need to take the variable and point it to the getProduct(); method. The method takes two parameters, the first as always using buybase, the $conn variable, the connection. The second parameter is the name of the product, this is a string and matches by the exact name of the product. Echo this out and your product will be shown. Here is an example of what we covered echo $buybase->getProduct($conn, "iPhone");





Listing items

To show all of the products in your store you need to use the the instance of the buybase object and point to the getAll(); method. This takes two parameters but only one is neccessary. You need to add the connection as always by using the $conn variable, and then the second one is actually the limit of items you wan't to show. This means that if you have like a hundred products and you only want to show around ten, you can put ten in the second parameter.







Categorize

To show items from a category in your store you need to point to the getCategory(); method. This takes three parameters, the connection, the category that you wish to show, and the limit.







Register

Registering users is surprisingly simple with Buybase. Now as of the Beta version 1.2 you still have to create your own form. But this gives more customizeable features to it. You will first need a form with the post method, and the action of $buybase->register($conn);. The input fields are 4, or 5 if you count the submit button. These input field names are username, email, password, repassword, register. The name register is given to the submit button. As long as all of these names are set, registering will work.





Login

Now logging in is very similar, create the form in the same fashion, but instead of pointing to the register method, point to the login method (Don't forget the connection). There should be two inputs here or three if you count with the submit button. The names are as you might have guessed username, password, login. The login name should be applied to the submit button. If you are interested in whats going on behind the scenes here, download the popeye files and check it out. In the code it shows you in depth whats going on.





Product page

For this part, you will need a product.php file. In the file you need to run the productPage(); method and pass in the following three arguments. The connection, the product id that is stored as $id = $_GET['id']; in the url after selecting an item. This means that if you visit the page without clicking on a product, will return nothing. And lastly and probably most importantly the stripe variable. I'm going to give you an example of exactly how to set this up on the product page. echo $buybase->productPage($conn, $id, $stripe, $shop);. Notice how all of them are stored as variables. The stripe variable is found in the config file, and like we saw earlier the id is found in the url. The connection is also from the config and the shop variable is the name of your shop that will be displayed at the top of the payment form.





Listed items styling

Essentailly, the markup is just an image, an h2, an h4, a paragraph and a view product button (an anchor tag). These are wrapped in a div with the class name of .listed-product.





Product page items styling

The product page has a span with that shows the stock of the product (In Stock, Out of Stock, Low in Stock), an h1 that shows the name of the product, an h3 that shows the price, and a paragraph that is just a description. Below that there is a button. This is the payment button tho and you will have to style it according to the Stripe documentation if it's there. All of this is wrapped in a div. If you wan't to style the div then the class is .paged-product.





Search results styling

The search result styling is essentially just the same as the listed product styling. The class names are just a little bit different. The markup is just an image, an h2, an h4, a paragraph and a view product button (an anchor tag). These are wrapped in a div with the class name of .searched-product.