WordPress.org

Ready to get started?Download WordPress

Forums

WPPizza
[resolved] Write out categorie name on order page. Possible ? (6 posts)

  1. Szalk
    Member
    Posted 9 months ago #

    I want to write out the name of the ithemes category on the order page. (and, if possible, in e-mail)
    Is there any easy way?

    For example here:

    wppizza-order.php

    <?php foreach($cart['items'] as $item){ ?>
    
    <li><u><?php echo''.$item['count'].' X </u> '.$item['name'].' <b><small>[ '.$item['size'].'  ]</small></b>' ?> <span><?php echo''.$cart['currency'].' '.$item['pricetotal'].''; ?></span> [CATEGORIE NAME]</li>
    				<?php if(is_array($item['additionalinfo']) && count($item['additionalinfo'])>0){foreach($item['additionalinfo'] as $additionalInfo){?>
    					<span><?php echo $additionalInfo ?></span>
    				<?php }} ?>
    			<?php } ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Thank you very much!

    http://wordpress.org/extend/plugins/wppizza/

  2. ollybach
    Member
    Plugin Author

    Posted 9 months ago #

    short answer: not easily/really . no.

    long answer: you could change:

    <?php foreach($cart['items'] as $item){ ?>

    to

    <?php foreach($cart['items'] as $itemKey => $item){
    $expl=explode(".",$itemKey);
    /*now $expl[0] contains the post id
    and you could to something like getting the permalink for this id and do something with it*/
    etc etc
    ?>

    however: if you have the same item in more than 1 category it will only ever display the same category, no matter which category the item was under when you added it to the cart.

    that's a wordpress thing and has nothing to do with me .....

  3. Szalk
    Member
    Posted 7 months ago #

    I tried, but failed.
    All food is included in one category only.
    I want to do it that name, size and category of the food is send me by email.
    I changed the code, but how do I specify that a class type that?

    Thanks for your help!

  4. ollybach
    Member
    Plugin Author

    Posted 7 months ago #

    it does't do that at the moment.
    however, there will be an update available to the plugin in a couple of days or so (v.2.5) which has some filters added you will be able to use.

    when it's released I will post a code example here

  5. ollybach
    Member
    Plugin Author

    Posted 6 months ago #

    sorry will take a few more days

    (i've integrated it in the next update to make it quite easy to do, but as quite a few more things have been added i need to make sure i dont break things)

  6. ollybach
    Member
    Plugin Author

    Posted 6 months ago #

    2.5+ will also now return the category(ies) of any given item.
    just edit your templates accordingly

    for example in wppizza-order-email-html.php
    in the foreach loop

    foreach($order_items as $k=>$v){ etc...

    $v['categories'] would also return the categories and their slugs etc
    you can probably take it from there...

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.