Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 05/09/2017 BIG Autumn SALE

    Use AUTUMN17 coupon code to buy our WordPress or Joomla! extensions with 25% discount. Hurry up! The offer is valid till 11 September.

  • 14/04/2017 Happy Easter

    Wish a Happy Easter and give 30% discount for all our WordPress and Joomla! extensions. Use EASTER17 coupon code. The offer is valid till 17 April.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

DataTable filter by urlid
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: DataTable filter by urlid
#56996
DataTable filter by urlid 1 Year, 8 Months ago Karma: 0
I have CRMERY plugin installed and have made many forms using rsforms.

I would like to display the form data entered by client only.

These datatables will load on 3 pages that have different url id's based on the page that is loading.

page 1 example i need the deal "id"
index.php?option=com_crmery&view=deals&layout=deal&id=7&Itemid=290

Page 2 example I need the person "id"
index.php?option=com_crmery&view=people&layout=person&id=43

Page 3 example I need the company "id"
index.php?option=com_crmery&view=companies&layout=company&id=29


How can I get a MYSQL only statement to have the "ID" as my variable for all pages to start my datatables select statement.

I have been able to do this in rsform to populate a dropdown for each form to select the client from the company group of contacts. (code at bottom)

Thank you in advance for any help in the right direction with the URL ID capture SQL statement.

Shane

//<code>
$url = RSFormProHelper::getURL();
$url= str_replace('app.plan-your-federal-retirement.com/index.php?option=com_crmery&view=deals&layout=deal&id=','',$url);

$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you'd like a "Please select" option, otherwise comment or remove it
$items[] = "|Please Select[c]";

// Run the SQL query and store it in $results
$sql="SELECT CONCAT(first_name,' ' ,last_name) AS name
FROM `pyfr_crmery_people` WHERE company_id = (SELECT company_id FROM pyfr_crmery_deals WHERE id='$url')";
$db->setQuery($sql);
$results = $db->loadObjectList();


foreach ($results as $result) {
$value = $result->name;
$label = $result->name;
$items[] = $value.'|'.$label;
}

$items = implode("\n", $items);


return $items;
//</code>
The administrator has disabled public write access.
 
#56997
Re:DataTable filter by urlid 1 Year, 8 Months ago Karma: 667
Hello,

If you want to use "id" request variable in "WHERE" clause of SQL query, a query will look like:

Code:


SELECT
 id,
 title
FROM
 tbl
WHERE
 ({$REQUEST:id|empty:''} = '' || record_id = {$REQUEST:id|empty:''})



Regards,
ARI Soft
The administrator has disabled public write access.
 
#57002
Re:DataTable filter by urlid 1 Year, 8 Months ago Karma: 0
Thank you for this base code.

I have gotten this far.
SELECT
advisor_url_id_estateplanning,
advisor_clients_estateplanning
FROM
ninja_estateplanning
WHERE
({$REQUEST:'id'|empty:''} = '' || advisor_url_id_estateplanning = {$REQUEST:'id'|empty:''})

This has only made my datatable display ALL clients regardless of 'id'

Do I need to continue this statement to only display clients with the requested 'id'

Or how do I make it dynamically change the datatable view based on the 'id'

Sorry I missing something,

Shaen
The administrator has disabled public write access.
 
#57003
Re:DataTable filter by urlid 1 Year, 8 Months ago Karma: 667
Remove quotes for 'id' parameter. It should be like in our sample query:

{$REQUEST:id} instead of {$REQUEST:'id'}

This feature works when "Server side pagination" parameter is set to "No".

Regards,
ARI Soft
The administrator has disabled public write access.
 
#57017
Re:DataTable filter by urlid 1 Year, 8 Months ago Karma: 0
Thank you,

Works great now,

Shane
The administrator has disabled public write access.
 
Go to topPage: 1