0

I have many categories like rings, pendents, chains in my site. the products under category rings have custom option like Quality grade - A, B, C .... size - 5,6,7 ..... metal - Gold , silver, platinum all with some extra prices

Is there any way to create custom option once for the product and i can use them in all other product under rings.

As now i have to add same options again n again when i add products? Different custom option for different category.

Please suggest

  • use configurable product instead of custom option – Amit Bera Mar 19 '15 at 11:28
  • @sonal, do each of these custom options on a ring have its own (and different) amount added to the price? – musicliftsme Mar 19 '15 at 13:36
  • yes, price varies with custom options for each ring – sonal Mar 20 '15 at 4:29
0

You can create an attribute by option

  • Grade (with values "A", "B", "C", etc.)
  • Metal (with values "gold", "silver", etc.)
  • Size (with values "5", "6", "7", etc.)

Then create simple products for all variation

  • ring variation 1 : grade A, Metal Gold, Size 5
  • ring variation 2 : grade B, Metal Gold, Size 5
  • ring variation 3 : grade B, Metal Silver, Size 5
  • etc.

Then create configurable product on attributes grade, size and metal. You'll just have to link simple products to enable an option.

  • But in this case if the one ring comes in 10 variation then i have to add it ten times as simple product and after that i should create a configurable product ,right? – sonal Mar 19 '15 at 12:03
  • Yes, but it is easier to duplicate products and change only one attribute. You can also mass import simple products in your backend with a CSV file. – Pilou Mar 19 '15 at 12:20
0

There is no interface in the admin to copy custom options, unfortunately. However, it can be done easily with a script or extension. I answered a question on how to programmatically add custom options not long ago.

Check it out: Add custom options to products programmatically

0

I had to do this last night so i'm gonna show you how i did it, perhaps this could help someone, in my scenario i have to add for a custom category the option of unassembled-preassembled product, with a 6% increment, as you'll see you can setup your option as you want, you don't have to spend money if you know a little of stored procedured and cursors. Ok so here is the code: i'll put 22 as the category_id in your case it should be probably a different category_id.

   CREATE PROCEDURE `customOptions`()
    BEGIN
      DECLARE finished integer DEFAULT 0;
      DECLARE v_id integer;
      DECLARE v_option integer;
      DECLARE v_option_type_one integer;
      DECLARE v_option_type_two integer;
      DECLARE product_cursor CURSOR FOR
        SELECT DISTINCT (`product_id`) FROM `catalog_category_product` WHERE `category_id` IN (22);
      DECLARE CONTINUE HANDLER FOR NOT FOUND
        SET finished = 1;
      OPEN product_cursor;
      get_product: LOOP
        FETCH product_cursor INTO v_id;
        IF finished = 1 THEN
          LEAVE get_product;
        END IF;
        -- build email list
        INSERT
          INTO `catalog_product_option`
        VALUES
          (NULL, v_id, 'drop_down', 1, NULL, 0, NULL, 0, 0, 1);
        SET v_option = LAST_INSERT_ID();
        INSERT
          INTO `catalog_product_option_title`
        VALUES
          (NULL, v_option, 0, 'preassembled');
        INSERT
          INTO `catalog_product_option_type_value`
        VALUES
          (NULL, v_option, NULL, 1);
        SET v_option_type_one = LAST_INSERT_ID();
        INSERT
          INTO `catalog_product_option_type_value`
        VALUES
          (NULL, v_option, NULL, 2);
        SET v_option_type_two = LAST_INSERT_ID();
        INSERT
          INTO `catalog_product_option_type_price`
        VALUES
          (NULL, v_option_type_one, 0, 0, 'percent');
        INSERT
          INTO `catalog_product_option_type_price`
        VALUES
          (NULL, v_option_type_two, 0, 6, 'percent');
        INSERT
          INTO `catalog_product_option_type_title`
        VALUES
          (NULL, v_option_type_one, 0, 'No');
        INSERT
          INTO `catalog_product_option_type_title`
        VALUES
          (NULL, v_option_type_two, 0, 'Yes');
      END LOOP get_product;
      CLOSE product_cursor;
        update catalog_product_entity set has_options=1,required_options=1 where entity_id in (SELECT DISTINCT (`product_id`) FROM `catalog_category_product` WHERE `category_id` IN (22));

    END; 

So, that's pretty much all, hope this could help someone, have a great day!

  • of course you then type php bin/magento indexer:reindex and clean cache and you're all set. – Daniel B Jul 31 at 19:44
  • you could also do that with a php script, but as i feel comfortable with sql is easier for me also i learn about the magento structure. – Daniel B Jul 31 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.