Get array value for [price_group] in member.php

Discussion in 'Customization & add-ons' started by paul_law1, Nov 1, 2006.

  1. paul_law1

    paul_law1 New Member

    Joined:
    Aug 22, 2006
    Messages:
    7
    I'm stuck on a simple problem of fetching the value of [price_group].

    In member.php at the top where it loops through all current active subscriptions (within {foreach from=$payments item=p} section), I just need to get a value for [price_group] for each product.

    I've tried lots of variations along the line of {$_amember_products.price_group} but with no success.

    If anyone can help with this simple problem, I'd be jolly happy!!

    Thanks.
  2. paul_law1

    paul_law1 New Member

    Joined:
    Aug 22, 2006
    Messages:
    7
    Am I on the right track?...

    I've now managed to get the [price_group] displaying by each product in member.php (at the top of the page where it lists active subscriptions).

    The value is coming from:
    {lookup arr=$pricegroup key=$p.product_id}

    And in member.php
    // MOD START get product price_group
    $pricegroup = & $db->get_products_list();
    $pp = array();
    $_product_id = array();
    foreach ($pricegroup as $p) {
    $pp[ $p['product_id'] ] = $p['price_group'] ;
    $_product_id[] = $p['product_id'];
    }
    $t->assign('pricegroup', $pp);
    // MOD END get product price_group

    This is outputting the correct numeric value, but I need to create a custom message if the price_group = 5 i.e. {if [price_group] = 5}

    Not sure how to do this - can anyone help? :confused:
  3. paul_law1

    paul_law1 New Member

    Joined:
    Aug 22, 2006
    Messages:
    7
    How to create {if} by price_group

    As mentioned above, I have the price_group value displaying by each product in 'list subscriptions' at top of member.php.

    This value is being displayed by {lookup arr=$pricegroup key=$p.product_id}

    How can I make this into an {if} tag?

    The I will be able to display a custom message based on the price group.

    Any one know???:confused: :confused: :confused:
  4. paul_law1

    paul_law1 New Member

    Joined:
    Aug 22, 2006
    Messages:
    7
    Alex suggested:

    {if $smarty.request.price_group eq "5" }

    From forum posts this seems to work in signup.html as the '.request.' bit is defined in signup.php - but I can't get it to work in member.html...

    Has anyone made this work in member.html or does anyone know how to make it work?

    Any advice needed please.:eek:
  5. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Some special programming needed to get this, contact us via helpdesk and we will help.
  6. paul_law1

    paul_law1 New Member

    Joined:
    Aug 22, 2006
    Messages:
    7
    Success! How to get value for [price_group] in mamber.php

    Thanks Alex for your help.

    Thought it would be handy for people to know how it works...

    In member.php, around line 300, just above comment in code:

    // common processing

    I've added:

    // MOD START get product price_group
    $pricegroup = & $db->get_products_list();
    $pp = array();
    $_product_id = array();
    foreach ($pricegroup as $p) {
    $pp[ $p['product_id'] ] = $p['price_group'] ;
    $_product_id[] = $p['product_id'];
    }
    $t->assign('pricegroup', $pp);
    // MOD END get product price_group

    This assigns a value for [price_group. Then in the template member.html you can call this variable by:

    {assign var="pgroup" value=$p.product_id}

    Then you can refer to this value (below scans for a subscription in price_group 5)...

    {if $pricegroup.$pgroup eq "5" }

    Hope this helps someone! :D

Share This Page