shipping / payment method conflicts
- brainforge
-
Topic Author
- Offline
Less
More
15 years 8 months ago #5786
by brainforge
shipping / payment method conflicts was created by brainforge
I have a scenario where certain shipping / payment combinations are invalid. Ideally would like to see a valid payment options parameter against shipping options and corresponding validation as part of the core code. However, in the absence of such have been able to achieve this as follows:
Using following checkout workflow:
Needed to make a simple mod to the step.php template to prevent people jumping ahead in the workflow (in the default template although steps are greyed out they are still clickable links).
Another simple mod to the paypal plug-in makes it unavailable if the delivery and installation shipping option is selected:
This works exactly as I want provided that the customer goes through the checkout workflow (both forwards and backwards) in the normal way using the next button or the step links. However, it is still possible for a customer to get into steps 5 / 6 and create the order by playing with the URL.
To prevent this I have been looking at the onBeforeOrderCreate() method for the payment plugin.
However, although the shipping method name is provided in $order the shipping parameters are not.
Would it be possible to add these details to the $order object please (they are provided when onPaymentDisplay() is called).
Using following checkout workflow:
Have a delivery and installation shipping plug-in which takes a price type parameter of either please quote or price from. If selected certain payment methods become inappropriate until after a quote has been submitted and agreed (e.g. paypal).cart_coupon,login,address,shipping,payment,confirm_cart_coupon_status_fields,end
Needed to make a simple mod to the step.php template to prevent people jumping ahead in the workflow (in the default template although steps are greyed out they are still clickable links).
Another simple mod to the paypal plug-in makes it unavailable if the delivery and installation shipping option is selected:
Code:
function onPaymentDisplay(&$order,&$methods,&$usable_methods){
switch (@$order->shipping->shipping_params->shipping_price_type) {
case 'quote' :
case 'from' :
return false;
default:
break;
}
if(!empty($methods)){ ... etc ...
To prevent this I have been looking at the onBeforeOrderCreate() method for the payment plugin.
However, although the shipping method name is provided in $order the shipping parameters are not.
Would it be possible to add these details to the $order object please (they are provided when onPaymentDisplay() is called).
Please Log in or Create an account to join the conversation.
15 years 8 months ago #5794
by nicolas
Replied by nicolas on topic Re: shipping / payment method conflicts
In the function onBeforeOrderCreate, the variable $order->cart will be the equivalent of the object $order in the function onPaymentDisplay.
In the function onPaymentDisplay, the $order object is a snapshot of all the information about the current cart. In the function onBeforeOrderCreate, the variable $order is really the data which will be saved in the database by the order class for the order ( the objects inside it are ignored automatically ), and the cart sub object is added to it specifically for such cases where you would need more information.
In the function onPaymentDisplay, the $order object is a snapshot of all the information about the current cart. In the function onBeforeOrderCreate, the variable $order is really the data which will be saved in the database by the order class for the order ( the objects inside it are ignored automatically ), and the cart sub object is added to it specifically for such cases where you would need more information.
Please Log in or Create an account to join the conversation.
- brainforge
-
Topic Author
- Offline
15 years 8 months ago #5803
by brainforge
Replied by brainforge on topic Re: shipping / payment method conflicts
Perfect, thanks, I had not drilled down far enough in the variables.
Please Log in or Create an account to join the conversation.
Time to create page: 0.175 seconds