Saving product with data like this:

$ids = array(‘1′,’1′,’2’);
$_product->setWebsiteIds($ids);

makes error : “SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry …”.

To avoid this error, just use function array_unique, on $ids array.

This solution, i think, could be implemented as default in new version of Magento.

Leave a reply

Your email address will not be published.