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

  • SEARCH
  • Home
  • 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 3976152
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:46:13+00:00 2026-05-20T04:46:13+00:00

I can’t figure out how to log into my account here on Stackoverflow, I

  • 0

I can’t figure out how to log into my account here on Stackoverflow, I find it a little confusing. Anyway, I’ve asked a question here about a problem I’m having:

Other Question

I’ve since found an open source project that does exactly what I need done but the code is PHP and while I can understand most of it there are bits I don’t get. I’ll post it here with my comments through it and if someone can add extra details that would be appreciated.

    public function productAttributeExists($attributesList, $currentProductAttribute = false)
{
    $result = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pac.`id_product_attribute`
    FROM `'._DB_PREFIX_.'product_attribute` pa
    LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
    WHERE pa.`id_product` = '.intval($this->id));

    if (!$result OR empty($result))
        return false;

    $productAttributes = array();
    foreach ($result AS $productAttribute)
        $productAttributes[$productAttribute['id_product_attribute']][] = $productAttribute['id_attribute'];

    foreach ($productAttributes AS $key => $productAttribute)
        if (sizeof($productAttribute) == sizeof($attributesList))
        {
            $diff = false;
            for ($i = 0; $diff == false AND isset($productAttribute[$i]); $i++)
                if (!in_array($productAttribute[$i], $attributesList) OR $key == $currentProductAttribute)
                    $diff = true;
            if (!$diff)
                return true;
        }
    return false;
}

Ok turns out I can’t comment this code in Stackoverflow without it all going to formatting hell. So my understanding is this:

1) Get the Data
2) If the dataset is empty return false
3) New array called productAttributes
4) Loop through the dataset and populate the array
5) Not sure what this last section is doing, the section beginning ‘foreach’ is unclear to me.

Any tips appreciated. Incidentally, C# is my preferred language and the one I understand best.

  • 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-20T04:46:14+00:00Added an answer on May 20, 2026 at 4:46 am

    This function, as it is named, is only supposed to check if a particular attribute list of a product exists and is the same as the one provided in the first parameter.

    The last part is confusing, but it’s iterating through all the attributes to see if any of the retrieved attributes are the same as the ones provided.

    in a loop iteration:

    • it first tries to see if the provided attribute list is the same length as the one coming from the database – if not, it just goes to the next attribute list in the for loop
    • if the length of the lists is the same, then it will go through each attribute in the attribute list and see if there’s something different amongst any of the elements.

    The function isn’t very optimal, btw.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't figure out how to do this in a pretty way : I have
Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can anyone help me trying to find out why this doesn't work. The brushes
Can I authenticate with just Google account username and password instead of using OAuth?
Can we change the default action of the edit selected row button? Here is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can anybody shed some light on getDay() in Javascript please. Here datepicker is textbox
Can't work out a way to make an array of buttons in android. This
can any one tell me why im only getting flag inserted into my tables
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of

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.