Hello,
I've created a payment module template as starting point for new payment modules in 1.4.something:
Please have a look at the text file included for some additional informations about how to proceed. (Why is that so complicated? Well, I'm ranting over there...)
Bye,
christian
I've created a payment module template as starting point for new payment modules in 1.4.something:
Please have a look at the text file included for some additional informations about how to proceed. (Why is that so complicated? Well, I'm ranting over there...)
Bye,
christian
Well the catalog view won't work as that is very much hardcoded to pp_standard.tpl
Actually, that I've already pretty much addressed in all of my payment modules. Instead of listing them out like the core ones:
I use a simple array in the payment controller:
And then a simple for loop in the tpl:
I used this template for ALL my payment modules except the ones that collect credit card data onsite, which i have a slightly different template. Tho with some simple changes the same template could be used for both.
And call it personal preference.... But I CAN'T STAND comments like this:
It makes me want to jab a fork in my eye. I know it is popular but it is absolutely horrendous.
What is wrong with a cleaner method:
even multiline comments looks much cleaner with:
Nobody should be that friendly with the asterisk key as php devs are
Actually, that I've already pretty much addressed in all of my payment modules. Instead of listing them out like the core ones:
Code: Select all
<form action="<?php echo $action; ?>" method="post" id="checkout">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="<?php echo $business; ?>" />
<input type="hidden" name="item_name" value="<?php echo $item_name; ?>" />
<input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>" />
....
</form>
Code: Select all
$this->data['fields'] = array();
$this->data['fields']['cmd'] = '_cart';
$this->data['fields']['upload'] = '1';
$this->data['fields']['business'] = $this->config->get('pp_standard_email');
$this->data['fields']['currency_code'] = $currency;
Code: Select all
<form action="<?php echo $action; ?>" method="post" id="checkout">
<?php foreach ($fields as $key => $value) { ?>
<input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>" />
<?php } ?>
</form>
And call it personal preference.... But I CAN'T STAND comments like this:
Code: Select all
/**
* Module name
*
* @var protected string $modulename
*/
protected $modulename;
/**
* Class constructor
*
* Determines current module name
*/
public function __construct() {
$this->modulename = basename(__FILE__, '.php');
}
What is wrong with a cleaner method:
Code: Select all
//Module name
protected $modulename;
//Class constructor. Determines current module name
public function __construct() {
$this->modulename = basename(__FILE__, '.php');
}
Code: Select all
//Module name
//This is the name of the module
protected $modulename;
//Class constructor. Determines current module name
public function __construct() {
$this->modulename = basename(__FILE__, '.php');
}
The catalog model file and maybe the admin controller are pretty much the only ones that could be common, though there are sometimes other checks you might want to add there. For example, some payment gateways requires a single currency. So you can add a currency check to the model and set the status to disabled. I suppose that could be worked in other ways tho if it was standardized.
You could also probably extend the form loop method I use above to work with the admin view, though it would need to support passing in what "type" of field is used.
You could also probably extend the form loop method I use above to work with the admin view, though it would need to support passing in what "type" of field is used.
It's called docblock and it's so popular because it allows you to run the code through something like phpDocumentor and autgenerate documentation.Qphoria wrote: And call it personal preference.... But I CAN'T STAND comments like this:
It makes me want to jab a fork in my eye. I know it is popular but it is absolutely horrendous.Code: Select all
/** * Module name * * @var protected string $modulename */ protected $modulename; /** * Class constructor * * Determines current module name */ public function __construct() { $this->modulename = basename(__FILE__, '.php'); }
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Concerning the comments: Commenting class variables sucks, I know. Otherwise this is pretty much standard phpDoc. If you're using IDEs like Eclipse, this will provide you with instant documentation on methods, classes etc. Plus Eclipse does pretty much generate these comments automatically for you.
Like I said, this is a template and will not work out of the box. The catalog view has to be modified heavily according to the technical specifictions of the payment service provider.
Like I said, this is a template and will not work out of the box. The catalog view has to be modified heavily according to the technical specifictions of the payment service provider.
Who is online
Users browsing this forum: Google [Bot] and 1 guest