cancel
Showing results for 
Search instead for 
Did you mean: 

how to make a list table of product variables?

how to make a list table of product variables?

Hi,

 

I'm new to magento. I saw a template with a feature that attract me it's like a list of values table of a configurable product and here is a screenshot

 

1.png

 

So is there any template out there with this feature?

 

Thank you

1 REPLY

Re: how to make a list table of product variables?

All Custom Variables are stored in:

core_variable
core_variable_value

 

--------------------------------------------

 

I'm guessing you need a list of only visible values. I say "values" because attributes are not the actual values, they are descriptors. The following is the salient parts from Mage_Mage_Catalog_Block_Product_View_Attributes:

 

$attributes = $product->getAttributes();
foreach ($attributes as $attribute) {
if ($attribute->getIsVisibleOnFront()) {
$value = $attribute->getFrontend()->getValue($product);
// do something with $value here
}
}


You don't really need to duplicate this though since you can alter/use the template catalog/product/view/attributes.phtml which is already declared on the product view page as attributes block.

 

Reference: http://stackoverflow.com/questions/4961117/get-an-array-of-all-a-products-attributes-in-magento

 

-----------------------------------------

 

This will give all the attributes of a product on the vew page

$product_id = $_product->getId();
$product = Mage::getModel('catalog/product')->load($product_id);
$attributes = $product->getAttributes();

foreach ($attributes as $attribute) {
if($attribute->getAttributeCode() == 'zoo_spec_dog' || $attribute->getAttributeCode() == 'zoo_taste')
{
$attributeLabel = $attribute->getFrontendLabel();
$value = $attribute->getFrontend()->getValue($product);
echo $attributeLabel . '-' . $label . '-' . $value; echo "<br />";
}
}

Reference: http://magento.stackexchange.com/questions/73812/get-all-attributes-of-product