Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/app/code/Magecomp/Savecartpro/view/frontend/templates/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/old/app/code/Magecomp/Savecartpro/view/frontend/templates/cart.phtml
<?php $mergedCells = ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 2 : 1); ?>

<?= $block->getChildHtml('form_before') ?>
<form action="<?= /* @escapeNotVerified */ $block->getUrl('checkout/cart/updatePost') ?>"
      method="post"
      id="form-validate"
      data-mage-init='{"validation":{}}'
      class="form form-cart">
    <?= $block->getBlockHtml('formkey') ?>
    <div class="cart table-wrapper<?= $mergedCells == 2 ? ' detailed' : '' ?>">
        <?php if ($block->getPagerHtml()): ?>
            <div class="cart-products-toolbar cart-products-toolbar-top toolbar" data-attribute="cart-products-toolbar-top"><?= $block->getPagerHtml() ?></div>
        <?php endif ?>
        <table id="shopping-cart-table"
               class="cart items data table"
               data-mage-init='{"shoppingCart":{"emptyCartButton": "action.clear",
               "updateCartActionContainer": "#update_cart_action_container"}}'>
            <caption role="heading" aria-level="2" class="table-caption"><?= /* @escapeNotVerified */ __('Shopping Cart Items') ?></caption>
            <thead>
            <tr>
                <th class="col item" scope="col"><span><?= /* @escapeNotVerified */ __('Item') ?></span></th>
                <th class="col availability" scope="col"><span><?= /* @escapeNotVerified */ __('Availability') ?></span></th>
                <th class="col price" scope="col"><span><?= /* @escapeNotVerified */ __('Unit Price HT') ?></span></th>
                <th class="col qty" scope="col"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
                <th class="col subtotal" scope="col"><span><?= /* @escapeNotVerified */ __('Subtotal') ?></span></th>
            </tr>
            </thead>
            <?php foreach ($block->getItems() as $_item): ?>
                <?= $block->getItemHtml($_item) ?>
            <?php endforeach ?>
        </table>
        <?php if ($block->getPagerHtml()): ?>
            <div class="cart-products-toolbar cart-products-toolbar-bottom toolbar" data-attribute="cart-products-toolbar-bottom"><?= $block->getPagerHtml() ?></div>
        <?php endif ?>
    </div>

    <div class="cart main actions">
        <?php if ($block->getContinueShoppingUrl()): ?>
            <a class="action continue"
               href="<?php echo $block->escapeUrl($block->getContinueShoppingUrl()) ?>"
               title="<?php echo $block->escapeHtml(__('Continue Shopping')); ?>">
                <span><?php /* @escapeNotVerified */ echo __('Continue Shopping') ?></span>
            </a>
        <?php endif; ?>
        <button type="submit"
                name="update_cart_action"
                data-cart-empty=""
                value="empty_cart"
                title="<?php echo $block->escapeHtml(__('Clear Shopping Cart')); ?>"
                class="action clear" id="empty_cart_button">
            <span><?php /* @escapeNotVerified */ echo __('Clear Shopping Cart'); ?></span>
        </button>
        <button type="submit"
                name="update_cart_action" id="update_cart_action"
                data-cart-item-update=""
                value="update_qty"
                title="<?php echo $block->escapeHtml(__('Update Shopping Cart')); ?>"
                class="action update">
            <span><?php /* @escapeNotVerified */ echo __('Update Shopping Cart'); ?></span>
        </button>
        <button type="button"
                name="savecart_cart_action" id="savecart_cart_action"
                value="Save Cart"
                title="<?php echo $block->escapeHtml(__('Save my cart')); ?>">
            <span><?php /* @escapeNotVerified */ echo __('Save my cart'); ?></span>
        </button>


    </div>
        <input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
</form>
    <div id="savecart-login" class="popup-modal" style="display:none;">
        <span><?php echo $block->escapeHtml(__('Before Saving into cart you must Login')); ?></span>
        <button id="savecartlogin">Login</button>
    </div>

    <div id="popup-modal" class="popup-modal" style="display:none;">

        <button id="newcart"><?= $block->escapeHtml(__('New')) ?></button>
        <button id="existingcart"><?= $block->escapeHtml(__('Existing')) ?></button>
    </div>

    <div id="newcart_popup-modal" class="popup-modal" style="display:none;">
        <span><?php echo $block->escapeHtml(__('Please set the title to save your Cart')); ?></span>
        <input type="text" id="txtcartname" required placeholder="<?php echo $block->escapeHtml(__('Name Your Cart')); ?>" />
        <button id="savecart"><?php echo $block->escapeHtml(__('Save my cart')); ?></button>
    </div>

    <div id="existing_cart_popup-modal" class="popup-modal" style="display:none;">

        <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $listblock = $objectManager->create('\Magecomp\Savecartpro\Block\Custcartlist');
        $cartlist = $listblock->CustomerCartList();
        if(sizeof($cartlist) > 0) :?>
            <span><?php echo $block->escapeHtml(__('Select a cart you want to update')); ?></span>
        <select id="slctupdate">

            <?php foreach($cartlist as $cart) { ?>
                    <option value="<?php echo $cart->getSavecartId(); ?>"><?php echo $cart->getCartName(); ?></option>
                    <?php
                }
            ?>
        </select>
        <button id="existingsavecart"><?php echo $block->escapeHtml(__('Save my cart')); ?></button>
        <?php else: ?>
            <span><?php /* @escapeNotVerified */ echo __('You don\'t have any Existing Saved Cart'); ?></span>
       <?php  endif; ?>

    </div>

<?php echo $block->getChildHtml('checkout.cart.order.actions') ?>
<?php echo $block->getChildHtml('shopping.cart.table.after'); ?>
<?php
// Custom Code


$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$storeurl=$storeManager->getStore()->getBaseUrl();




$om = \Magento\Framework\App\ObjectManager::getInstance(); 
$redirect = $om->get('Magento\Framework\App\RequestInterface');
$lasturl = $redirect->getServer('HTTP_REFERER');
if(strpos($lasturl,'savecartpro/customer/viewcart/qid') !== false || strpos($lasturl,'savecartpro/customer/cartlist') !== false) { ?>
	<script>
	require([
        'Magento_Customer/js/customer-data'
    ], function (customerData) {
        var sections = ['cart'];
        customerData.invalidate(sections);
    });
	document.getElementById('update_cart_action').click();

	</script>
<?php } ?>

<script>
    require(
        [
            'jquery',
            'Magento_Ui/js/modal/modal',
            'mage/translate'
        ],
        function(
            $,
            modal
        ) {
            var options = {
                type: 'popup',
                responsive: true,
                modalClass: 'save-card-modal',
                innerScroll: true,
                title: $.mage.__('Save my cart')

            };
            var redirectlink;
            var popup = modal(options, $('#popup-modal'));
            var popuplog=modal(options, $('#savecart-login'));
            $("#savecart_cart_action").on('click',function(){
                var body = $('body').loader();
                body.loader('show');
                $.ajax({
                    url: "<?php echo $storeurl."savecartpro/customer/isloggedin"; ?>",
                    type: 'POST',
                    data: {
                    },
                    success: function(response){
                        var body = $('body').loader();
                        body.loader('hide');
                        if (response.redirectUrl!="") {
                            redirectlink=response.redirectUrl;
                            $("#savecart-login").modal("openModal");
                        }
                        else {
                            $("#popup-modal").modal("openModal");
                        }

                    },
                });

            });

            var popup1 = modal(options, $('#newcart_popup-modal'));
                    $("#newcart").on('click',function(){
                        $(".modal-header h1 b").text("Save Cart");
                        $("#newcart_popup-modal").modal("openModal");
                        $('#popup-modal').modal('closeModal');
                    });

            var popup2 = modal(options, $('#existing_cart_popup-modal'));
            $("#existingcart").on('click',function(){
                $(".modal-header h1 b").text("Your Existing Saved Carts");
                $("#existing_cart_popup-modal").modal("openModal");
                $('#popup-modal').modal('closeModal');
            });
            $("#savecart").on('click',function(){
                var cartname=$('#txtcartname').val();
                var body = $('body').loader();
                body.loader('show');
                $.ajax({
                    url: "<?php echo $storeurl."savecartpro/index/save"; ?>",
                    type: 'POST',
                    data: {
                        cartname:cartname,
                        qty:1
                    },
                    success: function(response){
                        var body = $('body').loader();
                        body.loader('hide');
                        if (response.redirectUrl!="") {

                            window.location.href = response.redirectUrl;
                        }

                    },
                    error: function(data) {
                        var body = $('body').loader();
                        body.loader('hide');
                        location.reload();
                    }
                });
            });
            $("#existingsavecart").on('click',function(){
                var selectedCart = $("#slctupdate option:selected").val();
                var cartname = $("#slctupdate option:selected").text();
                var body = $('body').loader();
                body.loader('show');
                $.ajax({
                    url: "<?php echo $storeurl."savecartpro/index/update"; ?>",
                    type: 'POST',
                    data: {
                        cartname:cartname,
                        savecartid:selectedCart,
                        qty:1
                    },
                    success: function(response){
                        var body = $('body').loader();
                        body.loader('hide');
                        if (response.redirectUrl!="") {
                            window.location.href = response.redirectUrl;
                        }
                    },
                    error: function(data) {
                        var body = $('body').loader();
                        body.loader('hide');
                        location.reload();
                    }
                });

            });
            $("#savecartlogin").on('click',function() {
                document.location.href=redirectlink;
            });

        }
    );
</script>

Spamworldpro Mini