1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Join our Telegram chat: https://t.me/a_parser_en
    Dismiss Notice

Include original query in result

Discussion in 'A-Parser Support Forum' started by IStores, Feb 16, 2019.

Tags:
  1. IStores

    IStores A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Dec 4, 2018
    Messages:
    11
    Likes Received:
    3
  2. Support

    Support Administrator
    Staff Member A-Parser Enterprise

    Joined:
    Mar 16, 2012
    Messages:
    4,377
    Likes Received:
    2,107
    Hello.
    Try this:
    Code:
    $p1.products.format('$query,$link\n')
     
    IStores likes this.
  3. IStores

    IStores A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Dec 4, 2018
    Messages:
    11
    Likes Received:
    3
    Thanks, that was simple!

    Can you do the same with 2 different arrays?

     
  4. Support

    Support Administrator
    Staff Member A-Parser Enterprise

    Joined:
    Mar 16, 2012
    Messages:
    4,377
    Likes Received:
    2,107
    Please specify what exactly you want to do?
     
  5. IStores

    IStores A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Dec 4, 2018
    Messages:
    11
    Likes Received:
    3
    For example I would like to parse the link to extract ID

    Here parse results makes you create a new array for the result.

    Using
    $p1.products.format('$query,$id,$link\n')

    Does not show id from products2 array, this is what I dont know how to do, $p1.products2.format('$id') is what I would like to include in results for each
    line too.

    Hope I explained ok

    Thanks
     
  6. Support

    Support Administrator
    Staff Member A-Parser Enterprise

    Joined:
    Mar 16, 2012
    Messages:
    4,377
    Likes Received:
    2,107
    If the sizes of product1 and product2 are always the same, then you can loop through one of the arrays (using the template engine) and output data from both arrays using a variable from the loop.
    Example:
    [​IMG]

    If the sizes of arrays are different, then how should the data contained in them correspond?
     
    IStores likes this.
  7. IStores

    IStores A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Dec 4, 2018
    Messages:
    11
    Likes Received:
    3
    Yes, they will always be the same.

    I will try that, thank you
     
    Support likes this.

Share This Page