Home » News » hooks and filters part 2

hooks and filters part 2

Put your hand up if you like hooks and filters?

We do too! And it no doubt shows – as we still boast the most in the old hooks and filters department. But enough is never enough around here – in my recent Wish list article a small handful of people (theme developers and so on) asked us to include even more hooks and filters for them… but unfortunately nobody provided us with an abundance of detail. So now is your chance to tell us precisely what hooks and filters you need and where you want us to place them. Heck if you’re really smart you’ll even provide us with the code!

We’ll do our best to either get em impending 3.8 release or what is probably more likely, the ominous and all encompassing 3.8.1 release.

Peace. Love WP e-Commerce Plugin.


29 Responses to hooks and filters part 2


  1. Dan Milward November 8, 2010 at 4:58 pm

    Keep comments on topic. Or they will be deleted :D

  2. Dan Milward November 8, 2010 at 5:01 pm

    For the record though the upcoming 3.8 release is due out soon. We reckon that we’ll have a publicly ready Beta available by Wednesday this week (NZT)… then the full release will be available whenever we fix all the bugs related to the Beta release.

    I wish it was out already but we want it to be rock solid right :P

  3. Gonçalo Rodrigues November 9, 2010 at 3:12 am

    Hi there,

    I will appreciate the following, or similar, changes in filters and hooks.

    FILE: transaction_result_functions.php
    LINE: 247
    $additional_content = apply_filters(‘cnoti_wpsc_transaction_result_content’, array(“purchase_id” =>$purchase_log['id'], “cart_item”=>$row, “purchase_log”=>$purchase_log));
    $message .= $additional_content;
    $message_html .= $additional_content;
    Note: So that we can add additional content via a filter (custom plugin).

    FILE: cart.class.php
    LINE: 1751
    $price = apply_filters(‘wpsc_do_convert_price’, $price, $this->product_id);
    Note: Add second argument to filter.

    FILE: processing.functions.php
    LINE: 305
    $price = apply_filters(‘wpsc_do_convert_price’, $price, $product_id);
    Note: Add second argument to filter.

    FILE wpsc_query.php
    LINE: 279
    //return wpautop(wptexturize( wp_kses(stripslashes($wpsc_query->product['description']), $description_allowed_tags )));
    Note: Not a filter/hook thing but i would like you give an option to the following or even comment the following code.

    The line numbers maybe are not 100% accurate, but give you an idea where to do the modifications.
    I am using WP e-Commerce version 3.7.6.9.
    Thanks for your great plugin.

    Best regards,
    Gonçalo Rodrigues.

    • Thomas Doki-Thonon August 9, 2011 at 11:26 pm

      Hello,
      Does the filter exists now to add content on both page and email as Gonzalo asked ?
      Thanks

      • Thiruktheeswarn March 6, 2012 at 9:24 pm

        That query really is not an issue, an inner join and a left join, no big deal, your hnsitog company obviously thinks its clever to send such a technical email, but in reality that don’t have a clue. With the correct indexes the query should take no more time than any other query. It is more likely that the plugin does not update the indexes for the relevant tables. My guess is that your overall traffic is high, and this slightly more complex query stood out, (or something is broken).I have a few blogs running under a VPS with much more complex SQL without any issues (with 5000+ unique visits per day) But overall I think moving to a dedicated is always the way forward.

  4. leewillis77 November 9, 2010 at 8:40 pm

    Goncalo,

    wpsc_transaction_result_content already exists to add extra content to transaction results pretty much the same as your first example as far as I can see.

    Also on your last point, you can modify which tags are preserved just by defining $description_allowed_tags in your functions.php file with the right tags.

    Hope that helps.

    • Gonçalo Rodrigues November 13, 2010 at 12:57 am

      Hi,

      Thanks for your answers.

      About wpsc_transaction_result_content it’s not the same i want to add content on line (~247) from a custom plugin i made. And i need it to be around that specific line so i can attach that content (after product listing) to message and message_html variables, so it appears on screen and email.
      In that custom plugin i gave the user different messages from custom payments i made for WP e-Commerce and also add the Client Details and Shipping Details to screen and email.

      About $description_allowed_tags, yeah i already knew that.

      Gonçalo Rodrigues.

  5. nicolas1106 November 10, 2010 at 12:21 am

    Hi,
    Happy to see the 3.8 release is coming soon soon soon :-)

    Concerning the hook and filters topic before adding anything I would be very happy to see more examples / tutorial about the actual hook and filters. For most of the ones I had to use so far, I found a good way to use it but for instance this one “wpsc_cart_updated” remains in my “what kind of alien is that?” list.

    One hook that could be useful I think is the ability to had some jQuery script to the existing one. I personally hate to have many .js in my html tags.
    Eventually this kind of hook will make it even more easy during a plugin development to decide on which site page/section this jQuery code will be added to the actual jQuery file. Then, what about the js already cached in the browser… if anyone has an opinion about that i’ll be happy to hear it.

    That was it for now, if i think of anything else i’ll let you know.

    Cheers.

    Ps: I have added a nice new website made with WP-ecommerce premium plugin in the showcase list 10 days ago and it’s is not there yet. Any bug, or the waiting list is looooong ?
    I think this is an interesting one, some of the e-commerce behavior had been modified. And honestly the business owner who paid for the premium plugin would be happy to see his site on the list ;-)

    • Dan Milward November 10, 2010 at 9:41 am

      Yes I agree. It’d be nice if somebody could help with that :D

    • BrowardNET November 30, 2010 at 2:24 am

      What will be updated in 3.8? Will we know the files for manual updates due to customization? Also, regarding hooks and filters, better documentation on what they are and how they work would be greatly appreciated.

      Thanks. Like the plugin despite its quirks. A lot of flexibility. :)

      • Dan Milward December 1, 2010 at 2:33 pm

        We’ve started work on docs. getshopped.org which will eventually because the home for our documentation. It’ll eventually be a wiki too. Sounds like you should download the developers beta and start learning it. And in future if you extend WP e-Commerce please provide us your hooks and filters so we can add em to the Plugin :)

      • sweet March 6, 2012 at 9:09 pm

        That query really is not an issue, an inner join and a left join, no big deal, your noitshg company obviously thinks its clever to send such a technical email, but in reality that don’t have a clue. With the correct indexes the query should take no more time than any other query. It is more likely that the plugin does not update the indexes for the relevant tables. My guess is that your overall traffic is high, and this slightly more complex query stood out, (or something is broken).I have a few blogs running under a VPS with much more complex SQL without any issues (with 5000+ unique visits per day) But overall I think moving to a dedicated is always the way forward.

  6. Andrew November 12, 2010 at 7:50 pm

    Any news on the Beta??

  7. 好买吧 November 14, 2010 at 5:50 pm

    我觉得确实是这样的,写的不错。

  8. Stephan November 14, 2010 at 10:23 pm

    Any news on the Beta?

  9. Aadi November 15, 2010 at 8:15 pm

    This concerns the admin part..
    My client wishes to have WYSIWYG editor for ‘Additional Description’, Categories “Description” field and Product Custom meta fields.
    I ain’t sure if this is possible via hooks, but will be great to have a page where we can define which fields to convert to Rich Text Editors.

  10. Andrew Johnson November 20, 2010 at 4:10 am

    was the beta a joke just to tease us?!?

  11. Rob November 20, 2010 at 7:35 pm

    Would LOVE to get my hands on the 3.8 release. Can you send me an alert when it is released?

  12. http://www.haohaotao.cn December 31, 2011 at 2:15 pm

    good artical, thanks for sharing

  13. Patricia March 7, 2012 at 12:07 pm

    shawtyheartsmakeup1 on November 7, 2011 to be soneht i have never been asked this question but for you i’ll answer, well my favourite food has got to be chineese noodles and the soup just the best

  14. Arjan de Vreede March 8, 2012 at 4:54 am

    I would like a hook which returns all the information of the ordered cart, this includes personal details and the complete cart.

    I need this because my client wants an xml file to import into their system. I can do this now by doing a lot of extra queries, but it would be nicer to return the complete $cart object instead of just a row (I’m now using ‘wpsc_transaction_result_cart_item’).

    Maybe you guys have better suggestions if something like this already exists.