Jump to content

Recommended Posts

Hello ! i've this portion of code in a file:

 

validation.php

 

$paypal->validateOrder($_POST['custom'], _PS_OS_PAYMENT_, $price, $paypal->displayName, $paypal->getL('transaction').$_POST['txn_id']);

 

That function is declared in another file

 

PaymentModule.php

 

public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
$secure_key = false, Shop $shop = null)
{CONTENT FUNCTION}

 

 

I want that $paypal->validateOrder calls another file, for example PaymentModuleMod.php that will contains the same function little modified.

 

in which way can i do this ? and for just curiosity, in which way the system KNOWS that validateOrder() is in PaymentModule.php ? is that $paypal-> that specify this ?

 

Thanks, i'm trying to modify some Prestashop's modules ;) Thanks to ALL!!

 

p.s. i tried to integrate the function directly in the validation.php and i also tried to replace the VALUES, but doesn't work 'cause i wrong something :-/

Edited by ienabellamy
Link to comment
https://forums.phpfreaks.com/topic/269819-specify-a-php-function/
Share on other sites

Can't you just rename the current file to, like, PaymentModuleMod.bak.php, and move the modified version into its place?

 

Most likely (there are other possibilities):

PaymentModule.php includes the definition of some class. $paypal is an instance of that class. So when code calls $paypal->validateOrder() it'll run the code contained in that file.

and in which way can i specify that the function is in the same file when function is called ? like

 

 

validateOrder($_POST['custom'], _PS_OS_PAYMENT_, $price, $paypal->displayName, $paypal->getL('transaction').$_POST['txn_id']);
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null) {CONTENT FUNCTION}

 

is it correct ? because i tried and it doesn't work :-/

Hi all ! i solved ! i simply replicated the function, with my modifies, validateOrderMod (declared in the same class $paypal), and so, the new method is: $paypal->validateOrderMod

 

Thanks to all, i'm real new to the Object style programming, i'm coming from old style, Ansi C, and is real difficult understand object oriented php language. Thanks to all again !!!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.