Search

Hi, how Can I filter from a list the current ID of a page with Data Source (or other method)?

For Example:

I'm in a product page and below there's the correlated products. In the list of correlated products I wouldn't show the current product of this page.

Thank's Davide

In the list of correlated products I wouldn't show the current product of this page.

How do you relate an entry to a page? Are you creating a physical Symphony page for every product? If so, you can link a product entry to a Symphony page using the Page Select field. However if you have one "product" page and you pass a product ID/handle as a URL parameter (such as /product/my-product-name) then you will build the URL as a string using that handle value.

I'm not quite sure what you are asking. Could you be more specific, perhaps show us your XML/XSLT?

You could filter out the current page's product in XSLT. Something like:

<xsl:if test="not(/data/products/entry/@id = /data/params/your-product-param-name)">
    <!-- display product -->
</xsl:if>

You'll need to adjust the xpath as necessary.

Assuming you have the latter set up, as Nick described above, you can filter out the current product displayed by taking the handle from the URL and doing a comparison in your XSLT. Assuming you have

<xsl:apply-templates select="correlated-products/entry[$entry-handle != @handle]"/>

David beat me to it, but you can do it either way.

I'd go with Lewis's approach having seen it as it seems more elegant to me :-)

@Nick I've got one product page and I show the product values in this page by an ID (the name)

The solutions of Lewis and David is what I was looking for.

Thanks to all!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details