Jump to content

create html select for all Features


Recommended Posts

Hello everyone, I read all the documentation online but I could not solve, ask for help.


I have to create in a separate .php file (not directly on prestashop) a select for each Feature existing, with its description and value.


I do a similiar thing for categories, like:




$cats = Category::getCategories( (int)($cookie->id_lang), true, false  ) ;  



for features how i can do?



Link to comment
Share on other sites

foreach($productlist as $product){
    $productObj = new Product($product['product_id']);
    $productFeatures = Product::getFeaturesStatic($product['product_id']);

Just loop trough the products and then remove duplicates. You have to get all products and store them as array

Edited by jsmit2 (see edit history)
Link to comment
Share on other sites

At the end this is the code i need:

$lang_id = 1;
$features = Feature::getFeatures( $lang_id, false );
foreach($features as $feature){  
    echo($feature["name"].": <select name=\"".$feature["id_feature"]."\">");   
    $featurevalues = FeatureValue::getFeatureValuesWithLang ( (int)($feature["id_feature"]), $lang_id, false );  
    foreach($featurevalues as $featurevalue){
        echo("<option value=\"".$featurevalue["id_feature_value"]."\">".$featurevalue["value"]."</option>");            

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...