Support » Plugin: MarketPress - WordPress eCommerce » [Plugin: WordPress eCommerce – MarketPress] Conditional test for shipping page

  • Resolved wallyO


    I am trying to find a conditional test for whether the current page is the shipping page.
    I have read this topic about conditionally targetting a product, and
    is_page( '1019' )
    is_singular( 'product' )
    are similar to what I want but neither target the shipping page.
    The reason I want/need this is so as to conditionally turn off email encoder bundle plugin on the shipping page because it breaks the html at the email inputs on the shipping page and has no built in way to exclude pages.
    I can already do this on any page or post, but do not know how to target the shipping page.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hiya,

    Either of those conditional statements should work. Where are you implementing the code? I did a quick test by adding a conditional to header.php inside the twentyeleven template and it worked as expected.

    Here’s my snippet:

    global $post;     // if outside the loop
    if ( is_page( '807' )) {
    	echo "This is the shopping cart";

    Of course, you’d replace 807 with whatever the post ID is for your shopping cart page.

    Hope that helps!

    Thanks for your reply masonjames.
    This is my attempt to find the post id if this shipping page has one. In,
    On line 497 I added this code,

    $postid = get_the_ID();
    $content .= '<div>The Post ID is ' . $postid . '</div>'

    The output generated was,
    <div>The Post ID is </div>
    The shipping “thingy” is not in the admin page list or the admin post list.
    Herein lies the problem, I don’t think this page is a post at all and does not have an ID. That is why I am asking for another way to reference it.


    Do you have a link to your site’s shipping page so I can have a look?

    On my test site, I’m simply using firebug to see what Post ID is given in the body tag. If there isn’t one there you can always create a shipping page manually in the wp admin, but I believe there will be one there by default.

    Let me know if you continue to have any trouble.


    Continuing on in the same tone, (hacky and flaky), of the previous post I tried,

    $myurl = $_SERVER["REQUEST_URI"];
    $content .= '<div>The request uri is ' . $myurl . '</div>' ;

    in the same place as above and the generated output was
    <div>The request uri is /store/shopping-cart/shipping/</div>
    So to get things working I added the code after line 142 in,

    if ($_SERVER["REQUEST_URI"] == '/store/shopping-cart/shipping/') {
    remove_filter( 'the_content', array( $this, '_filter_callback' ), $priority );

    This works for me, but I know it will be lost on update of email encoder bundle and will stop working if I change any of the slug names, “store”, “shopping-cart”.

    Sorry, I missed your last reply.
    The body class is page-id-0
    Shipping page url

    Hiya wallyO,

    My apologies, I was working with some older data and it actually provided me with a page ID for the shopping cart, when I started over with a fresh install, I get exactly what you have here.

    So, as an alternative, you’ll want to create a new page in our theme template. You can make a copy of page.php (or whatever your default page is you’d like to use) and cal it mp_cart.php.

    Inside this new page template use the following function instead of the normal WordPress loop:
    <?php mp_show_cart('checkout'); ?>

    This will be the page marketpress uses for checkout – you can then create your filter. It’s probably wise to a check to see if the function exists first – that way if you disable the plugin at some point you won’t get a php error on the page.


    masonjames thanks again for your help,
    I think I will persist with my original solution for the time being, not because it is better, but rather it is more compact to maintain and document.
    If the developer of email encoder bundle plugin adds the ability to exclude pages based on ID, I will implement the solution you have documented here.
    This hack would then become an update safe modification.

    Wish you all the best in your life and endeavors for the rapidly approaching new year.



    Hi how do I link only a section of my page. I want when people come to my site and click on ex. feather extension it takes them to the page under products but in the section with feather extension not feather earrings. And how do I categorize my product page ex:
    -feather earrings ( I want this to be on the top of the page)
    -feather extensions (this should be after the earrings)
    so on

    On my store page I have a list of items by categories, but I need to link the words to the type of jewelry they go with in the mid or end section of the product page and I don’t have the slightest clue how to do that.

    Here’s my website:

    Any help would be awesome!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WordPress eCommerce – MarketPress] Conditional test for shipping page’ is closed to new replies.