Okay
  Public Ticket #3743099
unable to create url with a column from a permalink from another column
Closed

Comments

  • darren waggott started the conversation

    Dear wpDataTables Support Team,

    I have been trying to create a table where the entries in one column are clickable links that direct to URLs constructed from another column's values. Despite following online documentation and even consulting with ChatGPT, I haven't been successful in achieving this functionality.

    Issue Details:

    • Table Setup:
      • I have a column named "Short Name" that contains the names of products.
      • I also have a column named "product_slug" that contains the corresponding product slugs pulled from the WordPress database.
    • Objective:
      • I want the entries in the "Short Name" column to be clickable links.
      • The URL for each link should be constructed using the value from the "product_slug" column.
      • The desired URL structure is: https://www.theminingshop.co.uk/buy-asic-miners/{product_slug}/

    Specific Example:

    • Product:
      • Short Name: Antminer AL1
      • product_slug Value: bitmain-antminer-al1-pro-16-6th-alephium-alph-blake3-asic-miner
    • Current Outcome:
      • The link for "Antminer AL1" currently points to: https://www.theminingshop.co.uk/wp-admin/Antminer%20AL1
    • Desired Outcome:
      • The link should point to: https://www.theminingshop.co.uk/buy-asic-miners/bitmain-antminer-al1-pro-16-6th-alephium-alph-blake3-asic-miner/

    What I've Tried:

    • In the wpDataTable settings for the "Short Name" column, I attempted to make the column a clickable link by:
      • Setting the URL Template to: https://www.theminingshop.co.uk/buy-asic-miners/%product_slug%/
      • Setting the Display Text to: %Short Name%
    • Despite this configuration, the links are not using the product_slug values and are instead pointing incorrectly to the admin URL with the product name.

    Additional Information:

    • Here is a sample of the data from my table:
      BrandAlgorithmPowerPriceDailyROI
      BitmainBlake33735W11,80031.72372

    Request:

    Could you please provide guidance on how to correctly configure the "Short Name" column to use the "product_slug" column for constructing the URLs? I would like the links to direct users to the appropriate product pages as per the desired URL structure.

    I appreciate your assistance and look forward to your response.

    Thank you.

    Best regards,

    Darren 

    Attached files:  Screenshot 2024-10-12 at 14.44.14.png

  •  1,825
    Miloš replied

    Hi Darren,

    My sincerest apology, there was an error on this ticket from my end - I wrote a reply, but it somehow did not get sent properly.

    This will not happen again, thank you very much for your patience.

     

    1. Can you first please make sure that all the columns included in this operation are set to be "String" type?
      As mentioned on the Documentation, when we use the Transform Value feature, if you try setting the "transform" column to "URL link type" - that won't work;
      or if any of the columns, from the placeholders used, are also not string - there will be issues.

      And also, for any clickable link, you will need to write the full Custom HTML in the String Column "transform value", in order to make hyperlinks, with the "a href" property.


    2. Here is my example of a table where we have some dummy products, and how we create the "Transform Value" solution to combine two columns as placeholders for the clickable hyperlink.

      It will be a 'standard' hyperlink by combining creating an "a href" and wrapping that around some column value placeholders and in this way it works without issues.

       

      We have a Table with some Products, the Product ID Column named  as "id"  along with Field "ProductName", etc;

      For each Product, we made an individual Page, with the URL as  :

      http://myWebsite/page-Product ID/

      For Product ID 221 the full URL will be like :

      http://localhost/current/page-221/

       

       

      4873800829.png

       

      For a Custom Link, i will create an "a href" HTML hyperlink and add a "target blank", an optional attribute to open it in a new tab, as well as displayed link text.

      For the URL, we create each cell to start with "<a href="http://localhost/current/page-"  then add the value for the Product ID as column placeholder {id.value} and for the displayed link text we will combine adding the product name such as "Click here to view {productname.value} Page" , ending it with the closing </a> tag, like :

      <a href="http://localhost/current/page-{id.value}" target="_blank">Click here to view {productname.value} Page</a>
      4092167752.png

       

      Of course, we can additionally add a CSS class to the HTML anchor Tag, such as :

      <a class="customlink" href="http://localhost/current/page-{id.value}" target="_blank">Click here to view {productname.value} Page</a>
      

      Then we can call that class for custom styling and make the link look as a button in the Table's Customize/Custom CSS, and so on.

      9771482354.png

      So, as long as we include some existing column placeholders with values, we can construct custom links, etc.

       

       

      Let me know how it goes, if you encounter any further issues with this use-case.


      Once again, my sincerest apologies for such extreme waiting time, this will not happen again.




     

     

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • darren waggott replied

    EVEN THOUGH THIS TICKET WAS POSTED THREE WEEKS AGO! I MANANGED TO SOLVE THIS MY SELF!
    REPLY TO MY NEW TICKETS!

  •  1,825
    Miloš replied

    Hi Darren,

    My sincere apologies once again for that error on this ticket.
    We will monitor all open tickets closely going forward, the issue should not happen again.

    We will respond to all your other open tickets now.
    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables