Forum

Thread tagged as: Question, Problem, Add-on-development

Your cart is empty

Have managed to get a products page and a products details page but when I add a product to the cart I get a message 'your cart is empty'. Totally stuck. I uploaded the default product.html and cart.html templates, but still no luck.

Can anyone suggest where I may be going wrong?

Helen Forrest

Helen Forrest 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostics report?

Summary information
Perch: 3.1.2, PHP: 5.5.38, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4)
App runtimes: <?php $apps_list = [ 'perch_members', 'perch_shop', ];
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/web/admin
PERCH_CORE: /var/www/web/admin/core
PERCH_RESFILEPATH: /var/www/web/admin/resources
Image manipulation: GD
PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
DOCUMENT_ROOT: /var/www/web
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/
HTTP_HOST: www.srendipityjewellery.co.uk


Perch information
Perch: 3.1.2
Production mode: Production (100)
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), 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_categories (5), perch3_category_counts (0), perch3_category_sets (1), perch3_content_index (0), perch3_content_items (0), perch3_content_regions (0), perch3_members (0), perch3_members_forms (0), perch3_members_member_tags (0), perch3_members_sessions (0), perch3_members_tags (0), perch3_menu_items (12), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (0), perch3_pages (0), perch3_resource_log (80), perch3_resource_tags (0), perch3_resources (49), perch3_resources_to_tags (0), perch3_settings (30), perch3_shop_addresses (0), perch3_shop_admin_index (23), perch3_shop_brands (1), perch3_shop_cart (16), perch3_shop_cart_data (8), perch3_shop_cart_items (5), perch3_shop_countries (250), perch3_shop_currencies (152), perch3_shop_customers (0), perch3_shop_emails (1), perch3_shop_index (753), 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 (20), perch3_shop_promotions (0), perch3_shop_sales (0), perch3_shop_search (20), perch3_shop_shipping_zone_countries (1), 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 (0), perch3_shop_variants (0), perch3_user_passwords (0), perch3_user_privileges (67), perch3_user_role_privileges (36), perch3_user_roles (2), perch3_users (2)
Users: 2
App runtimes:
<?php
    $apps_list = [ 
        'perch_members',
        'perch_shop',
    ];
Editor plug-ins:
H1: 7862e71a7f3af8c5b08422041c5df58a
L1: de5a41f6287bf1902b5461772e58756f
F1: 3b606135b33e6a102526838f4152a807
headerColour: #eeebec
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
installedAt: 3.1.2
update_3.1.2: done
latest_version:
on_sale_version: 3.1.2
headerScheme: light
sidebar_back_link: 1
keyboardShortcuts: 1
perch_members_login_page: /members/login.php?r={returnURL}
perch_shop_price_tax_mode: inc
perch_shop_site_url: https://www.srendipityjewellery.co.uk
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: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
logoPath: /admin/resources/logo.png
perch_shop_update: 1.2.6
perch_members_update: 1.4
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: srendipityj
PERCH_DB_SERVER: mysql9.namesco.net
PERCH_DB_DATABASE: PH506302_srendipityj
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: admin@loudonwebdesign.co.uk
PERCH_EMAIL_FROM_NAME: Helen Forrest
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/web/admin
PERCH_CORE: /var/www/web/admin/core
PERCH_RESFILEPATH: /var/www/web/admin/resources
PERCH_RESPATH: /admin/resources
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: /var/www/web/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.5.38
Zend: 2.5.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $
MySQL server: 5.5.60-log
Free disk space: 2.72 TB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, enchant, hash, fileinfo, filter, ftp, gd, gettext, gmp, SPL, iconv, session, intl, json, ldap, mbstring, mcrypt, mssql, standard, mysqlnd, mysqli, odbc, pcntl, mysql, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, recode, Reflection, imap, shmop, SimpleXML, snmp, soap, sockets, exif, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, mhash, ionCube Loader
GD: Yes
ImageMagick: No
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 128M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PATH: /sbin:/usr/sbin:/bin:/usr/bin
DOCUMENT_ROOT: /var/www/web
ORIG_SCRIPT_NAME: /.platform.cgi-bin/php55-cgi
ORIG_PATH_TRANSLATED: /var/www/web/admin/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /admin/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /usr/share/web/cgi-bin/php55-cgi
HTTP_CONNECTION: close
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.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_QUERY_STRING: extended
REDIRECT_URL: /admin/core/settings/diagnostics/index.php
REMOTE_PORT: 45534
SCRIPT_FILENAME: /var/www/web/admin/core/settings/diagnostics/index.php
SERVER_ADMIN: webmaster@this.domain
CONTEXT_DOCUMENT_ROOT: /usr/share/web/cgi-bin
CONTEXT_PREFIX: /.platform.cgi-bin
REQUEST_SCHEME: http
REMOTE_ADDR: 92.1.143.221
SERVER_PORT: 80
SERVER_ADDR: 192.168.96.18
SERVER_NAME: www.srendipityjewellery.co.uk
SERVER_SOFTWARE: Apache
HTTP_COOKIE: cmsa=1; _gid=GA1.3.636120102.1539030475; PHPSESSID=unbc4n69fpjfebe0ahiutbmka4;
HTTP_HOST: www.srendipityjewellery.co.uk
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.9
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_REFERER: https://www.srendipityjewellery.co.uk/admin/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
HTTP_DNT: 1
HTTP_UPGRADE_INSECURE_REQUESTS: 1
rate_limit: 12500
REMOTE_HOST: 92.1.143.221
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php55-script
REDIRECT_rate_limit: 12500
REDIRECT_REMOTE_HOST: 92.1.143.221
FCGI_ROLE: RESPONDER
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1539184379.3938
REQUEST_TIME: 1539184379



Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you developing this live, or do you have it working on a development server elsewhere?

I'm developing it live

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'd recommend turning on debug to see what happens when you add something to the cart. If that's not possible on a live site, you might want to look at doing this in development.

I got this with debug

Debug Message - Perch 3.1.2
[1] SELECT * FROM perch3_pages WHERE pagePath='/cart/index.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=33
[1] SELECT * FROM perch3_shop_cart WHERE cartID=33
Using cart from cache.
[30] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
Using template: /addons/apps/perch_shop/templates/shop/cart/cart.html

In the DB table perch3_shop_cart there is an entry for cartID = 33 but this shows as having no total items or products. When I look at the table perch3_pages there are no entries. I don't know what this means or how to remedy it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is that after posting to the cart? I'd expect to see an attempt in there to store the cart item in the database.

Perhaps the issue is your add-to-cart form. Can you show us what you have there?

This is the add-to-cart form on product.html


<perch:form id="add_to_cart" app="perch_shop" action="/cart"> <perch:input id="product" type="hidden" value="<perch:shop id="title" type="hidden">"> <perch:input type="submit" value="Add to cart"> </perch:form>
Drew McLellan

Drew McLellan 2638 points
Perch Support

This needs to be a product ID. not the title:

<perch:input id="product" type="hidden" value="<perch:shop id="title" type="hidden">">

Could you try with the default templates and see if that solves your issue?

Thanks Drew, I tried this but no joy. I think I need to start again with the shop. Delete and reinstall

Finally sorted it by changing the form action, adding a forward slash after cart.

I have exactly the same problem. Anyone got a suggestion? https://mypremiercreditcard.me