OK it didn't work. It produces an error:
Here is Line 712 to 719 in order.php:Code:[11-Aug-2016 15:36:31 America/Chicago] PHP Warning: Invalid argument supplied for foreach() in /hsphere/local/home/religiousshop/religious-shop.com/includes/classes/order.php on line 713
Code:712 $shipping_array = $_SESSION['cart']->vendor_shipping; 713 foreach ($shipping_array as $vendors_id => $shipping_data) { 714 $vendors = $db->Execute("select vendors_name from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'"); 715 $vendors_name = 'Unknown'; 716 if ($vendors) { 717 $vendors_name = $vendors->fields['vendors_name']; 718 } 719 $shipping_method_array = explode ('_', $shipping_data['id']);
What do you think?
Frank
Frank, I was thinking last night that there's a better way ... and there is.
Rather than going down the config.core.php replacement, simply place the following define statement just before your script loads application_top.php:
That definition will "preempt" the database setting and will allow your script to run in "normal" checkout mode regardless the configuration of the One-Page Checkout plugin.Code:define ('CHECKOUT_ONE_ENABLED', 'false');
v1.0.1 is now available for download from the Zen Cart plugins. There are a couple of issues (identified in postings above) that are targeted for a v1.0.2 release, which will most likely happen within the next week.
Hello,
Well it took all my brainpower and a very long investigation to figure this out. The file we were looking at in post #55 had absolutely nothing to do with my MVS/Vendor plugin. It was to be used if you wanted to charge freight, not per order but by vendor. In other words if an order went to two different vendors that file would have been used to charge the customer multiple shipping charges. When I was working with the plugin developer I had them change the way the plugin work so that the customer was only charged for one freight charge. Unfortunately they left that file in the distribution but it didn't do anything. The more I looked at the file the more I realized that it made no sense. I removed it from the server and placed an order using the standard multi form check out and the order was processed and the vendor information was posted and vendor email was sent.. Just as it was suppose to, even though that file was removed.
I placed another order using the on-page checkout and it processed the order but it did not produce any vendor information or vendor email.
I looked at the standard modules/pages/header_php.php pages and compared them to modules/pages/checkout_one/header_php.php file.
I ended up adding this code:
$vendor_shipping = $_SESSION['cart']->vendor_shipping(); to the confirmation_one/header_php.php page code, and then ran another test order and guess what it all worked. Problem solved. Sorry for being so winded but I wanted you to know the full story
I want to thank you for all your assistance and certainly going the extra mile to help out a fellow zenner.
P.S. Don't think abut this tonight put your valuable talents to work on something really worth while. Suggestion, a new COWA plugin to go along with the one-page checkout. :-)
A couple more bugfixes have been posted to the plugin's GitHub repository:
Need to move the customers_auth check to after we know the customer's logged in (there were PHP Notify errors being recorded). Change needed to /includes/modules/pages/checkout_one/header_php.php to move that checking block. Currently:
toCode:// ----- // If the plugin's debug-mode is set to "full", then enable ALL error reporting for the checkout_one page. // if (CHECKOUT_ONE_DEBUG == 'full') { @ini_set('error_reporting', -1 ); } // ----- // In the "normal" Zen Cart checkout flow, the module /includes/init_includes/init_customer_auth.php performs the // following check to see that the customer is authorized to checkout. Rather than changing the code in that // core-file, we'll repeat that check here. // if ($_SESSION['customers_authorization'] != 0) { $messageStack->add_session ('header', TEXT_AUTHORIZATION_PENDING_CHECKOUT, 'caution'); zen_redirect (zen_href_link (FILENAME_DEFAULT)); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($_SESSION['cart']->count_contents() <= 0) { zen_redirect (zen_href_link (FILENAME_SHOPPING_CART, '', 'NONSSL')); } // if the customer is not logged on, redirect them to the login page if (!isset($_SESSION['customer_id']) || !$_SESSION['customer_id']) { $_SESSION['navigation']->set_snapshot(); zen_redirect (zen_href_link (FILENAME_LOGIN, '', 'SSL')); } else { // validate customer if (zen_get_customer_validate_session ($_SESSION['customer_id']) == false) { $_SESSION['navigation']->set_snapshot (array ('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_ONEPAGE)); zen_redirect (zen_href_link (FILENAME_LOGIN, '', 'SSL')); } }
... essentially, moving that customers_authorization check to after we know the customer's logged in.Code:// ----- // If the plugin's debug-mode is set to "full", then enable ALL error reporting for the checkout_one page. // if (CHECKOUT_ONE_DEBUG == 'full') { @ini_set('error_reporting', -1 ); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($_SESSION['cart']->count_contents() <= 0) { zen_redirect (zen_href_link (FILENAME_SHOPPING_CART, '', 'NONSSL')); } // if the customer is not logged on, redirect them to the login page if (!isset($_SESSION['customer_id']) || !$_SESSION['customer_id']) { $_SESSION['navigation']->set_snapshot(); zen_redirect (zen_href_link (FILENAME_LOGIN, '', 'SSL')); } else { // validate customer if (zen_get_customer_validate_session ($_SESSION['customer_id']) == false) { $_SESSION['navigation']->set_snapshot (array ('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_ONEPAGE)); zen_redirect (zen_href_link (FILENAME_LOGIN, '', 'SSL')); } } // ----- // In the "normal" Zen Cart checkout flow, the module /includes/init_includes/init_customer_auth.php performs the // following check to see that the customer is authorized to checkout. Rather than changing the code in that // core-file, we'll repeat that check here. // if ($_SESSION['customers_authorization'] != 0) { $messageStack->add_session ('header', TEXT_AUTHORIZATION_PENDING_CHECKOUT, 'caution'); zen_redirect (zen_href_link (FILENAME_DEFAULT)); }
I'll identify the other issue in a follow-on post.
Here's the other one:
The "collectsCardDataOnsite" interface changed between Zen Cart 1.5.4 and 1.5.5 and the plugin's using the 1.5.4 version (which was used to verify the authorizenet_aim payment method). Need to update /includes/modules/pages/checkout_one/jscript_main.php to include the ZC 1.5.5 version of the interface as well.
To correct, add the highlighted code sections:
Code:function shippingIsBilling () { var shippingAddress = document.getElementById ('checkoutOneShipto'); if (shippingAddress) { if (document.getElementById ('shipping_billing').checked) { shippingAddress.className = 'hiddenField'; shippingAddress.setAttribute ('className', 'hiddenField'); } else { shippingAddress.className = 'visibleField'; shippingAddress.setAttribute ('className', 'visibleField'); } } } <?php // ----- // The "collectsCartDataOnsite" interface built into Zen Cart magically transformed between // Zen Cart 1.5.4 and 1.5.5, so this module for the One-Page Checkout plugin includes both // forms. That way, if a payment module was written for 1.5.4 it'll work, ditto for those // written for the 1.5.5 method. // ?> function collectsCardDataOnsite(paymentValue) { zcJS.ajax({ url: "ajax.php?act=ajaxPayment&method=doesCollectsCardDataOnsite", data: {paymentValue: paymentValue} }).done(function( response ) { if (response.data == true) { var str = $('form[name="checkout_payment"]').serializeArray(); zcJS.ajax({ url: "ajax.php?act=ajaxPayment&method=prepareConfirmation", data: str }).done(function( response ) { $('#checkoutPayment').hide(); $('#navBreadCrumb').html(response.breadCrumbHtml); $('#checkoutPayment').before(response.confirmationHtml); $(document).attr('title', response.pageTitle); }); } else { zcLog2Console ('collectsCartDataOnsite: submitting form'); $('form[name="checkout_payment"]')[0].submit(); } }); return false; } function doesCollectsCardDataOnsite(paymentValue) { if ($('#'+paymentValue+'_collects_onsite').val()) { if ($('#pmt-'+paymentValue).is(':checked')) { return true; } } return false; } function doCollectsCardDataOnsite(paymentValue) { var str = $('form[name="checkout_payment"]').serializeArray(); zcJS.ajax({ url: "ajax.php?act=ajaxPayment&method=prepareConfirmation", data: str }).done(function( response ) { $('#checkoutPayment').hide(); $('#navBreadCrumb').html(response.breadCrumbHtml); $('#checkoutPayment').before(response.confirmationHtml); $(document).attr('title', response.pageTitle); }); }
I've just submitted v1.0.2 to the plugins' area for review (if you can't wait, you can download it from either the plugin's GitHub repository or my website).
This version provides changes to address the following issues (as identified by their issue numbers in the plugin's GitHub repository):
#13: Form won't submit under IE-11
#14: Pre-integration with "Product Delivery by Postcode (PDP)"
#17: Missing semi-colon in language file
#18: Error-log generated when the customer has applied a discount coupon
#19: Move customer's authorization check
#20: Include both ZC1.5.4 and 1.5.5 versions of "handlesCreditCardDataOnSite"
#21: Correct interoperation with some shipping methods
#22: Correct AJAX session-save issue
#23: Session time-out handling
#24: Display payment-method block when in "special checkout"