Skip to content

Commit

Permalink
avoid js error when closing popup
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Apr 25, 2024
1 parent dcafe4e commit b5b29da
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
<script type="text/javascript">
var added = false;
function addProduct(closeAfter) {
if(window.opener!=null && !added) {
<?php if($this->isEdit()): ?>
window.opener.superProduct.updateProduct(<?php echo $this->getProductId() ?>, <?php echo $this->getAttributesJson(); ?>);
<?php else: ?>
window.opener.superProduct.addNewProduct(<?php echo $this->getProductId() ?>, <?php echo $this->getAttributesJson(); ?>);
window.opener.superProduct.showNoticeMessage();
<?php endif ?>
added = true;
if(window.opener != null && !added) {
if (window.opener.superProduct) {
<?php if($this->isEdit()): ?>
window.opener.superProduct.updateProduct(<?php echo $this->getProductId() ?>, <?php echo $this->getAttributesJson(); ?>);
<?php else: ?>
window.opener.superProduct.addNewProduct(<?php echo $this->getProductId() ?>, <?php echo $this->getAttributesJson(); ?>);
window.opener.superProduct.showNoticeMessage();
<?php endif ?>
added = true;
}
}

if(closeAfter)
Expand Down

0 comments on commit b5b29da

Please sign in to comment.