Hello!
I have a problem. I'm saving outclicks on products, to show them on the site reports section in the CMS. The only problem is, I can't seem to figure out how to pass the array to the sourceRecords() in extended SS_Report, without using a DataObject.
I tried to create a DataObject for the results, but it keeps creating new ones.
I have 2 objects/databases, 1 is the clicks where there are many ProductID's, the other one is the object/database where I pull the counted clicks, so the ProductID's there should be unique.
How can I UPDATE an object, with a specific ID, rather then it adding a new one?
I've tried using the ->write(), but that only creates a new one. Also using ->push() doesn't work. What should I do?
PS. To make it even more clear:
ProductOutclicks.php
static $db = array(
);
public static $has_one = array(
"Product" => "Product"
);
----------
In between here, I collect all the above ProductOutclicks, and merge them into their respective ProductID, counting the total amount of clicks.
---------
ProductOutclickReportObject.php
static $db = array(
"Name" => "Text",
"Clicks" => "Int",
"ProductsID" => "Int"
);
Now I want to pull a specific ProductID from this object and UPDATE it, if the ProductID does not work, we add it to the DataObject.
I've tried all kinds of stuff,
->write()
->push()
custom code
Thanks in advance,
Andreas Saarva.