Impossible to create a list on an adsmanager's table

Status
Not open for further replies.

Borox

Member
Hi,

I'm using adsmanager 3.1.4.
When I create a List on a table (tried on tables adsmanager_ads and adsmanager_pending_ads), there's no error but I just have a blank page when I want to display the list, either by frontend and by backend.

I put the debug on, but no information is showing (just the blank page).

Is There something on adsmanager table's structure that prevent to use fabrik?

Thanks

Nicolas
 
Have a look at their table in something like phpMyAdmin, and see if they use a composite primary key (so more than one column is used for the PK).

-- hugh
 
Thanks guys for your quick answers.

troester:
Error reporting wasn't at max, I did and I have this error:
Catchable fatal error: Object of class stdClass could not be converted to string in /home/inarcomf/public_html/test_inarcom_ex/components/com_fabrik/layouts/element/fabrik-element-tip.php on line 12

Hugh:
Yes the tables use a composite primary key
 
have you tried creating new table and joing elements of your adsmanager tables using DBjoin element?
 
That's an idea but in my case I need to modify the original adsmanager's tables to allowed a special user to publish/unpublish ads by frontend.

I'm gonna try with triggers on my database...
 
OK, just in case others are interested, here what I've done to be able with fabrik to modify a field in a table with a composite key.

As I can't directly create a list on this particular table ( because of the composite PK), I've created with fabrik a list with some fields.

I created 3 triggers on the adsmanager table to synchronize it with my new fabrik table (on INSERT, UPDATE and DELETE)

AFTER DELETE
PHP:
DELETE FROM annonces_adsmanager where OLD.id=ads_id

AFTER INSERT
PHP:
INSERT INTO annonces_adsmanager (ads_id,ads_name,ads_email,ads_ad_headline,ads_images,ads_ad_text,ads_published)
VALUES (NEW.id,NEW.name,NEW.email,NEW.ad_headline,NEW.images,NEW.ad_text,NEW.published)

AFTER UPDATE
PHP:
UPDATE annonces_adsmanager
set ads_name=NEW.name,ads_email=NEW.email,ads_ad_headline=NEW.ad_headline,ads_images=NEW.images,ads_ad_text=NEW.ad_text,ads_published=NEW.published
WHERE ads_id=NEW.id

In my form I inserted the plugin PHP and 'OnAfterProcess' I put this code to update the adsmanager table:
PHP:
//Get the id we are working on
$ads_id = $formModel->getElementData('annonces_adsmanager___ads_id');

//Get the value of the radio button 'published' (0 or 1)
$ads_published = $formModel->getElementData('annonces_adsmanager___ads_published')[0];

//Update the table adsmanager_ads to publish or unpublish the ad
$db = JFactory::getDBO();
$prefix=$db->getPrefix();
$sql= "UPDATE ".$prefix."adsmanager_ads set published=".$ads_published." WHERE id=".$ads_id;
$db->setQuery($sql);
$db->query();
$db->loadResult()

We can't use a trigger to do that because it creates a deadloop ( I couldn't figured out if there's a way to avoid that)

It works, I can publish/unpublish the ads created by the extension adsmanager by using a form created by fabrik.

Fabrik is an awesome extension. Thanks guys
 
Last edited:
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top