Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-26 11:58:28

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Packed Custom Fields issues

Hi guys,
I am trying to use Packed Custom Fields for a project but I got nothing from the custom field I am using.
Anyone has experience with the plugin to help me?

The code is:

The custom field name is “productBuyLink”

Its content is:

article1(name='Product name';price='$29.99 USD';buylink='?action=add&product=60&notify=y')|article2(name='Product name Pro';price='$59.99 USD';buylink='?action=add&product=70&notify=y')

While the form code is:

<txp:sed_pcf_for_each_value name="productBuyLink" debug="1">
    <li class="box button">
        <a class="buy-btn" title="Add {name} to the cart ({price})" href="{buylink}">Add {name} to the cart ({price})</a>
    </li>
</txp:sed_pcf_for_each_value>

As always, thank you all for your help.

Offline

#2 2011-01-26 16:16:17

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: Packed Custom Fields issues

A little follow up.

Converting the custom field name to lowercase, I was able to make the tag “at least” to show its content but I still got no variables (such as {name}) parsed.

Offline

#3 2011-01-26 17:31:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Packed Custom Fields issues

Hi Giuseppe

You might get more information if you posted your issues at the plugin’s thread. This is always a good idea as it keeps all issues on the same place and reduces forum searches.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2011-01-26 17:36:58

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: Packed Custom Fields issues

Ok, I got it to work.
I was confused by the documentation and its lack of examples, but, simply put, the syntax I used was just wrong, sorry.
Even if the way I used it would be really better to use it is not possible to use the sed_pcf_for_each_value since it will work on simple CSV values.

So, the right to write the form is:

    <txp:sed_pcf_if_field_section custom='productbuylink' section='article1'>
    <li class="box button">
        <a class="buy-btn" title="Add <txp:sed_pcf_get_value custom='productbuylink' section='article1' variable='name' /> to the cart (<txp:sed_pcf_get_value custom='productbuylink' section='article1' variable='price' />)" href="?action=add&product=<txp:sed_pcf_get_value custom='productbuylink' section='article1' variable='productid' />">Buy <txp:sed_pcf_get_value custom='productbuylink' section='article1' variable='name' />! <span><txp:sed_pcf_get_value custom='productbuylink' section='article1' variable='price' /></span></a>
    </li>
    </txp:sed_pcf_if_field_section>

    <txp:sed_pcf_if_field_section custom='productbuylink' section='article2'>
    <li class="box button">
        <a class="buy-btn" title="Add <txp:sed_pcf_get_value custom='productbuylink' section='article2' variable='name' /> to the cart (<txp:sed_pcf_get_value custom='productbuylink' section='article2' variable='price' />)" href="?action=add&product=<txp:sed_pcf_get_value custom='productbuylink' section='article2' variable='productid' />">Buy <txp:sed_pcf_get_value custom='productbuylink' section='article2' variable='name' />! <span><txp:sed_pcf_get_value custom='productbuylink' section='article2' variable='price' /></span></a>
    </li>
    </txp:sed_pcf_if_field_section>

while custom field data has changed like:

article1(name='Product name';price='$29.99 USD';productid='60')|article2(name='Product name Pro';price='$59.99 USD';productid='70')

note as the previous productbuylink key in the datas has changed since a bug in parsing the query string truncated it to the action= token considering it a key and not part of the value string.
As a fix I changed it to productid.

I hope this can help.

Offline

#5 2011-01-26 17:39:20

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: Packed Custom Fields issues

Yiannis, I am sorry, I thought about it just after posting it. Is it possible to move it? If not, can I post a link to the plug in thread to this post?

Offline

#6 2011-01-26 17:47:31

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Packed Custom Fields issues

Giuseppe

just got your email but glad you got it working already.


Steve

Offline

#7 2011-01-26 18:10:41

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: Packed Custom Fields issues

Thanks to you Steve for your time. :)
I am going to fork the plugin on github to collaborate on the documentation if you fancy. ;)

Offline

#8 2011-01-26 19:15:48

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Packed Custom Fields issues

Giuseppe

I am going to fork the plugin on github to collaborate on the documentation if you fancy.

Please do :)


Steve

Offline

#9 2011-01-26 19:33:08

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Packed Custom Fields issues

caruso_g wrote:

Yiannis, I am sorry, I thought about it just after posting it. Is it possible to move it? If not, can I post a link to the plug in thread to this post?

The forum as it is now doesn’t allow splitting or merging topics. Never mind, just keep it in mind for a next time ;)

Offline

Board footer

Powered by FluxBB