Jump to content

Payment module not in Module/Payment


Croonical

Recommended Posts

Hello everybody !

 

I've developed a payment module, but i can't find it in the "Modules list" when i use the Payment tab (in modules).

 

219533moduleList.png

 

However i find it when i use the other ways (Modules/Module/Payment for example).

 

882551categoryList.png

 

public function __construct()
{
			//[...]
 $this->tab = 'payments_gateways';
			//[...]
   }

 

I set the tab value to 'payments_gateways', i thought it was enough, but maybe i'm missing something ?

 

Thanks !

Edited by Croonical (see edit history)
Link to comment
Share on other sites

Hi,

 

please check this code, solution inside:

 

foreach ($modules as $module)
if ($module->tab == 'payments_gateways')
{
   if ($module->id)
   {
    if (!get_class($module) == 'SimpleXMLElement')
	    $module->country = array();
    $countries = DB::getInstance()->executeS('
	    SELECT id_country
	    FROM '._DB_PREFIX_.'module_country
	    WHERE id_module = '.(int)$module->id.' AND `id_shop`='.(int)$shop_id
    );
    foreach ($countries as $country)
	    $module->country[] = $country['id_country'];
    if (!get_class($module) == 'SimpleXMLElement')
	    $module->currency = array();
    $currencies = DB::getInstance()->executeS('
	    SELECT id_currency
	    FROM '._DB_PREFIX_.'module_currency
	    WHERE id_module = '.(int)$module->id.' AND `id_shop`='.(int)$shop_id
    );
    foreach ($currencies as $currency)
	    $module->currency[] = $currency['id_currency'];
    if (!get_class($module) == 'SimpleXMLElement')
	    $module->group = array();
    $groups = DB::getInstance()->executeS('
	    SELECT id_group
	    FROM '._DB_PREFIX_.'module_group
	    WHERE id_module = '.(int)$module->id.' AND `id_shop`='.(int)$shop_id
    );
    foreach ($groups as $group)
	    $module->group[] = $group['id_group'];
   }
   else
   {
    $module->country = null;
    $module->currency = null;
    $module->group = null;
   }
   $this->payment_modules[] = $module;
}

 

Regards

Link to comment
Share on other sites

Hi,

 

Thanks for your answer. I took a look at your code (from AdminPaymentController) but i still can't see the solution.

I did a var_dump on my module and another one (moneybookers, which is displayed in the list) in order to compare, but i have the same output.

 

208348moneybookercomparison.png

 

Any idea ?

Link to comment
Share on other sites

Thank you again Alexander for your answer.

Actually i just checked, the line

$this->payment_modules[] = $module;

isn't skipped with my module. It seems that my module is added to the array.

 

I also added

var_dump($this->payment_modules);

after the loop, and my module correctly appears, among the other ones. I really don't see the problem here..

Edited by Croonical (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...