Hello there!

Is there any way to get product attribute SKUs? (on product page template)

What I would like to achieve is to show stock information for each product attribute, which are sizes of the product on my website.

Thanks!

Comments

TR’s picture

Component: Stock » Products
Status: Active » Fixed
kevin_91’s picture

Hey, thanks for that, although I already tried this. It's almost perfect, I can get SKUs of the attributes but not in the right order.

For example:

Product - Organic Towel
Attribute - Size:
- Hand Towel (SKU: 6L-Z4LJ-YAON)
- Bath Towel (SKU: 1A-IHT6-JE3Y)
- Jumbo Bath Towel (SKU: B007DW316E)

When I try to get the SKUs what I get is:

0: 1A-IHT6-JE3Y
1: 6L-Z4LJ-YAON
2: B007DW316E

Is there any way to get attribute option ID maybe or something similar?

kevin_91’s picture

Status: Fixed » Active
TR’s picture

Status: Active » Fixed

Late response, but the answer is basically the same as what I said in your other issue #2462125: Show Attribute Option Stock
Specifically, attributes don't have SKUs. Instead SKUs may be assigned to any of the combinations of selected attribute options available on the product.

I believe that the default order of attributes should be the same as that shown on the node/%/edit/attributes page for that product. There are API functions in the uc_attribute module for looking up the option name based on the option ID.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.