0

I am creating a small plugin, and am having an issue. I am using Carthrob for my e-commerce, and want to take some information into the tag data for my plugin.

My tag is the following:

{exp:submission_data:details cart_entries="{exp:cartthrob:cart_items_info}{entries}x{quantity},{/exp:cartthrob:cart_items_info}"}

The code within the tag data is outputting:

4x1,2x3,1x4,

Here is the part of the my plugin:

$tagdata = $this->EE->TMPL->tagdata;  

$cart_entries = $this->EE->TMPL->fetch_param('cart_entries');

$cart_entries_total = 0;
$explode = explode(",", $cart_entries);

foreach ($explode as $explodeSegment) {
    if (trim($explodeSegment) != "") {
        list($amount, $quantity) = explode("x", $explodeSegment);
        $cart_entries_total += ((int)$amount * (int)$quantity);
    }
}

Currently this is returning 0, instead of 14.

If I add the data (4x1,2x3,1x4,) manually, it outputs the correct number.

I am guessing this is something to do with the CT tags in the tagdata.

Do I need to remove them in the code? how, or is there another solution?

Thank you.

1 Answer 1

1

Try adding parse="inward" to the exp:submission_data:details tag.

0

Your Answer

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

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