Lolita
Lolita

Reputation: 45

PhP file to edit, but unfamiliar with php

i want to integrate an affiliate script with a shopping cart,

for that i need to edit 2 php files but the tutorial is not easy for me because i'm not familiar with php.

For example :

Open the "wp_eStore1.php" file and find the following function:

function eStore_get_custom_field_value()

once you find it just add the following towards the end of the function (just before the return statement):

$name = 'jrox_cookie';
$value = $_COOKIE['jrox'];
$custom_field_val = append_values_to_custom_field($name,$value);

Where should i add those 3 lines in wp_eStore1.php ?

This is the source code of this file : http://pastebin.com/nwZixJZa the function is located line 676

Thanks

Upvotes: 0

Views: 110

Answers (3)

MEM
MEM

Reputation: 31387

Like this:

function eStore_get_custom_field_value()
{

        $output = '';

        $_SESSION['eStore_custom_values']='';

        if (!empty($_SESSION['ap_id']))

        {

        $name = 'ap_id';

        $value = $_SESSION['ap_id'];

        $custom_field_val = append_values_to_custom_field($name,$value);

        }

        else if (isset($_COOKIE['ap_id']))

        {

        $name = 'ap_id';

        $value = $_COOKIE['ap_id'];

        $custom_field_val = append_values_to_custom_field($name,$value);

        }

        if (!empty($_SESSION['eStore_coupon_code']))

        {

        $name = 'coupon';

        $value = $_SESSION['eStore_coupon_code'];

        $custom_field_val = append_values_to_custom_field($name,$value);

    }

    if (function_exists('wp_eMember_install'))

    {  

            global $auth;
            $user_id = $auth->getUserInfo('member_id');

            if (!empty($user_id))
            {
                        $name = 'eMember_id';
                        $custom_field_val = append_values_to_custom_field($name,$user_id);
            }
    }  
    /* HERE ARE YOUR LINES */
    $name = 'jrox_cookie';
    $value = $_COOKIE['jrox'];
    $custom_field_val = append_values_to_custom_field($name,$value);

    return $custom_field_val;
}

:)

Upvotes: 0

Crozin
Crozin

Reputation: 44396

Well, line 676 contains function definition that is enclosed between { and } (lines 677 - 709). On the end of that definition there is a return statement: return $custom_field_val;. Insert your code just before that line.

Upvotes: 0

gen_Eric
gen_Eric

Reputation: 227310

It's asking you to put those 3 lines before the return statement (which is on line 708).

Upvotes: 1

Related Questions