bnadauld Posted May 17, 2019 Share Posted May 17, 2019 The only way i can get customization to work is by writing db entries via ps_customization_field & ps_customization_field_lang and even then i have to go into each product (in the back office) and move the required slider and click save. With 500 products ..a laborious job to say the least. Any ideas? 1 Link to comment Share on other sites More sharing options...
NemoPS Posted May 19, 2019 Share Posted May 19, 2019 You can make a simple script, here is what I did $id_categories = [1430]; // can be multiple $context = Context::getContext(); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT id_product FROM '._DB_PREFIX_.'category_product WHERE id_category IN('.implode(',', $id_categories).')'); if($result) { foreach ($result as $pr) { $product = new Product($pr['id_product'], false, $context->language->id); $text_count = 3; $product->createLabels(0, $text_count); $product->customizable = 1; $product->text_fields = 3; $product->update(); $fields = $product->getCustomizationFields(); $n = 0; foreach ($fields[1] as $id => $value) { switch ($n) { case 0: $_POST['label_1_'.(int)$id.'_1'] = 'Associated To'; break; case 1: $_POST['label_1_'.(int)$id.'_1'] = 'Sender Name'; break; case 2: $_POST['label_1_'.(int)$id.'_1'] = 'Recipient Name'; break; } $n++; } $product->updateLabels(); } } Adds customization fields to all products of certain categories 1 Link to comment Share on other sites More sharing options...
bnadauld Posted May 19, 2019 Author Share Posted May 19, 2019 Thanks very much for the help...Really appreciate it! 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