Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › eStore Programmers API available?
Tagged: api, functions list
- This topic has 4 replies, 3 voices, and was last updated 10 years, 10 months ago by wzp.
-
AuthorPosts
-
August 31, 2012 at 5:39 pm #7289ishmaelangeloMember
Where’s the API for programmers?
This list is short and general, does me no good:
http://www.tipsandtricks-hq.com/ecommerce/wp-content/uploads/wp-estore-shortcodes.pdf
I need to know the list of class functions or API functions like WordPress provides (theID(),theCategory(),getPosts(),hasPosts(),etc)
Where is the list of functions such as:
eStore_has_items_in_cart()
eStore_get_items_in_cart()
eStore_get_products($category) //would return array of objects
etc…
Thanks
August 31, 2012 at 10:17 pm #48861ishmaelangeloMemberI found the extra short codes pdf: http://www.tipsandtricks-hq.com/ecommerce/wp-content/uploads/extra-eStore-shortcodes.pdf
And I installed this addon. It provides more functionality however still not exactly what I am looking for.
I may just end up writing some custom functions, if so I’ll post them here for others who want to query the products database and get PHP objects to work with.
August 31, 2012 at 10:45 pm #48862ishmaelangeloMemberWell, that wasn’t too hard, only took a little while using the functions in shortcode_include.php as templates.
Here’s a couple of functions that you can place in your WordPress theme’s functions.php file:
//returns a product object, you can then place values in your own HTML markup
function eStore_get_product_by_ID($id)
{
if(empty($id))
{
return “You did not specify a product ID.”;
}
global $wpdb;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$wp_eStore_db = $wpdb->get_results(“SELECT * FROM $products_table_name where id=$id LIMIT 1”, OBJECT);
if(!empty($wp_eStore_db))return $wp_eStore_db[0];
else return false;
}
//returns an array of product objects, you can then output the product list in your own HTML markup using PHP loop
function eStore_get_products_by_cat_ID($id,$limit=null)
{
if(empty($id))
{
return “You did not specify a category ID.”;
}
$limit = $limit == null?””:”LIMIT {$limit}”;
global $wpdb;
$cat_prod_rel_table_name = WP_ESTORE_CATEGORY_RELATIONS_TABLE_NAME;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$wp_eStore_db = $wpdb->get_results(“SELECT * FROM $cat_prod_rel_table_name INNER JOIN $products_table_name ON
$cat_prod_rel_table_name.prod_id=$products_table_name.id where cat_id=$id ORDER BY name {$limit}”, OBJECT);
if(!empty($wp_eStore_db))return $wp_eStore_db;
else return false;
}
January 16, 2014 at 8:22 pm #48863ellie4905MemberHello – Not sure if this response will go back to OP or not…I am trying to do something a bit different than the shortcodes provide also, and I *think* this is what I need.
However, I am not familiar with php, I am comfortable making changes as long as I have directions to follow though.
Can you pls tell me
A) does it matter where this goes in my functions file?
How do I then call the code to perform on a page?
I am wondering if this has now been added to eStore because I see the post is a year old…
pls advise if possible…thank you
January 16, 2014 at 9:51 pm #48864wzpModeratorWhat is it you are trying to do?
-
AuthorPosts
- You must be logged in to reply to this topic.