Forum
Product Variants variable
Hi everyone,
For some reason a part of my script stopped working.
$product = perch_shop_product(perch_get('slug'), [
'skip-template' => true
], true);
$variants = perch_shop_product_variants(perch_get('slug'), [
'skip-template' => true
], true);
PerchSystem::set_var('variants', $variants);
perch_shop_product(perch_get('slug'), [
'template' => 'products/_product_page.html'
]);
perch_shop_product_variants(perch_get('slug')); returns NULL and $variants is an empty array although 4 variants have been assigned to it.
Many thanks, Damian
Perch Runway: 2.8.34
Production mode: Production (100)
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_blog (5.0), perch_forms (1.8.3), perch_shop_orders (1.0.10), perch_shop_products (1.0.10), collection_2 (2.8.34), perch_shop (1.0.10), perch_members (1.5)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_blog_authors (2), perch2_blog_comments (0), perch2_blog_index (156), perch2_blog_posts (1), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blogs (1), perch2_categories (8), perch2_category_counts (0), perch2_category_sets (3), perch2_collection_index (793), perch2_collection_items (88), perch2_collection_revisions (17), perch2_collections (1), perch2_content_index (25653), perch2_content_items (2166), perch2_content_regions (597), perch2_forms (7), perch2_forms_responses (25), perch2_members (30), perch2_members_forms (1), perch2_members_member_tags (0), perch2_members_sessions (1), perch2_members_tags (0), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_routes (154), perch2_page_templates (27), perch2_pages (167), perch2_resource_log (788), perch2_resource_tags (48), perch2_resources (255), perch2_resources_to_tags (60), perch2_settings (41), perch2_shop_addresses (43), perch2_shop_admin_index (30), perch2_shop_brands (1), perch2_shop_cart (749), perch2_shop_cart_data (0), perch2_shop_cart_items (136), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (30), perch2_shop_emails (2), perch2_shop_index (17480), perch2_shop_option_values (35), perch2_shop_options (8), perch2_shop_order_items (12), perch2_shop_order_promotions (2), perch2_shop_order_statuses (9), perch2_shop_orders (11), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (29), perch2_shop_product_options (7), perch2_shop_product_tags (0), perch2_shop_products (367), perch2_shop_promotions (4), perch2_shop_search (358), perch2_shop_shipping_zone_countries (1), perch2_shop_shipping_zones (1), perch2_shop_shippings (1), perch2_shop_tax_exhibits (41), perch2_shop_tax_group_rates (29), perch2_shop_tax_groups (1), perch2_shop_tax_locations (29), perch2_shop_tax_rates (30), perch2_shop_variants (42), perch2_user_passwords (5), perch2_user_privileges (78), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (6)
Users: 6
PHPMailer: 5.2.21
App runtimes:
<?php
$apps_list = array(
'content',
'categories',
'perch_blog',
'perch_forms',
'perch_members',
'perch_shop',
);
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup, redactor
H1: 3e4bc6a764d4522dcb518a67758246e7
L1: bed5a8bfe0e04530418296fc36347fb8
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
headerColour: #0177b5
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.25: done
latest_version: 2.8.15
on_sale_version: 2.8.34
headerScheme: dark
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 1
content_frontend_edit: 0
logoPath: /cms/resources/docs_logo.png
perch_blog_update: 5.0.1
perch_blog_post_url: /blog/{postSlug}
perch_blog_site_name: Site
perch_blog_slug_format: {postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 30
perch_blog_comment_notify: 0
update_2.8.29: done
update_2.8.31: done
perch_shop_update: 1.0.10
perch_shop_price_tax_mode: exc
perch_shop_site_url: https://localhost
perch_shop_product_url: /product/{slug}
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
perch_shop_invoice_number_format: INV-%d
perch_members_login_page: /members/login.php?r={returnURL}
perch_members_update: 1.4
update_runway_2.8.31: done
update_runway_2.8.32: done
perch_shop_trade_price_tax_mode: exc
update_runway_2.8.33: done
update_runway_2.8.34: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: docs_perch
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: docs_perch
PERCH_SITEPATH: /home/docs/www/htdocs
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: admin@admin.com
PERCH_EMAIL_FROM_NAME: Admin
PERCH_LOGINPATH: /cms
PERCH_PATH: /home/docs/www/htdocs/cms
PERCH_CORE: /home/docs/www/htdocs/cms/core
PERCH_RESFILEPATH: /home/docs/www/htdocs/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_HTML5: 1
PERCH_YOUTUBE_API_KEY:
PERCH_DEBUG: 1
PERCH_RUNWAY: 1
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: /home/docs/www/htdocs/cms/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.10
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS
PHP: 5.6.25
Zend: 2.6.0
OS: Linux
SAPI: apache2handler
Safe mode: not detected
MySQL client: 5.6.33
MySQL server: 5.6.33
Free disk space: 541.20 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dbase, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, imagick, session, intl, json, mailparse, mbstring, mcrypt, standard, imap, memcached, mssql, mysql, mysqli, OAuth, PDFlib, PDO, pdo_mysql, pdo_sqlite, pspell, Reflection, SimpleXML, soap, ssh2, exif, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, memcache, apache2handler, mhash, ionCube Loader, Zend Guard Loader, Zend OPcache
GD: Yes
ImageMagick: Yes
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 256M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
UNIQUE_ID: WGzFbVPfagoAAAX2ClIAAAAl
HTTP_HOST: localhost
HTTP_CONNECTION: keep-alive
HTTP_PRAGMA: no-cache
HTTP_CACHE_CONTROL: no-cache
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_REFERER: https://localhost/cms/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.8,en;q=0.6,pl;q=0.4
HTTP_COOKIE: cmssb=0; __distillery=586dbc2_21b79b38-cb66-44a0-947e-2b879e9665b6-1679b8131-379c01ab6627-c0bb; p_m=; muxData=mux_viewer_id=ca333f86-ad47-4039-be58-a4885f473a47&msn=0.4776333276302458&sid=c5a85817-75a2-42c4-95d2-5cb05d322bf8&sst=1482920749598&sex=1482924059190; cmsa=1; _ga=GA1.2.49413937.1473760650; PHPSESSID=ved729dutspls1edj1nlkm04f7
PATH: /usr/bin:/bin
SERVER_SIGNATURE: <address>Apache Server at localhost Port 80</address>
SERVER_SOFTWARE: Apache
SERVER_NAME: localhost
SERVER_ADDR: 83.223.102.11
SERVER_PORT: 80
REMOTE_ADDR: 91.127.112.61
DOCUMENT_ROOT: /home/docs/www/htdocs/
SERVER_ADMIN: postmaster@localhost
SCRIPT_FILENAME: /home/docs/www/htdocs/cms/core/settings/diagnostics/index.php
REMOTE_PORT: 51086
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /cms/core/settings/diagnostics/?extended
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1483523437.249
REQUEST_TIME: 1483523437
What does debug output for the page?
We've just tracked down a bug with
perch_shop_product_variants()
- should be fixed in the next update.Thanks Drew. I'm glad we've found it.
Do you think there is a quick fix how to temporarily go around it?
No, but I'll get that update out shortly.
Many thanks Drew!
We tried to downgrade the Perch to 2.8.32 where everything used to worked fine.
Now we are experiencing a PHP error when trying to call perch_shop_product_variants(perch_get('slug'));
Fatal error: Call to undefined function perch_shop_product_variants() in /www/htdocs/cms/templates/pages/product.php on line 9
I wonder what could go wrong?
Diagnostics:
Debug msg:
Downgrading isn't supported. I've no idea what might happen if you try to do that.
The only supported solution would be to roll back both database and files to the backups you took before the update.
Thanks for letting me know.
I wonder if there is any info on when the patch will be available?
It would have been today, but the forum has been busy. So tomorrow morning if I can.
I wonder if there is an update available on this?
Damian,
I think Perch shop 1.0.11 fixed this:
https://docs.grabaperch.com/addons/shop/changelog/
Brilliant! Thanks a lot.