RSS Feed

‘PHP’ Category

  1. Decommissioning the dFramewerk

    February 7, 2012 by Dave

    Well, with a long face and heavy heart I have decided to no longer support the dFramewerk; no longer actively develop it and no longer promote it. I have closed the website and will be letting it the domain expire so you can snap that up nice and easy at the cost of a normal domain name.

    The reasoning

    After years of using the dFramewerk myself I have learned many things about PHP (and still continually learn) and I have strayed into using the Zend Framework for my projects, this has worked out very well for me and my clientele and I feel comfortable enough with it now to stop active development of the dFramewerk as the combination of both the maintenance and updates takes up as much of my time as the actual software development!

    The evolution of the framework itself has been slowing down over the last 18 months, to a stand still in-fact but I still had support requests and bugs to fix for the general public, now I know many thousands of people have downloaded and implemented the framework and as with any open source software the risk was that support and development may stop at any time but it is; at the end of the day my choice to discontinue the development of the project and offer my greatest apologies for all that I am disappointing.

    This decision didn’t come lightly but it is in the best interest for my clients that I use a more standardised framework and a framework I can rapidly develop with.


  2. WordPress eCommerce – popular products IMPROVED

    November 20, 2011 by Dave

    My previous post on how to get popular products from WP eCommerce is a little dated and doesn’t actually work too well. (in fact my client updated after being specifically told not to update wp ecommerce. Poor I know but what’r'ya gonna do?)

    SO I’ve re-written most of the code and now it can be updated and has all the correct details and should work with variations. See the code below:


  3. WP e-Commerce plugin for popular products

    August 24, 2011 by Dave

    So my snippet a few posts ago got a LOT of attention which I’m glad for; so I’ve decided I’m going to make it a plugin to make it easier for everyone to use, on a different note I’ll be investing a lot more time into posting code snippets and tutorials on here for you all. Keep coming back.


  4. WP eCommerce product by id

    June 2, 2011 by Dave

    So I’ve trawled the interwebs for days and hours now trying to find out how you bloody get products by their ID in WP eCommerce (the best WordPress eCommerce solution) and I’ve given in and just edited the core files of WP eCommerce to allow this to work.

    Basically, I edited a few functions to get the top sellers on a friends website on the front page.

    Below are the functions I edited they’re all in wp-includes/product-template.php.

    wpsc_the_product_permalink ( ) on line 716 my function now looks like this

    /**
     * wpsc product permalink function
     * @var int - The ID of the product you want the permalink for (optional)
     * @return string - the URL to the single product page for this product
     */
    function wpsc_the_product_permalink ( $id = false ) {
    	global $wp_query;
    	if ( $id != false ){
    		return get_permalink ( $id );
    	}
    	else return get_permalink ( );
    }
    

    And wpsc_the_product_title ( ) on line 684, my code now looks like this

    /**
     * wpsc the product title function
     * @var int - the product you want the name of (optional)
     * @return string - the product title
     */
    function wpsc_the_product_title ( $id = false) {
    	if ( $id != false )
    		return get_the_title( $id );
    	else return get_the_title ( );
    }
    

    For wpsc_the_product_thumbnail ( ) I just passed the third argument through so I used the function like this

    wpsc_the_product_thumbnail ( null, null, $product_id );
    

    For wpsc_the_product_price ( ) I added an extra argument to the function (I’m not posting the whole thing here, its massive) so line 387 looks like this

    function wpsc_the_product_price( $no_decimals = false, $id = false ) {
    

    I also changed line 394 to look like this

    $product_id = ( $id != false ) ? $id : get_the_ID ( );
    

    For anyone looking for a quick easy “best sellers” function in wp ecommerce use the below code. Piece of cake, I even made it a short code! WIN.

    //Popular products function
    function popular_products ( $atts ) {
    
    	//Expose the Db to the function
    	global $wpdb;
    	
    	//Get the results
    	$pp = $wpdb -> get_results ( "SELECT `prodid`, SUM(quantity) FROM `{$wpdb->prefix}wpsc_cart_contents` GROUP BY `prodid` ORDER BY `quantity` DESC LIMIT {$atts['limit']}", ARRAY_A);
    	
    	//Loop through the results
    	foreach ( $pp as $item ) {
    			//Output it
    		?>
    			<a href="<?php echo wpsc_the_product_permalink ( $item['prodid'] )?>">
    				<img alt="<?php echo wpsc_the_product_title ( $item['prodid'] )?>" src="<?php echo wpsc_the_product_thumbnail ( null, null, $item['prodid'] )?>" />
    				<span><?php echo wpsc_the_product_price ( false, $item['prodid'] )?>>
    				<?php echo wpsc_the_product_title ( $item['prodid'] )?>
    			</a>
    		<?php
    		}
    }
    
    add_shortcode ( 'dm_popular', popular_products );
    

    to use the wp ecommerce best seller shortcode just put into your posts/pages [dm_popular limit=10]