WordPress.org

Support

Support » Plugins and Hacks » [Plugin: eShop] Echo Product ID

[Plugin: eShop] Echo Product ID

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author elfin
    Participant

    @elfin

    the product id? or did you mean the sku?

    Yeah, SKU – sorry.

    Plugin Author elfin
    Participant

    @elfin

    $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.

    Bernard Chabrol
    Member

    @bernard-chabrol

    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?

    Bernard Chabrol
    Member

    @bernard-chabrol

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

    Bernard Chabrol
    Member

    @bernard-chabrol

    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”)

    esmi
    Forum Moderator

    @esmi

    Please post a new topic.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: eShop] Echo Product ID’ is closed to new replies.