We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Error, Shop

Fatal Error for Perch Shop

Hi,

I'm currently setting up a shop and am getting a blank screen when the add to cart button is being clicked. My error log shows the following '[Mon Nov 12 15:46:07.317332 2018] [fcgid:warn] [pid 27994] [client 91.103.188.194:59738] mod_fcgid: stderr: PHP Fatal error: Call to a member function get_prices() on boolean in /home/linweb23/a/arthur.web-design.wales/user/htdocs/admin/addons/apps/perch_shop/lib/PerchShop_Cart.class.php on line 723, referer: http://arthur.web-design.wales/course.php?s=agent

Here are my diagnostics:


Perch: 3.1.3 Production mode: Production (100) Installed apps: content (3.1.3), assets (3.1.3), categories (3.1.3), perch_blog (5.6.1), perch_forms (1.12), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4) DB driver: PDO DB tables: perch3_blog_authors (1), perch3_blog_comments (0), perch3_blog_index (25), 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 (0), perch3_category_counts (0), perch3_category_sets (2), perch3_content_index (189), perch3_content_items (41), perch3_content_regions (15), perch3_forms (1), perch3_forms_responses (1), perch3_menu_items (14), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (0), perch3_pages (7), perch3_resource_log (54), perch3_resource_tags (0), perch3_resources (14), perch3_resources_to_tags (0), perch3_settings (38), perch3_shop_addresses (0), perch3_shop_admin_index (32), perch3_shop_brands (1), perch3_shop_cart (1), perch3_shop_cart_data (1), perch3_shop_cart_items (3), perch3_shop_countries (250), perch3_shop_currencies (152), perch3_shop_customers (0), perch3_shop_emails (1), perch3_shop_index (144), perch3_shop_option_values (0), perch3_shop_options (0), perch3_shop_order_items (0), perch3_shop_order_promotions (0), perch3_shop_order_statuses (9), perch3_shop_orders (0), perch3_shop_orders_meta (1), perch3_shop_product_files (0), perch3_shop_product_option_values (0), perch3_shop_product_options (0), perch3_shop_product_tags (0), perch3_shop_products (3), perch3_shop_promotions (0), perch3_shop_sales (0), perch3_shop_search (3), perch3_shop_shipping_zone_countries (0), perch3_shop_shipping_zones (1), perch3_shop_shippings (1), perch3_shop_tax_exhibits (0), perch3_shop_tax_group_rates (1), perch3_shop_tax_groups (1), perch3_shop_tax_locations (1), perch3_shop_tax_rates (1), perch3_shop_variants (0), perch3_user_passwords (0), perch3_user_privileges (80), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1) Users: 1 App runtimes: <?php $apps_list = [ '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: 44a5c94721e58b540b7649cf3da15f6e L1: f484b7bda06f1b0f78238491a7d9344e F1: 3b606135b33e6a102526838f4152a807 headerColour: #ffffff content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb installedAt: 3.1.3 update_3.1.3: done latest_version: on_sale_version: 3.1.3 headerScheme: light perch_shop_price_tax_mode: exc perch_shop_site_url: http://www.dawsonstrainingwales.co.uk perch_shop_product_url: /shop/products/{slug} perch_shop_invoice_number_format: Invoice%d perch_blog_site_name: perch_blog_post_url: news-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} dashboard: 0 sidebar_back_link: 0 hide_pwd_reset: 0 keyboardShortcuts: 1 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 logoPath: /assets/daw-logo.png perch_blog_update: 5.6 perch_shop_update: 1.2.6 perch_shop_default_currency: 47 perch_shop_reporting_currency: 47 PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: trainingdawsons PERCH_DB_SERVER: 213.171.200.92 PERCH_DB_DATABASE: dawsonstraining PERCH_DB_PREFIX: perch3_ PERCH_TZ: UTC PERCH_EMAIL_FROM: jade@picseli.co.uk PERCH_EMAIL_FROM_NAME: Jade Marling PERCH_LOGINPATH: /admin PERCH_PATH: /home/linweb23/a/arthur.web-design.wales/user/htdocs/admin PERCH_CORE: /home/linweb23/a/arthur.web-design.wales/user/htdocs/admin/core PERCH_RESFILEPATH: /home/linweb23/a/arthur.web-design.wales/user/htdocs/assets PERCH_RESPATH: /assets PERCH_HTML5: 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: 6738d5d5f5664f7c5e34 PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /home/linweb23/a/arthur.web-design.wales/user/htdocs/admin/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.6 PERCH_APPS_EDITOR_PLUGIN: markitup PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown Hosting settings PHP: 5.6.38 Zend: 2.6.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: 5.5.60-MariaDB MySQL server: 5.6.42-log Free disk space: 204.16 GB Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bz2, calendar, ctype, curl, hash, fileinfo, filter, ftp, gettext, gmp, SPL, iconv, intl, pcntl, session, standard, posix, readline, Reflection, Phar, shmop, SimpleXML, sockets, mbstring, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, cgi-fcgi, bcmath, dba, dom, gd, imap, json, ldap, exif, mcrypt, mssql, mysql, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, pspell, snmp, soap, tidy, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader, Zend OPcache GD: Yes ImageMagick: No PHP max upload size: 20M PHP max form post size: 20M PHP memory limit: 64M 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/sbin:/usr/local/bin:/usr/sbin:/usr/bin PWD: /var/www/fcgi PHP_FCGI_MAX_REQUESTS: 100 ORIG_SCRIPT_NAME: /fcgi-bin/php56-cgi ORIG_PATH_TRANSLATED: /home/linweb23/a/arthur.web-design.wales/user/htdocs/admin/core/settings/diagnostics/index.php ORIG_PATH_INFO: /admin/core/settings/diagnostics/index.php ORIG_SCRIPT_FILENAME: /var/www/fcgi/php56-cgi SCRIPT_NAME: /admin/core/settings/diagnostics/index.php REQUEST_URI: /admin/core/settings/diagnostics/?extended QUERY_STRING: extended REQUEST_METHOD: GET SERVER_PROTOCOL: HTTP/1.0 GATEWAY_INTERFACE: CGI/1.1 REDIRECT_URL: /admin/core/settings/diagnostics/index.php REDIRECT_QUERY_STRING: extended REMOTE_PORT: 43962 SCRIPT_FILENAME: /home/linweb23/a/arthur.web-design.wales/user/htdocs/admin/core/settings/diagnostics/index.php SERVER_ADMIN: support@fasthosts.com CONTEXT_DOCUMENT_ROOT: /var/www/fcgi/ CONTEXT_PREFIX: /fcgi-bin/ REQUEST_SCHEME: http DOCUMENT_ROOT: /home/linweb23/a/arthur.web-design.wales/user/htdocs REMOTE_ADDR: 91.103.188.194 SERVER_PORT: 80 SERVER_ADDR: 127.0.0.1 SERVER_NAME: arthur.web-design.wales SERVER_SOFTWARE: Apache HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_COOKIE: _ga=GA1.2.1589248101.1537449823; PHPSESSID=vq8p5qle5nejsmengd0cil74v1; cmsa=1 HTTP_REFERER: http://arthur.web-design.wales/admin/core/settings/diagnostics/ HTTP_ACCEPT_ENCODING: gzip, deflate HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.5 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 HTTP_CONNECTION: close HTTP_X_FORWARDED_FOR: 91.103.188.194 HTTP_X_REAL_IP: 91.103.188.194 HTTP_HOST: arthur.web-design.wales UNIQUE_ID: W@mg9SQ9Vf-6Ekn4surXxgAAAA0 on: 127.0.0.1 REDIRECT_STATUS: 200 REDIRECT_HANDLER: application/x-httpd-php56 REDIRECT_UNIQUE_ID: W@mg9SQ9Vf-6Ekn4surXxgAAAA0 REDIRECT_on: 127.0.0.1 FCGI_ROLE: RESPONDER PHP_SELF: /admin/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1542037749.194 REQUEST_TIME: 1542037749

Here are the cart.html template:

<div class="wrapper cols2-nav-right">   
    <div class="primary-content">

<perch:if id="product_count" match="gt" value="0">
    <h1>Your cart (<perch:shop id="item_count" />)</h1>
    <perch:form id="cart" app="perch_shop">

        <perch:input type="submit" value="Update" hidden="true" aria-hidden="true" />

        <table class="cart">
            <tr>
                <th></th>
                <th>Code</th>
                <th>Item</th>
                <th>Quantity</th>
                <th>Price</th>
                <th>Total</th>
            </tr>
            <perch:cartitems>
                <tr>
                    <td><perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" /></td>
                    <td><perch:cartitem id="sku" /></td>
                    <td>
                        <b><perch:cartitem id="title" /></b>
                        <p><i><perch:cartitem id="variant_desc" /></i></p>
                        <div class="desc">
                            <perch:cartitem id="description" type="textarea" markdown="true" />
                        </div>
                        <button type="submit" class="remove_cart" name="del:<perch:cartitem id="identifier" />" value="1">
                            Remove from cart
                        </button>
                    </td>
                    <td><perch:input id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0" /></td>
                    <td class="money"><perch:cartitem id="price_without_tax" /></td>
                    <td class="money"><perch:cartitem id="total_without_tax_formatted" /></td>
                </tr>
            </perch:cartitems>

            <perch:if id="total_discounts" match="gt" value="0.00">
                <tr class="total">
                    <th colspan="5">
                        Discount (<perch:shop id="discount_code" />)
                    </th>
                    <td class="money">
                        <perch:shop id="total_discounts_formatted" />
                    </td>
                </tr>
                <tr class="total">
                    <th colspan="5">
                        Total
                    </th>
                    <td class="money">
                        <perch:shop id="total_items_discounted_formatted" />
                    </td>
                </tr>
            <perch:else />
                <tr class="total">
                    <th colspan="5">
                        Total
                    </th>
                    <td class="money">
                        <perch:shop id="total_items_formatted" />
                    </td>
                </tr>
            </perch:if>
            <tr class="total">
                <th colspan="5">
                    Tax
                </th>
                <td class="money">
                    <perch:shop id="total_tax_formatted" />
                </td>
            </tr>
            <tr class="total">
                <th colspan="5">
                    Grand total
                </th>
                <td class="money">
                    <perch:shop id="grand_total_formatted" />
                </td>
            </tr>
        </table>

        <div class="discount">
            <perch:label for="discount">
                Discount code
                <perch:input type="text" id="discount_code" />
            </perch:label>
        </div>

        <perch:input type="submit" value="Update" />

    </perch:form>

    <p>
        <a href="checkout">Checkout now</a>
    </p>

<perch:else />
<h1>Your cart</h1>

<p>Your cart is empty.</p>
</perch:if>





</div>
</div>





<style>
.cart {
    width: 100%;
    border-collapse: collapse;
}

.cart th {
    font-weight: 600;
}

.cart td,
.cart th {
    border: 1px solid #efefef;
    vertical-align: top;
    padding: 3px;
}

.cart .total,
.cart .money {
    text-align: right;
}

.discount {
    max-width: 300px;
}

.desc {
    font-size: small;
}

b {
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
}

i {
    font-style: italic;
    font-size: small;
    color: rgba(0, 0, 0, 0.6);
}

.remove_cart {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    text-decoration: underline;
}

input[type=number] {
    width: 35px;
}
</style>

Here is the product.html template:

<perch:shop id="sku" type="text" label="SKU" required="true" order="1" />
<perch:shop id="title" type="text" label="Title" required="true" order="2" />
<perch:shop id="slug" type="slug" editable="true" indelible="true" label="Slug" for="title sku" order="10" divider-before="Meta data" />
<perch:shop id="description" type="textarea" label="Description" editor="markitup" order="3" markdown="true" size="s" />
<perch:shop id="image" type="image" label="Main product image" order="4" width="800" />
<perch:shop id="image" type="image" width="80" height="80" density="1.6" crop="true" />
<perch:shop id="status" type="shop_status" label="Status" />

<perch:shop id="brand" type="shop_brand" label="Brand" allowempty="true" />

<perch:categories id="category" set="products" label="Category">
    <perch:category id="catTitle" />
</perch:categories>

<perch:shop id="catalog_only" type="shop_catalog_only" label="Catalog only" />
<perch:shop id="price" type="shop_currency_value" label="Price" divider-before="Pricing" size="s" min="0" step="any" />
<perch:shop id="sale_price" type="shop_currency_value" label="Sale price" size="s" min="0" step="any" />
<perch:shop id="trade_price" type="shop_currency_value" label="Trade price" size="s" min="0" step="any" runway="true" />
<perch:shop id="on_sale" type="checkbox" value="1" label="Use sale price" />
<perch:shop id="tax_group" type="shop_tax_group" label="Tax group" required="true" />


<perch:shop id="stock_status" type="shop_stock_status" label="Stock status" divider-before="Stock" required="true" />
<perch:shop id="stock_level" type="number" label="Stock level" size="s" />
<perch:shop id="stock_location" type="shop_stock_location" label="Count stock" />
<perch:shop id="max_in_cart" type="number" label="Max quantity in cart" size="s" />

<perch:shop id="requires_shipping" type="shop_requires_shipping" label="Requires shipping" divider-before="Shipping" />
<perch:shop id="weight" type="number" label="Shipping weight" size="s" />
<perch:shop id="width" type="number" label="Width" size="s" />
<perch:shop id="height" type="number" label="Height" size="s" />
<perch:shop id="depth" type="number" label="Depth" size="s" />

<perch:form id="add_to_cart" app="perch_shop" action="/cart.php">
    <perch:input id="product" type="hidden" env-autofill="false" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
    <perch:input type="submit" value="Add to cart" />
</perch:form>
Jade Marling

Jade Marling 0 points

  • 5 months ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

On your product page (with the add to cart button), view source and let me know what the product hidden input looks like.

I had similar issues when I was starting to use Perch shop... in fact, one was on exactly that same line (723). It always came down to not having done the initial setup correctly, or sometimes it got messed up somehow. So I suggest you try double checking that you've gone through all the steps here: https://docs.grabaperch.com/addons/shop/installation/