$5
Photography website - using gallery & foxycart to sell products
In my head, I thought the best way of doing this would be to somehow intercept the [gallery] output, so that for each image that is returned, I add the product options fields for Foxycart to use.
How would I go about doing this - or is there perhaps a better way of doing this that I haven't thought of?
Darfuria | 02/08/10 at 12:06pm |
Answers
(3) Possible Answers Submitted...
-

Last edited:
02/08/10
12:14pmUtkarsh Kukreti says:You can fetch a list of the attachments using something like
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
You can get the attachment link using wp_get_attachment_link
Some more useful functions are available at wp-includes/media.php -

Last edited:
02/08/10
1:07pmBen Huson says:Have you thought about using any of the WordPress ecommerce plugins?
I know WP e-Commerce can handle downloadable products like MP3 and probably images.- Darfuria says:
As each of the purchasing options are going to be the same for every image, it'd be an unnecessarily lengthy process to use an eCommerce system and manually add each image as a product. FoxyCart is an ideal solution, I just need a way of intercepting the code generated by the [gallery] shortcode so that I can add the fields after each image.
- Darfuria says:
-

Last edited:
02/09/10
11:04amDan Fraticiu says:You could mirror the [gallery] short code. And by mirror I mean simply copy it, you can find it here or in wp-includes/media.php function name gallery_shortcode().
You paste that function in your functions.php file of your theme, change it's name with something like foxy_gallery_shortcode, then the shortcode like this:
add_shortcode('foxy_gallery', 'foxy_gallery_shortcode');
Now you should be able to add you custom code in the foreach that builds the gallery.
- Darfuria says:
This seemed like a viable solution, but unfortunately I'm getting the following error upon coping the function into my functions.php file and renaming it to foxy_gallery:
Warning: Cannot modify header information - headers already sent by (output started at .../functions.php:114) in .../wp-includes/pluggable.php on line 865
- Darfuria says:
This question has expired.


