Integrity constraint violation: Duplicate entry for key 'UNQ_CATALOG_PRODUCT_SUPER_ATTRIBUTE_PRODUCT_ID_ATTRIBUTE_ID'Error 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 chords be inferred from melody alone?
The size of sheafification
Do any languages mention the top limit of a range first?
What are these circular spots on these Ariane V SRB nozzles?
How many years before enough atoms of your body are replaced to survive the sudden disappearance of the original body’s atoms?
How easy is it to get a gun illegally in the United States?
Where to pee in London?
Are certificates without DNS fundamentally flawed?
How to check a file was encrypted (really & correctly)
Does the spell "Silence" affect the caster?
Did WWII Japanese soldiers engage in cannibalism of their enemies?
What could prevent players from leaving an island?
Why can I log in to my Facebook account with a misspelled email/password?
Print only the last three columns from file
What does VB stand for?
Is it double speak?
Should I self-publish my novella on Amazon or try my luck getting publishers?
Traveling from Germany to other countries by train?
Which genus do I use for neutral expressions in German?
Does this smartphone photo show Mars just below the Sun?
Is it a bad idea to offer variants of a final exam based on the type of allowed calculators?
Is DC heating faster than AC heating?
Does a 4 bladed prop have almost twice the thrust of a 2 bladed prop?
How to approach protecting my code as a research assistant? Should I be worried in the first place?
Integrity constraint violation: Duplicate entry for key 'UNQ_CATALOG_PRODUCT_SUPER_ATTRIBUTE_PRODUCT_ID_ATTRIBUTE_ID'
Error 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
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
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
add a comment |
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
add a comment |
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
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
magento-1 superattribute
edited Apr 13 '16 at 7:55
Siarhey Uchukhlebau
10.6k9 gold badges32 silver badges61 bronze badges
10.6k9 gold badges32 silver badges61 bronze badges
asked Apr 12 '16 at 5:21
Manuel MattarManuel Mattar
62 bronze badges
62 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Apr 13 '16 at 7:47
simonthesorcerersimonthesorcerer
3,6572 gold badges11 silver badges28 bronze badges
3,6572 gold badges11 silver badges28 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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