Helper/Discount.php
public function cloneAmastyGiftCards($sourceQuoteId, $destinationQuoteId)
    {
        if (! $this->isAmastyGiftCardAvailable()) {
            return;
        }
        $connection = $this->resource->getConnection();
        $connection->beginTransaction();
        try {
            $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote');

            // Clear previously applied gift cart codes from the immutable quote
            $sql = "DELETE FROM {$giftCardTable} WHERE quote_id = :destination_quote_id";
            $connection->query($sql, ['destination_quote_id' => $destinationQuoteId]);

            // Copy all gift cart codes applied to the parent quote to the immutable quote
            $sql = "INSERT INTO {$giftCardTable} (quote_id, code_id, account_id, base_gift_amount, code) 
                    SELECT :destination_quote_id, code_id, account_id, base_gift_amount, code
                    FROM {$giftCardTable} WHERE quote_id = :source_quote_id";
            $connection->query($sql, ['destination_quote_id' => $destinationQuoteId, 'source_quote_id' => $sourceQuoteId]);

            $connection->commit();
        } catch (\Zend_Db_Statement_Exception $e) {
            $connection->rollBack();
            $this->bugsnag->notifyException($e);
        }
    }
public function cloneAmastyGiftCards($sourceQuoteId, $destinationQuoteId)
    {
        if (! $this->isAmastyGiftCardAvailable()) {
            return;
        }
        $connection = $this->resource->getConnection();
        $connection->beginTransaction();
        try {
            $giftCardTable = $this->resource->getTableName('amasty_amgiftcard_quote');

            // Clear previously applied gift cart codes from the immutable quote
            $sql = "DELETE FROM {$giftCardTable} WHERE quote_id = :destination_quote_id";
            $connection->query($sql, ['destination_quote_id' => $destinationQuoteId]);

            // Copy all gift cart codes applied to the parent quote to the immutable quote
            $sql = "INSERT INTO {$giftCardTable} (quote_id, code_id, account_id, base_gift_amount, code) 
                    SELECT :destination_quote_id, code_id, account_id, base_gift_amount, code
                    FROM {$giftCardTable} WHERE quote_id = :source_quote_id";
            $connection->query($sql, ['destination_quote_id' => $destinationQuoteId, 'source_quote_id' => $sourceQuoteId]);

            $connection->commit();
        } catch (\Zend_Db_Statement_Exception $e) {
            $connection->rollBack();
            $this->bugsnag->notifyException($e);
        }
    }
public function cloneAmastyGiftCards ( $ sourceQuoteId , $ destinationQuoteId ) { if ( ! $ this -> isAmastyGiftCardAvailable ( ) ) { return ; } $ connection = $ this -> resource -> getConnection ( ) ; $ connection -> beginTransaction ( ) ; try { $ giftCardTable = $ this -> resource -> getTableName ( 'amasty_amgiftcard_quote' ) ; // Clear previously applied gift cart codes from the immutable quote $ sql = "DELETE FROM {$giftCardTable} WHERE quote_id = :destination_quote_id" ; $ connection -> query ( $ sql , [ 'destination_quote_id' => $ destinationQuoteId ] ) ; // Copy all gift cart codes applied to the parent quote to the immutable quote $ sql = "INSERT INTO {$giftCardTable} (quote_id, code_id, account_id, base_gift_amount, code) 
                    SELECT :destination_quote_id, code_id, account_id, base_gift_amount, code
                    FROM {$giftCardTable} WHERE quote_id = :source_quote_id" ; $ connection -> query ( $ sql , [ 'destination_quote_id' => $ destinationQuoteId , 'source_quote_id' => $ sourceQuoteId ] ) ; $ connection -> commit ( ) ; } catch ( \ Zend_Db_Statement_Exception $ e ) { $ connection -> rollBack ( ) ; $ this -> bugsnag -> notifyException ( $ e ) ; } }
Copy Amasty Gift Cart data from source to destination quote

@param int|string $sourceQuoteId
@param int|string $destinationQuoteId
Copy Amasty Gift Cart data from source to destination quote