Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk
Getting the same with WebPay but only occasionally.
Also getting completed orders that trigger a PHP notice for a missing token. Followed the process with the console and saw no problem but the notice still appeared.
Are You Vulnerable for an Accessibility Lawsuit?
myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.
Hi Cindy,
I'm running into an issue, non related to OPC but that is affecting it. The way ZC works when it comes to free shipping (free options) and gift vouchers is a bit odd. Ideally if I offer free shipping over $100 and the customer applies a $10 discount coupon for example, free shipping should not apply anymore. However the reality is, with the way ZC is designed free shipping still applies because freeoptions works on order subtotal not order total.
The way I've made it work in the past was by hiding the place order button if certain conditions do not apply. I wrote a rudimentary piece code (perfected by @mc12345678 a little while back, to whom I will forever be grateful to) but I can't make it work with OPC.
The code determines if both discount coupons and free shipping are loaded and if the order total drops below the free shipping threshold, then the button is hidden, for the most part. I placed the code in the tpl_checkout_confirmation_default.php on the native ZC checkout which is where the place order button displays. On OPC that could be according to what I've noticed the module works, on the tpl_modules_opc_submit_block.php, but it just doesn't work, and I was wondering if you could take a look and maybe point me in the right direction?
This below is what I have.
When loading the page I get a popup "Please contact the store owner; some required elements of this page are missing" and in the logs "PHP Parse error: syntax error, unexpected end of file in /includes/templates/responsive_classic/templates/tpl_modules_opc_submit_block.php on line 68."PHP Code:
<?php
// -----
// Part of the One-Page Checkout plugin, provided under GPL 2.0 license by lat9 ().
// Copyright (C) 2013-2017, Vinos de Frutas Tropicales. All rights reserved.
//
// Check to see that at least one shipping-method and one payment-method is enabled; if not, don't render the submit-button.
//
if ($shipping_module_available && $payment_module_available) {
// -----
// Set up two form-submittal buttons, one for payment methods that require confirmation and one for those that don't.
// This page's header_php.php has created an array of payment modules that require confirmation, which is pulled into the
// page's jscript_main.php.
//
?>
<!-- bof disable checkout button from displaying 1 of 3 -->
<?php
if (!IS_ADMIN_FLAG) {
global $order, $db;
if (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && !empty($_SESSION['cot_gv']) && (($_SESSION['cot_gv'] + $order->info['total']) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN)) { // Do the following (show button) if total is below the min, free options is offered, a gift certificate is used and the sum of the gift certificate and order total is equal to or greater than the minimum.
?>
<!-- bof disable checkout button from displaying 1 of 3 -->
<!--bof submit block -->
<div id="checkoutOneSubmit" class="buttonRow forward">
<span id="opc-order-confirm"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_CONFIRM, BUTTON_CHECKOUT_ONE_CONFIRM_ALT); ?></span>
<span id="opc-order-review"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_REVIEW, BUTTON_CHECKOUT_ONE_REVIEW_ALT); ?></span>
<?php echo zen_draw_hidden_field('order_confirmed', '1', 'id="confirm-the-order"') . zen_draw_hidden_field ('current_order_total', '0', 'id="current-order-total"'); ?>
</div>
<?php
if (!empty($order->customer['email_address'])) {
?>
<div id="checkoutOneEmail" class="forward clearRight"><?php echo sprintf(TEXT_CONFIRMATION_EMAILS_SENT_TO, $order->customer['email_address']); ?></div>
<?php
}
?>
<div class="clearBoth"></div>
<!--eof submit block -->
<!-- bof disable checkout button from displaying 2 of 3 -->
<?php } elseif (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { // Stop checkout if below the minimum and free options is displayed (Note that at this point of execution, the gift certificate is not a factor because if it "helped" then this code is not reached).
echo '<div style="border: 3px solid #777777; padding: 10px 0;"><p style="text-align: center;"><strong>Your order no longer qualifies for Free Shipping.</strong></p>';
} else { // standard checkout, basically total is anything that doesn't cause freeoptions to display.
?>
<!-- eof disable checkout button from displaying 2 of 2 -->
<!--bof submit block -->
<div id="checkoutOneSubmit" class="buttonRow forward">
<span id="opc-order-confirm"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_CONFIRM, BUTTON_CHECKOUT_ONE_CONFIRM_ALT); ?></span>
<span id="opc-order-review"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_REVIEW, BUTTON_CHECKOUT_ONE_REVIEW_ALT); ?></span>
<?php echo zen_draw_hidden_field('order_confirmed', '1', 'id="confirm-the-order"') . zen_draw_hidden_field ('current_order_total', '0', 'id="current-order-total"'); ?>
</div>
<?php
if (!empty($order->customer['email_address'])) {
?>
<div id="checkoutOneEmail" class="forward clearRight"><?php echo sprintf(TEXT_CONFIRMATION_EMAILS_SENT_TO, $order->customer['email_address']); ?></div>
<?php
}
?>
<div class="clearBoth"></div>
<!--eof submit block -->
//<!-- bof disable checkout button from displaying 3 of 3 -->
<?php
}
}
Thanks in advance for your guidance.
After adding the missing curly bracket the code doesn't work. Lowering the order total doesn't trigger the message nor hides the button. What am I doing wrong?
PHP Code:
<?php
// -----
// Part of the One-Page Checkout plugin, provided under GPL 2.0 license by lat9 ().
// Copyright (C) 2013-2017, Vinos de Frutas Tropicales. All rights reserved.
//
// Check to see that at least one shipping-method and one payment-method is enabled; if not, don't render the submit-button.
//
if ($shipping_module_available && $payment_module_available) {
// -----
// Set up two form-submittal buttons, one for payment methods that require confirmation and one for those that don't.
// This page's header_php.php has created an array of payment modules that require confirmation, which is pulled into the
// page's jscript_main.php.
//
?>
<!-- bof disable checkout button from displaying 1 of 3 -->
<?php
if (!IS_ADMIN_FLAG) {
global $order, $db;
if (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && !empty($_SESSION['cot_gv']) && (($_SESSION['cot_gv'] + $order->info['total']) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN)) { // Do the following (show button) if total is below the min, free options is offered, a gift certificate is used and the sum of the gift certificate and order total is equal to or greater than the minimum.
?>
<!-- bof disable checkout button from displaying 1 of 3 -->
<!--bof submit block -->
<div id="checkoutOneSubmit" class="buttonRow forward">
<span id="opc-order-confirm"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_CONFIRM, BUTTON_CHECKOUT_ONE_CONFIRM_ALT); ?></span>
<span id="opc-order-review"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_REVIEW, BUTTON_CHECKOUT_ONE_REVIEW_ALT); ?></span>
<?php echo zen_draw_hidden_field('order_confirmed', '1', 'id="confirm-the-order"') . zen_draw_hidden_field ('current_order_total', '0', 'id="current-order-total"'); ?>
</div>
<?php
if (!empty($order->customer['email_address'])) {
?>
<div id="checkoutOneEmail" class="forward clearRight"><?php echo sprintf(TEXT_CONFIRMATION_EMAILS_SENT_TO, $order->customer['email_address']); ?></div>
<?php
}
?>
<div class="clearBoth"></div>
<!--eof submit block -->
<!-- bof disable checkout button from displaying 2 of 3 -->
<?php } elseif (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { // Stop checkout if below the minimum and free options is displayed (Note that at this point of execution, the gift certificate is not a factor because if it "helped" then this code is not reached).
echo '<div style="border: 3px solid #777777; padding: 10px 0;"><p style="text-align: center;"><strong>Your order no longer qualifies for Free Shipping.</strong></p>';
} else { // standard checkout, basically total is anything that doesn't cause freeoptions to display.
?>
<!-- eof disable checkout button from displaying 2 of 2 -->
<!--bof submit block -->
<div id="checkoutOneSubmit" class="buttonRow forward">
<span id="opc-order-confirm"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_CONFIRM, BUTTON_CHECKOUT_ONE_CONFIRM_ALT); ?></span>
<span id="opc-order-review"><?php echo zen_image_button(BUTTON_IMAGE_CHECKOUT_ONE_REVIEW, BUTTON_CHECKOUT_ONE_REVIEW_ALT); ?></span>
<?php echo zen_draw_hidden_field('order_confirmed', '1', 'id="confirm-the-order"') . zen_draw_hidden_field ('current_order_total', '0', 'id="current-order-total"'); ?>
</div>
<?php
if (!empty($order->customer['email_address'])) {
?>
<div id="checkoutOneEmail" class="forward clearRight"><?php echo sprintf(TEXT_CONFIRMATION_EMAILS_SENT_TO, $order->customer['email_address']); ?></div>
<?php
}
?>
<div class="clearBoth"></div>
<!--eof submit block -->
//<!-- bof disable checkout button from displaying 3 of 3 -->
<?php
}
}
}
I need some help to modify the display showing the billing address and shipping address. By OPC default, billing shows on the top and billing (if different than shipping) shows on the bottom. I want to display shipping on the top and billing on the bottom. We are selling physical products so we want the shipping address on the top. I did some tests, and I narrow down this function into following three php files:
\includes\templates\template_default\templates
tpl_checkout_one_default.php, tpl_modules_opc_billing_address.php and tpl_modules_opc_shipping_address.php
tpl_checkout_one_default.php file is very clear. It has two sections, one for billing and one for shipping. Just swap two sections.
The part I'm not sure is the location for the question "Shipping Address, Same as Billing". By default, this question is between the billing block and shipping block. After I changed the tpl_checkout_one_default.php, this question is above the "Billing/Shipping Address" section. I prefer to move it below this section instead, like the original OPC location, or the bottom of both address blocks.
I found the following code is located on the top of tpl_modules_opc_shipping_address.php and I suspected they are for this question. So I tried to move this section to the bottom of tpl_modules_opc_billing_address.php. It seems partially work. If I turn this question on/off for several times, or under some special patterns, the billing address block cannot be hidden anymore, unless I refreshed the whole page. So this display/hide function might use JavaScript, which I'm not familiar...
Any help are appreciated.PHP Code:
if ($is_virtual_order) {
echo zen_draw_checkbox_field('shipping_billing', '1', false, 'id="shipping_billing" style="display: none;"');
} else {
if (CHECKOUT_ONE_ENABLE_SHIPPING_BILLING == 'false') {
echo zen_draw_checkbox_field('shipping_billing', '1', false, 'id="shipping_billing" style="display: none;"');
} else {
?>
<div id="checkoutOneShippingFlag" class="custom-control custom-checkbox" style="display: none;"><?php echo zen_draw_checkbox_field('shipping_billing', '1', $shipping_billing, 'id="shipping_billing"');?>
<label class="custom-control-label checkboxLabel" for="shipping_billing"><?php echo TEXT_USE_BILLING_FOR_SHIPPING; ?></label>
</div>
<?php
}
?>
I am getting complaints from customers saying that the greyed out screen lags and takes ages to process a payment. This is through paypal and square up. Because there is a long delay, this confuses the customer. They are thinking that the payment isn't processing and the website has crashed. The greyed out screen is just grey and doesn't let the customers know that their payment is actually processing. It just stays grey for ages. I can't actually say whether people are clicking off this screen or not, but my orders have gone down since installing OPC so I suspect that customers are getting that far and thinking that nothing is happening.
I am running OPC 2.4.1 on Zen Cart 1.5.7D.
Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk
Bookmarks