duepiudue Posted January 20, 2015 Share Posted January 20, 2015 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: <?php require_once("site/config/defines.inc.php"); require_once("site/config/autoload.php"); $cats = Category::getCategories( (int)($cookie->id_lang), true, false ) ; print_r($cats); ?> for features how i can do? Link to comment Share on other sites More sharing options...
jsmit2 Posted January 20, 2015 Share Posted January 20, 2015 So you want to have the presta base functionality outside of the url presta is on? Or a seperate file in your module map? Link to comment Share on other sites More sharing options...
duepiudue Posted January 20, 2015 Author Share Posted January 20, 2015 sorry for double post Link to comment Share on other sites More sharing options...
jsmit2 Posted January 20, 2015 Share Posted January 20, 2015 (edited) No problem. You cannot include the prestashop functions outside of prestashop. But if it is your modules folder you must add this include: require_once('../../config/config.inc.php'); Edited January 20, 2015 by jsmit2 (see edit history) Link to comment Share on other sites More sharing options...
duepiudue Posted January 20, 2015 Author Share Posted January 20, 2015 ok, thanks, but.. what function i need to use for Features? Feature::getFeatures((int)($cookie->id_lang)) return empty array Link to comment Share on other sites More sharing options...
jsmit2 Posted January 20, 2015 Share Posted January 20, 2015 (edited) If you mean features of a product try to look at this: $productObj = new Product($product['product_id']); $productFeatures = Product::getFeaturesStatic($product['product_id']); Edited January 20, 2015 by jsmit2 (see edit history) Link to comment Share on other sites More sharing options...
duepiudue Posted January 20, 2015 Author Share Posted January 20, 2015 No sorry, i need the all features possible Link to comment Share on other sites More sharing options...
jsmit2 Posted January 20, 2015 Share Posted January 20, 2015 (edited) 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 January 20, 2015 by jsmit2 (see edit history) Link to comment Share on other sites More sharing options...
duepiudue Posted January 20, 2015 Author Share Posted January 20, 2015 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>"); } echo("</select>");} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now