Integrity constraint violation: Duplicate entry for key 'UNQ_CATALOG_PRODUCT_SUPER_ATTRIBUTE_PRODUCT_ID_ATTRIBUTE_ID' The Next CEO of Stack OverflowError When Adding Attribute: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 1dynamic key => value pair adminhtml setting for custom moduleConfigurable product super attribute Integrity constraint violation errorMagento exception Integrity constraint violation: 1048 Column 'value' cannot be null' in libZendDbStatementPdo.php:234Magento: using duplicate product button, but emptying Url KeyMagento How to add configurable product while placing order programatically?Magento uses <h1> for the logo on EVERY page - Duplicate h1 tags

Can you replace a racial trait cantrip when leveling up?

Why do professional authors make "consistency" mistakes? And how to avoid them?

Preparing Indesign booklet with .psd graphics for print

Why does the UK parliament need a vote on the political declaration?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Is it possible to search for a directory/file combination?

How do I avoid eval and parse?

Why didn't Khan get resurrected in the Genesis Explosion?

Bold, vivid family

If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?

Why do airplanes bank sharply to the right after air-to-air refueling?

How powerful is the invisibility granted by the Gloom Stalker ranger's Umbral Sight feature?

Return the Closest Prime Number

In the bitcoin scripting language, how can I access other outputs of the transaction? Or how else can I limit how the coins may be spent?

Is it professional to write unrelated content in an almost-empty email?

How to solve a differential equation with a term to a power?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Is micro rebar a better way to reinforce concrete than rebar?

WOW air has ceased operation, can I get my tickets refunded?

How do I go from 300 unfinished/half written blog posts, to published posts?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

In excess I'm lethal

What is the result of assigning to std::vector<T>::begin()?

Does it take more energy to get to Venus or to Mars?



Integrity constraint violation: Duplicate entry for key 'UNQ_CATALOG_PRODUCT_SUPER_ATTRIBUTE_PRODUCT_ID_ATTRIBUTE_ID'



The Next CEO of Stack OverflowError When Adding Attribute: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 1dynamic key => value pair adminhtml setting for custom moduleConfigurable product super attribute Integrity constraint violation errorMagento exception Integrity constraint violation: 1048 Column 'value' cannot be null' in libZendDbStatementPdo.php:234Magento: using duplicate product button, but emptying Url KeyMagento How to add configurable product while placing order programatically?Magento uses <h1> for the logo on EVERY page - Duplicate h1 tags










1















I cant save the super attribute because i get error



$pricesByAttributeValues = array();
$baseCode = Mage::app()->getBaseCurrencyCode();
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect(array('name', 'id', 'price','special_price','desde','moneda_base'))
->addAttributeToFilter('type_id', array('eq' => 'configurable'))
->addAttributeToFilter('sku', array('like' => 'Miila-CV'));

foreach ($collectionConfigurable as $_configurableproduct)
$_configurableproduct->getId();
$_configurableproduct->getName();
$moneda_base = Mage::getModel('catalog/product')->load($_configurableproduct->getId())->getAttributeText('moneda_base');
//Get precio moneda base
foreach ($rates as $rate=>$value)
if (strcmp ($rate , $moneda_base ) == 0)

$moneda_base = $value;


//Precio y Ofertas
$precio = number_format($_configurableproduct->getPrice() / $moneda_base , 2);
$descuento = number_format($_configurableproduct->getSpecialPrice() / $moneda_base , 2);
$desde = number_format($_configurableproduct->getDesde() / $moneda_base , 2);
$_configurableproduct->setPrice($precio);
$_configurableproduct->setSpecialPrice($descuento);
$_configurableproduct->setDesde($desde);
//Configurables
$attributes = $_configurableproduct->getTypeInstance(true)->getConfigurableAttributes($_configurableproduct);
$i = 0;
foreach ($attributes as $attribute)
$prices = $attribute->getPrices();
foreach ($prices as $price)
$pricesByAttributeValues[$i]['product_super_attribute_id'] = $price['product_super_attribute_id'];
$pricesByAttributeValues[$i]['value_index'] = $price['value_index'];
$pricesByAttributeValues[$i]['label'] = $price['label'];
$pricesByAttributeValues[$i]['default_label'] = $price['default_label'];
$pricesByAttributeValues[$i]['store_label'] = $price['store_label'];
$pricesByAttributeValues[$i]['is_percent'] = $price['is_percent'];
$pricesByAttributeValues[$i]['pricing_value'] = (float)$price['pricing_value'] / 2;
$pricesByAttributeValues[$i]['use_default_value'] = $price['use_default_value'];
$pricesByAttributeValues[$i]['value_id'] = $price['value_id'];
$i++;


try

$_configurableproduct->setCanSaveConfigurableAttributes(true);
$_configurableproduct->setConfigurableAttributesData($pricesByAttributeValues);
$_configurableproduct->save();
catch (Exception $e)
echo 'Excepción capturada: ', $e->getMessage(), "n";











share|improve this question
















bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    1















    I cant save the super attribute because i get error



    $pricesByAttributeValues = array();
    $baseCode = Mage::app()->getBaseCurrencyCode();
    $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
    $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
    $collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToSelect(array('name', 'id', 'price','special_price','desde','moneda_base'))
    ->addAttributeToFilter('type_id', array('eq' => 'configurable'))
    ->addAttributeToFilter('sku', array('like' => 'Miila-CV'));

    foreach ($collectionConfigurable as $_configurableproduct)
    $_configurableproduct->getId();
    $_configurableproduct->getName();
    $moneda_base = Mage::getModel('catalog/product')->load($_configurableproduct->getId())->getAttributeText('moneda_base');
    //Get precio moneda base
    foreach ($rates as $rate=>$value)
    if (strcmp ($rate , $moneda_base ) == 0)

    $moneda_base = $value;


    //Precio y Ofertas
    $precio = number_format($_configurableproduct->getPrice() / $moneda_base , 2);
    $descuento = number_format($_configurableproduct->getSpecialPrice() / $moneda_base , 2);
    $desde = number_format($_configurableproduct->getDesde() / $moneda_base , 2);
    $_configurableproduct->setPrice($precio);
    $_configurableproduct->setSpecialPrice($descuento);
    $_configurableproduct->setDesde($desde);
    //Configurables
    $attributes = $_configurableproduct->getTypeInstance(true)->getConfigurableAttributes($_configurableproduct);
    $i = 0;
    foreach ($attributes as $attribute)
    $prices = $attribute->getPrices();
    foreach ($prices as $price)
    $pricesByAttributeValues[$i]['product_super_attribute_id'] = $price['product_super_attribute_id'];
    $pricesByAttributeValues[$i]['value_index'] = $price['value_index'];
    $pricesByAttributeValues[$i]['label'] = $price['label'];
    $pricesByAttributeValues[$i]['default_label'] = $price['default_label'];
    $pricesByAttributeValues[$i]['store_label'] = $price['store_label'];
    $pricesByAttributeValues[$i]['is_percent'] = $price['is_percent'];
    $pricesByAttributeValues[$i]['pricing_value'] = (float)$price['pricing_value'] / 2;
    $pricesByAttributeValues[$i]['use_default_value'] = $price['use_default_value'];
    $pricesByAttributeValues[$i]['value_id'] = $price['value_id'];
    $i++;


    try

    $_configurableproduct->setCanSaveConfigurableAttributes(true);
    $_configurableproduct->setConfigurableAttributesData($pricesByAttributeValues);
    $_configurableproduct->save();
    catch (Exception $e)
    echo 'Excepción capturada: ', $e->getMessage(), "n";











    share|improve this question
















    bumped to the homepage by Community 4 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      1












      1








      1








      I cant save the super attribute because i get error



      $pricesByAttributeValues = array();
      $baseCode = Mage::app()->getBaseCurrencyCode();
      $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
      $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
      $collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
      ->addAttributeToSelect(array('name', 'id', 'price','special_price','desde','moneda_base'))
      ->addAttributeToFilter('type_id', array('eq' => 'configurable'))
      ->addAttributeToFilter('sku', array('like' => 'Miila-CV'));

      foreach ($collectionConfigurable as $_configurableproduct)
      $_configurableproduct->getId();
      $_configurableproduct->getName();
      $moneda_base = Mage::getModel('catalog/product')->load($_configurableproduct->getId())->getAttributeText('moneda_base');
      //Get precio moneda base
      foreach ($rates as $rate=>$value)
      if (strcmp ($rate , $moneda_base ) == 0)

      $moneda_base = $value;


      //Precio y Ofertas
      $precio = number_format($_configurableproduct->getPrice() / $moneda_base , 2);
      $descuento = number_format($_configurableproduct->getSpecialPrice() / $moneda_base , 2);
      $desde = number_format($_configurableproduct->getDesde() / $moneda_base , 2);
      $_configurableproduct->setPrice($precio);
      $_configurableproduct->setSpecialPrice($descuento);
      $_configurableproduct->setDesde($desde);
      //Configurables
      $attributes = $_configurableproduct->getTypeInstance(true)->getConfigurableAttributes($_configurableproduct);
      $i = 0;
      foreach ($attributes as $attribute)
      $prices = $attribute->getPrices();
      foreach ($prices as $price)
      $pricesByAttributeValues[$i]['product_super_attribute_id'] = $price['product_super_attribute_id'];
      $pricesByAttributeValues[$i]['value_index'] = $price['value_index'];
      $pricesByAttributeValues[$i]['label'] = $price['label'];
      $pricesByAttributeValues[$i]['default_label'] = $price['default_label'];
      $pricesByAttributeValues[$i]['store_label'] = $price['store_label'];
      $pricesByAttributeValues[$i]['is_percent'] = $price['is_percent'];
      $pricesByAttributeValues[$i]['pricing_value'] = (float)$price['pricing_value'] / 2;
      $pricesByAttributeValues[$i]['use_default_value'] = $price['use_default_value'];
      $pricesByAttributeValues[$i]['value_id'] = $price['value_id'];
      $i++;


      try

      $_configurableproduct->setCanSaveConfigurableAttributes(true);
      $_configurableproduct->setConfigurableAttributesData($pricesByAttributeValues);
      $_configurableproduct->save();
      catch (Exception $e)
      echo 'Excepción capturada: ', $e->getMessage(), "n";











      share|improve this question
















      I cant save the super attribute because i get error



      $pricesByAttributeValues = array();
      $baseCode = Mage::app()->getBaseCurrencyCode();
      $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
      $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
      $collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
      ->addAttributeToSelect(array('name', 'id', 'price','special_price','desde','moneda_base'))
      ->addAttributeToFilter('type_id', array('eq' => 'configurable'))
      ->addAttributeToFilter('sku', array('like' => 'Miila-CV'));

      foreach ($collectionConfigurable as $_configurableproduct)
      $_configurableproduct->getId();
      $_configurableproduct->getName();
      $moneda_base = Mage::getModel('catalog/product')->load($_configurableproduct->getId())->getAttributeText('moneda_base');
      //Get precio moneda base
      foreach ($rates as $rate=>$value)
      if (strcmp ($rate , $moneda_base ) == 0)

      $moneda_base = $value;


      //Precio y Ofertas
      $precio = number_format($_configurableproduct->getPrice() / $moneda_base , 2);
      $descuento = number_format($_configurableproduct->getSpecialPrice() / $moneda_base , 2);
      $desde = number_format($_configurableproduct->getDesde() / $moneda_base , 2);
      $_configurableproduct->setPrice($precio);
      $_configurableproduct->setSpecialPrice($descuento);
      $_configurableproduct->setDesde($desde);
      //Configurables
      $attributes = $_configurableproduct->getTypeInstance(true)->getConfigurableAttributes($_configurableproduct);
      $i = 0;
      foreach ($attributes as $attribute)
      $prices = $attribute->getPrices();
      foreach ($prices as $price)
      $pricesByAttributeValues[$i]['product_super_attribute_id'] = $price['product_super_attribute_id'];
      $pricesByAttributeValues[$i]['value_index'] = $price['value_index'];
      $pricesByAttributeValues[$i]['label'] = $price['label'];
      $pricesByAttributeValues[$i]['default_label'] = $price['default_label'];
      $pricesByAttributeValues[$i]['store_label'] = $price['store_label'];
      $pricesByAttributeValues[$i]['is_percent'] = $price['is_percent'];
      $pricesByAttributeValues[$i]['pricing_value'] = (float)$price['pricing_value'] / 2;
      $pricesByAttributeValues[$i]['use_default_value'] = $price['use_default_value'];
      $pricesByAttributeValues[$i]['value_id'] = $price['value_id'];
      $i++;


      try

      $_configurableproduct->setCanSaveConfigurableAttributes(true);
      $_configurableproduct->setConfigurableAttributesData($pricesByAttributeValues);
      $_configurableproduct->save();
      catch (Exception $e)
      echo 'Excepción capturada: ', $e->getMessage(), "n";








      magento-1 superattribute






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '16 at 7:55









      Siarhey Uchukhlebau

      9,92693058




      9,92693058










      asked Apr 12 '16 at 5:21









      Manuel MattarManuel Mattar

      62




      62





      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I think what the exception is saying, is, that you try to add the same super-attribute twice to the product; so, when trying to insert into the database, the unique key throws an error.



          For more help, please add some more comments to your code, and please to this in English. You could also clean it up a little; only by first glance, these lines:



          $_configurableproduct->getId();
          $_configurableproduct->getName();


          ...don't do anything at all, they're just useless.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f110458%2fintegrity-constraint-violation-duplicate-entry-for-key-unq-catalog-product-sup%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I think what the exception is saying, is, that you try to add the same super-attribute twice to the product; so, when trying to insert into the database, the unique key throws an error.



            For more help, please add some more comments to your code, and please to this in English. You could also clean it up a little; only by first glance, these lines:



            $_configurableproduct->getId();
            $_configurableproduct->getName();


            ...don't do anything at all, they're just useless.






            share|improve this answer



























              0














              I think what the exception is saying, is, that you try to add the same super-attribute twice to the product; so, when trying to insert into the database, the unique key throws an error.



              For more help, please add some more comments to your code, and please to this in English. You could also clean it up a little; only by first glance, these lines:



              $_configurableproduct->getId();
              $_configurableproduct->getName();


              ...don't do anything at all, they're just useless.






              share|improve this answer

























                0












                0








                0







                I think what the exception is saying, is, that you try to add the same super-attribute twice to the product; so, when trying to insert into the database, the unique key throws an error.



                For more help, please add some more comments to your code, and please to this in English. You could also clean it up a little; only by first glance, these lines:



                $_configurableproduct->getId();
                $_configurableproduct->getName();


                ...don't do anything at all, they're just useless.






                share|improve this answer













                I think what the exception is saying, is, that you try to add the same super-attribute twice to the product; so, when trying to insert into the database, the unique key throws an error.



                For more help, please add some more comments to your code, and please to this in English. You could also clean it up a little; only by first glance, these lines:



                $_configurableproduct->getId();
                $_configurableproduct->getName();


                ...don't do anything at all, they're just useless.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 13 '16 at 7:47









                simonthesorcerersimonthesorcerer

                3,56721127




                3,56721127



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f110458%2fintegrity-constraint-violation-duplicate-entry-for-key-unq-catalog-product-sup%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                    How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2

                    Nissan Patrol Зміст Перше покоління — 4W60 (1951-1960) | Друге покоління — 60 series (1960-1980) | Третє покоління (1980–2002) | Четверте покоління — Y60 (1987–1998) | П'яте покоління — Y61 (1997–2013) | Шосте покоління — Y62 (2010- ) | Посилання | Зноски | Навігаційне менюОфіційний український сайтТест-драйв Nissan Patrol 2010 7-го поколінняNissan PatrolКак мы тестировали Nissan Patrol 2016рвиправивши або дописавши її