Forum
Manual Checkout not redirecting to success page
Hello,
I'm at the next stage of my free product functionality (see here for part 1 https://forum.grabaperch.com/forum/04-09-2018-free-products-issue ), and I'm able to use manual checkout to successfully checkout. An order goes through and an order confirmation is sent.
Unfortunately I am not redirected to my success page, which I'd imagine will confuse the user.
My checkout code:
<?php
// if (!perch_shop_addresses_set() || !perch_member_logged_in()) {
if (!perch_shop_addresses_set()) {
perch_shop_edit_address_form(false, [
'template' => 'checkout/customer_create_passwordless.html',
]);
}
$cart_total = perch_shop_cart_total([], true);
if ($cart_total=='£0.00') {
// your 'success' return URL
$return_url = 'https://xx/manual-complete.php';
$cancel_url = 'https://xx/manual-complete.php';
perch_shop_checkout('manual', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
}
// your 'success' return URL
$return_url = 'https://xx/paypal-complete.php';
$cancel_url = 'https://xx/paypal-failed.php';
perch_shop_checkout('paypal-express', [
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
?>
My diagnostics:
Perch: 3.1.1
Production mode: Production (100)
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1), perch_blog (5.6.1), perch_events (1.9.5), perch_forms (1.10), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2), pipit_catalog (1.2.0)
DB driver: PDO
DB tables: perch3_blog_authors (1), perch3_blog_comments (0), perch3_blog_index (31), perch3_blog_posts (1), perch3_blog_posts_to_tags (0), perch3_blog_sections (1), perch3_blog_tags (0), perch3_blog_webmention_queue (0), perch3_blogs (1), perch3_categories (7), perch3_category_counts (0), perch3_category_sets (2), perch3_content_index (85), perch3_content_items (33), perch3_content_regions (7), perch3_events (0), perch3_events_categories (2), perch3_events_to_categories (0), perch3_forms (1), perch3_forms_responses (0), perch3_members (213), perch3_members_forms (1), perch3_members_member_tags (0), perch3_members_sessions (12), perch3_members_tags (0), perch3_menu_items (16), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (1), perch3_pages (6), perch3_resource_log (236), perch3_resource_tags (0), perch3_resources (183), perch3_resources_to_tags (0), perch3_scheduled_tasks (3), perch3_settings (55), perch3_shop_addresses (672), perch3_shop_admin_index (30), perch3_shop_brands (1), perch3_shop_cart (51763), perch3_shop_cart_data (742), perch3_shop_cart_items (580), perch3_shop_countries (250), perch3_shop_currencies (152), perch3_shop_customers (212), perch3_shop_emails (2), perch3_shop_index (2740), perch3_shop_option_values (0), perch3_shop_options (0), perch3_shop_order_items (423), perch3_shop_order_promotions (12), perch3_shop_order_statuses (10), perch3_shop_orders (252), perch3_shop_orders_meta (1), perch3_shop_product_files (14), perch3_shop_product_option_values (0), perch3_shop_product_options (0), perch3_shop_product_tags (0), perch3_shop_products (42), perch3_shop_promotions (2), perch3_shop_sales (0), perch3_shop_search (42), perch3_shop_shipping_zone_countries (1), perch3_shop_shipping_zones (1), perch3_shop_shippings (1), perch3_shop_tax_exhibits (680), perch3_shop_tax_group_rates (1), perch3_shop_tax_groups (1), perch3_shop_tax_locations (1), perch3_shop_tax_rates (0), perch3_shop_variants (0), perch3_user_passwords (4), perch3_user_privileges (83), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (2)
Users: 2
App runtimes:
<?php
$apps_list = [
'content',
'categories',
'perch_blog',
'perch_forms',
'perch_members',
'perch_shop',
];
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins)
Editor plug-ins:
H1: bef505e94e3a9e9c7fb464028b56cf35
L1: ae06bcd311ecd071b4dbfbf8093ca25a
F1: 3b606135b33e6a102526838f4152a807
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
hideBranding: 0
content_collapseList: 1
lang: en-gb
installedAt: 3.0.13
update_3.0.13: done
latest_version:
on_sale_version: 3.1.1
perch_shop_update: 1.2.5
perch_blog_update: 5.6
perch_blog_post_url: /blog.php?s={postSlug}
perch_events_update: 1.8
headerScheme: light
sidebar_back_link: 1
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_events_detail_url: /events/event.php?s={eventSlug}
perch_members_login_page: /members/login.php?r={returnURL}
perch_shop_price_tax_mode: inc
perch_shop_product_url: events.php?s={slug}
perch_shop_invoice_number_format: Invoice %d
dashboard: 0
hide_pwd_reset: 0
keyboardShortcuts: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
perch_blog_comment_notify: 0
perch_blog_webmention_tx: 0
perch_blog_webmention_rx: 0
perch_blog_site_name: Under The Trees
perch_shop_site_url: https://www.example.com
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
pipit_catalog_productsSet: 10
pipit_catalog_lowStok: 5
pipit_catalog_thumbW:
pipit_catalog_thumbH:
pipit_catalog_thumbDensity:
pipit_catalog_hideCat: 0
pipit_catalog_hideBrand: 1
pipit_catalog_hideStatus: 1
pipit_catalog_hideSale: 0
pipit_catalog_hideShipping: 1
pipit_catalog_hideSearch: 1
pipit_catalog_hideProductImages: 0
pipit_catalog_displaySalePrices: 0
pipit_catalog_thumbCrop: 0
perch_members_update: 1.4
siteURL: https://www.example.com
update_3.1.1: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: dbo719835523
PERCH_DB_SERVER: db719835523.db.1and1.com
PERCH_DB_DATABASE: db719835523
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: chris@christy.digital
PERCH_EMAIL_FROM_NAME: Chris McMahon
PERCH_LOGINPATH: /perch
PERCH_PATH: /homepages/21/d688763965/htdocs/utt/perch
PERCH_CORE: /homepages/21/d688763965/htdocs/utt/perch/core
PERCH_RESFILEPATH: /homepages/21/d688763965/htdocs/utt/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_SCHEDULE_SECRET: puttanesca
PERCH_DEBUG: 1
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 8255e4c4a367cfa3e2bd
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /homepages/21/d688763965/htdocs/utt/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SHOP_VERSION: 1.2.5
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 7.1.15
Zend: 3.1.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
MySQL server: 5.5.59-0+deb7u1-log
Free disk space: 436.95 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, session, intl, json, mbstring, mcrypt, standard, PDO, mysqlnd, pdo_sqlite, Phar, posix, Reflection, imap, shmop, SimpleXML, soap, pdo_mysql, exif, tidy, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, mysqli, cgi-fcgi
GD: Yes
ImageMagick: No
PHP max upload size: 64M
PHP max form post size: 64M
PHP memory limit: 256M
Total max uploadable file size: 64M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
REDIRECT_UNIQUE_ID: Wsx6vdmgPuQAAEGxXf8AAAA9
REDIRECT_SCRIPT_URL: /perch/core/settings/diagnostics/
REDIRECT_SCRIPT_URI: https://www.example.com/perch/core/settings/diagnostics/
REDIRECT_DOCUMENT_ROOT: /kunden/homepages/21/d688763965/htdocs/utt
REDIRECT_UI_SUEXEC_DEFAULT_CHROOT_ID: 7
REDIRECT_UI_SUEXEC_FSTATD_UNIXSOCKET: /run/ui-fstatd.suexec.socket
REDIRECT_UI_SUEXEC_STATISTICS_UNIXSOCKET: /homepages/sclientMF/http.sock.bin
REDIRECT_DBENTRY__RSCLVL_CPU: 40
REDIRECT_DBENTRY__RSCLVL_MEM: 768
REDIRECT_DBENTRY__RSCLVL_PROCSOFT: 15
REDIRECT_DBENTRY__RSCLVL_PROCHARD: 27
REDIRECT_DBENTRY_HOST: example.com
REDIRECT_DBENTRY_VALUE: /kunden/homepages/21/d688763965/htdocs/utt:d0000#CPU 60 #MEM 524288 #CGI 786762 #NPROC 20 #TAID 89798431 #LANG 1 #PARKING 1 #RSCLVL 300 #STAT 1 #CHROOT 11
REDIRECT_DBENTRY_DOCROOT: /kunden/homepages/21/d688763965/htdocs/utt
REDIRECT_DBENTRY_HASH: d0000
REDIRECT_DBENTRY__CPU: 60
REDIRECT_DBENTRY__MEM: 524288
REDIRECT_DBENTRY__CGI: 786762
REDIRECT_DBENTRY__NPROC: 20
REDIRECT_DBENTRY__TAID: 89798431
REDIRECT_DBENTRY__LANG: 1
REDIRECT_DBENTRY__PARKING: 1
REDIRECT_DBENTRY__RSCLVL: 300
REDIRECT_DBENTRY__STAT: 1
REDIRECT_DBENTRY__CHROOT: 11
REDIRECT_DBENTRY: /kunden/homepages/21/d688763965/htdocs/utt:d0000#CPU 60 #MEM 524288 #CGI 786762 #NPROC 20 #TAID 89798431 #LANG 1 #PARKING 1 #RSCLVL 300 #STAT 1 #CHROOT 11
REDIRECT_HANDLER: x-mapp-php5.5
REDIRECT_STATUS: 200
UNIQUE_ID: Wsx6vdmgPuQAAEGxXf8AAAA9
SCRIPT_URL: /perch/core/settings/diagnostics/
SCRIPT_URI: https://www.example.com/perch/core/settings/diagnostics/
UI_SUEXEC_DEFAULT_CHROOT_ID: 7
DBENTRY_HOST: example.com
DBENTRY_VALUE: /kunden/homepages/21/d688763965/htdocs/utt:d0000#CPU 60 #MEM 524288 #CGI 786762 #NPROC 20 #TAID 89798431 #LANG 1 #PARKING 1 #RSCLVL 300 #STAT 1 #CHROOT 11
DBENTRY_DOCROOT: /kunden/homepages/21/d688763965/htdocs/utt
DBENTRY_HASH: d0000
DBENTRY__CPU: 60
DBENTRY__MEM: 524288
DBENTRY__CGI: 786762
DBENTRY__NPROC: 20
DBENTRY__TAID: 89798431
DBENTRY__LANG: 1
DBENTRY__PARKING: 1
DBENTRY__STAT: 1
DBENTRY__CHROOT: 11
DBENTRY: /kunden/homepages/21/d688763965/htdocs/utt:d0000#CPU 60 #MEM 524288 #CGI 786762 #NPROC 20 #TAID 89798431 #LANG 1 #PARKING 1 #RSCLVL 300 #STAT 1 #CHROOT 11
HTTP_HOST: www.example.com
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_COOKIE: PHPSESSID=5cd92f6812ebfc914ecaaab3464f36e2; cmsa=1; p_m=7b5093f263049d4e8f26d1630a97c65c33ded2bc; _snow_id.b43f=af25ee4b-eecd-480d-902c-265b65697af6.1509017366.4.1510565424.1509470751.5c335b13-c0e8-48fd-ae85-8413f3c0bead; _sp_id.f68c=47e18833-7fa4-4137-96bc-4cb6965cb109.1509017365.4.1510565424.1509470751.36f27d90-2544-4932-b5df-f75deccd4883; __qca=P0-736055959-1509017365726
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15
HTTP_REFERER: https://www.example.com/perch/core/settings/diagnostics/
HTTP_DNT: 1
HTTP_ACCEPT_LANGUAGE: en-gb
PATH: /bin:/usr/bin
SERVER_SOFTWARE: Apache
SERVER_NAME: example.com
SERVER_ADDR: 217.160.62.228
SERVER_PORT: 80
REMOTE_ADDR: 80.234.227.6
DOCUMENT_ROOT: /kunden/homepages/21/d688763965/htdocs/utt
REQUEST_SCHEME: http
CONTEXT_PREFIX: /system-bin/
CONTEXT_DOCUMENT_ROOT: /kunden/usr/lib/cgi-bin/
SERVER_ADMIN: webmaster@example.com
SCRIPT_FILENAME: /kunden/homepages/21/d688763965/htdocs/utt/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 24026
REDIRECT_QUERY_STRING: extended
REDIRECT_URL: /perch/core/settings/diagnostics/index.php
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
STATUS: 200
ORIG_PATH_INFO: /perch/core/settings/diagnostics/index.php
ORIG_PATH_TRANSLATED: /kunden/homepages/21/d688763965/htdocs/utt/perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1523350205.3032
REQUEST_TIME: 1523350205
argc: 1
Do you output anything to the page before this code?
I use
<?php perch_shop_cart_item_count(); ?>
as part of my nav menu, but there's no other php or perch except the runtime include.For the record, the paypal-express checkout redirects with no issues.
If you turn on debug and try it, what does it output?
Added debug to my footer, but it doesn't get there due to a fatal php error. My error log:
I'm guessing it's something to do with the address due to
get_address(NULL, 'default')
, but like I said, I'm confused as to why the same code works fine for paypal-express.What's on line 2 of
/homepages/21/d688763965/htdocs/utt/cart.php
?It looks like something is being output.
That's my
<!DOCTYPE html>
declaration.Any page function that issues a redirect needs to happen before you output anything. So before the doctype.
Ah, I see, I think I've been looking at this from a daft scripting perspective - seeing the <body> as the main loop. Will give this a go Drew, thanks again for your help & patience.
This worked and clarified a few things for me.