magento 1.9 CE error when duplicating a productExclude a specific categoryHow to create/update bulk of...
Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act (2019 S.130)?
How can I get my players to come to the game session after agreeing to a date?
Play Zip, Zap, Zop
How much mayhem could I cause as a sentient fish?
Nested word series [humans only]
Why avoid shared user accounts?
Can a long polymer chain interact with itself via van der Waals forces?
Am I a Rude Number?
Why did Luke use his left hand to shoot?
Why is working on the same position for more than 15 years not a red flag?
Does theoretical physics suggest that gravity is the exchange of gravitons or deformation/bending of spacetime?
Why did the villain in the first Men in Black movie care about Earth's Cockroaches?
Is it possible to grant users sftp access without shell access? If yes, how is it implemented?
Can you tell from a blurry photo if focus was too close or too far?
In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?
Is boss over stepping boundary/micromanaging?
If I delete my router's history can my ISP still provide it to my parents?
What is a good reason for every spaceship to carry a weapon on board?
When can a QA tester start his job?
Can a Pact of the Blade warlock use the correct existing pact magic weapon so it functions as a "Returning" weapon?
Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?
Eww, those bytes are gross
Can a person refuse a presidential pardon?
How to limit sight distance to 1 KM
magento 1.9 CE error when duplicating a product
Exclude a specific categoryHow to create/update bulk of products at a time programmaticallyRetrieve product status query optimization in core magentoReindex error magento 1.9.X.XProgrammatically Assign Attributes to Products in Magento 1.9How to change dynamic attributes when simple product is selectedWebsite Displays Error When AccessedWishlist error when register in Magento 1.9emptying Url Key when duplicating productExport Category name in xml feed Magento 1.9.2
When I use the method to duplicate an object sometimes I get this error message, the product is created:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-0-0-1-4-24884-0' for key 'KEY', query was: INSERT INTO `etpq_catalogrule_product` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`action_operator`,`action_amount`,`action_stop`,`sort_order`,`sub_simple_action`,`sub_discount_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
This is how I duplicate a product and I associate it to a configurable:
try {
$configurable = Mage::getModel( 'catalog/product')->load( '2456' );
$childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds( $configurable->getId() )[0];
$id= $childIds[0];
//duplicate this product
$child = Mage::getModel( 'catalog/product' )->load( $id );
//echo 'chid: ' . $child->getId() . '<br />';
$duplicated = $child->duplicate();
// reload duplicated
$duplicated = Mage::getModel( 'catalog/product' )->load( $duplicated->getId() );
$duplicated
->setDescription( 'dummy' )
->setName( 'dummy - ' . $configurable->getName() )
->setTitle( 'dummy - ' . $configurable->getName() )
->setStatus( Mage_Catalog_Model_Product_Status::STATUS_DISABLED )
->setSku( 'dummy-' . $configurable->getSku() );
$duplicated->save();
$childIds[] = $duplicated->getId();
Mage::getResourceSingleton('catalog/product_type_configurable')->saveProducts( $configurable, $childIds );
$configurable->setData( 'status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED );
$configurable->getResource()->saveAttribute( $configurable, 'status' );
return TRUE;
}
catch ( Exception $e ) {
Mage::log( $e->getMessage() );
return FALSE;
}
magento-1.9 php database sql
add a comment |
When I use the method to duplicate an object sometimes I get this error message, the product is created:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-0-0-1-4-24884-0' for key 'KEY', query was: INSERT INTO `etpq_catalogrule_product` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`action_operator`,`action_amount`,`action_stop`,`sort_order`,`sub_simple_action`,`sub_discount_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
This is how I duplicate a product and I associate it to a configurable:
try {
$configurable = Mage::getModel( 'catalog/product')->load( '2456' );
$childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds( $configurable->getId() )[0];
$id= $childIds[0];
//duplicate this product
$child = Mage::getModel( 'catalog/product' )->load( $id );
//echo 'chid: ' . $child->getId() . '<br />';
$duplicated = $child->duplicate();
// reload duplicated
$duplicated = Mage::getModel( 'catalog/product' )->load( $duplicated->getId() );
$duplicated
->setDescription( 'dummy' )
->setName( 'dummy - ' . $configurable->getName() )
->setTitle( 'dummy - ' . $configurable->getName() )
->setStatus( Mage_Catalog_Model_Product_Status::STATUS_DISABLED )
->setSku( 'dummy-' . $configurable->getSku() );
$duplicated->save();
$childIds[] = $duplicated->getId();
Mage::getResourceSingleton('catalog/product_type_configurable')->saveProducts( $configurable, $childIds );
$configurable->setData( 'status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED );
$configurable->getResource()->saveAttribute( $configurable, 'status' );
return TRUE;
}
catch ( Exception $e ) {
Mage::log( $e->getMessage() );
return FALSE;
}
magento-1.9 php database sql
add a comment |
When I use the method to duplicate an object sometimes I get this error message, the product is created:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-0-0-1-4-24884-0' for key 'KEY', query was: INSERT INTO `etpq_catalogrule_product` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`action_operator`,`action_amount`,`action_stop`,`sort_order`,`sub_simple_action`,`sub_discount_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
This is how I duplicate a product and I associate it to a configurable:
try {
$configurable = Mage::getModel( 'catalog/product')->load( '2456' );
$childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds( $configurable->getId() )[0];
$id= $childIds[0];
//duplicate this product
$child = Mage::getModel( 'catalog/product' )->load( $id );
//echo 'chid: ' . $child->getId() . '<br />';
$duplicated = $child->duplicate();
// reload duplicated
$duplicated = Mage::getModel( 'catalog/product' )->load( $duplicated->getId() );
$duplicated
->setDescription( 'dummy' )
->setName( 'dummy - ' . $configurable->getName() )
->setTitle( 'dummy - ' . $configurable->getName() )
->setStatus( Mage_Catalog_Model_Product_Status::STATUS_DISABLED )
->setSku( 'dummy-' . $configurable->getSku() );
$duplicated->save();
$childIds[] = $duplicated->getId();
Mage::getResourceSingleton('catalog/product_type_configurable')->saveProducts( $configurable, $childIds );
$configurable->setData( 'status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED );
$configurable->getResource()->saveAttribute( $configurable, 'status' );
return TRUE;
}
catch ( Exception $e ) {
Mage::log( $e->getMessage() );
return FALSE;
}
magento-1.9 php database sql
When I use the method to duplicate an object sometimes I get this error message, the product is created:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-0-0-1-4-24884-0' for key 'KEY', query was: INSERT INTO `etpq_catalogrule_product` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`action_operator`,`action_amount`,`action_stop`,`sort_order`,`sub_simple_action`,`sub_discount_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
This is how I duplicate a product and I associate it to a configurable:
try {
$configurable = Mage::getModel( 'catalog/product')->load( '2456' );
$childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds( $configurable->getId() )[0];
$id= $childIds[0];
//duplicate this product
$child = Mage::getModel( 'catalog/product' )->load( $id );
//echo 'chid: ' . $child->getId() . '<br />';
$duplicated = $child->duplicate();
// reload duplicated
$duplicated = Mage::getModel( 'catalog/product' )->load( $duplicated->getId() );
$duplicated
->setDescription( 'dummy' )
->setName( 'dummy - ' . $configurable->getName() )
->setTitle( 'dummy - ' . $configurable->getName() )
->setStatus( Mage_Catalog_Model_Product_Status::STATUS_DISABLED )
->setSku( 'dummy-' . $configurable->getSku() );
$duplicated->save();
$childIds[] = $duplicated->getId();
Mage::getResourceSingleton('catalog/product_type_configurable')->saveProducts( $configurable, $childIds );
$configurable->setData( 'status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED );
$configurable->getResource()->saveAttribute( $configurable, 'status' );
return TRUE;
}
catch ( Exception $e ) {
Mage::log( $e->getMessage() );
return FALSE;
}
magento-1.9 php database sql
magento-1.9 php database sql
asked 10 mins ago
blobblob
206
206
add a comment |
add a comment |
0
active
oldest
votes
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%2f263882%2fmagento-1-9-ce-error-when-duplicating-a-product%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f263882%2fmagento-1-9-ce-error-when-duplicating-a-product%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