WordPress.org

Ready to get started?Download WordPress

Forums

eShop
[closed] Echo Product ID (8 posts)

  1. fangonk
    Member
    Posted 3 years ago #

    Is there anyway to echo the product ID - is there a short-tag or something for this? This is outside the product page, on the category page inside the loop - if it makes any difference.

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

  2. elfin
    Moderator
    Plugin Author

    Posted 3 years ago #

    the product id? or did you mean the sku?

  3. fangonk
    Member
    Posted 3 years ago #

    Yeah, SKU - sorry.

  4. elfin
    Moderator
    Plugin Author

    Posted 3 years ago #

    $eshop_product=maybe_unserialize(get_post_meta($id, '_eshop_product','true'));

    where $id is the id of the page/post you want details of. This returns an array, the sku would be $eshop_product['sku']

    or print_r the $eshop_product to find out what is available via that.

    Alternatively you can use: get_eshop_product($id) which returns the above plus a few extra bits.

  5. Bernard Chabrol
    Member
    Posted 2 years ago #

    Nice I made it work. However I cannot display the price the same way.
    I tried
    $eshop_product=maybe_unserialize(get_post_meta($id, '_eshop_product','true'));

    $eshop_product['eshop_price[1]']

    But apparently eshop_price[1] is not the good value.
    Would you have an idea?

  6. Bernard Chabrol
    Member
    Posted 2 years ago #

    Ok i found :
    if(substr($eshop_product['sku'],0,3)=="let"){ $prix=$eshop_product['products']['1']['price']." $";}else{$prix="free ";};

  7. Bernard Chabrol
    Member
    Posted 2 years ago #

    Would you have something better than this to test if the product is on sale or just free
    if(substr($eshop_product['sku'],0,3)=="let")

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    Please post a new topic.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags