ClassicPress / classic-commerce

A simple but powerful e-commerce platform built for ClassicPress. Forked from WooCommerce and compatible with many Woo extensions.
https://classiccommerce.cc/
GNU General Public License v3.0
54 stars 15 forks source link

Notice: Undefined variable: count_html #114

Closed zulfgani closed 5 years ago

zulfgani commented 5 years ago

Describe the bug The removal of $count_html = WC_Helper_Updater::get_updates_count_html(); from includes/admin/class-wc-admin-menus.php is now throwing a PHP Notice on the dashboard as follow Notice: Undefined variable: count_html in C:\Users\zulfn\Desktop\UniServerZ\www\featherlite\wp-content\plugins\classic-commerce\includes\admin\class-wc-admin-menus.php on line 131

To Reproduce Developing locally with WP_DEBUG set to true To continue developing with the latest version I've commented out line 31 of the same file for now.

Expected behavior No PHP Errors, Notices or Warnings should be generated upon plugin activation.

Isolating the problem (mark completed items with an [x]):

ClassicPress Environment

``` ` ### CMS Environment ### Home URL: http://localhost/featherlite Site URL: http://localhost/featherlite CC Version: 3.5.3 Log Directory Writable: ✔ CMS Version: ✔ You are running ClassicPress Version 1.1.1 Multisite: – Memory Limit: 256 MB Debug Mode: ✔ Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 7.1.1 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version PHP Post Max Size: 12 MB PHP Time Limit: 600 PHP Max Input Vars: 1000 cURL Version: 7.51.0 OpenSSL/1.0.2j SUHOSIN Installed: – MySQL Version: 5.6.35 Max Upload Size: 12 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected. DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### CC Database Version: 3.5.3 WC Database Prefix: td_ MaxMind GeoIP Database: ✔ Total Database Size: 5.54MB Database Data Size: 4.26MB Database Index Size: 1.28MB td_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB td_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB td_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB td_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB td_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB td_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB td_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB td_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB td_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB td_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB td_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB td_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB td_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB td_woocommerce_log: Data: 0.02MB + Index: 0.02MB td_commentmeta: Data: 0.02MB + Index: 0.03MB td_comments: Data: 0.02MB + Index: 0.08MB td_cpseo_404_logs: Data: 0.02MB + Index: 0.02MB td_cpseo_internal_links: Data: 0.02MB + Index: 0.02MB td_cpseo_internal_meta: Data: 0.02MB + Index: 0.00MB td_cpseo_redirections: Data: 0.02MB + Index: 0.02MB td_cpseo_redirections_cache: Data: 0.02MB + Index: 0.02MB td_links: Data: 0.02MB + Index: 0.02MB td_options: Data: 2.02MB + Index: 0.05MB td_postmeta: Data: 1.52MB + Index: 0.17MB td_posts: Data: 0.06MB + Index: 0.06MB td_termmeta: Data: 0.02MB + Index: 0.03MB td_terms: Data: 0.02MB + Index: 0.03MB td_term_relationships: Data: 0.02MB + Index: 0.02MB td_term_taxonomy: Data: 0.02MB + Index: 0.03MB td_udmanager_download_history: Data: 0.02MB + Index: 0.05MB td_udmanager_plugins: Data: 0.02MB + Index: 0.03MB td_udmanager_user_entitlements: Data: 0.02MB + Index: 0.11MB td_usermeta: Data: 0.02MB + Index: 0.03MB td_users: Data: 0.02MB + Index: 0.05MB td_wc_download_log: Data: 0.02MB + Index: 0.03MB td_wc_webhooks: Data: 0.02MB + Index: 0.02MB ### Post Type Counts ### attachment: 49 cmm4e_menu: 1 cmm4e_menu_theme: 1 cp_theme_repo: 1 custom_css: 2 customize_changeset: 55 elementor_library: 2 elementskit_template: 1 gp_elements: 3 happyform: 1 hf_composer: 1 insertpostads: 2 nav_menu_item: 23 next-megamenu: 1 opal_menu_item: 1 page: 17 post: 5 product: 18 product_variation: 7 revision: 45 tailor_templates: 1 ### Security ### Secure connection (HTTPS): ❌ Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: ❌Error messages should not be shown to visitors. ### Active Plugins (9) ### Secure WP Admin: by wpexpertsio – 1.3 Browser Shots: by Ben Gillbanks – 1.7.4 Classic Commerce: by ClassicPress Research Team – 0.1.0 Customize Object Selector: by XWP – 0.4.2 FeatherLite Controls: by GetFeatherLite – 1.0.0 Featherlite Parallax Hero: by ClassicDesigner – 1.0.0 Show Current Template: by JOTAKI Taisuke – 0.3.0 StorePage: ClassicCommerce Store Page: by CPEngineered – 1.0.0 Customize Widget Sidebar Meta: by Weston Ruter XWP – 0.1.0 ### Settings ### API Enabled: – Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) ### WC Pages ### Shop base: #246 - /shop/ Cart: #247 - /cart/ Checkout: #248 - /checkout/ My account: #249 - /my-account/ Terms and conditions: ❌ Page visibility should be public ### Theme ### Name: FeatherLite Version: 1.0.0 Author URL: https://getfeatherlite.com Child Theme: ❌ – If you are modifying Classic Commerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme Classic Commerce Support: ✔ ### Templates ### Overrides: – ` ```
bahiirwa commented 5 years ago

That's spot. We removed that function because it was calling server updates checks with woocommerce.com. We don't intend to manage that for the customer currently. So it would be prudent to remove the particular $count_html variable.

Would you mind opening a PR for this?

public function addons_menu() {
        /* translators*/
        $menu_title = sprintf( __( 'Extensions %s', 'classic-commerce' ), $count_html );
        add_submenu_page( 'woocommerce', __( 'Classic Commerce extensions', 'classic-commerce' ), $menu_title, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
    }

We could merge the variable needed to:

public function addons_menu() {
        add_submenu_page( 'woocommerce', __( 'Classic Commerce extensions', 'classic-commerce' ), __( 'Extensions', 'classic-commerce' ), 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
    }
zulfgani commented 5 years ago

Will take a stab at it when I get back in from work today.