Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to more easily inlcude SIZE data as array #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seansan
Copy link
Contributor

@seansan seansan commented Jan 15, 2019

No description provided.

@seansan
Copy link
Contributor Author

seansan commented Jan 15, 2019

@hkb Sorry about that, made it more robust for 'any' attribute

/* Returns array of sizes data - and flexible to use in Product.php because of param */
public function getChildAttribute($attribute_code)
{
    $values = array();
    if($this->isConfigurable()){
        $all = $this->getTypeInstance(true)->getUsedProducts(null, $this);
        foreach ($all as $child) {
            if ($child->isSaleable()) { 
                $values[] = $child->getAttributeText($attribute_code); 
                /* Get the ID $values[] = $child->getData($attribute_code); */
            }
        }
    } else {
        $values[] = $this->getAttributeText($attribute_code);
    }

    return $values;
}

@seansan
Copy link
Contributor Author

seansan commented Jan 15, 2019

Can also add an optional flag

$val = true

if $val = true get value if set to false then get the ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant