Jump to content

Payment and Shippingmodules having major configuration issue!!


Recommended Posts

There is a major issue with the payment en shipping modules in PrestaShop.

The problem is that if I set-up my shop with 2 carriers (pickup and deliver) and 2 payment (cash on pickup and bankwire) I cannot force the carrier modules to only have 1 payment module.

Lets say my customer chooses the deliver-carrier option, I want him to only have the Bankwire payment option and not the CasOnPickup.
Same goes for any other set-up I create.

In osCommerce we have Ship2Pay, we need such a thing for PrestaShop a.s.a.p.

Or am I missing the point?

Link to comment
Share on other sites

  • 2 weeks later...
Hi TropischBruin,

My guess is that we have to look in order.php and there combine those two items.
I will give it some attention after the Xmass hollidays.


I'm not sure if this is want you want.
I think a better solution is to have options within PS where you can use somethin like a dropdown box in the carrier configuration to choose:

1. when left empty the carrier can be used with any payment module
2. when set to cash-on-pickup it will only allow this payment module and nothing else.

Thans anyway foor your time!
Link to comment
Share on other sites

I don't think there is room for this in prestashop now (not with a module atleast)
but it should be possible to make some kind of check on the paymentmodule code and see what carrier is selected.

you can get what you want, if you modify the payment module.
$cart->id_carrier should be something you might want to check at

Link to comment
Share on other sites

I don't think there is room for this in prestashop now (not with a module atleast)
but it should be possible to make some kind of check on the paymentmodule code and see what carrier is selected.

you can get what you want, if you modify the payment module.
$cart->id_carrier should be something you might want to check at


OK, so the payment-modules should check on the carriers used.
Hmm, that is not so easy to do (meaning that I'm no php-coder ;-) ).

Adding a code I can, thinking on what code to use I cannot.
Link to comment
Share on other sites

Is it an idea to add the carrier and payment on the product page in the admin panel?
Let's say you have a product X, a carrier Y and a payment Z.

Now on the catalog> product page you choose the carrier and the payment that you want this product to have.
So you can tell PS that you want product X only uses carrier Y and payment Z, product A can use carrier B and payment C, for example.

Link to comment
Share on other sites

Is it an idea to add the carrier and payment on the product page in the admin panel?
Let's say you have a product X, a carrier Y and a payment Z.

Now on the catalog> product page you choose the carrier and the payment that you want this product to have.
So you can tell PS that you want product X only uses carrier Y and payment Z, product A can use carrier B and payment C, for example.


That is to much of a hassle.

Best is:

Set: Carrier1 = payment1
Set: Carrier2 = payment2

Of no choice (set) is made then:

carrier 1 = payment1 or payment2
Link to comment
Share on other sites

Hhmmm..

Ok, but i have some products like licenses, who can be payed after delivery (in dutch: op rekening)
When the customer does'nt pay the bill, i allways can cancell the license.
However, when a customer buys a solar panel, and he can pay after delivery, and he does'nt pay his bill then it is very difficult to get back my goods. When i can sat that the solar panel can be shipped by TNT and payed by iDeal, i have no risk.

Link to comment
Share on other sites

I think this is only possible (currently) by editing the payment modules. In effect you could choose not to display a payment option if a particular carrier has been selected (using a hard-coded carrier_id).

In payment modules there is always a hookPayment() function which displays the payment method. Within this function you would do your test for the carrier.

So, for example if someone has picked a carrier that takes payment on delivery, you don't want to allow payment by PayPal to be an option. In paypal.php (line 139) there is:

   public function hookPayment($params)
   {
       global $smarty;

       $address = new Address(intval($params['cart']->id_address_invoice));
       $customer = new Customer(intval($params['cart']->id_customer));
       $business = Configuration::get('PAYPAL_BUSINESS');
       $currency = $this->getCurrency();


etc.

Lets's say your cash on delivery carrier has the id of 2, then you could change the above to:

   public function hookPayment($params)
   {
       global $smarty;

       $cart = new Cart(intval($params['cart']));
       if (intval($cart->id_carrier==2)) return;

       $address = new Address(intval($params['cart']->id_address_invoice));
       $customer = new Customer(intval($params['cart']->id_customer));
       $business = Configuration::get('PAYPAL_BUSINESS');
       $currency = $this->getCurrency();



This will disable PayPal for any checkout processes where the customer has selected the carrier with the ID of 2.

A bit messy, but it would provide a quick fix.

Paul

Link to comment
Share on other sites

I think this is only possible (currently) by editing the payment modules. In effect you could choose not to display a payment option if a particular carrier has been selected (using a hard-coded carrier_id).

A bit messy, but it would provide a quick fix.

Paul


Paul, this will do I'll guess.

I will testrun tonight.

Thanks!
Link to comment
Share on other sites

  • 2 weeks later...
Hi.

I have made a patch that enable Payment restrictions depending on the carrier.

Download it from http://alphaspel.se/prestashop/patches/Payment_Carriers_restrictions.zip there is a README.txt inside. If there is any questions please ask them in this thread.

Best regards Fredrik


hey...i downloaded this patch...and followed the README.txt file...and im applying the patch after the installation bcuz i had prestashop installed and everything already...BUT there's one part i dont understand...
"Then add the table found in module_carrier.sql to the database, do not forgett to change PREFIX."
Please explain what this means...thanks so much :)
Link to comment
Share on other sites



hey...i downloaded this patch...and followed the README.txt file...and im applying the patch after the installation bcuz i had prestashop installed and everything already...BUT there's one part i dont understand...
"Then add the table found in module_carrier.sql to the database, do not forgett to change PREFIX."
Please explain what this means...thanks so much :)


This is done via phpMyAdmin.
Link to comment
Share on other sites

  • 2 weeks later...

i got it right tho, and thanks a lot for this great applications.

For those who dont know how to upload the module_carrier.sql. These are the steps

1. Login into your cpanel
2. Click on phpmyadmin
3. On the left side, click on the database you use for your prestashop.
4. You can see list of tables on your left, and then on top, click import tabs.
5. Before you import the table, take a look at the prefix used by all the tables inside your database, and open the module_carrier.sql using notepad.
6. Change CREATE TABLE `PREFIX_module_carrier` PREFIX to the correct prefix used by your tables, in my case the prefix is ps_, so i change it to CREATE TABLE `ps_module_carrier`.
7. Save it.
8. At the import tab, browse the file, and click go.
9. Then everything should be ok.

Thanks again to the creator.

Link to comment
Share on other sites

  • 3 months later...

hi Guys !!!

Great Module !!!

Unfortunately when I need it i haven't found this thread so I realize my own module ! :-(


Your version is surely cooler but I have a different approach when realize modules, my first rule is "IF I CAN I DON'T CHANGE DB OR EXISTING PS CORE FILE".
So my works often doesn't fit perfectly the customer need but it's really transparent and don't create issues when you update your shop.

If you want to test my module this is the link.

The thread is in Italian but the downloadable module has been developed in English (someone has translated it in Spanish).

Enjoy it !
mM

Link to comment
Share on other sites

SURE ! :coolsmile:

If you follow this link you can find the original (Italian) thread where you can download the module!

But nothing new, you can download the same file yesterday too, the same link was present in my previous post, something wrong?

I know the thread is in italian but trust me, download the file attached to the first post and you'll find the instruction in Inglish in the package!

Enjoy it!

Link to comment
Share on other sites

  • 2 weeks later...
Hi Paul,

I have tried this little tweak but it seems not to work.
Did you actually test it?


Never mind i found it :)


What did you find? I tried this too. I get the wrong payment option to disappear. But it also doesn't appear when I do need it. Can you give me a hint?
Link to comment
Share on other sites

  • 2 months later...

Hi sassur.

I like your solution to restrict the carriers because it can manage all the modules of payment and not just one.
Is there any chance of making it work in PS 1.2.1?

I followed the instructions of the diff file and run it on PS 1.2.1 with sucess, but still there is a problem: After the purchase, the order-confirmation.tpl file is shown several times. If there are 6 carriers for the module, the order-confirmation.tpl file is shown 6 times.

Link to comment
Share on other sites

  • 3 months later...
Hi.

I have made a patch that enable Payment restrictions depending on the carrier.

Download it from http://alphaspel.se/prestashop/patches/Payment_Carriers_restrictions.zip there is a README.txt inside. If there is any questions please ask them in this thread.

Best regards Fredrik


is it working with presta 1.2.4 too? or only for 1.1. - i found answer one post later.... sorry
Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...
  • 2 weeks later...
  • 2 months later...
Hi.

I have made a patch that enable Payment restrictions depending on the carrier.

Download it from http://alphaspel.se/prestashop/patches/Payment_Carriers_restrictions.zip there is a README.txt inside. If there is any questions please ask them in this thread.

Best regards Fredrik



One more suggestion:

http://www.prestashop.com/forums/viewthread/28286/modules_tiers/mise_a_disposition_de_2_modules (module 2: stiffmodulecarrier)


Enjoy!
Link to comment
Share on other sites

  • 2 years later...

I think this is only possible (currently) by editing the payment modules. In effect you could choose not to display a payment option if a particular carrier has been selected (using a hard-coded carrier_id).

 

In payment modules there is always a hookPayment() function which displays the payment method. Within this function you would do your test for the carrier.

 

So, for example if someone has picked a carrier that takes payment on delivery, you don't want to allow payment by PayPal to be an option. In paypal.php (line 139) there is:

 

public function hookPayment($params)
{
	global $smarty;

	$address = new Address(intval($params['cart']->id_address_invoice));
	$customer = new Customer(intval($params['cart']->id_customer));
	$business = Configuration::get('PAYPAL_BUSINESS');
	$currency = $this->getCurrency();

etc.

 

Lets's say your cash on delivery carrier has the id of 2, then you could change the above to:

 

public function hookPayment($params)
{
	global $smarty;

	$cart = new Cart(intval($params['cart']));
	if (intval($cart->id_carrier==2)) return;

	$address = new Address(intval($params['cart']->id_address_invoice));
	$customer = new Customer(intval($params['cart']->id_customer));
	$business = Configuration::get('PAYPAL_BUSINESS');
	$currency = $this->getCurrency();

 

This will disable PayPal for any checkout processes where the customer has selected the carrier with the ID of 2.

 

A bit messy, but it would provide a quick fix.

 

Paul

$cart->id_carrier is always 2 no matther what carrier I select. How can I get the real carrier ID?

Link to comment
Share on other sites

  • 1 year later...

I think this is only possible (currently) by editing the payment modules. In effect you could choose not to display a payment option if a particular carrier has been selected (using a hard-coded carrier_id).

 

In payment modules there is always a hookPayment() function which displays the payment method. Within this function you would do your test for the carrier.

 

So, for example if someone has picked a carrier that takes payment on delivery, you don't want to allow payment by PayPal to be an option. In paypal.php (line 139) there is:

 

public function hookPayment($params)    {        global $smarty;        $address = new Address(intval($params['cart']->id_address_invoice));        $customer = new Customer(intval($params['cart']->id_customer));        $business = Configuration::get('PAYPAL_BUSINESS');        $currency = $this->getCurrency();
etc.

 

Lets's say your cash on delivery carrier has the id of 2, then you could change the above to:

 

public function hookPayment($params)    {        global $smarty;        $cart = new Cart(intval($params['cart']));        if (intval($cart->id_carrier==2)) return;        $address = new Address(intval($params['cart']->id_address_invoice));        $customer = new Customer(intval($params['cart']->id_customer));        $business = Configuration::get('PAYPAL_BUSINESS');        $currency = $this->getCurrency();

This will disable PayPal for any checkout processes where the customer has selected the carrier with the ID of 2.

 

A bit messy, but it would provide a quick fix.

 

Paul

 

 

This method is also working in PS 1.6 but with little modification:

in choosen payment module php find:

public function hookPayment($params)
    {
        if (!$this->active)
            return;
     ...
     ...

and change to

public function hookPayment($params)
    {
        if (!$this->active)
            return;

     // custom deactivation for CashOnPickup
        $id_carrier = (int)$this->context->cart->id_carrier;
        if (intval($id_carrier==3)) // use your choosen carrier id
            return;
            ...
            ...

Id of carrier you can easy find in Administration (BO) > Shipping > Carriers

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Hello,

 

Thanks janoo.

 

Tested and works fine.

 

Maybe you would try this FREE Addons, tested on PrestaShop 1.6.0.6 and works fine, even if it's for PrestaShop 1.5.

 

You can download the free module, unzip the zip file and you will find two versions. I choosen "ShipToPay version 1.5"

 

http://addonspresta.com/en/free-modules/48-ship-to-pay.html

 

Regards

 

 

 

post-777922-0-52306700-1413543434_thumb.jpg

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

×
×
  • Create New...