Please consider this is just a note, that can be useful for people with advanced PHP knowledge.
Question:
"What I want to know is how to have access to all the data of the listing object; for now I'm stuck in widgets so I can retrieve just a part of the listing, I want to have all the information about the buyer, the seller, the product in one and only place. So that I could do a shortcode to use it on the entire website. "
Answer:
a) Listing Fields
/**
* tdf_fields() return all custom fields
*/
foreach (tdf_fields() as $field) {
/* @var \Tangibledesign\Framework\Models\Field\Field $field */
echo($field->getId() . ' (' . $field->getId() . ')<br>');
}
/**
* example how to get specific field
*/
$field = tdf_fields()->find(function ($field) {
/* @var \Tangibledesign\Framework\Models\Field\Field $field */
return $field->getId() === 1000; // specific field id
});
/**
* Check listivo-core/framework/Models/Field/ for specific field type classes
* Example for price field
*/
$priceField = tdf_fields()->find(function ($field) {
return $field->getId() === 300;
});
$listingId = 10; // example listing id
$listing = tdf_post_factory()->create($listingId);
if ($listing instanceof \Tangibledesign\Framework\Models\Model && $priceField instanceof \Tangibledesign\Framework\Models\Field\PriceField) {
$values = $priceField->getValue($listing);
print_r($values);
}b) How to get information about the user: