Forum

Thread tagged as: PayPal, Shop

perch Shop, checkout to paypal (not paypal express)

Hi, can I disable the perch shop paypal express checkout. and use my form I have generated.

as I'm finding, perch shop seems to replace the checkout button with

     <a href="checkout.php?paypal-express=true" class="checkout button"><button>Checkout now</button></a>

thanks in advance...

tony

Diagnostics report
PERCH INFORMATION

Perch: 2.8.31
Production mode: Production (100)
Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_blog (5.0), perch_shop_orders (PERCH_SHOP_VERSION), perch_shop_products (1.0.8), perch_shop (1.0.8), perch_members (1.5)
DB driver: PDO
DB tables: perch2_categories (50), perch2_category_counts (0), perch2_category_sets (1), perch2_content_index (143), perch2_content_items (49), perch2_content_regions (29), perch2_members (3), perch2_members_forms (1), perch2_members_member_tags (0), perch2_members_sessions (3), perch2_members_tags (0), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (1), perch2_pages (4), perch2_resource_log (882), perch2_resource_tags (0), perch2_resources (895), perch2_resources_to_tags (0), perch2_settings (32), perch2_shop_addresses (32), perch2_shop_admin_index (95), perch2_shop_brands (2), perch2_shop_cart (2853), perch2_shop_cart_data (349), perch2_shop_cart_items (138), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (3), perch2_shop_emails (1), perch2_shop_index (8173), perch2_shop_option_values (159), perch2_shop_options (3), perch2_shop_order_items (27), perch2_shop_order_promotions (6), perch2_shop_order_statuses (9), perch2_shop_orders (13), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (216), perch2_shop_product_options (64), perch2_shop_product_tags (0), perch2_shop_products (464), perch2_shop_promotions (1), perch2_shop_search (96), perch2_shop_shipping_zone_countries (1), perch2_shop_shipping_zones (1), perch2_shop_shippings (3), perch2_shop_tax_exhibits (25), perch2_shop_tax_group_rates (0), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (1), perch2_shop_variants (464), perch2_user_passwords (0), perch2_user_privileges (66), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (3)
Users: 3
App runtimes:
<?php
    $apps_list = array(
        'content',
        'categories',
        'perch_blog',
        'perch_members',
        'perch_shop',
    );
?>
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup
H1: b95549e023a1e8891b21845e5a4bdae5
L1: 15df4da316a6b61570fd981038ecd532
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.30: done
latest_version: 2.8.15
on_sale_version: 2.8.32
perch_shop_update: 1.0.8
headerScheme: light
perch_blog_site_name:
perch_blog_post_url: /blog/post.php?s={postSlug}
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_members_login_page: /members/login.php?r={returnURL}
perch_shop_price_tax_mode: inc
perch_shop_site_url: https://
perch_shop_product_url: /shop/products/{slug}
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
perch_shop_invoice_number_format: Invoice%d
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_blog_comment_notify: 0
logoPath: /perch/resources/little-stylish-me-logo.png
update_2.8.31: done
perch_members_update: 1.4
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: db78335_Victoria
PERCH_DB_SERVER: internal-db.s78335.gridserver.com
PERCH_DB_DATABASE: db78335_littleme
PERCH_DB_PREFIX: perch2_
PERCH_TZ: Europe/London
PERCH_EMAIL_FROM: tony@pupletang.co.uk
PERCH_EMAIL_FROM_NAME: Tony Monckton
PERCH_LOGINPATH: /perch
PERCH_PATH: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch
PERCH_CORE: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch/core
PERCH_RESFILEPATH: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_MEMBERS_SESSION_TIME: 365 DAYS
PERCH_HTML5: 1
PERCH_DEBUG:
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_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
PERCH_SHOP_VERSION: 1.0.8
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS

PHP: 5.5.35
Zend: 2.5.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.5.49
MySQL server: 5.1.63-rel13.4
Free disk space: 3.67 TB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, session, intl, json, ldap, mbstring, mcrypt, standard, mysqlnd, mysqli, mysql, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, Reflection, imap, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, mhash
GD: Yes
ImageMagick: No
PHP max upload size: 20M
PHP max form post size: 20M
PHP memory limit: 2048M
Total max uploadable file size: 20M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PATH: /usr/local/bin:/usr/bin:/bin
REDIRECT_HANDLER: php-latest
REDIRECT_STATUS: 200
UNIQUE_ID: WDwYIkYgRBgAAAblAOQAAAAj
SCRIPT_URL: /perch/core/settings/diagnostics/
SCRIPT_URI: https://shop.stylishlittleme.com/perch/core/settings/diagnostics/
WM_UCONTROL_XMLRPC_SERVER: https://10.0.0.13
ACCESS_DOMAIN: s78335.gridserver.com
DATABASE_SERVER: internal-db.s78335.gridserver.com
SITE_ROOT: /home/78335
SITE_CGIROOT: /home/78335/cgi-bin
SITE_HTMLROOT: /home/78335/domains/shop.stylishlittleme.com/html
PHPRC: /home/78335/etc/
HTTP_HOST: shop.stylishlittleme.com
HTTP_COOKIE: PHPSESSID=2a99d94aea751de35100e058aebff3b2; cmsa=1; p_m=a5afa27a2cca803ee2a435128978e33a448e65bb
HTTP_CONNECTION: keep-alive
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_11_6) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14
HTTP_REFERER: https://shop.stylishlittleme.com/perch/core/settings/diagnostics/
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_ACCEPT_ENCODING: gzip, deflate
SERVER_SIGNATURE: <address>Apache/2.2.22 Server at shop.stylishlittleme.com Port 80</address>
SERVER_SOFTWARE: Apache/2.2.22
SERVER_NAME: shop.stylishlittleme.com
SERVER_ADDR: 70.32.68.91
SERVER_PORT: 80
REMOTE_ADDR: 86.183.80.98
DOCUMENT_ROOT: /home/78335/domains/shop.stylishlittleme.com/html
SERVER_ADMIN: webmaster@shop.stylishlittleme.com
SCRIPT_FILENAME: /home/78335/domains/shop.stylishlittleme.com/html/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 51089
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
ORIG_SCRIPT_FILENAME: /etc/apache2/gs-bin/php-latest
ORIG_PATH_INFO: /perch/core/settings/diagnostics/index.php
ORIG_PATH_TRANSLATED: /home/78335/domains/shop.stylishlittleme.com/html/perch/core/settings/diagnostics/index.php
ORIG_SCRIPT_NAME: /gs-bin/php-latest
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1480333346.0918
REQUEST_TIME: 1480333346
argc: 1

Tony Monckton

Tony Monckton 0 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

I'm not sure what you mean by "the form you have generated". Can you explain further (with your code)?

    $cart = perch_shop_cart(['skip-template' => true]);

    function buildPaypalForm($cart)
    {
        $items              = $cart["items"];

        $currency_symbol    = $cart['currency_symbol'];
        $total              = $cart['total_items'];
        $discount           = $cart['total_discounts'];
        $shipping           = $cart['total_shipping'];
        $shippingDiscount   = $cart['total_shipping_discount'];
        $grandTotal         = $cart['grand_total'];

        print '<form id="paypalCheckout" action="https://www.paypal.com/cgi-bin/webscr" method="post">';

            print '<input type ="hidden" name ="cmd" value ="_cart">';

            print ' <input type="hidden" name="upload"          value="1">';
            print ' <input type="hidden" name="business"        value="info@littlestylishme.com">';
            print ' <input type="hidden" name="currency_code"   value="GBP">';
            print ' <input type="hidden" name="lc"              value="GB">';

            $i          = 1;
            $totalItems = count($items);
            $custom     = "";

            foreach($items as $item)
            {
                //print "$i) sku:".$item["sku"]."<br>";
                $sku    = rawurlencode($item["sku"]);
                $name   = $item["title"];
                $qty    = $item["qty"];
                $amount = $item["price_without_tax"];
                print '<input type="hidden" name="item_name_'.$i.'" value="'.$name." ".$sku.'">';
                print '<input type="hidden" name="quantity_'.$i.'"  value="'.$qty.'">';
                print '<input type="hidden" name="amount_'.$i.'"    value="'.$amount.'">';

                if ($i==1)  {   $custom += "$sku";  } else { $custom += "|$sku"; }
                $custom += "|$qty|$amount";

                $i++;
            }
            $custom += "";

            print '<input type="hidden" name="custom"           value="'.$custom.'">';
            print '<input type="hidden" name="no_shipping"      value="0">';
            print '<input type="hidden" name="shipping"         value="'.$shipping.'">';
            print '<input type="hidden" name="return"           value="https://shop.stylishlittleme.com/ordercompletepp.php">';
            print '<input type="hidden" name="rm"               value="2">';
            print '<input type="hidden" name="cbt"              value="Little Stylish Me">';
//          print '<input type="hidden" name="notify_url"       value="https://shop.stylishlittleme.com/ipn.php" />';
            print '<input type="submit" value="Checkout now!">';



        print '</form>';

    }


    $items = $cart['items'];
    $totalItems         = perch_shop_cart_item_count("",true);
    $currency_symbol    = $cart['currency_symbol'];
    $total              = $cart['total_items'];
    $discount           = $cart['total_discounts'];
    $shipping           = $cart['total_shipping'];
    $shippingDiscount   = $cart['total_shipping_discount'];
    $grandTotal         = $cart['grand_total']; 


                            <?php 
                                if (perch_member_logged_in()) 
                                {
                                    print '<a href="checkout.php?paypal-express=true" class="checkout button"><button>Checkout now</button></a>';
                                }
                                else
                                {
                                    buildPaypalForm($cart);

                                    //<button class="checkout button" onclick="document.paypalCheckout.submit();">Checkout now!</button>


                                    //print '<a href="checkout.php" class="checkout button"><button>Checkout now</button></a>';

                                    //print '<br><br><div align="center"><h4>You need to be logged in, to Checkout.</h4></div>';
                                }                       
                            ?>

this is my code.

tony

Drew McLellan

Drew McLellan 2638 points
Perch Support

The code you're saying you don't want is right there in your page.

hi,

sorry, I found out what I was doing wrong.

tony