Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- when adding product there is no need to remove any attributes belonging to it - when updating the product the attributes related to the product are already cleared with ```php $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "'"); ``` no need to issue more specific deletion queries inside the loop ```php $this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'"); ``
- Loading branch information
e8f4700
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the same attribute twice selected
This change errors Error: Duplicate entry '62-19-0' for key 'PRIMARY'
e8f4700
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @eka7a ,
in those cases it would still be better to cleanup post data for duplicate ids than doing that with db queries.
e8f4700
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eka7a
i added this PR #2902
please download and give it a try
regards,
maks
e8f4700
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I know it might not be necessary or it might degrade the performance of the code, but wasn't the original idea of this piece of code
is to prevent possible error to occur ? It can even correct the mistake made by developers. I think the idea was sanitary check anyway.