Using $CPF_LIST w/ fractional editing

Post

Posted
Rating:
#3609 (In Topic #722)
Joe
I'm using fractional editing with a CPF that contains list type values. In order to display these values automatically, I think I need to use $CPF_LIST to return all possible values of my CPF.

According to the documentation, fractional editing requires a list separated by a |

$CPF_LIST returns all values separated with a comma and oddly repeats the value. Example:

Code

value1=value1,value2=value2,value3=value3, etc.

I imagine I can surround $CPF_LIST with $REPLACE to replace the commas with |, but I'm not sure how to remove the value= part (CPF values all contain different amounts of characters as well).

Post

Posted
Rating:
#3641
This is really pushing at the edges, but I got it to work.

First, I had to make a few fixes:
https://github.com/ocproducts/composr/commit/8e947c532181155ea698b1185b308562162121ea

Then I did it like:

Code

{$SET,edit_type,{$SUBSTR,{$PREG_REPLACE,(^|\,)([^=]*)=([^\,]*),|$2,{$CPF_LIST,Currency code}},1}}

(I just used Currency code as that is a default CPF with a list that I could test with).

Post

Posted
Rating:
#3642
Actually, I think it is better I just code CPF_LIST to support different output.

https://github.com/ocproducts/composr/commit/71cfbb817a99646226541f2719fd3b96326d8473

Code

{$SET,edit_type,{$CPF_LIST,Currency code,|,0}}

Post

Posted
Rating:
#3870
Joe
Chris,

This was working but no longer does. Not sure what happened. Instead of showing a dropdown, it just shows a text field now, almost like it's ignoring $SET.

I don't recall upgrading my installation since you've posted this. It's possible but I'm unsure. I compared both CPF_LIST.php on Github and in my installation, they are both the same.

Is it possible something else could've affected this?

It's not too big of a deal - I'd rather it be dynamic in case I make a change to one of the CPF drop down values so then it'll update on its own when using fractional editing, but worse case scenario I can just manually hard code the drop down values.

Post

Posted
Rating:
#3871
Joe
Nevermind,

What happened was I created a new theme and doing so somehow reverted the changes to FRACTIONAL_EDIT.tpl, so it wasn't using $GET to retrieve the edit_type.

It's fixed now. Sorry.
4 guests and 0 members have recently viewed this.