[Solved] Modified bankwire mod - ALMOST works - need help
Started by clokwise, Nov 17 2008 01:44 PM
I'm creating a Western Union payment module using the "bankwire" module as a base.
It basically works 99%, but the problem is I can only get it to work if I keep all the core variables and methods named the same as in the bankwire module, plus it has to reside in a directory called "bankwire". These two modules can not co-exist obviously so I had to delete the real "bankwire".
Now if I try renaming the module to "westernunion" it will generate a not found in config error on the Modules page. I then tried to rename the Class and all the other variables named "bankwire" into "westernunion", then it will at least appear in the install list but it still fails at install.
Like I said, the module is functional as long as it remains named "bankwire". Agghh!
It seems like the file name of the module appears to be very closely tied to the module objects, but I don't understand the logic, nor do I understand how to overcome this.
Can anyone give me some pointers?
It basically works 99%, but the problem is I can only get it to work if I keep all the core variables and methods named the same as in the bankwire module, plus it has to reside in a directory called "bankwire". These two modules can not co-exist obviously so I had to delete the real "bankwire".
Now if I try renaming the module to "westernunion" it will generate a not found in config error on the Modules page. I then tried to rename the Class and all the other variables named "bankwire" into "westernunion", then it will at least appear in the install list but it still fails at install.
Like I said, the module is functional as long as it remains named "bankwire". Agghh!
It seems like the file name of the module appears to be very closely tied to the module objects, but I don't understand the logic, nor do I understand how to overcome this.
Can anyone give me some pointers?
It's all in the naming. Off the top of my head you'll need to:
1) Rename the module directory to the module name (lowercase) e.g. "westernunion"
2) Rename the main php file containing the module class definition to the module name (lowercase) e.g. "westernunion"
3) In the main php file name the class e.g. "WesternUnion" (must be the same, but can be mixed lower and upper case)
4) In function __construct(), set the class name member variable to the module name (lowercase) e.g. $this->name = 'westernunion';
5) Modify the name of any setting in the module so that they're unique
I thinks that's them all :)
Paul
1) Rename the module directory to the module name (lowercase) e.g. "westernunion"
2) Rename the main php file containing the module class definition to the module name (lowercase) e.g. "westernunion"
3) In the main php file name the class e.g. "WesternUnion" (must be the same, but can be mixed lower and upper case)
4) In function __construct(), set the class name member variable to the module name (lowercase) e.g. $this->name = 'westernunion';
5) Modify the name of any setting in the module so that they're unique
I thinks that's them all :)
Paul
Free Prestashop modules and developer resources
Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2
Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net
Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2
Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net
Indeed I did all of the above. I painstakingly changed every reference to 'bankwire' until they are all gone. I have studied other modules here such as 'creditcard' and 'cashondelivery' and it seems I've done everything correctly, and yet, the thing will not install if renamed.
Can I post the code here, or offsite, for someone to look at ?
Can I post the code here, or offsite, for someone to look at ?
Did you rename the directory?? All the files must be in /modules/
Otherwise upload a zip file here, and we can take a look.
Paul
Otherwise upload a zip file here, and we can take a look.
Paul
Free Prestashop modules and developer resources
Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2
Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net
Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2
Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net
Thanks Paul. For some reason I am unable to upload the archive here. The site is ignoring the attachment to this message. Here's a link to it here: http://rapidshare.co...esternunion.rar
Take a look at it. In its current state is silently fails to install. Prior to my renaming everything it was working nearly 100%.
I've gone back to square one and renamed bits and pieces of this module a dozen times already - it's getting quite frustrating.
FWIW, I'm building this on prestashop_1.1.0.1
Take a look at it. In its current state is silently fails to install. Prior to my renaming everything it was working nearly 100%.
I've gone back to square one and renamed bits and pieces of this module a dozen times already - it's getting quite frustrating.
FWIW, I'm building this on prestashop_1.1.0.1
The only thing I can see that's a problem is:
$os->template is a multi-lang field so is an array, you'll need to use the same technique as the status message to fill all 10 elements with the template name. That way you should be able to set $os->send-mail = 1;
Paul
$os->send_mail = 0; //This should be 1, however it fails, perhaps for the same reasons this entire module fails
$os->template = ""; //This should be "westernunion", however it fails, perhaps for the same reasons this entire module fails
$os->template is a multi-lang field so is an array, you'll need to use the same technique as the status message to fill all 10 elements with the template name. That way you should be able to set $os->send-mail = 1;
Paul
Free Prestashop modules and developer resources
Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2
Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net
Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2
Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net
Thanks for the tip on the $os->template!
Thing is, that particular function is trivial and you can comment it out of the module and it makes no difference - still fails.
So are you saying you were otherwise able to install the module and run it ??
Thing is, that particular function is trivial and you can comment it out of the module and it makes no difference - still fails.
So are you saying you were otherwise able to install the module and run it ??
It occurred to me that perhaps a simpler challenge would be to show you my working code.
http://rapidshare.co...sternunion_.rar
This code functions correctly as long as it is called "bankwire".
I've tried countless times to rename it to "westernunion" and it always fails in different ways. Should be easy right? Why can't I do it??
BTW, I commented out the custom idOrderState functions in this module, which still has a couple bugs, just so that the focus can be on getting the darn module renamed.
If someone can assist I will be forever grateful, not to mention I'll freely share the working code once it works.
http://rapidshare.co...sternunion_.rar
This code functions correctly as long as it is called "bankwire".
I've tried countless times to rename it to "westernunion" and it always fails in different ways. Should be easy right? Why can't I do it??
BTW, I commented out the custom idOrderState functions in this module, which still has a couple bugs, just so that the focus can be on getting the darn module renamed.
If someone can assist I will be forever grateful, not to mention I'll freely share the working code once it works.
Just a bump to see if I can persuade anyone to have a look at renaming this module. It's must be something obvious, but I'm totally stumped.
Another bump. I have been working on renaming the module for 3 weeks now and no joy. It's ridiculous. Obviously there is some quirk in the naming of the modules which is not documented. PLEASE can somebody who has done it before take a look at the code and rename this module? It can't be that hard.
http://rapidshare.co...sternunion_.rar
http://rapidshare.co...sternunion_.rar
I managed to solve this problem and finish the module, however the solution is ridiculous and I can't explain it.
It all boiled down to a single line of code!!
The original code:
$this->displayName = $this->l('Bank Wire');
which I had changed to
$this->displayName = $this->l('Western Union');
Seems innocuous, no?
Turns out the word "Union" within the displayName variable completely screws up Prestashop!! I have changed it to this for the time being:
$this->displayName = $this->l('Western Onion');
And it works just fine.
Can ANYONE explain why this is a bug????
It all boiled down to a single line of code!!
The original code:
$this->displayName = $this->l('Bank Wire');
which I had changed to
$this->displayName = $this->l('Western Union');
Seems innocuous, no?
Turns out the word "Union" within the displayName variable completely screws up Prestashop!! I have changed it to this for the time being:
$this->displayName = $this->l('Western Onion');
And it works just fine.
Can ANYONE explain why this is a bug????
I believe it is because the word 'union' is blacklisted. You can remove UNION from the blacklist in db.php, but that will create a security hole. It might be better to use empty html tags to split the word.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
Interesting. Is that a sql injection security hole?
I tried this, it nearly worked but it failed at the final payment step :
I tried this, it nearly worked but it failed at the final payment step :
Western Union
Try Western Union. If that doesn't work, it must be another problem.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
Sadly, your suggestion does not work - results in "hack attempt" error.
Neither does "Western_Union".
Neither does "Western_Union".
Try using double quotes instead of single. You can try using an sql escape function like mysql_real_escape_string or a substitute from the db class too.
BVK Software Professional web & application development and Commercial PrestaShop Modules
Commercial PrestaShop Modules Available:
Bundle Discounts, Dropshipping, CSV Order Export, Product Feature Comparison Module, Canonical SEO Module - Prevent Duplicate Content, Events Module, Save My Cart Module, Forum Module
Commercial PrestaShop Modules Available:
Bundle Discounts, Dropshipping, CSV Order Export, Product Feature Comparison Module, Canonical SEO Module - Prevent Duplicate Content, Events Module, Save My Cart Module, Forum Module
hello
am not using the check module so I made it a western union module by changing lang variables only
now if someone chooses it it says:
name - mobile phone - location
is that the same you are aiming at??
am not using the check module so I made it a western union module by changing lang variables only
now if someone chooses it it says:
name - mobile phone - location
is that the same you are aiming at??
You cant choose to be smart but you choose to think
From 1229007983:
Try using double quotes instead of single. You can try using an sql escape function like mysql_real_escape_string or a substitute from the db class too.
Just tried and both ideas failed!
So apart from renaming to "Onion" or some such thing, it seems like removing UNION from the blacklist in db.php is the only solution. Really??? However that requires user modifying core code, which could make the module break during an upgrade. Also, it's in the blacklist for a reason, so it must be a security concern.
I think the Prestashop team are trying to come up with an alternative to the blacklist. Until then, you could try using codes like U or the union symbol ∪ in place of the U in union or if that doesn't work then |_|. There must be a way to write "Union" that isn't a security risk and so won't be blacklisted. You might need to be creative. :)
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.




Back to top









