Adding a mysql table as custom Field in Smart Search(Joomla) - php

Can anyone please guide me how to create a custom field (search filter) on joomla.
I want to create a custom filter from which i can select any particular table to search items in that table. Kindly refer to the screenshot i have attached.
I am a beginner to joomla & PHP.
I want to incorporate the search in the core joomla smart search or if there is any problem with that than i dont have any problem in having a dedicated page on the site.
I have 8-9 tables with 5-6K records for which i want to search the data. User will search some keywords and filter it with the table name present in mysql database. Search will use that particular table selected. Only particular users having access to that page will be using that search. At most 2-3 people will be having access to search.
What i am concerned is about the process of creating a custom field with drop down field of table in mysql DB. I tried searching but i didn't got any specific information. I have the knowledge on OOP methodologies but not much on MVC. Kindly suggest.

What you want to do can be done but will require a functional understanding of both OOP methodologies and MVC principles.
You can create a custom field to generate the drop down field of tables to search.
The next part depends on how you want to incorporate the feature into your website. Do you want it to be part of the core Joomla search or have a dedicated view for it.
Another major programming obstacle is how to generate the table search queries in a way that doesn't require you to build out complicated and difficult to maintain query generation code for each table. Otherwise any tables not explicitly codes for would not be part of search until you updated code.
I would edit your question with following information:
where and how will user search
does search need to list all tables and search all
Is this something you want to expose to the public, or a tool for Admins.

Related

Doctrine / ExtJS: Use model to create another model

I'm having difficulties implementing some of the features my client would like to have.
We're building a shopware shop, which is almost done. I've developed some plugins and customizations to have the shop fit my client, but I'm not the best at backend development using ExtJS and Doctrine.
The situation is: The shop sells car parts. We've bought a third-party plugin that allows us to enter ktype numbers for each product, so that the client can search for his/her car in the frontend and get all fitting products.
The plugin has it's own window in the backend, which isn't very comfortable.
So I created an extra tab in the article details, which displays all entries from the database using the third-party model.
That wasn't so hard since the model and database were created by the third-party plugin and I just had to query the data and display it.
What I'm trying to accomplish is: I added an extra column (selected) with a checkbox, where the admin can choose the cars the article fits to.
The plan was to read the textfield "ktypes" of the article on load, check all corresponding checkboxes and then when a checkbox is altered just save the new ktypes array to the article.
Problem is, that this way I can't sort by that column since it's not in the ExtJS store/model.
So now I'm thinking I'll create my own Model with all the columns from the third-party model, add a article_id column and a selected column and reference everything there.
What I don't know is: How to I get the contents of the third-party model into my own database?
The third-party plugin doesn't reference the article. The table only holds all car data imported from a csv list. The reference between an article and the data is just a textfield in the article details.
I thought about Doctrine associations, but I don't really have a reference point or foreign key...
Has anyone got an idea how to solve this?
Can share code if that helps...
Thanks!
I went in a different direction but still need help. Will post a new question though since it's a different topic.
Thanks for trying to help!

How to create a full in-site search with PHP for all my tables?

I need to search all content of my site in all modules and pages with PHP. i have no static page and all of my site is in MySQL. All samples in the web just explain how to search in one MySQL table. But I need to search all my tables except administration tables. I think it is not fair If I to join all of them. How can I achieve this?

Implement Custom Search Plugin for Joomla

I would like to implement a Custom Search Plugin for Joomla 3.5.1. I am new to Joomla and still busy getting my feet together.
I recently implemented a plugin that adds custom/extra fields (5 fields, free text inputs) to an article in Joomla 3.5.1. I followed their tutorial on how to get this right and so far so good. This plugin saves the extra/custom fields in the #__user_profiles table as per their tutorial. I could obviously save it to a different table but since I am learning, I kept it simple. This plugin works perfectly and I can capture the extra fields and saves successfully and the data is saved along with the article id being edited/created.
My next task is to create another site/front-end "search" (or smart search) plugin. This plugin must group the 4 field's values and provide them to the user in the front-end as selects/dropdowns.
Is there someone that can give me a lead on how I can archive this. Must I implement it as a search or smart search plugin? Is it even possible to archive what I am trying to archive?
This search plugin will only appear on one page but that I know I can config correctly once I've a plugin. Once user searches, the system must post back the selected options and I will search the "#__user_profiles" for any matching profile_key vs profile_value and collect all user_id (article_id) and get these articles from contents table and return this list of articles to the front-end as search results. Anyone can help me into the right direction?
I tried their tutorial of creating a search plugin but I seem lost, mostly I don't know how to dynamically provide my selects/dropdowns with that info saved in the #__user_profiles table.
Please assist in anyway possible...
I don't think that this might be done without modifying core 'search' task. My advise is to advise search view and include extra filtering, then write own 'search' task which allow you to read this data and provide additional results.
By writing just search plugin you can only extend search results by data which is stored outside default Joomla! tables but nothing more.

Handling custom table data in WordPress

I'm making a plugin for WordPress and it requires some custom tables of mine (or the data in them, to be specific). These tables are simple. They only contain an id and a varchar field. Do not mention meta fields. I am using custom tables for a reason. The problem is, I need to allow the user to edit the data in these tables. To insert, update and delete rows in the tables. How do I handle this in WordPress?
I can make my own custom pages and create a whole system for editing, inserting and updating them but that's a workaround since none of that would be native to WordPress.
The only thing I came up with is making them into custom post types and having WordPress let me use its native adding, editing and deleting menu (the same one used in posts, pages, etc.). Though then new problems would arise. I need to connect the post ids to the rows in the custom tables and be very careful when editing, updating and deleting to make sure that both the posts and my custom table data remain consistent with each other. And that's a whole new layer of complexity.
So I was wondering if there's an elegant way to handle these sorts of simple tables. If there isn't I'll find my own workaround.
EDIT:
The plugin I'm making is supposed to turn your WordPress site into a kind of an ad posting site. And I need the custom tables to provide details about the ads.
refer this codex Wp_list_table. you can play with custom table data. for more you can go through an example plugin.

Custom table queries in WordPress

I am developing a WordPress site for a client and they would like me to setup a custom page that allows logged in users to query a custom table in the WordPress database. I'll be naming the custom table 'inspectors' and will import the data from a CSV file.
I've found this helpful tutorial on doing this
But the 'fly in the ointment' is that they want the results to be displayed according to location - so the user would enter a postal code or town and will get results for inspectors that are located within a 50 k radius. I'm pretty sure I could manage a basic query to the custom table, but getting it to return location-based results is beyond me.
Is it even possible - and if so, is it worth the time and effort it would take to make it happen - or is there a simple solution I just don't know about?
Also, they also would like me to create a custom form (that is available only to the admin user role) so they can update the info from WordPress and not have to update the info in the spreadsheet. They'd like to be able to export the data in the table to CSV easily too ...
Thanks for any help on this!
Refer the below link and write your own custom queries.
http://codex.wordpress.org/Class_Reference/wpdb

Categories