Wordpress page/post ID's and auto generated Marketpress URLS

Hello,

Do the auto generated pages in marketpress have a wordpress page/post ID associated with them?

I need my website to perform specific actions if a particular page is being displayed and I cannot find the post ID's

For example, what are the post ID's for the following pages?

store/shopping-cart/
store/order-status/

etc?

Thank you,
Michael

  • Timothy
    • Chief Pigeon

    Hey there.

    MarketPress is a custom post type, they have IDs, custom post IDs.

    It's in the same table as posts and pages.

    The main MarketPress page is an actual page. The products are dynamically generated through that page.

    For example, what are the post ID's for the following pages?

    store/shopping-cart/
    store/order-status/

    Those two are virtually created pages. They don't have a specific ID.

    Hope this helps, let me know if you have any further questions.

    Take care.

  • michael_packman
    • Flash Drive

    Hi there, it actually doesn't help.

    I understand those pages are virtually created pages, but I need my website to perform specific actions when those pages are opened by the visitor.

    I usually use php if statements to identify the post ID and have my website perform the actions I require from there.

    Is there some other way in my php code I can use to identify when I virtually created page is being viewed by the visitor?

    Thanks,
    Michael

  • Timothy
    • Chief Pigeon

    Hey again.

    So if the product ID was 221 and you wanted to target that specific product, then you could do something like this:

    if (is_page( '221' )){
    	echo "This is page ID 221";
    }

    Or if you just want to target the post type then you could do this:

    if ( get_post_type() == "product" ){
       echo "This is a MarketPress page";
    }

    Or something with:

    is_singular('product');

    Theming:

    /marketpress/marketpress-includes/themes/Themeing_MarketPress.txt

    Store Page - mp_store.php

    Cart/Checkout Page - mp_cart.php

    Order Status Page - mp_orderstatus.php

    Product List Page - mp_productlist.php

    Does this help?

    Take care.

  • michael_packman
    • Flash Drive

    No this still doesn't help. You can only get a post_type on a post that is logged in the wordpress database.

    Because the store/shopping-cart/ page is virtually created it does not have a post_type associated with it. The wordpress functions used to reference these post_types will only apply to pages in the database.

    These MP virtually created pages are not in the wordpress database.

    Could there be a way of determining when a virtually created page is being accessed through the MP code somewhere?

    I'll let you know if I come up with something.

    Thanks,
    Michael

  • Timothy
    • Chief Pigeon

    Ok then, how about:

    $graburl = $_SERVER["REQUEST_URI"];
    $isitshoppingcart = strstr($graburl, 'shopping-cart');
    	if ($isitshoppingcart == "shopping-cart/"){
    			echo "This is the shopping cart page page";
    }

    That's grabbing the url, looking for the shopping-cart slug and if it's there doing the business.

    Does that help then?

  • jmarcello
    • WPMU DEV Initiate

    I need some help with a similar problem for a breadcrumbs script I am developing...

    My store has a store base of /store
    And a products list of /store/products

    Since the /store/products page is generated by the plugin how to I target it and it's children? Usually I would use is_page('page_id') or is_tree('page_id') for something like this, however I cannot figure out the page ID for this

    I reckon I would also need to identify the store/product/caterort and/or tag as well as things like shopping cart and order status.

    Any help is greatly appreciated.

  • Ollie
    • The Incredible Code Injector

    Agreed with jmarcello breadcrumbs in marketpress are causing me nightmares.

    As for Michael.. Products are a custom post type so use them similarly how you would a normal category with posts.

    As for check out pages.. That is a function in your template-functions.php which you can copy to your themes and modify how you wish.

    Cheers

  • Timothy
    • Chief Pigeon

    Hey michael_packman.

    Excellent news, glad this resolves the matter for you! :slight_smile:

    Thanks for marking your thread resolved as well. :slight_smile:

    @jmarcello Then really you need to create your own thread for support rather than using another members thread.

    That way it will remain independent of this one and ensure it doesn't confuse issues here if this thread needs reopening again by the author. Assisting multiple members in a single thread can easily get confusing.

    This also allows us to better track and answer your questions to ensure we don't miss any for ya.

    You can start a new thread here:

    https://premium.wpmudev.org/qanda/

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.