Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issues with Special Price and SQL error on product save (+ editing in cart?) #52

Open
Selfish opened this Issue · 27 comments
@Selfish

Hi,

When using any version with Magento CE 1.6 I noticed at least 2 issues:
1. When creating a configurable product and trying to save the associated products I get an error: ""SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2944-0-1' for key 1""
2. When a product has a special price, the shopping cart shows it's 'price' field, not 'special price'.
3. Not sure if this a bug, however, when a configurable product is in the cart, it cannot be edited = no link 'edit' there.

Please!!!!! Help us out!!!!
We are creating our first store and are really stuck on the stage of filling a catalog with products =(

Thank you!
Dennis

@1pxrgba

I am also running Magento CE 1.6 and can confirm the above issues also exist on my installation.

@maggiesdirect

We are running Magento Pro 1.10.0.1 and have a related issue (just posted). I have found it is creating duplicate (or near duplicate) simple products and this is causing the logic to fail when adding to the cart.

@clayman80

Any news here? For now I have disabled this extension, but I would like to re-enable my configurable products as soon as possible.

Thanks

@Selfish

Alas =( I had to disable the extension as well...

@cschuler

Same issue. Magento v1.6.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '172-0-1' for key 'PRIMARY'

@msslovi0

I had the same problem with 1.6 on our first magento store that's not yet live. This extension is essential for us to run the store so I digged into the issue and came up with the following solution:

Copy app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php to app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php

Change line 533 from

$query = $select->insertFromSelect($this->getIdxTable(), array(), false);

to

$query = $select->insertIgnoreFromSelect($this->getIdxTable(), array(), false);

Copy app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php to app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/Price.php

Change lini 464 from

$query  = $select->insertFromSelect($this->getIdxTable(), array(), false);

to

$query  = $select->insertIgnoreFromSelect($this->getIdxTable(), array(), false);

I'm new to Magento, there might be a better way to solve this instead of copying core files to local.

@sloth456

Thanks for the solution msslovi0. How does the code work? Does this still require that simple configurable products is still installed or is this an alternative way of getting the same sort of functionality without SCP.

@sloth456

Ok I went ahead and made the changes msslovi0 suggested although I did not have a 'local' folder, so I made the changes direct to the core files. It seems to have fixed the sql integrity problem. I didn't need to uninstall SCP.

Everything works so far, so thanks again msslovi0! Would be nice to get some feedback from the developers on this.

@msslovi0

That's right, no need to uninstall SCP.
What the fix does is instead of sending an INSERT command to the database (which will fail if the primary key already exists) sending an INSERT IGNORE (which will just be dropped if the primary key exists). As this only affects temporary tables it is IMHO save to do so.

@cschuler

Thanks msslovi0!

I tried your fix, and it appears to stop the errors (but does it fix the actual problem?) I agree with sloth456... It would be nice to get some feedback from the developers on this.

For those who like to cun-n-paste (you'll need to change the path, probably)...

mkdir -p /var/www/html/magento/app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/Price
cd /var/www/html/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/
cp Default.php /var/www/html/magento/app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php
cd /var/www/html/magento/app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/Price/
gedit Default.php

(edit line 534, change to "insertIgnoreFromSelect")

cd /var/www/html/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/
cp Price.php /var/www/html/magento/app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/Price.php
cd /var/www/html/magento/app/code/local/Mage/Catalog/Model/Resource/Product/Indexer/
gedit Price.php

(edit line 464, change to "insertIgnoreFromSelect")

ver. 1.6.1.0-rc1

@buzbuzzer

Just did the fix to both files and it works perfect on 1.6.0.0 - Thanks!

@brentwpeterson

@msslovi0 :: are you on the Magento forums? I posted your solution there. Thanks again
http://www.magentocommerce.com/boards/viewthread/247694/P15/#t352893

@msslovi0

Yes I am. There's another thread I already postet this: http://www.magentocommerce.com/boards/viewthread/245061/#t349855

@leiweke

I tried this fix but after checking my system.log i got each time i load the article list and after saving a product the following entry at least 19 times : 2011-10-08T19:07:42+00:00 DEBUG (7): cpid:
but nothing behind.
it comes up after the modification of Default.php
if i have the original Magento core files and this module disabled, i got no entry in the system.log

@PauGNU

Hi all,

In Magento 1.11.0.2 and 1.11.1.0 this problem persists even after performing those changes. Any idea on how to solve it? Thanks!

@brentwpeterson

@PauGNU:: Have you opened a support ticket with Magento?

@PauGNU

Not yet ;) I wanted to ask before opening it ;). But maybe is the best solution if I can't solve the problem.

@PauGNU

OK, the solution above actually does work in Magento 1.11.0.2 and 1.11.1.0 (something related to caches or other things were the problem).

@brentwpeterson

Ahhh yes, many caching issues on first release of 1.11 especially in the cart

@amadex

Is there any feedback from the developers on the "The SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry..." issue?

@PauGNU

Sure. It's not that difficult to solve it. Read the previous message:
#52 (comment)

@amadex

But there is no colateral issues raised by those changes on core files?!... What is originating this issue in the module?

@cschuler

I think the concern here about this fix is with the "insertIgnoreFromSelect".

"ignoring" your problems does not make them go away.

@amadex

Yes. That's the problem! Why this problem is being raised and how can be solved at origin and not masking the results...
Never saw a comment from the developers on this. Did they still are active on this project?...

@amadex

Any news on this?...

@Samborg

As also suggested by JoshM (http://www.magentocommerce.com/boards/viewreply/365650/ ) the best solution seems to be to replace the function call at line 58 in

app/code/community/OrganicInternet/SimpleConfigurableProducts/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price.php

replace:

$this->cloneIndexTable(true);

with:

$this->clearTemporaryIndexTable();

Becuase in 1.6 cloneIndexTable does nothing but in previous versions when called with true as param it drops and re-creates the table, essentially the same as truncating it.

@marcelaerts

Does the above solutions work for the 'edit' function in the cart? Because I can't seem to get this working!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.