I try to find why something doesn't in my script
My problem is in discount_code
. I try to see if there is something or not and if the data is ok, but I don' see nothing.
How to see for example $sess_discount_code
or all data that I want in discount_code.php
to try to debug the file ?
Thank you
In my shopping_cart.php
, I have that
if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true') {
global $sess_discount_code;
$footer .= '
$(document).ready(function() {
var a = 0;
discount_code_process();
$(\'#inputCoupon\').blur(function() { if (a == 0) discount_code_process(); a = 0 });
$("#inputCoupon").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } });
function discount_code_process() { if ($("#inputCoupon").val() != "") { $("#inputCoupon").attr("readonly", "readonly"); $("#discount_code_status").empty().append(\'<i class="fa fa-cog fa-spin fa-lg"> </i>\'); $.post("discount_code.php", { inputCoupon: $("#inputCoupon").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append(\'<i class="fa fa-check fa-lg" style="color:#00b100;"></i>\') : $("#discount_code_status").empty().append(\'<i class="fa fa-ban fa-lg" style="color:#ff2800;"></i>\'); $("#inputCoupon").removeAttr("readonly") }); } } });
';
}
$footer .= '
</script>
<!-- End shipping estimator -->
';
// Discount Code - start
if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true') {
if ($sess_discount_code == 'undefined') $sess_discount_code = '';
$discounttxt = '<div class="col-sm-12 row">';
if ($OSCOM_Customer->isLoggedOn()) {
$discounttxt .= '<div class="col-sm-12"><strong>' . MODULE_SHOPPING_CART_SHIPPING_ESTIMATOR_DISCOUNT_CODE_TITLE . '</strong></div>
<div class="col-sm-5">' . HTML::inputField('coupon', $sess_discount_code, 'id="inputCoupon"') . '<span id="discount_code_status"></span></div>
<div class="col-sm-6"><a class="btn btn-default" role="button" href="_" onclick="return shipincart_submit(\'\');"><i class="glyphicon glyphicon-refresh"></i> '. IMAGE_BUTTON_UPDATE . ' </a></div>';
} else {
$discounttxt .= '<div class="col-sm-12">' . MODULE_SHOPPING_CART_SHIPPING_ESTIMATOR_DISCOUNT_CODE_TEXT_LOG_IN . '</div>
<div class="col-sm-12">' . HTML::button(MODULE_SHOPPING_CART_SHIPPING_ESTIMATOR_BUTTON_LOGIN, 'glyphicon glyphicon-log-in', OSCOM::link('login.php'), 'btn-success btn-sm') . '</div>';
}
$discounttxt .= '</div>
<div class="hr"></div>
<div class="clearfix"></div>
<div class="hr"></div>
';
$ShipTxt .= $discounttxt;
}
// Discount Code - end
In my discount_code.php
, I have that :
$discount = 0;
var_dump($sess_discount_code); ===> How to see that ????
if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' && !empty($_SERVERS['HTTP_X_REQUESTED_WITH']) && $SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
................
}
register_shutdown_function('session_write_close');
echo $discount > 0 ? 1 : 0;
exit;