This topic contains 8 replies, has 2 voices, and was last updated by es.answers.yahoo.com/question/index?qid=20140604200417AA5GEuz 2 years, 9 months ago.
May 16, 2012 at 12:33 pm #6099
I have several plugins that use a custom post type to organise their data. One example would be http://www.abstractsun.com/artists/mas-law/ that uses custom posts to organise artists/albums/tracks for a record label. I would like to add ‘add to cart’ buttons for eah track (which is a custom post of type ‘song’). I wondered if you had any suggestions/hints for achieving this. I can only think of two options at the moment.
1) creating a separate product for each song then writing another display-product-shortcode function to display that product’s ‘add to cart’ button next to the song in the list. This is not ideal as my client would need to create both a ‘song’ post type and a ‘product’ post type.
2) Adding the required custom fields to the ‘song’ post type then finding a way for dukapress to work with this post type as well as it’s own. This would be ideal but I’d need a few hints as to what custom fields i’d need and where dukapress needs extending to access other post types…
If you have any suggestions I’d love to hear them:-) It’s great to see such a quality product released fully as open source – I’d really like to extend it in the process of solving my client’s problems!
RobMay 16, 2012 at 4:58 pm #6101
Well, it is possibly to write another function based on the function that generates the “[dpsc_display_product]” shortcode.
However, what happens when you put in this shortcode in your custom post types? Theoretically, it should work perfectly. The only thing that would be missing would be the product details meta box (for defining the price, etc).
But you can go around that by using custom fields directly – please see: http://dukapress.org/docs/custom-fields-used/
As for the “grid display” shortcode, it actually takes a parameter to define the post type so no problem there 🙂 See: http://dukapress.org/docs/short-codes/May 16, 2012 at 7:50 pm #6102
Thanks for speedy response – much appreciated!
So if I’m understanding this right I could create the same custom fields for my post type as described in your document and then write a new [dpsc_display_product] that works for my post type. It would just display the product name, an mp3player link and an ‘add to cart’ button. (the previous two I have the code already)
Assuming I got the above right, would my ‘add to cart’ button function happily with the shopping cart or is there anything else I would need?
I noticed the grid view, post type parameter. It’s a bit of a last resort for me to effectively scrap all my existing display code but I could investigate. So you’re saying if I added the right custom fields to a custom post type, I could just display those custom posts as products using grid view & they’d work fine with the shopping cart?
Thanks again, I appreciate your time thinking about this!May 17, 2012 at 1:26 pm #6105
Success! Tried the former approach (new display product function) and it seems to be working fine:-) I’ll post something here when I have a finished plugin.May 21, 2012 at 2:54 pm #6133
Nice!!! 🙂August 9, 2012 at 3:42 pm #6529
I’m trying to do the same thing… extending dukapress to custom post types. Can you tell me how to do that? What is the code that ypu use in your functions.php?
Thanks in advanceSeptember 4, 2013 at 10:53 pm #58522
adodayAcouckyDecember 12, 2013 at 2:55 pm #87244
ClothknkJune 25, 2014 at 5:27 am #109626
Hoy en día, la marca Christian Louboutin zapatos de tacón alto a un precio de más de $ 500, los clientes siguen llegando, único encanto rojo es evidente. Como un contemporáneo del famoso diseñador de calzado, Christian Louboutin es sin duda la exposición más alta, su figura aparece a menudo en diversos Parte. Usó un alto perfil, actitud publicidad cambió los diseñadores de calzado tradicionales abogan por el interior, y puede rápidamente se convirtió en una estrella internacional en un corto tiempo, su “marketing” encanto personal negada. Él diseñó los zapatos no puede ser el mundo más cómodo, pero debe ser el más singular.