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 Comments

  1. Keep comments on topic. Or they will be deleted 😄

    Reply
  2. 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 😛

    Reply
    • Hey, anything new about the beta? I’m quite curious 😉

      Reply
  3. 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.

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

      Reply
      • 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.

        Reply
  4. 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.

    Reply
    • 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.

      Reply
  5. 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 😉

    Reply
    • Yes I agree. It’d be nice if somebody could help with that 😄

      Reply
    • 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. :)

      Reply
      • 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 :)

        Reply
      • 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.

        Reply
  6. Any news on the Beta??

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

    Reply
  8. Any news on the Beta?

    Reply
  9. 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.

    Reply
    • Just our of curiosity, why would they want a WYSIWYG editor on meta fields? They are plain text and they aren’t visible to anyone but search engines/ someone looking at the source (unless you’re talking about different meta tags). This would have no use…. The description field is obviously different…

      Reply
    • Totally agree with Aadi. Love this application, I am using it! but when I wanted to edit the Additional Description is not possible… Just a tip! Thanks!

      Reply
    • On the contrary, it was released / announced last week via the developers mailing list… Of course it is a version ‘for’ developers and peeps confident backing up their sites :))

      Reply
      • can I get a link to the development copy to start testing?

        Reply
        • Join the WP e-Commerce Developers mailing list. There ye shall find the link and there ye shall be able to discuss your findings with the rest of the dev team :)

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

    Reply
  11. good artical, thanks for sharing

    Reply
  12. 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

    Reply
  13. 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.

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>