0

I'd like to use a template variable {product_minimum_order_value} in a product model. Channel fields are accessible in template code using {django_syntax}, however I would like to use them in the models without sending them as form data.

Is Expression Engine able to do this without relying on the horrific mess of an alternative I've posted below:

SELECT title, field_id_118
AS 'product_minimum_order_value'
FROM exp_channel_titles t
INNER JOIN exp_channel_data d
ON d.entry_id = t.entry_id
WHERE d.entry_id = 82;`

1 Answer 1

1

If you are in a model (Any backend PHP file). You can do something like,

$data = ee('Model')->get('ChannelEntry', "82")->fields('title', 'field_id_118')->first();
$product_minimum_order_value = "";
if($data)
{
    $product_minimum_order_value = $data->field_id_118;
    unset($data);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.