Payment - Shipping relationship. Is it possible?

LiteCart Fan
Nuo Poland
Narys nuo rugp. 2018

Hey
I have created two new simple modules:

  • "Pickup in the store" shipping module
  • "Payment on picking up in the store" payment module

As you can imagine they are literally not doing anything, just setting proper order status. 
I would like to disable "Payment on picking up in the store" payment module when "Pickup in the store" is not selected as a shipping method. Is there an easy way to do so?

LiteCart Fan
Nuo Poland
Narys nuo rugp. 2018

Thanks, @tim :) I didn't notice this addon earlier.
But it is not working.  

From what I see from var_dump, $shipping variable has ['data']['selected'] field empty regardless of what shipping method I pick during the checkout. 

object(mod_shipping)#12 (3) { ["data"]=> array(2) { ["selected"]=> array(0) { } ["userdata"]=> array(0) { } } ["items"]=> array(0) { } ["modules"]=> array(4) { ["sm_poczta_polska"]=> object(sm_poczta_polska)#27 (9) { ["id"]=> string(16) "sm_poczta_polska" ["name"]=> string(13) "Poczta Polska" ["description"]=> string(0) "" ["author"]=> string(8) "skoruppa" ["version"]=> string(3) "1.0" ["website"]=> string(0) "" ["settings"]=> array(6) { ["status"]=> string(1) "1" ["icon"]=> string(34) "/images/shipping/poczta_polska.jpg" ["delivery_time"]=> string(7) "2-5 dni" ["handling_fee"]=> string(4) "8.00" ["tax_class_id"]=> string(0) "" ["priority"]=> string(1) "0" } ["status"]=> int(1) ["priority"]=> int(0) } ["sm_pickup"]=> object(sm_pickup)#31 (9) { ["id"]=> string(9) "sm_pickup" ["name"]=> string(6) "Pickup" ["description"]=> string(0) "" ["author"]=> string(17) "LiteCart Dev Team" ["version"]=> string(3) "1.0" ["website"]=> string(23) "http://www.litecart.net" ["settings"]=> array(4) { ["status"]=> string(1) "1" ["icon"]=> string(0) "" ["geo_zone_id"]=> string(0) "" ["priority"]=> string(1) "0" } ["status"]=> int(1) ["priority"]=> int(0) } ["sm_zone_weight"]=> object(sm_zone_weight)#14 (9) { ["id"]=> string(14) "sm_zone_weight" ["name"]=> string(40) "Koszty wysyłki dla stref geograficznych" ["description"]=> string(0) "" ["author"]=> string(17) "LiteCart Dev Team" ["version"]=> string(3) "1.0" ["website"]=> string(23) "http://www.litecart.net" ["settings"]=> array(14) { ["status"]=> string(1) "0" ["icon"]=> string(0) "" ["weight_class"]=> string(2) "kg" ["geo_zone_id_1"]=> string(0) "" ["weight_rate_table_1"]=> string(0) "" ["geo_zone_id_2"]=> string(0) "" ["weight_rate_table_2"]=> string(0) "" ["geo_zone_id_3"]=> string(0) "" ["weight_rate_table_3"]=> string(0) "" ["weight_rate_table_x"]=> string(15) "5:8.95;10:15.95" ["method"]=> string(4) "<" ["handling_fee"]=> string(4) "0.00" ["tax_class_id"]=> string(0) "" ["priority"]=> string(1) "0" } ["status"]=> int(0) ["priority"]=> int(0) } ["sm_country_based_shipping"]=> object(sm_country_based_shipping)#13 (9) { ["id"]=> string(25) "sm_country_based_shipping" ["name"]=> string(22) "Country Based Shipping" ["description"]=> string(0) "" ["author"]=> string(17) "LiteCart Dev Team" ["version"]=> string(3) "1.0" ["website"]=> string(23) "http://www.litecart.net" ["settings"]=> array(7) { ["status"]=> string(1) "0" ["icon"]=> string(0) "" ["weight_class"]=> string(2) "kg" ["rate_tables_map"]=> string(7) "PL;;pol" ["rate_tables"]=> string(6) "pol;:8" ["tax_class_id"]=> string(0) "" ["priority"]=> string(1) "0" } ["status"]=> int(0) ["priority"]=> int(0) } } }

tim
Founder
Nuo Sweden
Narys nuo geg. 2013
tim

Hmm.. that does not sound right. Maybe I should look into it. It should carry your last choice of shipping. $GLOBALS['shipping']->data['selected'] should return the choice of shipping for your current session. Is it the same if you access session::$data['shipping']['data']['selected'] ?

LiteCart Fan
Nuo Poland
Narys nuo rugp. 2018

Thanks again!

session::$data['shipping']->data['selected']['id']
is working just fine :)

This thread has been closed due to long inactivity. Posting to it is not possible.
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.