• Resolved lotsamottsa

    (@lotsamottsa)


    OK, so I made some edits to the order status and sales log via this thread. Everything is working fine except I am noticing that the changes I made are affecting the sales log… as the sales are no longer adding up correctly.

    All completed orders will change order status from “accepted payment” to “shipped” to “closed order” So really, I only want the “closed orders” to calculate in the sales logs and I want “voided”, “processing” “refunded”, etc. to be removed.

    Can someone tell me where I can change this information?

    Thanks!

    https://www.ads-software.com/plugins/wp-e-commerce/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Are you talking about the sales summary in the dashboard?

    Thread Starter lotsamottsa

    (@lotsamottsa)

    Yes, that is correct.

    Look here:
    wpsc-includes/processing.functions.php
    LIne 177:function admin_display_total_price

    Find these lines:
    $sql = $wpdb->prepare( “SELECT SUM(totalprice) FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE processed IN (2,3,4,5) AND date BETWEEN %s AND %s”, $start_timestamp, $end_timestamp );
    else
    $sql = “SELECT SUM(totalprice) FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE processed IN (2,3,4,5) AND date != ””;

    change the “IN (2,3,4,5)” to only include the state(s) you want.

    You’ll need to redo it when there’s an update to the plugin.

    Happy to do this for you – contact via whitelamp.com

    Plugin Author Justin Sainton

    (@justinsainton)

    I’d highly recommend against doing this. Not only will it require an update to the plugin (which is easy to forget to do), it’s just plain generally inadvisable to hack the core plugin for any plugin.

    whitelamp – we’d gladly merge a PR from you on GitHub to add a filter to these functions to do this properly.

    Hi justin,

    If a client comes to me with a request like this, and the only affordable way is to hack the core, then that’s what I do. It’s great if their budget can run to adding a filter, writing the filter, putting it in a plugin, and getting the core maintainers to incorporate it… but most of the time, given the choice between that, and a cheap and nasty hack, they’ll go for cheap and either pay or learn how to do it every time there’s an update.

    Thread Starter lotsamottsa

    (@lotsamottsa)

    Thanks Whitelamp.. I’ll try that!

    Also, thanks Justin! I understand about editing core plugin files. I’ve had to make a few little hacks, but I’ve been keeping a list of each file I change, and what code I change. I also save a backup of the file. Should I make these editable requests somewhere for the next release?

    If you want to point me in the right direction to accomplish what I need to above with a filter, I’d definitely be into setting it up that way instead, giving I am able to get it working ha.

    Plugin Author Justin Sainton

    (@justinsainton)

    Hi whitelamp,

    The time/cost of opening an issue on GitHub is roughly zero. You’re talking about a matter of seconds. Not a matter of budgetary constraint. Advising those who don’t know better to hack the core files of a plugin reflects poorly on you, not on them.

    Hi lotsamottsa,

    Yes, I’d love to know where you’ve found it necessary to hack the core plugin. Hopefully, we’ll find that there were proper filters to use that you were simply unaware of – though it’s entirely possible those filters don’t exist. In that case, we’d love to add them to the core platform.

    Thread Starter lotsamottsa

    (@lotsamottsa)

    Yes, there probably are filters, I just wasn’t aware of.. also, I’m fairly new to working with filters. I’ll post on Github. Thanks again!

    Plugin Author Justin Sainton

    (@justinsainton)

    Fantastic, thanks!

    Justin,

    I don’t have a zero-cost associated with opening an issue – not if I am doing it properly. That means checking that it is not already reported. And then *carefully* explaining the problem in a way that is both concise, but detailed enough for people to grasp the issue. I’ve had at least one occasion where I described a problem and someone else simply couldn’t see it. Secondly, I’ve not had a great track record with raised issues. I raised one in July last year – “easy fix”, as you subsequently marked it, but it’s not done. I don’t have time to get involved in the whole pull request business unless it’s paid work.

    If somebody wants something done and the only option is a small hack to core – how do you propose they do it? “Hope the developers get around to adding a filter”?

    (While we are here – on the other hand, I would like to thank you for the quick response on the USPS rounding issue I raised. Appreciated.)

    Plugin Author Justin Sainton

    (@justinsainton)

    Hi whitelamp,

    No need to submit a pull request if you don’t have time for that. No need even to search if an issue has been raised already.

    But since you already went through the work it took, for free, to find where in the codebase the function existed, and what changes would be needed to modify it, I took the liberty of creating a screencast to see exactly how long it would take to search for that function in GitHub issues, and then upon not finding it, open a ticket.

    https://quick.as/mqgswr2

    Took about 30 seconds. And just like that, you can help the rest of the community out, establish yourself as someone who does the right thing, the right way, and feel great about contributing to an open source project that you benefit from.

    As you know, I *do* raise issues where appropriate. And I find that providing a good short description is time consuming. As a clever bloke once said: “sorry for the long letter, I didn’t have time to write a short one”.

    But that’s slightly off the subject – someone’s asked how to do something, and I’ve shown how it can be done *now* through a very quick hack to code.

    I have other (nice!) comments which you will receive in email.

    Plugin Author Justin Sainton

    (@justinsainton)

    Looking forward to it, thanks ??

    Thread Starter lotsamottsa

    (@lotsamottsa)

    So for instance, if I want to change “product tags” to “product ingredients” instead of hacking the core files, I use the wpsc_register_taxonomies_product_tag_args filter? I can’t seem to get this to work…Am I doing something wrong?:

    // Product tags to Ingredients
    function product_ingredients(){
    	$labels = array(
    'name' => _x( 'Product Ingredients' , 'taxonomy general name' , 'wpsc' ),
    'singluar_name'=>_x('Product Ingredient', 'taxonomy singular name', 'wpsc'),
    'search_items' => __( 'Product Search Ingredients' , 'wpsc' ),
    'all_items' => __( 'All Product Ingredients' , 'wpsc' ),
    'edit_item' => __( 'Edit Tag' , 'wpsc' ),
    'update_item' => __( 'Update Ingredient' , 'wpsc' ),
    'add_new_item' => __( 'Add new Product Ingredient' , 'wpsc' ),
    'new_item_name' => __( 'New Product Ingredient Name', 'wpsc' ),
    );
    }
    
    add_filter('wpsc_register_taxonomies_product_tag_args', 'product_ingredients');
    Plugin Author Justin Sainton

    (@justinsainton)

    Hi lotsamottsa,

    That’s really close! You modified the labels field properly, you just need to assign it to the labels key in the $args argument and return it. Like this:

    // Product tags to Ingredients
    function lm_product_ingredients( $args ) {
    	$labels = array(
    		'name'          => _x( 'Product Ingredients' , 'taxonomy general name' , 'wpsc' ),
    		'singluar_name' => _x('Product Ingredient', 'taxonomy singular name', 'wpsc'),
    		'search_items'  => __( 'Product Search Ingredients' , 'wpsc' ),
    		'all_items'     => __( 'All Product Ingredients' , 'wpsc' ),
    		'edit_item'     => __( 'Edit Tag' , 'wpsc' ),
    		'update_item'   => __( 'Update Ingredient' , 'wpsc' ),
    		'add_new_item'  => __( 'Add New Product Ingredient' , 'wpsc' ),
    		'new_item_name' => __( 'New Product Ingredient Name', 'wpsc' ),
    	);
    
    	$args['labels'] = $labels;
    
    	return $args;
    }
    
    add_filter( 'wpsc_register_taxonomies_product_tag_args', 'lm_product_ingredients' );
Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Problem with Sales Log’ is closed to new replies.