FoxyPress has a variety of functions available for you to tap into for customizing your store and how it displays or functions.  Below we’ve outlined some of the basics and we’ve supplied a few tutorials on how to implement some cool things as well!

If you are looking for something that is not here or wish to add additional functionality, we’d love to hear from you so we can either develop it for you, or include your additional work into the next version.

All of the following can be found in the foxypress-helpers.php file in the FoxyPress plugin folder.  Check out full documentation here.

User Portal Related

foxypress_GetUserTransactions($user_email, $type=’current’)

Returns an array of all transactions placed by a specific user. This function is based upon the user’s email within wordpress matching the email address within foxy cart.

Get more information here.

Array
(
	[id] => 1928062
	[status] => Shipped
	[first_name] => John
	[last_name] => Doe
	[email] => jdoe@foxy-press.com
	[tracking_number] => 123456789
	[billing_address1] => 123 Some Street
	[billing_address2] => #2
	[billing_city] => New York
	[billing_state] 	=> New York
	[billing_zip] => 10001
	[billing_country] =>
	[shipping_address1] => 123 Some Street
	[shipping_address2] => #2
	[shipping_city] => New York
	[shipping_state] => New York
	[shipping_zip] => 10001
	[shipping_country] =>
	[date] => 2010-08-21 15:29:02
	[product_total] => 10.00
	[tax_total] => 0.00
	[shipping_total] => 0.00
	[order_total] => 10.00
)

foxypress_GetTransactionDetails($transaction)

Returns an array of all items related to a specific transaction and each items associated custom options. Simply pass the transaction id returned by foxypress_GetUserTransactions.

Get more information here.

Array
(
	[0] => Array
		(
			[product_code] => TWL1
			[product_name] => Towels
			[product_price] => 21.99
			[product_options] => Array
						(
							[0] => Array
								(
									[option_name] => Size
									[option_value] => 3.5x2
								)
						)
		)
)

foxypress_IsAffiliate($user_data->ID)

Returns true or false depending upon whether or not the user is an affiliate.

Get more information here.

foxypress_IsReferral($user_data->ID)

Returns true or false depending upon whether or not the affiliate has referral capability.

Get more information here.

foxypress_GetAffiliateData($user_data->ID)

Returns an array of all affiliate statistics.

Get more information here.

Array
(
	[total_clicks] => 482
	[total_referrals] => 50
	[total_orders] => 100
	[total_referral_paid_out] => 490.82
	[total_paid_out] => 108.32
	[referral_amount_due] => 15.61
	[amount_due] => 840.67
	[referral_commission] => $5.00
	[commission] => 30%
	[affiliate_url] => http://demo.foxy-press.com/wp-content/plugins/foxypress/foxypress-affiliate.php?aff_id=1 
	[user_facebook_page] => http://www.facebook.com/XXX
	[user_age] => 38
	[user_gender] => Male
	[avatar_name] => 0bf075df28827f75a132cccd2e90c60d
	[avatar_ext] => .jpg
	[open_orders] => Array
			     (
				[0] => Array
					(
	    					[order_id] => 8715192 
	    					[order_total] => 25.09 
	    					[affiliate_commission] => 5.00 
	    					[order_date] => 2012-04-12 12:48:50  
	    					[order_type] => Regular 
					)
			     )
	[paid_orders] => Array
			     (
				[0] => Array
					(
	    					[order_id] => 9388116 
	    					[order_total] => 404.20 
	    					[affiliate_payout] => $5
						[affiliate_commission] => 5.00
	    					[payment_method] => Paypal 
	    					[payment_date] => 2012-04-12 
	    					[order_type] => Regular 
					)
			     )
)

Product Related

foxypress_GetProduct($inventory_id)

Get more information here.

Array
(
    [id] => 10
    [code] => 100107
    [name] => SMILING BUDDHA RING
    [description] => Simple description here.
    [weight] => .5
    [quantity] => 1
    [quantity_max] => 0
    [quantity_min] => 0
    [price] => 52.00
    [featured_image] => fp_bid6ew0ef_1.png
    [sale_price] => 50.00
    [sale_start] => 2011-09-01
    [sale_end] => 2011-09-30
    [discount_quantity_amount] =>
    [discount_quantity_percentage] =>
    [discount_price_amount] =>
    [discount_price_percentage] =>
    [start_date] => 2011-09-01
    [end_date] => 2011-09-30
    [active] => 1
    [sub_frequency] => 30d
    [sub_startdate] => 20110830
    [sub_enddate] => 20120101
    [downloadable] =>
    [categories] => Array
        (
            [0] => Array
                (
                    [id] => 5
                    [name] => Most Popular
                    [image] => http://www.yourstore.com/wp-content/inventory_images/fp_h9n1n5ctrp_5.jpg
                )
        )
    [images] => Array
        (
            [0] => Array
                (
                    [id] => 43
                    [name] => http://www.yourstore.com/wp-content/inventory_images/fp_8sxcvx5ap_10.png
                    [order] => 99
                )
        )
    [options] => Array
    	(
	    [0] => Array
	        (
		    [id] => 4
		    [group_id] => 1
		    [group_name] => Type
		    [text] => Small
		    [value] => small
		    [extra_price] => 0.00
		    [extra_weight] => 0.00
		    [code] =>
		    [quantity] =>
		    [active] => 1
		    [order] => 99
	        )
        )
    [attributes] => Array
        (
            [0] => Array
                (
                    [id] => 16
                    [text] => Brand
                    [value] => Test Brand
                )
        )
)

foxypress_GetProducts($items_per_page = 9999, $page_number = 1, $include_history=”1″)

Returns an array of all your products, similar to the structure above.
Edit We now include a pagination object within the main set of objects returned.

Get more information here.

[pagination] => Array
        (
            [total_pages] => 1
            [total_items] => 7
            [current_page] => 1
            [] => 999999
        )

In addition the pagination, we allow for a parameter to be set to include products that are inactive/out of active date range or not.

foxypress_GetProductsByCategory($category_id, $items_per_page = 9999, $page_number = 1)

Both of these functions will return an array of the same product objects above, so you the only additional step when using this would be looping through the main array of products.

Get more information here.

foxypress_SearchProducts($search_term, $items_per_page = 9999, $page_number = 1)

This function returns an array of products based on a string value search term.

Get more information here.

Category Related

foxypress_GetCategories()

Get more information here.

Array
(
    [0] => Array
        (
            [id] => 1
            [name] => General
            [image] => http://www.yourstore.com/wp-content/inventory_images/
        )
)

foxypress_GetCategoryCount($category_id)

Simply returns the number of items for a specific category.

Get more information here.

Form Building Functions

When building your own product page templates with our API, you will want to use the above functions to gather your data and present it correctly, but we’ve added some functions that will help build out your form so you don’t have to worry about those details.

foxypress_GetProductFormStart

This will return the start of the form and should be at the start of any product area you are creating.

Get more information here.

foxypress_GetProductFormEnd

You will want to use this function at the very end of the product area.

Get more information here.

Other Helpful Functions

foxypress_GetTrackingModule()

We’ve created a tracking module that you can place on your pages to allow users to get the status of their order, based on what has been entered in the order management screens within FoxyPress admin.  This is great for stores that use order status management and set tracking numbers for orders.

Get more information here.

foxypress_GetProductQuantitySold($inventory_id)

Want to display to your users how many products have sold? Use this function and pass in the inventory ID to return the count.

Get more information here.

foxypress_GetMiniCartWidget($dropdowndisplay, $hideonzero)

This method returns a mini cart that can go in your sidebar, also available as a widget.  You can also pass “true” for $dropdowndisplay and have the cart drop down near the top of your store if you don’t want it in your sidebar.

Get more information here.