Announcement

Collapse
No announcement yet.

Bootstrap estimate shipping produces 403 error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • alexwh
    replied
    Re: Bootstrap estimate shipping produces 403 error

    Originally posted by Matt Zimmermann View Post
    Hi Alex,

    That function should be contained within the default JavaScript within the shipestimate item. Here is an example of the complete code you should have:

    HTML Code:
    <style>
        .shipestimate_dialog
        {
            display: none;
            z-index: 1100;
            position: absolute;
            background: #FFF;
            padding: 8px;
            border: 1px solid #434343;
        }
        
        .shipestimate_backing
        {
            display: none;
            z-index: 1000;
            position: absolute;
            top: 0px;
            left: 0px;
            width: 100%;
            background: #FFF;
            opacity: 0.5;
            filter: alpha(opacity=50);
        }
    
        #shipestimate_inputfields_tbody input, #shipestimate_inputfields_tbody select
        {
            width: 98%;
        }
    </style>
    
    <mvt:if expr="g.Secure">
        <form method="get" name="shipestimate_form" action="&mvt:global:secure_sessionurl;" target="shipestimate">
    <mvt:else>
        <form method="get" name="shipestimate_form" action="&mvt:global:sessionurl;" target="shipestimate">
    </mvt:if>
        <input type="hidden" name="Screen" value="SERT" />
        <input type="hidden" name="Store_Code" value="&mvte:store:code;" />
        
        <div id="shipestimate_dialog" class="shipestimate_dialog">
            <table id="shipestimate_table" width="350">
                <tbody id="shipestimate_close_tbody">
                    <tr>
                        <td align="right" colspan="2"><a href="#" id="shipestimate_close">Close</a></td>
                    </tr>
                </tbody>
                <tbody id="shipestimate_inputfields_tbody">
                    <tr>
                        <td align="center" colspan="2"><b>Calculate Shipping: Basket</b></td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">&nbsp;</td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_city"><b>City:</b></label></td>
                        <td width="100%"><input type="text" name="ShipEstimate:ship_city" value="&mvte:global:ShipEstimate:ship_city;" id="shipestimate_city" class="textfield" /></td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_state_select"><b>State/Province:</b></label></td>
                        <td width="100%">
                            <select name="ShipEstimate:ship_state_select" id="shipestimate_state_select">
                                <option value="">Outside US</option>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AK'">
                                    <option value="AK" selected>Alaska</option>
                                <mvt:else>
                                    <option value="AK">Alaska</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AL'">
                                    <option value="AL" selected>Alabama</option>
                                <mvt:else>
                                    <option value="AL">Alabama</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AR'">
                                    <option value="AR" selected>Arkansas</option>
                                <mvt:else>
                                    <option value="AR">Arkansas</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AZ'">
                                    <option value="AZ" selected>Arizona</option>
                                <mvt:else>
                                    <option value="AZ">Arizona</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'CA'">
                                    <option value="CA" selected>California</option>
                                <mvt:else>
                                    <option value="CA">California</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'CO'">
                                    <option value="CO" selected>Colorado</option>
                                <mvt:else>
                                    <option value="CO">Colorado</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'CT'">
                                    <option value="CT" selected>Connecticut</option>
                                <mvt:else>
                                    <option value="CT">Connecticut</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'DC'">
                                    <option value="DC" selected>District of Columbia</option>
                                <mvt:else>
                                    <option value="DC">District of Columbia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'DE'">
                                    <option value="DE" selected>Delaware</option>
                                <mvt:else>
                                    <option value="DE">Delaware</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'FL'">
                                    <option value="FL" selected>Florida</option>
                                <mvt:else>
                                    <option value="FL">Florida</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'GA'">
                                    <option value="GA" selected>Georgia</option>
                                <mvt:else>
                                    <option value="GA">Georgia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'HI'">
                                    <option value="HI" selected>Hawaii</option>
                                <mvt:else>
                                    <option value="HI">Hawaii</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'IA'">
                                    <option value="IA" selected>Iowa</option>
                                <mvt:else>
                                    <option value="IA">Iowa</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'ID'">
                                    <option value="ID" selected>Idaho</option>
                                <mvt:else>
                                    <option value="ID">Idaho</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'IL'">
                                    <option value="IL" selected>Illinois</option>
                                <mvt:else>
                                    <option value="IL">Illinois</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'IN'">
                                    <option value="IN" selected>Indiana</option>
                                <mvt:else>
                                    <option value="IN">Indiana</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'KS'">
                                    <option value="KS" selected>Kansas</option>
                                <mvt:else>
                                    <option value="KS">Kansas</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'KY'">
                                    <option value="KY" selected>Kentucky</option>
                                <mvt:else>
                                    <option value="KY">Kentucky</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'LA'">
                                    <option value="LA" selected>Louisiana</option>
                                <mvt:else>
                                    <option value="LA">Louisiana</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MA'">
                                    <option value="MA" selected>Massachusetts</option>
                                <mvt:else>
                                    <option value="MA">Massachusetts</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MD'">
                                    <option value="MD" selected>Maryland</option>
                                <mvt:else>
                                    <option value="MD">Maryland</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'ME'">
                                    <option value="ME" selected>Maine</option>
                                <mvt:else>
                                    <option value="ME">Maine</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MI'">
                                    <option value="MI" selected>Michigan</option>
                                <mvt:else>
                                    <option value="MI">Michigan</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MN'">
                                    <option value="MN" selected>Minnesota</option>
                                <mvt:else>
                                    <option value="MN">Minnesota</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MO'">
                                    <option value="MO" selected>Missouri</option>
                                <mvt:else>
                                    <option value="MO">Missouri</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MS'">
                                    <option value="MS" selected>Mississippi</option>
                                <mvt:else>
                                    <option value="MS">Mississippi</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MT'">
                                    <option value="MT" selected>Montana</option>
                                <mvt:else>
                                    <option value="MT">Montana</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NC'">
                                    <option value="NC" selected>North Carolina</option>
                                <mvt:else>
                                    <option value="NC">North Carolina</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'ND'">
                                    <option value="ND" selected>North Dakota</option>
                                <mvt:else>
                                    <option value="ND">North Dakota</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NE'">
                                    <option value="NE" selected>Nebraska</option>
                                <mvt:else>
                                    <option value="NE">Nebraska</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NH'">
                                    <option value="NH" selected>New Hampshire</option>
                                <mvt:else>
                                    <option value="NH">New Hampshire</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NJ'">
                                    <option value="NJ" selected>New Jersey</option>
                                <mvt:else>
                                    <option value="NJ">New Jersey</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NM'">
                                    <option value="NM" selected>New Mexico</option>
                                <mvt:else>
                                    <option value="NM">New Mexico</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NV'">
                                    <option value="NV" selected>Nevada</option>
                                <mvt:else>
                                    <option value="NV">Nevada</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NY'">
                                    <option value="NY" selected>New York</option>
                                <mvt:else>
                                    <option value="NY">New York</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'OH'">
                                    <option value="OH" selected>Ohio</option>
                                <mvt:else>
                                    <option value="OH">Ohio</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'OK'">
                                    <option value="OK" selected>Oklahoma</option>
                                <mvt:else>
                                    <option value="OK">Oklahoma</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'OR'">
                                    <option value="OR" selected>Oregon</option>
                                <mvt:else>
                                    <option value="OR">Oregon</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'PA'">
                                    <option value="PA" selected>Pennsylvania</option>
                                <mvt:else>
                                    <option value="PA">Pennsylvania</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'RI'">
                                    <option value="RI" selected>Rhode Island</option>
                                <mvt:else>
                                    <option value="RI">Rhode Island</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'SC'">
                                    <option value="SC" selected>South Carolina</option>
                                <mvt:else>
                                    <option value="SC">South Carolina</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'SD'">
                                    <option value="SD" selected>South Dakota</option>
                                <mvt:else>
                                    <option value="SD">South Dakota</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'TN'">
                                    <option value="TN" selected>Tennessee</option>
                                <mvt:else>
                                    <option value="TN">Tennessee</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'TX'">
                                    <option value="TX" selected>Texas</option>
                                <mvt:else>
                                    <option value="TX">Texas</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'UT'">
                                    <option value="UT" selected>Utah</option>
                                <mvt:else>
                                    <option value="UT">Utah</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'VA'">
                                    <option value="VA" selected>Virginia</option>
                                <mvt:else>
                                    <option value="VA">Virginia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'VT'">
                                    <option value="VT" selected>Vermont</option>
                                <mvt:else>
                                    <option value="VT">Vermont</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WA'">
                                    <option value="WA" selected>Washington</option>
                                <mvt:else>
                                    <option value="WA">Washington</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WI'">
                                    <option value="WI" selected>Wisconsin</option>
                                <mvt:else>
                                    <option value="WI">Wisconsin</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WV'">
                                    <option value="WV" selected>West Virginia</option>
                                <mvt:else>
                                    <option value="WV">West Virginia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WY'">
                                    <option value="WY" selected>Wyoming</option>
                                <mvt:else>
                                    <option value="WY">Wyoming</option>
                                </mvt:if>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_state">Other State/Province:</label></td>
                        <td width="100%"><input type="text" name="ShipEstimate:ship_state" value="&mvte:global:ShipEstimate:ship_state;" id="shipestimate_state" class="textfield" /></td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_zip"><b>ZIP/Postal Code:</b></label></td>
                        <td width="100%"><input type="text" name="ShipEstimate:ship_zip" value="&mvte:global:ShipEstimate:ship_zip;" id="shipestimate_zip" class="textfield" /></td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="hidden" name="ShipEstimate:ship_cntry" value="US" /></td>
                    </tr>
                </tbody>
                <tbody id="shipestimate_shippingmethods_tbody">
                    <tr>
                        <td align="center" id="shipestimate_shippingmethods" colspan="2"></td>
                    </tr>
                </tbody>
                <tbody id="shipestimate_controllers_tbody">
                    <tr>
                        <td align="right" colspan="2">
                            <input type="submit" id="shipestimate_calculate" class="button" value="Calculate Shipping" />
                            <input type="button" id="shipestimate_recalculate" class="button" value="Recalculate Shipping" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    
        <a href="#" id="shipestimate_show">Estimate Shipping</a>
    </form>
    <div id="shipestimate_backing" class="shipestimate_backing"></div>
    
    <script type="text/javascript">
        function shipestimate()
        {
            var self = this;
    
            this.dialog                     = document.getElementById( 'shipestimate_dialog' );
            this.backing                    = document.getElementById( 'shipestimate_backing' );
            this.inputfields_tbody          = document.getElementById( 'shipestimate_inputfields_tbody' );
            this.shippingmethods_tbody      = document.getElementById( 'shipestimate_shippingmethods_tbody' );
            this.shippingmethods            = document.getElementById( 'shipestimate_shippingmethods' );
            this.body                       = document.getElementsByTagName( 'body' )[ 0 ];
    
            this.close                      = document.getElementById( 'shipestimate_close' );
            this.recalculate                = document.getElementById( 'shipestimate_recalculate' );
        
            this.calculate                  = document.getElementById( 'shipestimate_calculate' );
            this.show                       = document.getElementById( 'shipestimate_show' );
        
            this.body.appendChild(this.dialog);
            this.body.appendChild(this.backing);
        
            if ( this.close )               this.close.onclick         = function() { self.Hide(); return false; }
            if ( this.recalculate )         this.recalculate.onclick   = function() { self.Show(); return false; }
        
            if ( this.calculate )           this.calculate.onclick     = function() { self.Calculate(); return false; }
            if ( this.show )                this.show.onclick          = function() { self.Show(); return false; }
            if ( this.backing )             this.backing.onclick       = function() { self.Hide(); return false; }
        }
    
        shipestimate.prototype.Show = function()
        {
            var self = this;
    
            this.dialog.style.display                 = 'block';
            this.backing.style.display                = 'inline-block';
            this.shippingmethods_tbody.style.display  = 'none';
            this.inputfields_tbody.style.display      = '';
            this.recalculate.style.display            = 'none';
        
            this.calculate.style.display              = 'inline-block';
    
            window.scrollTo( 0, 0 );
        
            window.onresize = function() { self.Resize(); }
            
            self.Resize();
        }
    
        shipestimate.prototype.Hide = function()
        {
            this.dialog.style.display   = 'none';
            this.backing.style.display  = 'none';
        }
    
        shipestimate.prototype.Calculate = function()
        {
            var iframe;
            var self = this;
    
            try
            {
                iframe = document.createElement( '<iframe name="shipestimate_iframe">' );
            }
            catch ( exception )
            {
                iframe = document.createElement( 'iframe' );
            }
    
            iframe.id                                 = 'shipestimate_iframe';
            iframe.name                               = 'shipestimate_iframe';
            iframe.style.display                      = 'none';
            
            this.shippingmethods.innerHTML              = '<br />loading...<br /><br />';
            this.shippingmethods_tbody.style.display  = '';
            this.inputfields_tbody.style.display      = 'none';
            this.recalculate.style.display            = 'none';
            this.calculate.style.display              = 'none';
    
            this.body.insertBefore( iframe, this.body.firstChild );
    
            if ( iframe.attachEvent )   iframe.attachEvent( "onload", function() { self.Replace( iframe ); } );
            else                        iframe.onload = function() { self.Replace( iframe ); };
            
            document.shipestimate_form.target = 'shipestimate_iframe';
            document.shipestimate_form.submit();
        }
    
        shipestimate.prototype.Replace = function( iframe )
        {
            var content;
            var self = this;
    
            content                         = ( iframe.contentWindow.document.getElementById( 'shipestimate_rates' ) || iframe.contentWindow.document.body ).innerHTML;
            this.shippingmethods.innerHTML    = content;
            this.recalculate.style.display  = 'inline-block';
    
            setTimeout( function(){ iframe.parentNode.removeChild( iframe ); }, 1 );
        }
    
        shipestimate.prototype.Resize = function()
        {
            if ( document.documentElement.clientHeight > document.body.scrollHeight )
            {
                if ( this.backing ) this.backing.style.height = document.documentElement.clientHeight + 'px';
            }
            else
            {
                if ( this.backing ) this.backing.style.height = ( document.body.scrollHeight > document.documentElement.scrollHeight ) ? document.body.scrollHeight + 'px' : document.documentElement.scrollHeight + 'px';
            }
            
            if ( this.dialog ) this.dialog.style.left = ( ( document.body.offsetWidth / 2 ) - ( this.dialog.offsetWidth / 2 ) ) + 'px';
            if ( this.dialog ) this.dialog.style.top  = 100 + 'px';
        }
    
        var shipestimate_init = new shipestimate();
    </script>
    Hi Matt,
    On a sidenote, I found that switching to point + click mode from advanced mode and making a change will undo all changes made in advanced mode. With that said, I copied your included code and overwrote my existing code. Now it works and takes you to a page which shows no results. Odd, since in the past it would pull in shipping methods? Also, this only works from the mini-basket popup on the basket page. However, another link on the basket page itself still produces the 403 error page...

    Regards,
    Alex

    Leave a comment:


  • Matt Zimmermann
    replied
    Re: Bootstrap estimate shipping produces 403 error

    Hi Alex,

    That function should be contained within the default JavaScript within the shipestimate item. Here is an example of the complete code you should have:

    HTML Code:
    <style>
        .shipestimate_dialog
        {
            display: none;
            z-index: 1100;
            position: absolute;
            background: #FFF;
            padding: 8px;
            border: 1px solid #434343;
        }
        
        .shipestimate_backing
        {
            display: none;
            z-index: 1000;
            position: absolute;
            top: 0px;
            left: 0px;
            width: 100%;
            background: #FFF;
            opacity: 0.5;
            filter: alpha(opacity=50);
        }
    
        #shipestimate_inputfields_tbody input, #shipestimate_inputfields_tbody select
        {
            width: 98%;
        }
    </style>
    
    <mvt:if expr="g.Secure">
        <form method="get" name="shipestimate_form" action="&mvt:global:secure_sessionurl;" target="shipestimate">
    <mvt:else>
        <form method="get" name="shipestimate_form" action="&mvt:global:sessionurl;" target="shipestimate">
    </mvt:if>
        <input type="hidden" name="Screen" value="SERT" />
        <input type="hidden" name="Store_Code" value="&mvte:store:code;" />
        
        <div id="shipestimate_dialog" class="shipestimate_dialog">
            <table id="shipestimate_table" width="350">
                <tbody id="shipestimate_close_tbody">
                    <tr>
                        <td align="right" colspan="2"><a href="#" id="shipestimate_close">Close</a></td>
                    </tr>
                </tbody>
                <tbody id="shipestimate_inputfields_tbody">
                    <tr>
                        <td align="center" colspan="2"><b>Calculate Shipping: Basket</b></td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">&nbsp;</td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_city"><b>City:</b></label></td>
                        <td width="100%"><input type="text" name="ShipEstimate:ship_city" value="&mvte:global:ShipEstimate:ship_city;" id="shipestimate_city" class="textfield" /></td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_state_select"><b>State/Province:</b></label></td>
                        <td width="100%">
                            <select name="ShipEstimate:ship_state_select" id="shipestimate_state_select">
                                <option value="">Outside US</option>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AK'">
                                    <option value="AK" selected>Alaska</option>
                                <mvt:else>
                                    <option value="AK">Alaska</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AL'">
                                    <option value="AL" selected>Alabama</option>
                                <mvt:else>
                                    <option value="AL">Alabama</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AR'">
                                    <option value="AR" selected>Arkansas</option>
                                <mvt:else>
                                    <option value="AR">Arkansas</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'AZ'">
                                    <option value="AZ" selected>Arizona</option>
                                <mvt:else>
                                    <option value="AZ">Arizona</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'CA'">
                                    <option value="CA" selected>California</option>
                                <mvt:else>
                                    <option value="CA">California</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'CO'">
                                    <option value="CO" selected>Colorado</option>
                                <mvt:else>
                                    <option value="CO">Colorado</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'CT'">
                                    <option value="CT" selected>Connecticut</option>
                                <mvt:else>
                                    <option value="CT">Connecticut</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'DC'">
                                    <option value="DC" selected>District of Columbia</option>
                                <mvt:else>
                                    <option value="DC">District of Columbia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'DE'">
                                    <option value="DE" selected>Delaware</option>
                                <mvt:else>
                                    <option value="DE">Delaware</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'FL'">
                                    <option value="FL" selected>Florida</option>
                                <mvt:else>
                                    <option value="FL">Florida</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'GA'">
                                    <option value="GA" selected>Georgia</option>
                                <mvt:else>
                                    <option value="GA">Georgia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'HI'">
                                    <option value="HI" selected>Hawaii</option>
                                <mvt:else>
                                    <option value="HI">Hawaii</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'IA'">
                                    <option value="IA" selected>Iowa</option>
                                <mvt:else>
                                    <option value="IA">Iowa</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'ID'">
                                    <option value="ID" selected>Idaho</option>
                                <mvt:else>
                                    <option value="ID">Idaho</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'IL'">
                                    <option value="IL" selected>Illinois</option>
                                <mvt:else>
                                    <option value="IL">Illinois</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'IN'">
                                    <option value="IN" selected>Indiana</option>
                                <mvt:else>
                                    <option value="IN">Indiana</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'KS'">
                                    <option value="KS" selected>Kansas</option>
                                <mvt:else>
                                    <option value="KS">Kansas</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'KY'">
                                    <option value="KY" selected>Kentucky</option>
                                <mvt:else>
                                    <option value="KY">Kentucky</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'LA'">
                                    <option value="LA" selected>Louisiana</option>
                                <mvt:else>
                                    <option value="LA">Louisiana</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MA'">
                                    <option value="MA" selected>Massachusetts</option>
                                <mvt:else>
                                    <option value="MA">Massachusetts</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MD'">
                                    <option value="MD" selected>Maryland</option>
                                <mvt:else>
                                    <option value="MD">Maryland</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'ME'">
                                    <option value="ME" selected>Maine</option>
                                <mvt:else>
                                    <option value="ME">Maine</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MI'">
                                    <option value="MI" selected>Michigan</option>
                                <mvt:else>
                                    <option value="MI">Michigan</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MN'">
                                    <option value="MN" selected>Minnesota</option>
                                <mvt:else>
                                    <option value="MN">Minnesota</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MO'">
                                    <option value="MO" selected>Missouri</option>
                                <mvt:else>
                                    <option value="MO">Missouri</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MS'">
                                    <option value="MS" selected>Mississippi</option>
                                <mvt:else>
                                    <option value="MS">Mississippi</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'MT'">
                                    <option value="MT" selected>Montana</option>
                                <mvt:else>
                                    <option value="MT">Montana</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NC'">
                                    <option value="NC" selected>North Carolina</option>
                                <mvt:else>
                                    <option value="NC">North Carolina</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'ND'">
                                    <option value="ND" selected>North Dakota</option>
                                <mvt:else>
                                    <option value="ND">North Dakota</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NE'">
                                    <option value="NE" selected>Nebraska</option>
                                <mvt:else>
                                    <option value="NE">Nebraska</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NH'">
                                    <option value="NH" selected>New Hampshire</option>
                                <mvt:else>
                                    <option value="NH">New Hampshire</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NJ'">
                                    <option value="NJ" selected>New Jersey</option>
                                <mvt:else>
                                    <option value="NJ">New Jersey</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NM'">
                                    <option value="NM" selected>New Mexico</option>
                                <mvt:else>
                                    <option value="NM">New Mexico</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NV'">
                                    <option value="NV" selected>Nevada</option>
                                <mvt:else>
                                    <option value="NV">Nevada</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'NY'">
                                    <option value="NY" selected>New York</option>
                                <mvt:else>
                                    <option value="NY">New York</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'OH'">
                                    <option value="OH" selected>Ohio</option>
                                <mvt:else>
                                    <option value="OH">Ohio</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'OK'">
                                    <option value="OK" selected>Oklahoma</option>
                                <mvt:else>
                                    <option value="OK">Oklahoma</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'OR'">
                                    <option value="OR" selected>Oregon</option>
                                <mvt:else>
                                    <option value="OR">Oregon</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'PA'">
                                    <option value="PA" selected>Pennsylvania</option>
                                <mvt:else>
                                    <option value="PA">Pennsylvania</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'RI'">
                                    <option value="RI" selected>Rhode Island</option>
                                <mvt:else>
                                    <option value="RI">Rhode Island</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'SC'">
                                    <option value="SC" selected>South Carolina</option>
                                <mvt:else>
                                    <option value="SC">South Carolina</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'SD'">
                                    <option value="SD" selected>South Dakota</option>
                                <mvt:else>
                                    <option value="SD">South Dakota</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'TN'">
                                    <option value="TN" selected>Tennessee</option>
                                <mvt:else>
                                    <option value="TN">Tennessee</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'TX'">
                                    <option value="TX" selected>Texas</option>
                                <mvt:else>
                                    <option value="TX">Texas</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'UT'">
                                    <option value="UT" selected>Utah</option>
                                <mvt:else>
                                    <option value="UT">Utah</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'VA'">
                                    <option value="VA" selected>Virginia</option>
                                <mvt:else>
                                    <option value="VA">Virginia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'VT'">
                                    <option value="VT" selected>Vermont</option>
                                <mvt:else>
                                    <option value="VT">Vermont</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WA'">
                                    <option value="WA" selected>Washington</option>
                                <mvt:else>
                                    <option value="WA">Washington</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WI'">
                                    <option value="WI" selected>Wisconsin</option>
                                <mvt:else>
                                    <option value="WI">Wisconsin</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WV'">
                                    <option value="WV" selected>West Virginia</option>
                                <mvt:else>
                                    <option value="WV">West Virginia</option>
                                </mvt:if>
                                <mvt:if expr="g.ShipEstimate:ship_state_select EQ 'WY'">
                                    <option value="WY" selected>Wyoming</option>
                                <mvt:else>
                                    <option value="WY">Wyoming</option>
                                </mvt:if>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_state">Other State/Province:</label></td>
                        <td width="100%"><input type="text" name="ShipEstimate:ship_state" value="&mvte:global:ShipEstimate:ship_state;" id="shipestimate_state" class="textfield" /></td>
                    </tr>
                    <tr>
                        <td nowrap align="right"><label for="shipestimate_zip"><b>ZIP/Postal Code:</b></label></td>
                        <td width="100%"><input type="text" name="ShipEstimate:ship_zip" value="&mvte:global:ShipEstimate:ship_zip;" id="shipestimate_zip" class="textfield" /></td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="hidden" name="ShipEstimate:ship_cntry" value="US" /></td>
                    </tr>
                </tbody>
                <tbody id="shipestimate_shippingmethods_tbody">
                    <tr>
                        <td align="center" id="shipestimate_shippingmethods" colspan="2"></td>
                    </tr>
                </tbody>
                <tbody id="shipestimate_controllers_tbody">
                    <tr>
                        <td align="right" colspan="2">
                            <input type="submit" id="shipestimate_calculate" class="button" value="Calculate Shipping" />
                            <input type="button" id="shipestimate_recalculate" class="button" value="Recalculate Shipping" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    
        <a href="#" id="shipestimate_show">Estimate Shipping</a>
    </form>
    <div id="shipestimate_backing" class="shipestimate_backing"></div>
    
    <script type="text/javascript">
        function shipestimate()
        {
            var self = this;
    
            this.dialog                     = document.getElementById( 'shipestimate_dialog' );
            this.backing                    = document.getElementById( 'shipestimate_backing' );
            this.inputfields_tbody          = document.getElementById( 'shipestimate_inputfields_tbody' );
            this.shippingmethods_tbody      = document.getElementById( 'shipestimate_shippingmethods_tbody' );
            this.shippingmethods            = document.getElementById( 'shipestimate_shippingmethods' );
            this.body                       = document.getElementsByTagName( 'body' )[ 0 ];
    
            this.close                      = document.getElementById( 'shipestimate_close' );
            this.recalculate                = document.getElementById( 'shipestimate_recalculate' );
        
            this.calculate                  = document.getElementById( 'shipestimate_calculate' );
            this.show                       = document.getElementById( 'shipestimate_show' );
        
            this.body.appendChild(this.dialog);
            this.body.appendChild(this.backing);
        
            if ( this.close )               this.close.onclick         = function() { self.Hide(); return false; }
            if ( this.recalculate )         this.recalculate.onclick   = function() { self.Show(); return false; }
        
            if ( this.calculate )           this.calculate.onclick     = function() { self.Calculate(); return false; }
            if ( this.show )                this.show.onclick          = function() { self.Show(); return false; }
            if ( this.backing )             this.backing.onclick       = function() { self.Hide(); return false; }
        }
    
        shipestimate.prototype.Show = function()
        {
            var self = this;
    
            this.dialog.style.display                 = 'block';
            this.backing.style.display                = 'inline-block';
            this.shippingmethods_tbody.style.display  = 'none';
            this.inputfields_tbody.style.display      = '';
            this.recalculate.style.display            = 'none';
        
            this.calculate.style.display              = 'inline-block';
    
            window.scrollTo( 0, 0 );
        
            window.onresize = function() { self.Resize(); }
            
            self.Resize();
        }
    
        shipestimate.prototype.Hide = function()
        {
            this.dialog.style.display   = 'none';
            this.backing.style.display  = 'none';
        }
    
        shipestimate.prototype.Calculate = function()
        {
            var iframe;
            var self = this;
    
            try
            {
                iframe = document.createElement( '<iframe name="shipestimate_iframe">' );
            }
            catch ( exception )
            {
                iframe = document.createElement( 'iframe' );
            }
    
            iframe.id                                 = 'shipestimate_iframe';
            iframe.name                               = 'shipestimate_iframe';
            iframe.style.display                      = 'none';
            
            this.shippingmethods.innerHTML              = '<br />loading...<br /><br />';
            this.shippingmethods_tbody.style.display  = '';
            this.inputfields_tbody.style.display      = 'none';
            this.recalculate.style.display            = 'none';
            this.calculate.style.display              = 'none';
    
            this.body.insertBefore( iframe, this.body.firstChild );
    
            if ( iframe.attachEvent )   iframe.attachEvent( "onload", function() { self.Replace( iframe ); } );
            else                        iframe.onload = function() { self.Replace( iframe ); };
            
            document.shipestimate_form.target = 'shipestimate_iframe';
            document.shipestimate_form.submit();
        }
    
        shipestimate.prototype.Replace = function( iframe )
        {
            var content;
            var self = this;
    
            content                         = ( iframe.contentWindow.document.getElementById( 'shipestimate_rates' ) || iframe.contentWindow.document.body ).innerHTML;
            this.shippingmethods.innerHTML    = content;
            this.recalculate.style.display  = 'inline-block';
    
            setTimeout( function(){ iframe.parentNode.removeChild( iframe ); }, 1 );
        }
    
        shipestimate.prototype.Resize = function()
        {
            if ( document.documentElement.clientHeight > document.body.scrollHeight )
            {
                if ( this.backing ) this.backing.style.height = document.documentElement.clientHeight + 'px';
            }
            else
            {
                if ( this.backing ) this.backing.style.height = ( document.body.scrollHeight > document.documentElement.scrollHeight ) ? document.body.scrollHeight + 'px' : document.documentElement.scrollHeight + 'px';
            }
            
            if ( this.dialog ) this.dialog.style.left = ( ( document.body.offsetWidth / 2 ) - ( this.dialog.offsetWidth / 2 ) ) + 'px';
            if ( this.dialog ) this.dialog.style.top  = 100 + 'px';
        }
    
        var shipestimate_init = new shipestimate();
    </script>

    Leave a comment:


  • alexwh
    replied
    Re: Bootstrap estimate shipping produces 403 error

    Originally posted by Matt Zimmermann View Post
    Here are a few updated needed to make the shipping estimator work as expected:

    • In your "custom.js" file, remove the Estimate Shipping Function called in JS_BASK.
    • In the CSS included with the shipestimate item, update .shipestimate_dialog z-index to 1100 and .shipestimate_backing z-index to 1000.
    • In the JavaScript included with the shipestimate item, add the following two lines to the shipestimate() function:
      Code:
      this.body.appendChild(this.dialog);
      this.body.appendChild(this.backing);
    Hi Matt,
    I change the code as you stated and the popup appears centered on the page better and no 403 error pages, however, removing estimate shipping function from the custom.js file makes it not work when you hit the calculate button. Do you have an updated function to replace it with?

    Regards,
    Alex

    Leave a comment:


  • alexwh
    replied
    Re: Bootstrap estimate shipping produces 403 error

    Originally posted by Jim Cockerham View Post
    I get a similar issue, quick popup and then I am sent the the storefront. Happens if the estimator is set to "new window", If I change the shipping estimator to "inline" it works.
    I tried that and it works when the link is clicked from the mini-basket, however, the link on the basket page still produces the same error...

    Leave a comment:


  • Matt Zimmermann
    replied
    Re: Bootstrap estimate shipping produces 403 error

    Here are a few updated needed to make the shipping estimator work as expected:

    • In your "custom.js" file, remove the Estimate Shipping Function called in JS_BASK.
    • In the CSS included with the shipestimate item, update .shipestimate_dialog z-index to 1100 and .shipestimate_backing z-index to 1000.
    • In the JavaScript included with the shipestimate item, add the following two lines to the shipestimate() function:
      Code:
      this.body.appendChild(this.dialog);
      this.body.appendChild(this.backing);

    Leave a comment:


  • Jim Cockerham
    replied
    Re: Bootstrap estimate shipping produces 403 error

    I get a similar issue, quick popup and then I am sent the the storefront. Happens if the estimator is set to "new window", If I change the shipping estimator to "inline" it works.

    Leave a comment:


  • alexwh
    started a topic Bootstrap estimate shipping produces 403 error

    Bootstrap estimate shipping produces 403 error

    When we have items in our basket and try to use the estimate shipping feature, we get a 403 error page reading - You do not have permission to access this document. If we try it off of the mini-basket, it produces a popup for a split second asking for state, country, etc., but then changes to the 403 error page as above...

    Regards,
    Alex
Working...
X