Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6940785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:47:51+00:00 2026-05-27T12:47:51+00:00

I have this multidimensionnal array in smarty : attribute => Array (16) 25 =>

  • 0

I have this multidimensionnal array in smarty :

attribute => Array (16)
  25 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Blue"
      id_product_attribute => "25"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "25"
  26 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Blue"
      id_product_attribute => "26"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "26"
  27 => Array (2)
    0 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "27"
    1 => Array (3)
      public_group_name => "Color"
      attribute_name => "Yellow"
      id_product_attribute => "27"
  28 => Array (2)
    0 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "28"
    1 => Array (3)
      public_group_name => "Color"
      attribute_name => "Yellow"
      id_product_attribute => "28"
  29 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Metal"
      id_product_attribute => "29"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "29"
  30 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Metal"
      id_product_attribute => "30"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "30"
  32 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Black"
      id_product_attribute => "32"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "32"
  33 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Orange"
      id_product_attribute => "33"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "33"
  34 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Orange"
      id_product_attribute => "34"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "34"
  35 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Pink"
      id_product_attribute => "35"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "35"
  36 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Pink"
      id_product_attribute => "36"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "36"
  39 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Green"
      id_product_attribute => "39"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "39"
  40 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Green"
      id_product_attribute => "40"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "40"
  41 => Array (2)
    0 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "41"
    1 => Array (3)
      public_group_name => "Color"
      attribute_name => "Purple"
      id_product_attribute => "41"
  42 => Array (2)
    0 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "8Go"
      id_product_attribute => "42"
    1 => Array (3)
      public_group_name => "Color"
      attribute_name => "Purple"
      id_product_attribute => "42"
  31 => Array (2)
    0 => Array (3)
      public_group_name => "Color"
      attribute_name => "Black"
      id_product_attribute => "31"
    1 => Array (3)
      public_group_name => "Disk space"
      attribute_name => "16Go"
      id_product_attribute => "31"

I can display all array thanks to this solution link :

{foreach from=$product.attribute key='id_attribute' item='attribute'} 

<li>

    {foreach from=$attribute key='id_property' item='property'} 
        {$property.public_group_name}
        {$property.attribute_name}
    {/foreach}

</li>

{/foreach}

The result is like this :

  • Color Blue Disk space 16Go
  • Color Blue Disk space 8Go
  • Disk space 16Go Color Yellow
  • Disk space 8Go Color Yellow
  • Color Metal Disk space 16Go
  • Color Metal Disk space 8Go
  • Color Black Disk space 8Go
  • Color Orange Disk space 16Go
  • Color Orange Disk space 8Go
  • Color Pink Disk space 16Go
  • Color Pink Disk space 8Go
  • Color Green Disk space 16Go
  • Color Green Disk space 8Go
  • Disk space 16Go Color Purple
  • Disk space 8Go Color Purple
  • Color Black Disk space 16Go

NOw, i want to display result only if a line contain “Blue”.
This array will not been display because he has attribute name = Orange:

33 => Array (2)
        0 => Array (3)
          public_group_name => "Color"
          attribute_name => "Orange"
          id_product_attribute => "33"
        1 => Array (3)
          public_group_name => "Disk space"
          attribute_name => "16Go"
          id_product_attribute => "33"

How can i do that ?
With in_array, can i verify if a value is in a multidimensionnal array ?

Thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:47:52+00:00Added an answer on May 27, 2026 at 12:47 pm

    I think this may do the job:

    {foreach from=$product.attribute key='id_attribute' item='attribute'} 
    {* 
      Test if the first or second element of this array has 
        public_group_name  "Color" 
        attribute_name "Blue"
    *}
    {if ($attribute[0].public_group_name == "Color" && $attribute[0].attribute_name == "Blue") || ($attribute[1].public_group_name == "Color" && $attribute[1].attribute_name == "Blue")}
    <li>
    
        {foreach from=$attribute key='id_property' item='property'} 
            {$property.public_group_name}
            {$property.attribute_name}
        {/foreach}
    
    </li>
    {/if}
    {/foreach}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an multidimensional array that looks like this: Array ( [0] => Array
I have CSV data loaded into a multidimensional array. In this way each row
I have this multidimensional array: Array ( [0] => Array ( [id] => 1
I have this example: var name; var id; var array = []; $.each(data, function(index,
I have a multidimensional array that look like this: Array [1] => Array (
I have a multidimensional-array which looks like this: $array = ( [0] => array
I have this multidimensional array. I need to search it and return only the
I have this array (I know, technically there is no such thing as a
I have this array that populates a dropdown menu. The key is my database
i have an array and i want to convert this array in comma seprated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.