Thinking out loud about an Addon

If it doesn't quite fit in the other areas, put it here...
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

One more admin module needed and this is to create a link to the new admin page, in the horizontal menu;
pointer.jpg
This is not really needed, but makes it a lot easier for shopowner to get to the new admin page.
You do not have the required permissions to view the files attached to this post.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

The admin side seems complete, obviously more testing might throw up issues and problems that need to be solved. The jigsaw puzzle picture is starting to make sense.

Next to think about is;
3. A way (in shop) to see those searches
As searches are generic (ie they are not linked to any particular product), how this is displayed needs to be "shop wide" rather than "product based". Options could be;

In the Header

I don't like this idea as the Header needs to be for "more important" things.

In the Footer

Certainly a possibility.

A Box

This is, I think, the most useful option. I'll make a box.
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

Another option could be a dedicated page, of course.

But let's go with a box. Making a box is super simple, just take one of the other boxes (I like to use the information box as it doesn't contain much code), make a copy and rename some bits of code appropriately. Then go into Admin and Install.

It'll end up as an empty box somewhat like this;
box.jpg
The next piece of the puzzle is to display all of the searches that have status = on. This is pretty simplistic;

Code: Select all

$string_query = $GLOBALS['db']->query(sprintf(<<<'EOSQL'
SELECT * FROM search_strings WHERE status = 1 AND language_id = %d
ORDER BY counter
EOSQL
          , (int)$_SESSION['languages_id']));
and

Code: Select all

while ($string = $string_query->fetch_assoc()) {
    $link = $GLOBALS['Linker']->build('advanced_search_result.php')->retain_query_except()->set_parameter('keywords', htmlspecialchars($string['string']));
    
    echo '<a class="font-weight-lighter" href="' . $link . '">' . $string['string'] . '</a><br>';
  }
Which outputs this;
eee.jpg
It's close, it might be that a simple list of searches (probably laid out nicer than this) would suit some shopowners. But that's not what I want, so next up is to make the text sizes bigger based on number of searches. I need to think about an easy way to do this. It's more difficult than it seems. If anyone has an idea don't hesitate to let me know.

My initial thoughts, based on (eg);
aaaaa.jpg
1 search = 1em font-size
154 searches = 1.54em
267 searches = 2.67em
and so on

I'm not sure how to treat 68 searches.
It needs to be bigger than 1 search but obviously a lot smaller than 154 searches.

So I can't treat it as 0.68em and I can't treat it as 1.68em. I'm stuck...it needs thinking about.
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

With some weird-ass mathematics, I think I've gotten it outputting in a way that makes sense;
qwerty66.jpg
IE; more searches makes a bigger font. Next up is to randomise the order, and remove the line breaks. We go back to the previous post and simply change the module file SQL to;

Code: Select all

ORDER BY RAND()
and the template file to remove the <br>

So the box display ends up like this;
qwerty667.jpg
Which is more or less what I was looking for.
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

Now it's time to think about any minor changes to make things more useful.

I can certainly think of one that I do want to add which is a link to from each search (in the admin page) to the advanced_search_result.php results page - this will allow shopowner to more easily see what products are shown when the search is made. I think that would be a nice little extra.

Can anyone think of any other extras ?
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

burt wrote: Thu Dec 21, 2023 11:09 am a link from each search (in the admin page) to the advanced_search_result.php results page
That was super simple;
ad-link.jpg
Obviously clicking on the eye loads the advanced_search_results.php?keywords={whatever} page, which increases the counter (of the {whatever} search) by 1. I don't suppose that increase in count matters.
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

I know the shop side box won't suit all shopowners, for sure. I think the benefit (to shopowners) is that record of what {keywords} are being searched for.

Put simply if you (shopowner) know what your customers (and potential customers) are searching for, it surely makes it a lot easier to tailor your offerings to customers needs, which could be as simple as;

- change product_description, product_name or seo_keywords to return better results for a search
- coming up with new products

and so on.

I think that list of searches is where the main value is in this addon.
Dan Cole
Senior Contributor
Posts: 498
Joined: Fri Oct 25, 2019 2:14 pm
Phoenix Version: 1.0.8.21
Has thanked: 67 times
Been thanked: 61 times

Re: Thinking out loud about an Addon

Post by Dan Cole »

Gary...it might be nice to have this on it's own page rather than in a box, especially when there are lots of searches, where you can display more searches and link to the advanced search page directly from the results. Just a thought. Maybe colour it up a bit too.

Dan
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Thinking out loud about an Addon

Post by burt »

Dan Cole wrote: Thu Dec 21, 2023 3:50 pm it might be nice to have this on it's own page
That would just be a case of manually making a page and copying the same SQL/HTML from the box/template into the page. I quite like the idea of a standalone page, with a link to it in the footer or somewhere, maybe that can be done in the future.
Dan Cole wrote: Thu Dec 21, 2023 3:50 pm Maybe colour it up a bit too.
colored.jpg
Not difficult, but equally not completely straightforward.
You do not have the required permissions to view the files attached to this post.
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Re: Thinking out loud about an Addon

Post by lecarlb »

@burt I'm thinking container boxes for product_info, index, index_nested, or if a shopowner wants to live on the edge a little maybe they would want it in a pi module. :D

I see 3 benefits implementing this:

(1) As you mentioned it allows the shopowner to tailor offerings in plain view

(2) It gives an SEO benefit to interlink popular searches with offerings and it's content

(3) It may help visitors find something that they might can't quite gather the search terms for or it'll be there to easily follow

And for more beverage money, maybe allow the shopowner to manually match a search to a product in admin by product ID byway of the product_info container.

All of this, I think, will give some UX benefit also.

NOTE: And allowing the shopowner to insert terms of their own, will enable them to insert queries from Google Search Console. So that's a huge plus. Kudos to you.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply