Developer forum

Forum » Ecommerce - Standard features » User specifing payment and shipping methods

User specifing payment and shipping methods

Ivan Marijanović
Ivan Marijanović
Reply

We have two payment and two shipping methods. We would like to have one set of methods available to logged in users and second one to anonymous user. Is this imposibble or I am missing something?

Sincerely

Ivan


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply
This post has been marked as an answer

Hi Ivan,

Try to create two paragraphs have cart module. Select the appropriate payment&shipping in 'Payment&Delivery' section of the module paragraph settings on the both paragraphs. Set permissions (paragraph edit-Advanced-Permissions) up on the both paragraph as follows (if you use new permission model): access for 'Authenticated users (frontend)' group should be set to 'None' & 'Anonymous users (frontend)' group should NOT be set to 'None' and viсe versa for the second paragraph. Please, find details about old model of paragraph permission here.

BR, Oleg QA   

Votes for this answer: 1
 
Nicolai Pedersen
Reply

You can set permissions for shipping methods in 9.7

https://doc.dynamicweb.com/documentation-9/ecommerce/payment-shipping/shipping#8683

But not on payments

 
Ivan Marijanović
Ivan Marijanović
Reply

Hi Nicolai

 

I solve it with permissions so I created two paragraphs in Cart with different permisisons - one for logedd in users and second for anonymous users and it displays payment methods and shippings correctly but now have different issue:

I set one default payment and shipping for country lets say payment 1 and shipping1. So when the logged users comes to cart everything works as expected and payment1 and shipping1 is already selected. But when anonymous user get to cart hi is not allowed to use payment1 and shippin1 and he cannot select them on page but they are allreday preselect as defaults and he can finish logout without problem. Is there way to set default payment and shiiping on cart?

BTW I made update to 9.7 version and can see the selection of shipping for groups but cannto select it - nothing happens:

 

SippingAcces.png
 
Ivan Marijanović
Ivan Marijanović
Reply

I see in documentation this and because of that I think this should be possible:

EcomCustomersSettings

 

Links a user (AccessUserId) with preferred currency, payment method and shipping method (CurrencyCode, PaymentMethodId, ShippingMethodId).

 
Ivan Marijanović
Ivan Marijanović
Reply

Hi Oleg

I implemented your suggestion but now have issue I explained as answer to Nicoali!

 

Thank you for your help!

 
Nicolai Pedersen
Reply

Hi Ivan

You might need to update your browser cache to load the security settings on a shipping.

The only way to set the default payment/shipping for the scenario you describe is to do it the template - make a fallback to take of the scenario.

The EcomCustomersSettings seems to have the data model for handling this - but there is no code implementing the feature!! Good find, but sorry it cannot be used for anything.

BR Nicolai

 
Ivan Marijanović
Ivan Marijanović
Reply

Thanks Nicolai

I am looking at apis and i plan to impelement in master template following: check if the user is not logged in and if it is not and if selected payment / shipping is one not allowed for anonymous user set it to default. I am looking at Dynamicweb.Ecommerce.Cart class but cannot find a way to do that.

What I am doing wrong?

Ivan

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Just check if Security.UserManagement.User.GetCurrentExtranetUser() is nothing (anonymous user) and then in your cart step template - put the value of Ecom:Cart.Paymethod.IsSelected in a variable, and if the currentuser is nothing, set that variable to true for the payment you want to be preselected.

Votes for this answer: 1
 
Nicolai Pedersen
Reply

Or use BeforeRenderingNewStep notification and set the paymentid on the order object of the passed args to the payment you want to be default.

 
Ivan Marijanović
Ivan Marijanović
Reply

Thank you Nicolai

 

Ivan

 
Ivan Marijanović
Ivan Marijanović
Reply

Nicolai

One question? If I do this in Cart step template then my mini cart will display wrong data since the selection would not be made before the cart is opened?

Ivan

 
Nicolai Pedersen
Reply

Yes - then better use a Cart.Created notification subscriber and set the payment and shipping method at that point.

 

You must be logged in to post in the forum