New website follow along

Ask the community for help and support.
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

New website follow along

Post by burt »

Follow along with a new shop build...If anyone has any questions or comments about what I am doing please feel free to ask and I will answer as best I can.

This shop needs to be slightly different to most as it is a shop that is selling spare pieces, the easiest way to enable this is to come up with some flavour of "Master and Slave" products, where the Slaves are the spare pieces (all buyable) and the Master is the product that the spare pieces are for (not buyable).

However the Master is what buyers would search for to find the spare piece(s) that they need. I hope this makes sense?

This "follow along" will probably take a couple of weeks as it's a project I'm doing in spare time as a favour. Let's see how it turns out ?

Main issue;

The master / slave system as mentioned above

Side issues;

Needs to be Bootstrap 5
Needs to have a nice design
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

First things first, I download and install Phoenix Pro.
This saves a lot of coding time as it comes pre-loaded with lots of addons.
LeeFoster
VIP Member
VIP Member
Posts: 177
Joined: Sun Feb 28, 2021 9:41 pm
Been thanked: 3 times

Re: New website follow along

Post by LeeFoster »

I know this is a deviation/alternative to the options/attributes system but will the 'Slaves' be able to have options/attributes of their own?

For example:

Master Product is a replacement car hose 'set'
Slaves are -
1. Induction Hose
2. Coolant Hose
3. Air intake Hose

Each of these 'slaves' are available in Red, Blue & Yellow.

So you would navigate to you Master product and select 1 of each 'slave' and then the colour you would like the 'slave' in.
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

Master / Slave system, here is my initial thoughts;

1. Hook for admin which allows shopowner to designate a product as Master or Slave. If the product is Slave, it needs to also designate "which Master".
2. Module in product_info which shows all Slaves of the Master when looking at a Master.
3. New "buy" action to allows to buy multiple slaves from the product_info page
4. Menus (eg categories) need to show only Master products
5. Search needs to search both Master and Slaves
6. Slave product_info page should not be accessible (maybe redirect to appropriate master?)

Before we get ahead of ourselves as this list is subject to change as we go along or as we (hopefully you guys) have ideas, let's start with that Admin Hook to allow to designate Master or Slave...
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

LeeFoster wrote: Thu May 26, 2022 12:25 pm I know this is a deviation/alternative to the options/attributes system but will the 'Slaves' be able to have options/attributes of their own?
For the needs of this shop, no.
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

10 minutes of a bit of coding, copy and paste, gives me this in the admin editing/adding page;
admin-1.jpg
This works to tell a product that it is Master or it is Slave.

What I now need to extend this if Slave is selected is a new dropdown that is a list of all the Master products, however I dont want this Master list dropdown visible all the time

To enable this I'll need to use a little piece of "hide me" javascript which unhides when Slave is chosen and hides when Master is selected. That's a task for tomorrow.

So far so good. NO CORE CODE CHANGES.
You do not have the required permissions to view the files attached to this post.
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

Another hour spent on this and we have some progress.

The system now allows me to choose whether the product is a Master or a Slave.

Slave is the default setting as there will be many more slaves than Masters.

https://www.youtube.com/watch?v=QMGRaJ5 ... e=youtu.be

The products infobox area shows whether the product is Master or Slave
ad-3.jpg
and
ad-4.jpg
The system saves the relevant details

IE, is product Master or Slave and saves the Master ID if the product is designated as a slave. Note that in this shops needs, the slave will only ever be `owned` by one master.

This, for now, concludes the admin side of this project with NO CORE CODE CHANGES, and just one new file to do all of the above.
You do not have the required permissions to view the files attached to this post.
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

I now need to move over to the shop side and start to think about what should happen in a number of scenarios.

The easiest task to do right now is to ensure that if a buyer somehow finds a link to a Slave product_info.php, they are redirected to the relevant Master product_info.php
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

OK, that redirect is now in place and seems to be working. This is a Hook file which does a standard "is this a Slave" look up and then redirects appropriately if so.

We are still at NO CORE CODE CHANGES.
burt
Lead Developer
Lead Developer
Posts: 1452
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 24 times
Been thanked: 48 times

Re: New website follow along

Post by burt »

Not much time today, but let's have a bit of progress anyway;

Bootstrap 5

Phoenix Core is Bootstrap 4, but for this site I want it to be Bootstrap 5.
BS5 is a lot different to BS4, but Phoenix Pro makes it easy - simply go into Admin and turn on the BS5 theme.
Admin > My Store > Template Selection > Edit > Choose {Bootstrap 5} > Save.

The reason for getting the changeover to Bootstrap5 early in the build is in case of any changes needed to any TPL (template) files. Getting the theme changed over first means I won't potentially have to double up my work (IE, do some changes,then change theme - the new theme might override my previous changes)...

Master Products will never be buyable

Let's turn off the main Buy Button in product_info.php
Admin > Layout Modules > Product Info > Choose {Buy Button} > Remove Module. There are other buy buttons to turn off/remove, and I'll address those tomorrow.
Post Reply