Payment Method Suggestions

Details of modifications which users can incorporate within Enuuk Auction Platform free of charge
Post Reply
RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Payment Method Suggestions

Post by RWAP » Fri Jun 22, 2012 10:53 am

The payment methods set up by sellers can be confusing for a few reasons:

a) A seller can add a new item for sale, even though they have not set any payment methods in their profile. Then when the item sells, the buyer is not sure how to make payment.

b) When listing or editing an offer, a seller can tick a payment method which is not set up in the profile.

To overcome this, you first of all need to amend class\UserPaymethod.php
Find the function: getListFromDB()

Change the line:

Code: Select all

        $sql = 'select userPay.id,userPay.paymethodId,userPay.details
to read:

Code: Select all

        $sql = 'select userPay.id,userPay.paymethodId,userPay.details,userPay.active
Then, in class\Action\User.php - find the function add()
Just below where it says

Code: Select all

        if(!$this->isLoggedUserASeller()){
            $this->alertLoggedUserIsNotASeller();
            return false;
        }
Add the following:

Code: Select all

        $userPayDetails = UserPayMethod::getListFromDB($this->db," where userId='".$this->context->loggedUser->id."' and userPay.active=1");
        if (!$userPayDetails){
            $this->context->status = false;
            $this->context->errorMessage = _('Please set up your payment settings before listing an item.');
	        $obj = new Action_UserPayMethod();
	        $obj->setContext($this->context);
            $obj->defaultAction();
            return false;
        }
Then,find the two instances of:

Code: Select all

			$data['payMethodsDB'] = PayMethod::getListFromDB($this->db,' where languageId="'.$l.'" and active=1');
Change each instance to:

Code: Select all

            $userPayDetails = UserPayMethod::getListFromDB($this->db," where userId='".$this->context->loggedUser->id."' and userPay.active=1");
            $payMethodsDB=array();
            foreach ($userPayDetails as $k=>$v){
            	$userPayMethod=array();
                $userPayMethod['id']=$v->paymethodId->id;
                $userPayMethod['name']=$v->paymethodId->name[$l];
                $payMethodsDB[]=$userPayMethod;
            }
            $data['payMethodsDB']=$payMethodsDB;

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: Payment Method Suggestions

Post by RWAP » Fri Sep 13, 2013 10:31 am

There is another knock on effect of this, in that if the admin de-activates some payment methods in the backend, they can still be visible to the user for their payment methods.

To overcome this, in class\UserPayMethod.php,

Find:

Code: Select all

    static public function getListFromDB(MyPDO $DB,$restrictions = '')
    {
Change this to read:

Code: Select all

    static public function getListFromDB(MyPDO $DB,$restrictions = '')
    {
    	// Never show paymethods which have been disabled in the admin backend
        if ($restrictions) {
            $restrictions = ' where pm.active=1 and '.substr($restrictions, strlen('where '));
        } else {
        	$restrictions = ' where pm.active=1';
        }

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest