Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • <div class="category-count-<?php wpsc_print_category_count(); ?>">

    bump, I’d be interested in this also. I’ve been poking around the category.functions.php file and I can see the reason that we’re not able to use any kind of simple variable is because the function does a single DB call and outputs all of the HTML by the time it even gets into our hands… Simply speaking this isn’t a loop at all, just a very elaborate database query.

    I’ve been able to bring out a post count in plain HTML but for my application I need to figure out how to get a PHP variable in my hands so that I can split my output into two sections a TOP and BOTTOM output (if that makes sense).

    If your simply looking for an HTML output you can create a new function in “wpsc-includes/category.functions.php”:

    /**
    * wpsc print category count function
    * places the shortcode for the category count
    */
    function wpsc_print_category_count(){
    	echo "[wpsc_print_category_count]";
    }

    On line 266-ish add a key to the foreach:
    foreach((array)$category_data as $count => $category_row) {

    Add the shortcode and replacement value into the output on line 362-ish:

    // get the list of products associated with this category.
    		$tags_to_replace = array('[wpsc_category_name]',
    		'[wpsc_category_description]',
    		'[wpsc_category_url]',
    		'[wpsc_category_id]',
    		'[wpsc_category_classes]',
    		'[wpsc_category_image]',
    		'[wpsc_subcategory]',
    		'[wpsc_category_products_count]',
    		'[wpsc_print_category_count]');
    
    		$content_to_place = array(
    		esc_html($category_row->name),
    		$category_description,
    		esc_url( get_term_link( $category_row->slug, 'wpsc_product_category' ) ),
    		$category_row->term_id,
    		$category_classes,
    		$category_image_html,
    		$sub_categories,
    		$category_count_html,
    		$count);

    Then you could just call it using something like:
    <?php wpsc_print_category_count(); ?>

    I had an issue with my plugins updating as well, IIS server and WP 3.5:

    Download failed. Destination directory for file streaming does not exist or is not writable.

    So following @ yylang1987 advice I added

    /* Setup a temporary folder for uploading and updating */
    define( 'WP_TEMP_DIR', ABSPATH . 'wp-content/tmp/') ;

    Still no cheddar, but followed up with @nebruz advice and updated class-http.php lines 141 – 145 (approx).

    // Force some settings if we are streaming to a file and check for existence and perms of destination directory
        if ( $r['stream'] ) {
        	$r['blocking'] = true;
        	 if ( ! is_writable( dirname( $r['filename'] ) ) )
        	 if ( ! call_user_func( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ? 'win_is_writable' : 'is_writable', dirname( $r['filename'] ) ) )
        		 return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
        }

    But then I got…

    Downloading update from https://downloads.www.ads-software.com/plugin/whatever.zip
    Unpacking the update
    Deactivating the plugin
    Removing the old version of the plugin
    Could not remove the old plugin
    Plugin upgrade Failed

    So following this post (https://www.ads-software.com/support/topic/plugin-upgrade-failing-cannot-remove-old-plugin?replies=25) and @ detroiter advice I updated the wp-config.php file with…

    define('FS_METHOD', 'ftpsockets');
    define('FTP_BASE', '/path/to/wordpress/');
    define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
    define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
    define('FTP_USER', 'username');
    define('FTP_PASS', 'password');
    define('FTP_HOST', 'ftp.example.org');

    SUCCESS!
    Thanks gang, super helpful.

Viewing 3 replies - 1 through 3 (of 3 total)