Forum
discount code
Hi,
Been trying to get this to work. I have setup a promotion: FREESHIPPING
my form is:
<form id="discount_code" method="post" target="checkout.php">
<input type="submit" value="Submit" style="float:right; width:100px;">
<input id="discount_code" name="discount_code" type="text" style="float:right;padding-left:1em; width:25%;" size="10" placeholder="Enter discount code" />
</form>
on submit, chechoutp.php will do the following...
if (!empty(@$_POST['discount_code']))
{
$code = $_POST['discount_code'];
perch_shop_set_discount_code($code);
}
but I get this:
Fatal error: Call to undefined method PerchShop_Cache::set_discount_code() in /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php on line 184
vardump($_POST)
postarray(1) { ["discount_code"]=> string(12) "FREESHIPPING" }
any ideas what's wrong...
tony
Can you post your diagnostics report please?
ok, here it is
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.6), perch_shop (1.0.6), perch_members (1.5) DB driver: PDO DB tables: perch2_categories (34), perch2_category_counts (0), perch2_category_sets (1), perch2_content_index (117), perch2_content_items (42), perch2_content_regions (16), perch2_members (2), 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_templates (0), perch2_pages (2), perch2_resource_log (112), perch2_resource_tags (0), perch2_resources (85), perch2_resources_to_tags (0), perch2_settings (32), perch2_shop_addresses (10), perch2_shop_admin_index (66), perch2_shop_brands (1), perch2_shop_cart (449), perch2_shop_cart_data (170), perch2_shop_cart_items (55), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (2), perch2_shop_emails (1), perch2_shop_index (766), perch2_shop_option_values (31), perch2_shop_options (3), perch2_shop_order_items (5), perch2_shop_order_promotions (0), perch2_shop_order_statuses (9), perch2_shop_orders (3), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (21), perch2_shop_product_options (8), perch2_shop_product_tags (0), perch2_shop_products (39), perch2_shop_promotions (1), perch2_shop_search (8), perch2_shop_shipping_zone_countries (1), perch2_shop_shipping_zones (1), perch2_shop_shippings (2), perch2_shop_tax_exhibits (3), perch2_shop_tax_group_rates (0), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (1), perch2_shop_variants (55), 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.31 perch_shop_update: 1.0.6 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_tony 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: 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_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.6 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: V7W@iUYgRB0AACH4oyIAAABn 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_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 HTTP_CONNECTION: keep-alive HTTP_COOKIE: PHPSESSID=6ba01b9c884ba5357e60162afe0aff46; cmsa=1; p_m=dee3329024905d4c06d7b75f5eb5807d583dca51 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7 HTTP_ACCEPT_LANGUAGE: en-us HTTP_REFERER: https://shop.stylishlittleme.com/perch/core/settings/diagnostics/ 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.180.237.251 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: 58395 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: 1471528585.8105 REQUEST_TIME: 1471528585 argc: 1
You're a couple of versions of Shop behind the release. Can you try with the current version?
ok, will get latest version
hi,
updated the shop.. created a new free shipping promo. I used the discount code. But postage is still £2.80, the promotion is enabled and the dates are correct.
but!
if I set the promotion Shipping: 'apply to shipping' to 'yes', and select shipping method. when I save it. I get
and
FIXED!
I had a stupid bit of code.. getting cart totals, before setting the cart discount.
tony